/* 星球自习室 · 设计规范
   纸张 + 墨色 + 朱砂印章：像一本摊开的练习本。
   颜色、字号、圆角都从这里取，页面里不要再写新的色值。 */
@font-face {
  font-family: "Star Kai";
  src: url("../fonts/star-kai.woff2?v=40e046ccb5") format("woff2");
  font-display: swap;
}

:root {
  --paper: #fbf6ea;
  --paper-deep: #f3ebd9;
  --card: #fffdf7;
  --ink: #2b2721;
  --ink-soft: #5f584a;
  --ink-faint: #8a826f;
  --line: #e9e0cc;
  --line-strong: #d9cdb2;

  --seal: #c43d26;
  --seal-deep: #a33019;
  --seal-tint: #fbe6dd;
  --leaf: #3e7c4a;
  --leaf-deep: #2f6239;
  --leaf-tint: #e3f0dc;
  --sky: #2e6ab1;
  --sky-tint: #e0ecf8;
  --sun: #b56d06;
  --sun-tint: #fbefd2;
  --grape: #6a55b3;
  --grape-tint: #ebe6f8;
  --lake: #1e8681;
  --lake-tint: #dbf0ed;
  --grid: #8fb996;

  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-kai: "Star Kai", "Kaiti SC", "STKaiti", "KaiTi", "TW-Kai", serif;

  --r-s: 12px;
  --r-m: 18px;
  --r-l: 26px;
  --shadow-1: 0 1px 2px rgba(74, 58, 28, .06), 0 6px 18px rgba(74, 58, 28, .07);
  --shadow-2: 0 2px 4px rgba(74, 58, 28, .08), 0 14px 34px rgba(74, 58, 28, .13);
  --gutter: clamp(16px, 3vw, 32px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-synthesis: none;
}
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.kai { font-family: var(--font-kai); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 12px; top: -60px; padding: 10px 16px; border-radius: var(--r-s); background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }

.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) var(--gutter) 28px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font: 400 clamp(32px, 6vw, 42px)/1.25 var(--font-kai); }
.page-head p { color: var(--ink-soft); }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 600; transition: transform .12s ease, background-color .15s ease; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--seal); color: #fff; box-shadow: 0 6px 16px rgba(196, 61, 38, .28); }
.btn-primary:hover { background: var(--seal-deep); }
.btn-quiet { background: var(--paper-deep); color: var(--ink); }
.btn-quiet:hover { background: var(--line); }
.btn-big { min-height: 56px; padding: 0 28px; font-size: 19px; }
.btn[disabled] { opacity: .45; cursor: default; }

.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: var(--ink-soft); background: var(--paper-deep); transition: transform .12s ease, background-color .15s ease; }
.icon-btn:hover { background: var(--line); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.icon-btn svg { width: 24px; height: 24px; }

svg.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 分段选择 */
.seg { display: inline-flex; gap: 3px; padding: 4px; border-radius: 999px; background: var(--paper-deep); }
.seg > a, .seg > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.seg > [aria-current="page"], .seg > [aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(74, 58, 28, .16); }
.seg small { font-size: 13px; font-weight: 500; color: var(--ink-faint); }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-1); }

/* 分区标题 */
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; font: 400 24px/1.3 var(--font-kai); }
.section-head a { color: var(--ink-soft); font-size: 15px; font-weight: 600; white-space: nowrap; }
.section-mark { width: 8px; height: 22px; border-radius: 4px; background: var(--tone, var(--seal)); }

/* 入口格：字即图标 */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); transition: transform .12s ease, box-shadow .15s ease; }
.tile:hover { box-shadow: var(--shadow-1); }
.tile:active { transform: scale(.985); }
.tile-icon { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--tint, var(--seal-tint)); color: var(--tone, var(--seal)); font: 400 30px/1 var(--font-kai); }
.tile-icon.latin { font: 700 20px/1 var(--font-ui); letter-spacing: -.5px; }
.tile-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.tile-text b { font-size: 19px; font-weight: 700; line-height: 1.35; }
.tile-text small { font-size: 14px; line-height: 1.4; color: var(--ink-soft); }
.tile > .icon { color: var(--line-strong); width: 22px; height: 22px; }

.tone-seal { --tone: var(--seal); --tint: var(--seal-tint); }
.tone-leaf { --tone: var(--leaf); --tint: var(--leaf-tint); }
.tone-sky { --tone: var(--sky); --tint: var(--sky-tint); }
.tone-sun { --tone: var(--sun); --tint: var(--sun-tint); }
.tone-grape { --tone: var(--grape); --tint: var(--grape-tint); }
.tone-lake { --tone: var(--lake); --tint: var(--lake-tint); }

.note { color: var(--ink-faint); font-size: 14px; line-height: 1.6; }

/* 档案小窗 */
.sheet { width: min(calc(100vw - 24px), 440px); max-height: min(86vh, 720px); padding: 0; border: 0; border-radius: var(--r-l); background: var(--card); color: var(--ink); box-shadow: var(--shadow-2); overflow: auto; }
.sheet::backdrop { background: rgba(43, 39, 33, .42); }
.sheet-inner { display: grid; gap: 16px; padding: 22px; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-top h2 { font: 400 26px/1.3 var(--font-kai); }
.who-list { display: grid; gap: 8px; }
.who-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: var(--r-m); text-align: left; background: var(--card); }
.who-row[aria-current="true"] { border-color: var(--seal); background: var(--seal-tint); }
.who-row .who-emoji { font-size: 30px; line-height: 1; }
.who-row b { display: block; font-size: 18px; line-height: 1.3; }
.who-row small { color: var(--ink-soft); font-size: 14px; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field input, .field select { min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-s); background: #fff; font-weight: 400; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { width: 48px; height: 48px; border-radius: 14px; font-size: 26px; background: var(--paper-deep); }
.avatar-pick button[aria-pressed="true"] { background: var(--seal-tint); box-shadow: inset 0 0 0 2px var(--seal); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

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