:root {
  --paper: #f3efe4;
  --paper-deep: #e7e0d0;
  --card: #fbf8f2;
  --ink: #1b2822;
  --muted: #5e6a62;
  --line: rgba(27, 40, 34, 0.12);
  --pine: #1e4a38;
  --pine-soft: #e4efe7;
  --gold: #a67c3d;
  --clay: #8c4632;
  --shadow: 0 16px 40px rgba(30, 42, 34, 0.06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "Noto Serif SC", serif;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --header: 72px;
}

[data-theme="dark"] {
  --paper: #121815;
  --paper-deep: #1c2420;
  --card: #1a221e;
  --ink: #e8efe9;
  --muted: #a3b0a8;
  --line: rgba(232, 239, 233, 0.12);
  --pine: #9dceae;
  --pine-soft: rgba(157, 206, 174, 0.12);
  --gold: #d4b483;
  --clay: #e0a090;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121815;
    --paper-deep: #1c2420;
    --card: #1a221e;
    --ink: #e8efe9;
    --muted: #a3b0a8;
    --line: rgba(232, 239, 233, 0.12);
    --pine: #9dceae;
    --pine-soft: rgba(157, 206, 174, 0.12);
    --gold: #d4b483;
    --clay: #e0a090;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(30, 74, 56, 0.08), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px 22px;
  min-height: var(--header);
  padding: 10px 28px 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand, .top-end { align-self: center; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}
.brand img { width: 36px; height: 36px; }
.brand-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  line-height: 1;
}
.brand-domain {
  display: block;
  margin-top: 3px;
  color: var(--pine);
  font-family: var(--serif);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
.ghost, .text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.ghost:hover, .text-btn:hover {
  color: var(--ink);
  background: var(--pine-soft);
}
.switch {
  position: relative;
  display: flex;
  width: 280px;
  margin-left: 8px;
}
.switch button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 14px 8px 12px;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 1.12rem;
}
.switch button.on { color: var(--ink); }
.switch-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 2px;
  background: var(--pine);
  transform: translateX(0);
  transition: transform 0.28s ease;
}
.switch.is-plans .switch-bar { transform: translateX(100%); }
.deck { overflow: visible; }
.deck-pane { display: none; }
.deck-pane.active { display: block; }
.pane { padding-top: 22px; }
.pull {
  height: 0;
  overflow: hidden;
  text-align: center;
  color: var(--pine);
  font-size: 0.84rem;
  line-height: 40px;
}
.guide-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 18px;
  align-items: start;
}
.guide-body:has(.reshuffle[hidden]) { grid-template-columns: minmax(0, 1fr); }
.reshuffle {
  position: sticky;
  top: calc(var(--header) + 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 46px;
  margin-top: 4px;
  padding: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(27, 40, 34, 0.05);
}
.reshuffle[hidden] { display: none; }
.reshuffle svg { width: 18px; height: 18px; }
.reshuffle span {
  writing-mode: vertical-rl;
  font-size: 0.95rem;
  font-weight: 560;
  letter-spacing: 0.2em;
  line-height: 1;
}
.reshuffle:hover { border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); }
.reshuffle.is-busy { pointer-events: none; }
.reshuffle.is-busy svg { animation: reshuffle-spin 0.7s linear infinite; }
@keyframes reshuffle-spin { to { transform: rotate(-360deg); } }
.deck.is-plans .reshuffle { display: none; }
.rarity {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pine-soft);
  color: var(--pine);
  font-size: 0.75rem;
}
.rarity.hot { color: var(--clay); background: color-mix(in srgb, var(--clay) 12%, transparent); }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}
.who img, .avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--pine);
  color: #f4f0e6;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
}

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 88px;
}
.kicker {
  margin: 0 0 10px;
  color: var(--pine);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 650; letter-spacing: 0.01em; }
h1 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.08; }
.lede { margin: 16px 0 0; max-width: 38rem; color: var(--muted); font-size: 1.08rem; }

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
  align-items: end;
  padding-bottom: 18px;
}
.hero-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }

.btn, .wx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn.primary, .wx-btn {
  background: var(--pine);
  color: #f6f3ea;
  box-shadow: none;
}
[data-theme="dark"] .btn.primary, [data-theme="dark"] .wx-btn { color: #122018; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary,
  :root:not([data-theme="light"]) .wx-btn { color: #122018; }
}
.btn.danger { color: var(--clay); }
.btn:disabled, .wx-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.wx-btn { background: #16734a; color: #f6f3ea; min-width: 220px; }

.feature-grid, .split, .stat-row, .species-grid, .plan-list {
  display: grid;
  gap: 16px;
}
.feature-grid { grid-template-columns: 1fr 1fr; margin-top: 34px; }
.feature {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.feature:hover { border-color: color-mix(in srgb, var(--pine) 45%, var(--line)); }
.feature-index {
  color: var(--gold);
  font-family: var(--serif);
  letter-spacing: 0.12em;
}
.feature h2 { margin: 10px 0 8px; font-size: 2rem; }
.feature p { margin: 0; color: var(--muted); }
.feature-go { margin-top: auto; padding-top: 22px; color: var(--pine); font-weight: 650; }

.section { margin-top: 54px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 1.7rem; }
.section-head a { color: var(--pine); }

.species-grid { grid-template-columns: repeat(4, 1fr); }
.species-grid .empty, .plan-list .empty { grid-column: 1 / -1; }
.species, .plan {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  box-shadow: var(--shadow);
}
.species-photo, .mono {
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  object-fit: cover;
  width: 100%;
}
.mono {
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 2.4rem;
  color: var(--pine);
}
.species-body, .plan { padding: 14px 14px 16px; }
.plan { padding: 18px; }
.latin { margin: 2px 0 0; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 0.92rem; }
.meta { margin-top: 8px; color: var(--muted); font-size: 0.84rem; }
.zh { margin: 0; font-family: var(--serif); font-size: 1.2rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.step b { display: block; margin-bottom: 6px; font-family: var(--serif); font-size: 1.15rem; font-weight: 650; }
.step span { color: var(--muted); }

.page-head, .detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.search {
  width: min(420px, 100%);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 10px 2px;
  outline: none;
}
.search:focus { border-bottom-color: var(--pine); }

.stat-row { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.stat {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.stat b { display: block; font-family: var(--serif); font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: 0.86rem; }

.tabs { display: flex; gap: 8px; margin: 8px 0 16px; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 0;
  margin-right: 14px;
  border-bottom: 2px solid transparent;
}
.tab.on { color: var(--ink); border-bottom-color: var(--pine); }

.target, .task {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: transparent;
  width: 100%;
  text-align: left;
}
.target img, .target .mini {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--paper-deep);
}
.mini { display: grid; place-items: center; color: var(--pine); font-family: var(--serif); }
.status-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.status-row button, .chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 0.8rem;
}
.status-row button.on { background: var(--pine); color: #f6f3ea; border-color: transparent; }
.task { grid-template-columns: 22px 1fr; }
.task input { width: 16px; height: 16px; accent-color: var(--pine); }
.done { color: var(--muted); text-decoration: line-through; }

.sheet, .login-card, .note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}
.empty {
  color: var(--muted);
  padding: 8px 0 4px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid label, .stack label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 0.86rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid textarea, .stack input, .stack select {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 12px;
}
.form-actions, .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.login-wrap {
  min-height: calc(100vh - var(--header));
  display: grid;
  place-items: center;
  padding: 24px 0 60px;
}
.login-card { width: min(440px, 100%); text-align: center; }
.login-card img { width: 72px; height: 72px; margin: 0 auto 12px; }
.login-card h1 { font-size: 2.2rem; }
.note { margin-top: 16px; color: var(--muted); text-align: left; }
.error { color: var(--clay); min-height: 1.2em; }

.footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 999px;
  z-index: 30;
}

@media (max-width: 860px) {
  .hero, .feature-grid, .species-grid, .steps, .stat-row, .form-grid { grid-template-columns: 1fr; }
  .species-grid { grid-template-columns: 1fr 1fr; }
  .top { padding: 12px 16px 0; }
  .brand-name { font-size: 1.15rem; letter-spacing: 0.04em; }
  .switch { order: 3; width: 100%; margin: 8px 0 0; }
  .brand-domain { display: none; }
  .deck { overflow: hidden; }
  .deck-track {
    display: flex;
    width: 200%;
    align-items: flex-start;
    transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .deck.is-plans .deck-track { transform: translateX(-50%); }
  .deck.dragging .deck-track { transition: none; }
  .deck-pane,
  .deck-pane.active {
    display: block;
    width: 50%;
    flex: none;
  }
  .page-head, .detail-head, .section-head, .footer { flex-direction: column; align-items: flex-start; }
  .target { grid-template-columns: 56px 1fr; }
  .status-row { grid-column: 1 / -1; justify-content: flex-start; }
  .wrap { width: min(1120px, calc(100% - 28px)); }
}
