:root {
  --ink: #18352d;
  --ink-soft: #48645b;
  --paper: #f6f1e6;
  --paper-deep: #ece3d2;
  --cream: #fffaf0;
  --leaf: #285d4b;
  --leaf-dark: #173d32;
  --tomato: #e75b3b;
  --tomato-dark: #bd3d24;
  --sun: #f2bc4c;
  --line: rgba(24, 53, 45, 0.16);
  --shadow: 0 18px 50px rgba(35, 58, 48, 0.12);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 30px;
  --body: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--leaf);
  color: white;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(40, 93, 75, .22); }
.button:active { transform: translateY(0); }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(231, 91, 59, .3); outline-offset: 2px; }
.button.secondary { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.button.danger { background: var(--tomato); }
.button.small { min-height: 36px; padding: 0 15px; font-size: 13px; }
.button[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.65); cursor: pointer; display: grid; place-items: center; }

.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255,255,255,.78);
}
.field textarea { min-height: 100px; resize: vertical; }
.form-error { color: var(--tomato-dark); font-size: 13px; min-height: 18px; }

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 40px 100px rgba(9, 28, 22, .28);
}
dialog::backdrop { background: rgba(19, 39, 33, .6); backdrop-filter: blur(7px); }
.dialog-inner { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.dialog-head h2 { font-family: var(--display); margin: 0; font-size: clamp(25px, 5vw, 36px); font-weight: 700; line-height: 1.15; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  background: var(--leaf-dark);
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-state { text-align: center; padding: 64px 20px; color: var(--ink-soft); }
.empty-state strong { display: block; color: var(--ink); font-family: var(--display); font-size: 24px; margin-bottom: 8px; }
.loading-line { height: 3px; position: fixed; inset: 0 0 auto; z-index: 200; background: linear-gradient(90deg, transparent, var(--tomato), transparent); background-size: 45% 100%; animation: loading 1.1s infinite linear; display: none; }
.loading-line.active { display: block; }
@keyframes loading { from { background-position: -80% 0; } to { background-position: 180% 0; } }

@media (max-width: 767px) {
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .dialog-inner { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
  .dialog-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
