/* app.css — 基础层：设计令牌、排版、容器、通用组件、动效。
   视觉方向：韩国学生原稿纸（원고지）＋ 红笔批改。纸张、格线、墨、批改红。 */

/* ============ 1. 令牌 ============ */

:root {
  --paper: #f5f2ea;
  --paper-2: #fffdf8;
  --paper-3: #ece7db;
  --paper-4: #e2dccd;
  --ink: #15181f;
  --ink-2: #4a4f5b;
  --ink-3: #8b8f99;
  --ink-4: #b6b9c0;
  --rule: #e0dacb;
  --rule-2: #cdc5b2;
  --pen: #c94329;
  --pen-2: #a5341f;
  --pen-wash: #fbe9e4;
  --jade: #2c6656;
  --jade-wash: #e5efe9;
  --hl: #ffe066;
  --hl-2: #fff3b8;

  --font-ko: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Nanum Gothic", sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-data: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 11px;
  --fs-s: 12.5px;
  --fs-m: 14.5px;
  --fs-l: 17px;
  --fs-xl: 22px;
  --fs-2xl: 30px;
  --fs-3xl: 44px;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 22px;

  --shadow-1: 0 1px 2px rgba(24, 22, 16, .05);
  --shadow-2: 0 1px 2px rgba(24, 22, 16, .05), 0 10px 26px -14px rgba(24, 22, 16, .22);
  --shadow-3: 0 2px 4px rgba(24, 22, 16, .06), 0 18px 40px -18px rgba(24, 22, 16, .28);

  --ease: cubic-bezier(.22, .68, .28, 1);
  --ease-out: cubic-bezier(.16, .9, .32, 1);
  --dur: .3s;

  --topbar-h: 54px;
  --tabbar-h: 67px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ============ 2. 基础 ============ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--fs-m);
  line-height: 1.62;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* 纸面格线：很淡的一层，滚动时不动 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(120, 110, 90, .055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 110, 90, .045) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, rgba(0, 0, 0, .35) 100%);
}

h1, h2, h3, h4, p, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--rule); }

.ko { font-family: var(--font-ko); }
.mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.dim { color: var(--ink-3); }
.small { font-size: var(--fs-s); }
.grow { flex: 1; }
.mt-s { margin-top: 8px; }
.mt-m { margin-top: 14px; }
.mt-l { margin-top: 22px; }
.mb-m { margin-bottom: 14px; }

::selection { background: var(--hl); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--pen);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ 3. 骨架 ============ */

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 18px calc(var(--tabbar-h) + var(--safe-b) + 26px);
}

#view {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-b) - 40px);
}

body.is-immersive #view { min-height: calc(100dvh - var(--topbar-h) - var(--safe-t) - 10px); }
body.is-immersive #app { padding-bottom: 12px; }

/* ---- 顶栏 ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
  margin: 0 -18px;
  padding: var(--safe-t) 18px 0;
  background: linear-gradient(to bottom, var(--paper) 62%, rgba(245, 242, 234, 0));
  backdrop-filter: saturate(1.2) blur(6px);
}

.topbar__title {
  font-size: var(--fs-l);
  font-weight: 640;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__sub {
  font-size: var(--fs-s);
  color: var(--ink-3);
  margin-left: 2px;
  white-space: nowrap;
}

.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar__actions .btn { min-height: 34px; padding: 0 12px; font-size: var(--fs-s); border-radius: 9px; }

.sectionhead > .seg { margin-left: auto; flex: none; }

/* ---- 底部导航 ---- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 120%);
  z-index: 40;
  width: 100%;
  max-width: 620px;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
  padding: 6px 10px calc(9px + var(--safe-b));
  background: rgba(250, 247, 240, .88);
  backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--rule);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  opacity: 0;
}

.tabbar[data-show="1"] { transform: translate(-50%, 0); opacity: 1; }

.tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px 7px;
  border: 0;
  background: none;
  border-radius: var(--r-m);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  line-height: 1.15;
  letter-spacing: .02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s var(--ease), transform .2s var(--ease);
}

.tab:active { transform: scale(.94); }
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tab[aria-current="page"] svg { transform: translateY(-1px); }
.tab svg { transition: transform .24s var(--ease); }

/* 当前页标记：贴在底栏上沿的一小段红笔 */
.tab__dot {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 18px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--pen);
  opacity: 0;
  transform: translateX(-50%) scaleX(.35);
  transition: opacity .22s var(--ease), transform .3s var(--ease-out);
}

.tab[aria-current="page"] .tab__dot { opacity: 1; transform: translateX(-50%) scaleX(1); }

/* ---- 视图进场 ---- */

#view > * {
  animation: rise var(--dur) var(--ease-out) both;
}

#view > *:nth-child(1) { animation-delay: 0ms; }
#view > *:nth-child(2) { animation-delay: 45ms; }
#view > *:nth-child(3) { animation-delay: 80ms; }
#view > *:nth-child(4) { animation-delay: 110ms; }
#view > *:nth-child(5) { animation-delay: 135ms; }
#view > *:nth-child(6) { animation-delay: 155ms; }
#view > *:nth-child(n+7) { animation-delay: 170ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: none; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes inkIn {
  from { opacity: 0; transform: translateY(6px) scale(.985); filter: blur(2px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ============ 4. 排版组件 ============ */

.sectionhead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 30px 2px 10px;
}

.sectionhead:first-child { margin-top: 6px; }

.sectionhead h2 {
  font-size: var(--fs-s);
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.sectionhead > a,
.sectionhead > .mono {
  margin-left: auto;
  font-size: var(--fs-s);
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 1px;
}

.sectionhead > a:active { color: var(--pen); }

.label {
  display: block;
  font-size: var(--fs-s);
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
  letter-spacing: .01em;
}

.label .hint, .hint {
  font-weight: 400;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  letter-spacing: 0;
}

.help {
  font-size: var(--fs-s);
  color: var(--ink-3);
  line-height: 1.6;
  margin-top: 6px;
}

.help--good { color: var(--jade); }
.help--warn { color: var(--pen); }

.footnote {
  margin: 34px 0 10px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--ink-4);
  letter-spacing: .06em;
}

/* ============ 5. 卡片 ============ */

.card {
  background: var(--paper-2);
  border: 1px solid rgba(21, 24, 31, .07);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  padding: 18px;
}

.card + .card { margin-top: 12px; }
.card--tight { padding: 14px 16px; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-m);
  background: var(--paper-3);
  font-size: var(--fs-s);
  line-height: 1.6;
  color: var(--ink-2);
}

.notice svg { flex: none; margin-top: 2px; color: var(--ink-3); }
.notice a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.notice--good { background: var(--jade-wash); color: #1f5648; }
.notice--good svg { color: var(--jade); }
.notice--pen { background: var(--pen-wash); color: var(--pen-2); }
.notice--pen svg { color: var(--pen); }
.notice--plain { background: transparent; border: 1px dashed var(--rule-2); }

/* ============ 6. 按钮 ============ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid rgba(21, 24, 31, .12);
  border-radius: var(--r-m);
  background: var(--paper-2);
  color: var(--ink);
  font-size: var(--fs-m);
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .14s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  box-shadow: var(--shadow-1);
}

.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn svg { flex: none; }

.btn--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffdf8;
  box-shadow: 0 1px 2px rgba(21, 24, 31, .2), 0 10px 22px -12px rgba(21, 24, 31, .6);
}

.btn--primary:active { background: #000; }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
}

.btn--ghost:active { background: rgba(21, 24, 31, .05); }

.btn--danger {
  background: transparent;
  border-color: rgba(201, 67, 41, .28);
  color: var(--pen);
  box-shadow: none;
}

.btn--sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-s); border-radius: var(--r-s); }
.btn--block { display: flex; width: 100%; }

.btnrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease), transform .16s var(--ease);
}

.iconbtn:active { transform: scale(.9); background: rgba(21, 24, 31, .06); }
.iconbtn--box { width: 40px; height: 40px; border-radius: var(--r-m); background: var(--paper-3); color: var(--ink-2); }
.iconbtn--box.is-on { background: var(--ink); color: #fffdf8; }

/* ============ 7. 表单 ============ */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.fieldrow { display: flex; gap: 12px; align-items: flex-start; }
.fieldrow > .field { flex: 1; min-width: 0; }
.field--grow { flex: 2.2 !important; }
.field--narrow { flex: 0 0 92px !important; }

.input, .textarea, .select {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(21, 24, 31, .14);
  border-radius: var(--r-m);
  background: var(--paper-2);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-m);
  line-height: 1.55;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.input { min-height: 44px; }
.input.num { text-align: right; font-family: var(--font-data); }

.input::placeholder, .textarea::placeholder { color: var(--ink-4); }

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(21, 24, 31, .07);
}

.textarea { resize: vertical; min-height: 96px; }
.textarea.ko, .input.ko { font-family: var(--font-ko); font-size: 15.5px; letter-spacing: .005em; }

.keyrow { display: flex; gap: 8px; align-items: center; }
.keyrow .input { flex: 1; }

/* 开关 */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--paper-4);
  cursor: pointer;
  transition: background .26s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(21, 24, 31, .25);
  transition: transform .28s var(--ease-out);
}

.switch[aria-pressed="true"] { background: var(--ink); }
.switch[aria-pressed="true"]::after { transform: translateX(20px); }

/* 分段 */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-m);
  background: var(--paper-3);
}

.seg--wide { display: flex; width: 100%; margin-bottom: 16px; }

.seg button {
  flex: 1;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-3);
  font-size: var(--fs-s);
  font-weight: 560;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}

.seg button[aria-pressed="true"] {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* 标签 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(21, 24, 31, .12);
  border-radius: 999px;
  background: var(--paper-2);
  font-size: var(--fs-s);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .14s var(--ease);
}

.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fffdf8; }
.chip--sm { padding: 3px 9px; font-size: var(--fs-xs); }
.chip .mono { opacity: .6; font-size: 10.5px; }
.chip[aria-pressed="true"] .mono { opacity: .75; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--paper-3);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  letter-spacing: .02em;
}

.unitcell {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 2px 8px;
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  letter-spacing: .04em;
  background: var(--paper-2);
}

.unitcell b { font-family: var(--font-data); font-size: var(--fs-s); color: var(--ink); }
.unitsep { color: var(--ink-4); }

/* 高亮 */
.mark {
  background-image: linear-gradient(transparent 58%, var(--hl) 58%, var(--hl) 92%, transparent 92%);
}

.hanji {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--r-m);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--pen);
  font-size: var(--fs-l);
  line-height: 1.7;
}

/* ============ 8. 列表 ============ */

.list {
  background: var(--paper-2);
  border: 1px solid rgba(21, 24, 31, .07);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.list > * + * { border-top: 1px solid var(--rule); }
.list > * { animation: rise .4s var(--ease-out) both; }
.list > *:nth-child(1) { animation-delay: 20ms; }
.list > *:nth-child(2) { animation-delay: 55ms; }
.list > *:nth-child(3) { animation-delay: 85ms; }
.list > *:nth-child(4) { animation-delay: 110ms; }
.list > *:nth-child(5) { animation-delay: 130ms; }
.list > *:nth-child(n+6) { animation-delay: 145ms; }

.rowlink {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.rowlink:active { background: var(--paper-3); }
.rowlink__main { flex: 1; min-width: 0; }

.rowlink__title {
  font-size: var(--fs-m);
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rowlink__meta {
  margin-top: 2px;
  font-size: var(--fs-s);
  color: var(--ink-3);
  display: flex;
  gap: 8px;
  align-items: center;
}

.rowlink__tail { color: var(--ink-4); flex: none; transition: transform .18s var(--ease); }
.rowlink:active .rowlink__tail { transform: translateX(2px); }

/* 空态 */
.empty {
  margin: 8px 0;
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-l);
  background: linear-gradient(to bottom, rgba(255, 253, 248, .5), transparent);
}

.empty__title { font-size: var(--fs-l); font-weight: 600; }
.empty__body { margin: 8px auto 18px; max-width: 260px; font-size: var(--fs-s); color: var(--ink-3); line-height: 1.65; }

/* 进度 */
.bar {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: var(--paper-4);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width .42s var(--ease-out);
}

.progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-s);
  color: var(--ink-2);
  margin-bottom: 10px;
}

.spin {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid var(--rule-2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spin--ink { border-color: rgba(21, 24, 31, .18); border-top-color: var(--ink); }

.loadcard {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-m);
  background: var(--paper-3);
  font-size: var(--fs-s);
  color: var(--ink-2);
  animation: pop .26s var(--ease-out) both;
}

.loadcard[hidden] { display: none; }

/* 统计条 */
.stats {
  display: flex;
  background: var(--paper-2);
  border: 1px solid rgba(21, 24, 31, .07);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.stat { flex: 1; padding: 14px 8px 12px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--rule); }

.stat__n {
  font-family: var(--font-data);
  font-size: var(--fs-xl);
  font-weight: 500;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat__k { margin-top: 3px; font-size: var(--fs-xs); color: var(--ink-3); letter-spacing: .04em; }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  font-size: var(--fs-m);
}

.kv + .kv { border-top: 1px solid var(--rule); }
.kv > span:first-child { color: var(--ink-2); }
.kv > span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============ 9. Markdown ============ */

.md { font-size: var(--fs-m); line-height: 1.78; color: var(--ink); }

.md h2 {
  margin: 26px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--pen);
  text-transform: uppercase;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}

.md h2:first-child { margin-top: 12px; }
.md h3 { margin: 18px 0 6px; font-size: var(--fs-m); font-weight: 650; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 20px; list-style: revert; }

.md li { margin: 5px 0; }
.md li::marker { color: var(--ink-4); }
.md strong { font-weight: 650; }
.md em { color: var(--ink-2); }

.md code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--paper-3);
  font-family: var(--font-ko);
  font-size: .95em;
}

.md blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 2px solid var(--rule-2);
  color: var(--ink-2);
  background: var(--paper-3);
  border-radius: 0 var(--r-s) var(--r-s) 0;
}

.md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: var(--fs-s); }
.md th, .md td { padding: 7px 9px; border-bottom: 1px solid var(--rule); text-align: left; }
.md th { color: var(--ink-3); font-weight: 600; font-size: var(--fs-xs); letter-spacing: .06em; }
.md hr { margin: 18px 0; }

/* ============ 10. 弹层 ============ */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(21, 24, 31, .34);
  backdrop-filter: blur(2px);
  animation: fadeIn .2s var(--ease) both;
}

.sheet[hidden] { display: none; }

.sheet__panel {
  width: 100%;
  max-width: 620px;
  max-height: 86dvh;
  overflow: auto;
  padding: 10px 18px calc(24px + var(--safe-b));
  background: var(--paper-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -10px 40px rgba(21, 24, 31, .18);
  animation: sheetUp .32s var(--ease-out) both;
}

.sheet__grip {
  width: 38px;
  height: 4px;
  margin: 4px auto 14px;
  border-radius: 999px;
  background: var(--rule-2);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ============ 11. 提示条 ============ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  z-index: 80;
  max-width: min(84vw, 420px);
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(21, 24, 31, .94);
  color: #fdfcf8;
  font-size: var(--fs-s);
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translate(-50%, 12px) scale(.96);
  pointer-events: none;
  transition: opacity .26s var(--ease), transform .26s var(--ease-out);
}

.toast[data-on="1"] { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ============ 12. 兼容 ============ */

:where(#view, #topbar, #tabbar, .sheet, .md) svg { width: 18px; height: 18px; flex: none; }
#tabbar svg { width: 22px; height: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
