/* 琅琅 · 九上古诗文背诵 — 宣纸水墨 · 移动优先 */

:root {
  --paper: #f4eee1;
  --paper-2: #fbf7ed;
  --paper-3: #efe7d5;
  --ink: #322a1f;
  --ink-2: #71634e;
  --ink-3: #9c8d74;
  --line: rgba(62, 46, 24, 0.16);
  --seal: #b23a2f;
  --seal-soft: rgba(178, 58, 47, 0.12);
  --accent: #46666f;
  --accent-soft: rgba(70, 102, 111, 0.12);
  --gold: #a97f34;
  --ok: #3e7a4e;
  --ok-soft: rgba(62, 122, 78, 0.14);
  --shadow: 0 2px 10px rgba(62, 46, 24, 0.08), 0 10px 34px rgba(62, 46, 24, 0.07);
  --radius: 16px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --brush: "Ma Shan Zheng", "Kaiti SC", "STKaiti", cursive;
}
html[data-theme="dark"] {
  --paper: #171310;
  --paper-2: #211c15;
  --paper-3: #2a2419;
  --ink: #eadfc8;
  --ink-2: #b1a184;
  --ink-3: #82755d;
  --line: rgba(234, 223, 200, 0.16);
  --seal: #cf4d3f;
  --seal-soft: rgba(207, 77, 63, 0.16);
  --accent: #8fb4bc;
  --accent-soft: rgba(143, 180, 188, 0.13);
  --gold: #cfa14f;
  --ok: #7ab387;
  --ok-soft: rgba(122, 179, 135, 0.15);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 10px 34px rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --paper: #171310; --paper-2: #211c15; --paper-3: #2a2419;
    --ink: #eadfc8; --ink-2: #b1a184; --ink-3: #82755d;
    --line: rgba(234, 223, 200, 0.16);
    --seal: #cf4d3f; --seal-soft: rgba(207, 77, 63, 0.16);
    --accent: #8fb4bc; --accent-soft: rgba(143, 180, 188, 0.13);
    --gold: #cfa14f; --ok: #7ab387; --ok-soft: rgba(122, 179, 135, 0.15);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 10px 34px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.75;
  min-height: 100dvh;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ---- 水墨底 ---- */
.ink-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ink-bg .wash { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5; }
.ink-bg .w1 { width: 90vw; height: 55vw; left: -25vw; top: -12vw; background: radial-gradient(closest-side, var(--accent-soft), transparent 70%); }
.ink-bg .w2 { width: 80vw; height: 60vw; right: -30vw; top: 22vh; background: radial-gradient(closest-side, var(--seal-soft), transparent 70%); opacity: 0.35; }
.ink-bg .w3 { width: 100vw; height: 60vw; left: -10vw; bottom: -22vw; background: radial-gradient(closest-side, rgba(169, 127, 52, 0.12), transparent 70%); }
.ink-bg .grain {
  position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .ink-bg .grain { mix-blend-mode: screen; opacity: 0.035; }

/* ---- 启动占位 ---- */
.boot { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--ink-2); }
.boot-seal {
  font-family: var(--brush); font-size: 2.4rem; color: #fff; background: var(--seal);
  width: 4.2rem; height: 4.2rem; display: grid; place-items: center; border-radius: 12px;
  transform: rotate(-6deg); box-shadow: var(--shadow); animation: bootPulse 1.6s ease infinite;
}
@keyframes bootPulse { 50% { transform: rotate(-6deg) scale(1.06); } }

#view { max-width: 720px; margin: 0 auto; padding: max(0.9rem, env(safe-area-inset-top)) 1rem calc(4.5rem + env(safe-area-inset-bottom)); }

/* ---- 顶栏 ---- */
.topbar { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0 1rem; }
.brand-seal {
  font-family: var(--brush); font-size: 1.7rem; line-height: 1; color: #fff; background: var(--seal);
  width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 10px;
  transform: rotate(-5deg); box-shadow: var(--shadow); flex: none;
}
.brand-words h1 { margin: 0; font-size: 1.45rem; font-weight: 900; letter-spacing: 0.06em; }
.brand-words p { margin: 0.1rem 0 0; font-size: 0.8rem; color: var(--ink-2); }
.theme-btn {
  margin-left: auto; flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper-2); font-size: 1.05rem; box-shadow: var(--shadow);
}

/* ---- 卷轴总进度 ---- */
.scroll-progress { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.85rem 1rem; margin-bottom: 1rem; }
.sp-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; color: var(--ink-2); }
.sp-row strong { font-size: 1.05rem; color: var(--ink); }
.sp-bar { height: 0.55rem; margin-top: 0.55rem; border-radius: 999px; background: var(--paper-3); overflow: hidden; position: relative; }
.sp-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--seal)); transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---- 每日一句 ---- */
.day-line { display: block; width: 100%; text-align: left; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.9rem 1rem; margin-bottom: 1.3rem; }
.day-line .dl-tag { font-size: 0.72rem; color: var(--seal); letter-spacing: 0.25em; }
.day-line .dl-text { font-size: 1.12rem; font-weight: 700; margin: 0.15rem 0; line-height: 1.6; }
.day-line .dl-src { font-size: 0.78rem; color: var(--ink-2); }

/* ---- 篇目列表 ---- */
.sect-head { display: flex; align-items: baseline; gap: 0.6rem; margin: 1.4rem 0 0.7rem; }
.sect-head h2 { margin: 0; font-size: 1.1rem; font-weight: 900; letter-spacing: 0.12em; }
.sect-head span { font-size: 0.78rem; color: var(--ink-3); }
.piece-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.piece-grid.wide { grid-template-columns: 1fr; }
.piece-card {
  position: relative; text-align: left; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.8rem 0.9rem; overflow: hidden;
  transition: transform 0.15s ease;
}
.piece-card:active { transform: scale(0.98); }
.pc-title { font-weight: 700; font-size: 1.02rem; line-height: 1.45; display: block; }
.pc-meta { font-size: 0.76rem; color: var(--ink-2); margin-top: 0.15rem; display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.pc-badge { font-size: 0.66rem; color: var(--gold); border: 1px solid currentColor; border-radius: 5px; padding: 0 0.3em; }
.pc-badge.out { color: var(--ink-3); }
.pc-dots { display: flex; gap: 0.32rem; margin-top: 0.55rem; }
.pc-dots i { width: 0.52rem; height: 0.52rem; border-radius: 50%; border: 1.5px solid var(--ink-3); opacity: 0.65; }
.pc-dots i.done { background: var(--seal); border-color: var(--seal); opacity: 1; }
.pc-seal {
  position: absolute; right: 0.55rem; top: 0.5rem; font-family: var(--brush);
  color: var(--seal); border: 2px solid var(--seal); border-radius: 8px;
  width: 2rem; height: 2rem; display: grid; place-items: center; font-size: 1.15rem;
  transform: rotate(9deg); opacity: 0.9;
}

/* ---- 篇目页 ---- */
.piece-top { display: flex; align-items: center; gap: 0.65rem; padding: 0.4rem 0 0.9rem; }
.back-btn { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-2); font-size: 1.1rem; box-shadow: var(--shadow); }
.piece-top .pt-words { min-width: 0; }
.piece-top h1 { margin: 0; font-size: 1.28rem; font-weight: 900; line-height: 1.4; }
.piece-top p { margin: 0; font-size: 0.78rem; color: var(--ink-2); }
.pt-seal { margin-left: auto; flex: none; font-family: var(--brush); color: var(--seal); border: 2px solid var(--seal); border-radius: 9px; padding: 0.15rem 0.4rem; font-size: 0.95rem; transform: rotate(8deg); }

.mode-tabs { display: flex; gap: 0.45rem; margin-bottom: 1rem; }
.mode-tabs button {
  flex: 1; padding: 0.55rem 0; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-2); font-size: 0.92rem; letter-spacing: 0.2em; text-indent: 0.2em;
}
.mode-tabs button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }

/* ---- 诵读 ---- */
.read-hint { font-size: 0.78rem; color: var(--ink-3); text-align: center; margin: 0 0 0.9rem; }
.read-page { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.15rem 1.6rem; }
.read-para { margin: 0 0 1.1rem; font-size: 1.16rem; line-height: 2.15; text-align: justify; }
.read-para.prose { text-indent: 2em; }
.read-para.verse { text-align: center; text-indent: 0; font-size: 1.22rem; }
.read-para.preface { font-size: 0.98rem; color: var(--ink-2); text-align: left; text-indent: 0; }
.read-para:last-child { margin-bottom: 0; }
.clause { border-radius: 6px; transition: background 0.25s ease; }
.clause:active, .clause.lit { background: var(--accent-soft); }
ruby rt { font-size: 0.52em; color: var(--accent); letter-spacing: 0; font-family: var(--serif); }

/* ---- 闯关 ---- */
.stage-list { display: grid; gap: 0.7rem; }
.stage-card {
  display: flex; align-items: center; gap: 0.9rem; text-align: left; width: 100%;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0.85rem 1rem;
}
.stage-card:disabled { opacity: 0.45; }
.sc-no { flex: none; font-family: var(--brush); font-size: 1.5rem; color: var(--accent); width: 2.2rem; text-align: center; }
.sc-words { min-width: 0; flex: 1; }
.sc-name { font-weight: 700; font-size: 1.05rem; font-family: var(--brush); letter-spacing: 0.08em; }
.sc-desc { font-size: 0.78rem; color: var(--ink-2); }
.sc-state { flex: none; font-size: 0.8rem; color: var(--ink-3); }
.sc-state.done { color: var(--seal); font-weight: 700; }
.stage-note { font-size: 0.78rem; color: var(--ink-3); text-align: center; margin: 1rem 0 0; }

/* 练习页 */
.prac-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.8rem; }
.prac-name { font-family: var(--brush); font-size: 1.25rem; letter-spacing: 0.1em; }
.prac-peek { font-size: 0.8rem; color: var(--ink-2); }
.prac-quit { border: none; background: none; color: var(--ink-3); font-size: 0.85rem; padding: 0.3rem; }
.cloze-page { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1rem 1.5rem; }
.cloze-para { margin: 0 0 1rem; font-size: 1.18rem; line-height: 2.3; text-align: justify; }
.cloze-para.verse { text-align: center; font-size: 1.2rem; }
.cloze-para:last-child { margin-bottom: 0; }
.cell { display: inline; }
.cell.blank {
  display: inline-grid; place-items: center; width: 1.35em; height: 1.35em;
  border: 1.5px dashed var(--ink-3); border-radius: 7px; vertical-align: -0.12em;
  margin: 0 0.06em; color: transparent; background: var(--paper-3); cursor: pointer;
  line-height: 1; font-weight: 700;
}
.cell.blank.peeked { color: var(--seal); border-color: var(--seal); border-style: solid; background: var(--seal-soft); animation: inkIn 0.4s ease; }
@keyframes inkIn { from { opacity: 0; filter: blur(5px); transform: scale(1.5); } }
.prac-actions { display: flex; gap: 0.7rem; margin-top: 1.1rem; }
.btn {
  flex: 1; padding: 0.75rem 0.5rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-2); font-size: 1rem; box-shadow: var(--shadow); letter-spacing: 0.08em;
}
.btn.primary { background: var(--seal); border-color: var(--seal); color: #fff; font-weight: 700; }
.btn.ghost { box-shadow: none; }
.btn:disabled { opacity: 0.5; }

/* 接龙 */
.quiz-progress { display: flex; gap: 0.3rem; margin-bottom: 0.9rem; }
.quiz-progress i { flex: 1; height: 0.32rem; border-radius: 99px; background: var(--paper-3); }
.quiz-progress i.hit { background: var(--ok); }
.quiz-progress i.miss { background: var(--seal); }
.quiz-progress i.now { background: var(--ink-3); }
.quiz-q { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1rem; text-align: center; margin-bottom: 0.9rem; }
.quiz-q .qq-tag { font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.3em; }
.quiz-q .qq-text { font-size: 1.25rem; font-weight: 700; line-height: 1.8; margin-top: 0.3rem; }
.quiz-opts { display: grid; gap: 0.65rem; }
.quiz-opt {
  padding: 0.8rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-2);
  font-size: 1.08rem; text-align: center; line-height: 1.7; box-shadow: var(--shadow); transition: transform 0.12s ease;
}
.quiz-opt:active { transform: scale(0.98); }
.quiz-opt.right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.quiz-opt.wrong { background: var(--seal-soft); border-color: var(--seal); color: var(--seal); animation: shake 0.35s ease; }
.quiz-opt:disabled { opacity: 0.92; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* 结算 */
.result-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem 1.2rem; text-align: center; }
.result-card .rc-face { font-family: var(--brush); font-size: 2.2rem; color: var(--seal); }
.result-card .rc-line { font-size: 1.05rem; margin: 0.5rem 0 0.2rem; font-weight: 700; }
.result-card .rc-sub { font-size: 0.82rem; color: var(--ink-2); }

/* ---- 默写 ---- */
.dict-page { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1rem 1.4rem; }
.dict-prompt { text-align: center; font-size: 1.15rem; font-weight: 700; line-height: 1.9; }
.dict-prompt .dp-tag { display: block; font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.3em; font-weight: 400; margin-bottom: 0.2rem; }
.dict-input {
  width: 100%; margin-top: 0.9rem; padding: 0.7rem 0.85rem; font-size: 1.1rem; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); outline: none;
}
.dict-input:focus { border-color: var(--accent); }
.dict-diff { margin-top: 0.9rem; font-size: 1.25rem; letter-spacing: 0.12em; line-height: 2; text-align: center; }
.dict-diff .ok { color: var(--ok); }
.dict-diff .bad { color: var(--seal); text-decoration: underline wavy; text-underline-offset: 0.3em; }
.dict-verdict { text-align: center; font-size: 0.85rem; color: var(--ink-2); margin-top: 0.35rem; }
.dict-upload {
  margin-top: 1.1rem; padding: 1rem; border: 1px dashed var(--line); border-radius: 14px;
  background: linear-gradient(180deg, var(--paper), var(--paper-2)); text-align: left;
}
.dict-upload .du-kicker { display: block; font-size: 0.68rem; color: var(--seal); letter-spacing: 0.28em; margin-bottom: 0.25rem; }
.dict-upload b { display: block; font-size: 1rem; line-height: 1.5; }
.dict-upload p { margin: 0.3rem 0 0.8rem; color: var(--ink-2); font-size: 0.8rem; line-height: 1.7; }
.upload-btn { display: grid; place-items: center; width: 100%; margin: 0.15rem 0 0; text-align: center; }
.upload-btn input { display: none; }
.upload-btn.disabled { opacity: 0.58; pointer-events: none; }
.du-file { display: block; margin-top: 0.55rem; color: var(--ink-3); font-size: 0.76rem; overflow-wrap: anywhere; text-align: center; }
.du-preview {
  display: block; width: 100%; max-height: 260px; object-fit: contain; margin-top: 0.8rem;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.du-loading {
  margin-top: 0.8rem; padding: 0.65rem 0.75rem; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink-2); font-size: 0.82rem; text-align: center;
}
.du-loading span::after { content: "。"; animation: dots 1.2s steps(3, end) infinite; }
@keyframes dots { 33% { content: "。。"; } 66% { content: "。。。"; } }
.du-error { color: var(--seal) !important; }
.du-result {
  margin-top: 0.85rem; padding: 0.85rem 0.95rem; border-radius: 12px;
  background: var(--paper-2); border: 1px solid var(--seal-soft); box-shadow: inset 4px 0 0 var(--seal);
  font-size: 0.9rem; line-height: 1.8;
}
.du-result .md p { margin: 0 0 0.55em; }
.du-result .md p:last-child { margin-bottom: 0; }
.du-result .md ul { margin: 0.25rem 0; padding-left: 1.2rem; }

/* ---- 句子抽屉 & 对话 ---- */
.sheet-host, .chat-host { position: fixed; inset: 0; z-index: 60; }
.backdrop { position: absolute; inset: 0; background: rgba(20, 14, 6, 0.45); backdrop-filter: blur(2px); animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet-card {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--paper-2);
  border-radius: 22px 22px 0 0; border-top: 1px solid var(--line);
  padding: 1rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom));
  animation: rise 0.25s cubic-bezier(0.22, 1, 0.36, 1); max-height: 78dvh; overflow: auto;
}
@keyframes rise { from { transform: translateY(40%); opacity: 0.4; } }
.sheet-card .sh-clause { font-size: 1.1rem; font-weight: 700; line-height: 1.8; margin: 0.2rem 0 0.9rem; }
.sheet-acts { display: grid; gap: 0.6rem; }
.sheet-acts .btn { text-align: left; padding-left: 1.1rem; }

.chat-card {
  position: absolute; left: 0; right: 0; bottom: 0; top: max(6dvh, env(safe-area-inset-top));
  background: var(--paper); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 720px; margin: 0 auto;
}
.chat-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.9rem 1.1rem 0.7rem; border-bottom: 1px solid var(--line); }
.chat-head .ch-seal { font-family: var(--brush); color: #fff; background: var(--seal); border-radius: 9px; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; font-size: 1.25rem; transform: rotate(-5deg); }
.chat-head .ch-words { min-width: 0; flex: 1; }
.chat-head .ch-words b { font-size: 1.02rem; }
.chat-head .ch-words p { margin: 0; font-size: 0.72rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-close { border: none; background: none; font-size: 1.3rem; color: var(--ink-3); padding: 0.4rem; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem 1rem 0.5rem; display: flex; flex-direction: column; gap: 0.7rem; }
.msg { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 14px; font-size: 0.98rem; line-height: 1.8; overflow-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--paper-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg.ai .md p { margin: 0 0 0.4em; } .msg.ai .md p:last-child { margin: 0; }
.msg.ai .md li { margin: 0.15em 0; }
.msg.ai .md ul { margin: 0.2em 0; padding-left: 1.2em; }
.msg.think { align-self: flex-start; color: var(--ink-3); font-size: 0.85rem; border: none; background: none; }
.msg.think i { animation: blink 1.2s infinite; font-style: normal; }
.msg.think i:nth-child(2) { animation-delay: 0.2s; } .msg.think i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.2; } }
.chat-chips { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.5rem 1rem; scrollbar-width: none; }
.chat-chips::-webkit-scrollbar { display: none; }
.chat-chips button { flex: none; font-size: 0.82rem; padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); }
.chat-inrow { display: flex; gap: 0.55rem; padding: 0.4rem 1rem calc(0.9rem + env(safe-area-inset-bottom)); }
.chat-input { flex: 1; border: 1.5px solid var(--line); background: var(--paper-2); border-radius: 999px; padding: 0.6rem 1rem; font-size: 1rem; color: var(--ink); outline: none; }
.chat-input:focus { border-color: var(--accent); }
.chat-send { flex: none; width: 2.9rem; height: 2.9rem; border-radius: 50%; border: none; background: var(--seal); color: #fff; font-family: var(--brush); font-size: 1.2rem; }
.chat-send:disabled { opacity: 0.5; }

/* 问先生浮钮 */
.ask-fab {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(1.3rem + env(safe-area-inset-bottom));
  width: 3.4rem; height: 3.4rem; border-radius: 14px; border: none; background: var(--seal); color: #fff;
  font-family: var(--brush); font-size: 1.5rem; box-shadow: 0 6px 20px rgba(178, 58, 47, 0.4);
  transform: rotate(-5deg); z-index: 40;
}
.ask-fab:active { transform: rotate(-5deg) scale(0.94); }

/* ---- 盖章特效 ---- */
.sealfx { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(20, 14, 6, 0.5); backdrop-filter: blur(3px); }
.sealfx-box { text-align: center; }
.sealfx-stamp {
  width: 200px; height: 200px; margin: 0 auto; border: 7px solid var(--seal); border-radius: 26px;
  display: grid; place-items: center; color: var(--seal);
  font-family: var(--brush); font-size: 4rem; letter-spacing: 0.05em; line-height: 1.15;
  background: radial-gradient(circle at 40% 35%, rgba(178,58,47,0.14), rgba(178,58,47,0.05));
  transform: rotate(-8deg); animation: stamp 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
  text-shadow: 0 0 1px currentColor;
}
@keyframes stamp { 0% { transform: rotate(-20deg) scale(2.4); opacity: 0; } 60% { transform: rotate(-8deg) scale(0.96); opacity: 1; } }
.sealfx-title { color: #f4eee1; margin-top: 1.1rem; font-size: 1.05rem; }
.sealfx-sub { color: rgba(244, 238, 225, 0.75); font-size: 0.82rem; margin-top: 0.2rem; }

/* ---- 杂项 ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(5.6rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 0.55rem 1.1rem; border-radius: 999px;
  font-size: 0.88rem; z-index: 90; box-shadow: var(--shadow); max-width: 85vw; text-align: center;
}
.footer-note { text-align: center; font-size: 0.72rem; color: var(--ink-3); margin-top: 2.2rem; line-height: 1.9; }
.footer-note a { color: inherit; }

@media (min-width: 560px) {
  .piece-grid { grid-template-columns: 1fr 1fr 1fr; }
  .piece-grid.wide { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
