/* ============================================================
   诗词接龙 · style.css
   暖米色国风 · 桌面左右分栏 / 移动单列 · 长诗句自适应
   ============================================================ */
:root {
  --bg: #f5f0e1;
  --card: #ffffff;
  --poem-bg: #faf8f5;
  --seal: #c0392b;
  --border: #8b7355;
  --line: #e7ddc9;
  --focus: #e6b422;
  --btn: #8b5e3c;
  --btn-d: #74492c;
  --ink: #3e2723;
  --ink2: #8d6e63;
  --green: #27ae60;
  --blue: #2980b9;
  --sh: 0 2px 8px rgba(0, 0, 0, .06);
  --sh-lg: 0 8px 28px rgba(62, 39, 35, .14);
  --serif: "Kaiti SC", "STKaiti", "Kaiti", "PingFang SC", "Songti SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 56px;
  --tab-h: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: 0.3; z-index: -1;
  background: url('./assets/ink-landscape.png') center bottom / cover no-repeat;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.serif { font-family: var(--serif); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ---------- 顶部导航 ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 20px; padding-right: 20px;
  background: rgba(253, 250, 246, 0.85);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 40px; height: 40px; border-radius: 8px; }
.brand-name { font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: 1px; }
.topnav-links { display: flex; gap: 6px; }
.navlink {
  padding: 7px 13px; border-radius: 8px; color: var(--ink2); font-size: 15px;
  transition: .15s;
}
.navlink:hover { background: #f3ece0; color: var(--ink); }
.navlink.active { color: var(--seal); font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 10px; padding: 12px 22px;
  font-size: 16px; font-weight: 600; color: #fff; background: var(--btn);
  transition: .15s; box-shadow: var(--sh);
}
.btn:hover { background: var(--btn-d); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--seal); }
.btn-primary:hover { background: #a5301f; }
.btn-start { background: linear-gradient(135deg, #a5301f, var(--seal)); width: 100%; padding: 15px; font-size: 18px; letter-spacing: 2px; }
.btn-line {
  border: 1px solid var(--line); background: #fff; color: var(--ink2);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; font-weight: 500; transition: .15s;
}
.btn-line:hover { border-color: var(--btn); color: var(--btn); }
.btn-line.danger:hover { border-color: var(--seal); color: var(--seal); }

/* ---------- 应用容器 ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }
.page { display: none; }
.page.active { display: block; }

#page-game {
  position: relative;
}

/* ---------- 游戏主区（移动单列 / 桌面左右分栏） ---------- */
.game-screen {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; min-width: 0;
}
.chain-col, .play-col {
  width: 100%; min-width: 0;
  background: rgba(253, 250, 246, 0.85); border-radius: 16px; box-shadow: var(--sh);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
}
.chain-col { order: 0; padding: 14px; min-height: 38vh; max-height: 50vh; display: flex; flex-direction: column; overflow: hidden; }
.play-col { order: 1; padding: 14px; position: static; display: flex; flex-direction: column; gap: 12px; }

/* 接龙要求横幅 */
.req-banner {
  background: var(--poem-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.req-banner::before {
  content: ""; position: absolute; right: -10px; top: -10px; width: 60px; height: 60px;
  background: radial-gradient(circle, rgba(192, 57, 43, .08), transparent 70%);
}
.req-mode {
  display: inline-block; font-size: 13px; color: #fff; background: var(--seal);
  padding: 2px 10px; border-radius: 20px; margin-bottom: 6px; letter-spacing: 1px;
}
.req-text { margin: 0; font-size: 16px; color: var(--ink); }
.req-text .hl {
  font-family: var(--serif); font-size: 1.5em; font-weight: 700; color: var(--seal);
  margin: 0 3px; vertical-align: -2px;
}

/* 接龙序列 */
.chain-wrap { flex: 1; overflow-y: auto; min-height: 200px; scroll-behavior: smooth; }
.chain-empty {
  height: 100%; min-height: 280px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--ink2); text-align: center;
}
.chain-empty .ce-seal {
  width: 72px; height: 72px; border-radius: 12px; background: var(--seal); color: #fff;
  font-family: var(--serif); font-size: 40px; display: grid; place-items: center; margin-bottom: 6px;
  box-shadow: var(--sh-lg); transform: rotate(-4deg);
}
.chain-empty p { margin: 4px 0 0; font-size: 18px; color: var(--ink); font-weight: 600; }
.chain-empty span { font-size: 14px; }
.chain { display: flex; flex-direction: column; gap: 10px; }
.chain-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  background: var(--poem-bg); border: 1px solid var(--line); border-radius: 12px;
  animation: rise .35s ease both;
}
.chain-item:not(.ci-ai) { background: #fffaf3; border-color: #e6dac6; }
.chain-item.ci-ai { background: #f8f3ee; border-color: #ded2c3; }
.chain-item.latest {
  border-color: #e3c56a;
  box-shadow: 0 4px 12px rgba(230, 180, 34, .12);
  background: #fffdf6;
}
.ci-who {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.ci-who.me { background: var(--seal); color: #fff; }
.ci-who.ai { background: #1a1a1a; color: #fff; }
.ci-body { flex: 1; min-width: 0; }
.ci-line {
  font-family: var(--serif); font-size: clamp(18px, 1.6vw, 23px); line-height: 1.5;
  color: var(--ink); word-break: break-word; cursor: pointer;
}
.ci-line .tail { color: var(--seal); font-weight: 700; }
.ci-meta { font-size: 13px; color: var(--ink2); margin-top: 3px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 模式 tabs */
.mode-tabs { display: flex; gap: 6px; background: #f3ece0; padding: 4px; border-radius: 11px; }
.mode-tab {
  flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 8px;
  font-size: 15px; font-weight: 600; color: var(--ink2); transition: .15s;
}
.mode-tab.active { background: #fff; color: var(--seal); box-shadow: var(--sh); }

/* 选项下拉 */
.opts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.custom-select { position: relative; user-select: none; }
.cs-header {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: 4px; padding: 9px 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; transition: .15s;
}
.cs-header:hover { border-color: var(--seal); }
.custom-select.open .cs-header { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(230, 180, 34, .18); }
.cs-lbl { font-size: 13px; color: var(--ink2); text-align: left; justify-self: start; }
.cs-val {
  font-size: 14px; font-weight: 600; color: var(--ink); text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-caret { font-size: 12px; line-height: 1; color: var(--ink2); transition: .15s; justify-self: end; }
.custom-select.open .cs-caret { transform: rotate(180deg); }
.cs-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--sh-lg);
  padding: 4px; display: none;
}
.custom-select.open .cs-list { display: block; }
.cs-opt { padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
.cs-opt:hover { background: #f3ece0; }
.cs-opt.active { color: var(--seal); font-weight: 600; background: #fbeeec; }

/* 计时 */
.timed-bar { display: flex; align-items: center; gap: 14px; background: var(--poem-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.tb-ring {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; background: conic-gradient(var(--seal) var(--p, 100%), #eadfca 0);
}
.tb-ring::after { content: ""; position: absolute; width: 46px; height: 46px; background: var(--card); border-radius: 50%; }
.tb-ring { position: relative; }
.tb-num { position: relative; z-index: 1; font-size: 20px; font-weight: 700; color: var(--seal); }
.tb-info { display: flex; flex-direction: column; }
.tb-lbl { font-size: 13px; color: var(--ink2); }
.tb-sub { font-size: 15px; color: var(--ink); }

/* 提示输入区 */
.play-area { display: flex; flex-direction: column; gap: 10px; }
.prompt { margin: 0; padding: 4px 0; font-size: 16px; color: var(--ink); min-height: 24px; line-height: 1.6; }
.prompt b { color: var(--seal); }
.input-row { display: flex; gap: 8px; }
.answer-input {
  flex: 1; min-width: 0; padding: 13px 14px; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px; outline: none; transition: .15s;
  font-family: var(--serif);
}
.answer-input::placeholder { font-family: var(--sans); color: #c4b49a; font-size: 15px; }
.answer-input:focus { border-color: var(--focus); box-shadow: 0 0 0 4px rgba(230, 180, 34, .2); }
.input-row .btn { padding-left: 20px; padding-right: 20px; white-space: nowrap; }
.play-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.play-tools .btn-line { flex: 1; min-width: 84px; text-align: center; }
.play-tip { margin: 0; font-size: 14px; min-height: 20px; }
.play-tip.ok { color: var(--green); }
.play-tip.err { color: var(--seal); }
.play-tip.info { color: var(--blue); }

/* 候选 */
.paths { border-top: 1px dashed var(--line); padding-top: 12px; }
.paths-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.paths-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.paths-sub { font-size: 12px; color: var(--ink2); }
.paths-grid { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.path-card {
  text-align: left; border: 1px solid var(--line); background: var(--poem-bg); border-radius: 8px;
  padding: 8px 12px; font-family: var(--serif); font-size: 16px; color: var(--ink); transition: .15s;
}
.path-card:hover { border-color: var(--seal); background: #fff; }
.path-card small { font-family: var(--sans); color: var(--ink2); font-size: 12px; margin-left: 6px; }

/* 状态栏 */
.statusbar {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  background: var(--poem-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.st { display: flex; align-items: baseline; gap: 4px; }
.st-lbl { font-size: 12px; color: var(--ink2); }
.st-val { font-size: 18px; font-weight: 700; color: var(--ink); }
.st-combo { font-size: 18px; font-weight: 700; color: var(--seal); }
.sb-actions { margin-left: auto; display: flex; gap: 6px; }

/* 广告位 */
.ad { display: flex; min-height: 60px; max-height: 60px; flex: 0 0 60px; margin: 16px 0 0; color: #999; font-size: 14px; border-radius: 8px; border: 1px dashed var(--line); background: rgba(255, 255, 255, 0.5); align-items: center; justify-content: center; overflow: hidden; backdrop-filter: blur(2px); }

/* ---------- 第二屏 ---------- */
.home2 { max-width: none; margin: 40px 0 0; }
.sec { margin: 0 auto; }
.sec-head { text-align: center; margin-bottom: 22px; }
.sec-title { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 24px; color: var(--ink); margin: 0; }
.ink-line { width: 46px; height: 2px; background: linear-gradient(90deg, transparent, var(--border)); }
.sec-title .ink-line:last-child { background: linear-gradient(90deg, var(--border), transparent); }
.sec-sub { margin: 6px 0 0; color: var(--ink2); font-size: 16px; }
.ink-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); margin: 38px 0; }

.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; text-align: center; box-shadow: var(--sh); transition: .18s; }
.mode-card:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.mc-icon { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px; display: grid; place-items: center; font-family: var(--serif); font-size: 28px; color: #fff; }
.mc-icon.red { background: var(--seal); }
.mc-icon.gold { background: #d4a017; }
.mc-icon.green { background: #4b8b6f; }
.mc-title { font-size: 19px; margin: 0 0 6px; color: var(--ink); }
.mc-desc { font-size: 16px; color: var(--ink2); margin: 0 0 16px; min-height: 42px; }
.mc-btn { width: 100%; padding: 10px; border-radius: 9px; font-size: 15px; font-weight: 600; transition: .15s; }
.mc-btn.primary { border: none; background: var(--seal); color: #fff; }
.mc-btn.primary:hover { background: #a5301f; }
.mc-btn.outline { border: 1px solid var(--border); background: #fff; color: var(--btn); }
.mc-btn.outline:hover { background: #f3ece0; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--sh); }
.feature-title { margin: 0 0 10px; font-size: 18px; line-height: 1.45; color: var(--ink); }
.feature-desc { margin: 0; font-size: 16px; line-height: 1.85; color: var(--ink2); }

.daily-word-card { display: flex; align-items: stretch; gap: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--sh); }
.dw-left { flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; }
.dw-badge { display: inline-block; align-self: flex-start; font-size: 12px; color: var(--seal); border: 1px solid var(--seal); border-radius: 20px; padding: 2px 10px; margin-bottom: 10px; }
.dw-word { font-size: clamp(20px, 2.4vw, 30px); color: var(--ink); line-height: 1.45; }
.dw-divider { width: 1px; background: var(--line); }
.dw-right { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.dw-row { display: flex; gap: 10px; font-size: 16px; }
.dw-row .dw-lbl { flex: 0 0 auto; color: #fff; background: var(--btn); border-radius: 6px; padding: 1px 9px; height: fit-content; font-size: 13px; }
.dw-row p { margin: 0; color: var(--ink2); }
.dw-row b { color: var(--seal); }

.steps { display: flex; align-items: stretch; justify-content: center; gap: 8px; flex-wrap: wrap; }
.step-card { flex: 1; min-width: 150px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-align: center; box-shadow: var(--sh); }
.step-n { width: 34px; height: 34px; border-radius: 50%; background: var(--seal); color: #fff; font-weight: 700; display: grid; place-items: center; margin: 0 auto 8px; }
.step-t { font-size: 16px; margin: 0 0 4px; color: var(--ink); }
.step-d { font-size: 16px; line-height: 1.8; color: var(--ink2); margin: 0; }
.step-arrow { align-self: center; color: var(--border); font-size: 20px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.guide-card { background: linear-gradient(180deg, #fff, #fcf8f1); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--sh); }
.guide-title { margin: 0 0 8px; font-size: 17px; color: var(--ink); }
.guide-desc { margin: 0; font-size: 16px; line-height: 1.85; color: var(--ink2); }
.sample-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sample-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--sh); }
.sample-tag { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 999px; background: #fbeeec; color: var(--seal); font-size: 12px; font-weight: 600; margin-bottom: 12px; }
.sample-title { margin: 0 0 8px; font-size: 18px; line-height: 1.45; color: var(--ink); }
.sample-desc { margin: 0; font-size: 16px; line-height: 1.85; color: var(--ink2); }
.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 18px; }
.scene-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--sh); }
.scene-title { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.scene-desc { margin: 0; font-size: 16px; line-height: 1.85; color: var(--ink2); }

.intro-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 26px; box-shadow: var(--sh); }
.intro-card p { margin: 0; font-size: 16px; line-height: 1.9; color: var(--ink2); }
.intro-card strong { color: var(--ink); }
.qa-list { display: grid; gap: 14px; }
.qa-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; box-shadow: var(--sh); }
.qa-q { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.qa-a { margin: 0; font-size: 16px; line-height: 1.85; color: var(--ink2); }

.dict-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(135deg, #fff, var(--poem-bg)); border: 1px solid var(--line); border-radius: 16px; padding: 24px 28px; box-shadow: var(--sh); transition: .18s; flex-wrap: wrap; }
.dict-banner:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.db-title { font-size: 26px; margin: 0 0 4px; color: var(--ink); }
.db-desc { margin: 0; color: var(--ink2); font-size: 16px; }
.db-actions { display: flex; align-items: center; gap: 16px; }
.db-search { color: var(--ink2); font-size: 14px; }
.db-enter { color: var(--seal); font-weight: 600; }

/* ---------- 子页面 ---------- */
.subpage { display: none; }
.subpage.active { display: block; }
#page-history.active, #page-growth.active { display: block; }
.sub-wrap { max-width: 960px; margin: 0 auto; }
.sub-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 14px; font-size: 14px; color: var(--ink2); }
.back-btn:hover { border-color: var(--btn); color: var(--btn); }
.sub-title { font-size: 22px; margin: 0; color: var(--ink); }
.sub-sub { margin: 2px 0 0; font-size: 13px; color: var(--ink2); }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; box-shadow: var(--sh); }
.stat-card .sc-num { font-size: 26px; font-weight: 700; color: var(--seal); }
.stat-card .sc-lbl { font-size: 13px; color: var(--ink2); margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--sh); margin-bottom: 16px; }
.panel-h { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.panel-tick { width: 4px; height: 16px; background: var(--seal); border-radius: 2px; }
.rec-table { display: flex; flex-direction: column; gap: 8px; }
.rec-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--poem-bg); border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.rec-badge { padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; }
.rec-badge.win { background: var(--green); }
.rec-badge.lose { background: var(--ink2); }
.rec-mode { color: var(--ink2); }
.rec-len { color: var(--ink); font-weight: 600; }
.rec-empty, .rec-row.muted { color: var(--ink2); text-align: center; justify-items: center; display: block; }
.rank-banner { background: linear-gradient(135deg, var(--seal), #8e2a1d); color: #fff; border-radius: 16px; padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--sh); }
.rb-rank { font-size: 26px; font-family: var(--serif); font-weight: 700; }
.rb-sub { font-size: 14px; opacity: .85; margin-top: 4px; }
.rb-track { height: 8px; background: rgba(255, 255, 255, .25); border-radius: 5px; margin-top: 12px; overflow: hidden; }
.rb-fill { height: 100%; background: var(--focus); border-radius: 5px; transition: width .5s; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--poem-bg); text-align: center; }
.badge.locked { opacity: .4; filter: grayscale(1); }
.badge .bg-ic { font-size: 26px; }
.badge .bg-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.badge .bg-desc { font-size: 11px; color: var(--ink2); }
.theme-bars { display: flex; flex-direction: column; gap: 10px; }
.theme-bar { display: grid; grid-template-columns: 50px 1fr 40px; align-items: center; gap: 10px; }
.theme-bar .tb-name { font-family: var(--serif); font-size: 16px; color: var(--ink); }
.theme-bar .tb-track { height: 10px; background: #f0e7d6; border-radius: 5px; overflow: hidden; }
.theme-bar .tb-fg { height: 100%; background: var(--seal); border-radius: 5px; }
.theme-bar .tb-c { font-size: 13px; color: var(--ink2); text-align: right; }

/* ---------- 页脚 ---------- */
.site-footer { background: #2e211c; color: #d8c9bd; margin-top: 50px; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 36px 20px calc(24px + var(--tab-h)); }
.footer-top { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.footer-brand { display: flex; gap: 12px; max-width: 360px; }
.footer-name { font-size: 18px; font-weight: 600; color: #fff; }
.footer-desc { font-size: 13px; line-height: 1.7; margin: 6px 0 0; opacity: .8; }
.footer-cols { display: flex; gap: 44px; flex-wrap: wrap; }
.fc-title { font-size: 14px; color: #fff; margin-bottom: 10px; font-weight: 600; }
.fc-link { display: block; font-size: 13px; color: #c3b2a4; margin-bottom: 7px; transition: .15s; }
.fc-link:hover { color: var(--focus); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 26px; padding-top: 18px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; opacity: .7; }

/* 返回顶部 */
#btn-back-top { position: fixed; right: 18px; bottom: calc(20px + var(--tab-h) + env(safe-area-inset-bottom)); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; box-shadow: var(--sh-lg); display: none; z-index: 40; }
#btn-back-top::before { content: "↑"; font-size: 20px; color: var(--btn); }
#btn-back-top.show { display: block; }

/* ---------- 移动端 TabBar ---------- */
.tabbar { display: none; }

/* ---------- 弹窗通用 ---------- */
.card-mask, .result-mask, .confirm-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(46, 33, 28, .5);
  display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px);
}
.card-mask.show, .result-mask.show, .confirm-mask.show { display: flex; }

.poem-modal, .result-card, .confirm-card {
  background: var(--card); border-radius: 18px; box-shadow: var(--sh-lg); width: 100%; max-width: 420px;
  padding: 22px; animation: pop .25s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.pm-head { display: flex; justify-content: space-between; gap: 12px; }
.pc-text { font-size: 24px; margin: 0; color: var(--ink); line-height: 1.5; }
.pc-meta { font-size: 14px; color: var(--ink2); margin: 4px 0 0; }
.pm-close { border: none; background: #f3ece0; width: 34px; height: 34px; border-radius: 8px; font-size: 16px; color: var(--ink2); flex: 0 0 auto; }
.pm-close:hover { background: #e9ddc9; }
.pm-divider { height: 1px; background: var(--line); margin: 14px 0; }
.pm-section { margin-bottom: 12px; }
.pm-h { font-size: 12px; color: var(--ink2); }
.pc-src { margin: 4px 0 0; font-size: 15px; color: var(--ink); }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.pc-tags .tag { font-size: 12px; color: var(--btn); background: var(--poem-bg); border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; }
.pm-actions { display: flex; gap: 10px; }
.im-join { flex: 1; border: none; background: var(--seal); color: #fff; border-radius: 10px; padding: 11px; font-size: 15px; font-weight: 600; }
.im-join:hover { background: #a5301f; }
.im-detail { flex: 0 0 auto; border: 1px solid var(--border); background: #fff; color: var(--btn); border-radius: 10px; padding: 11px 16px; font-size: 15px; text-decoration: none; text-align: center; white-space: nowrap; }
.im-detail:hover { background: var(--poem-bg); border-color: var(--btn); }

/* 结算 */
.result-card { text-align: center; max-width: 380px; }
.res-seal { width: 70px; height: 70px; margin: 0 auto 12px; border-radius: 14px; background: var(--seal); color: #fff; font-family: var(--serif); font-size: 38px; display: grid; place-items: center; transform: rotate(-5deg); box-shadow: var(--sh-lg); }
.res-seal.lose { background: var(--ink2); }
.res-title { font-size: 22px; margin: 0 0 4px; color: var(--ink); }
.res-sub { font-size: 14px; color: var(--ink2); margin: 0 0 16px; }
.res-stats { display: flex; justify-content: center; gap: 22px; margin-bottom: 14px; }
.res-stats .rs { display: flex; flex-direction: column; }
.res-stats .rs-n { font-size: 24px; font-weight: 700; color: var(--seal); }
.res-stats .rs-l { font-size: 12px; color: var(--ink2); }
.res-best { background: var(--poem-bg); border: 1px solid var(--focus); color: #b8860b; border-radius: 10px; padding: 8px; font-size: 14px; margin-bottom: 14px; }
.res-actions { display: flex; flex-direction: column; gap: 8px; }
.res-btn-line { border: 1px solid var(--line); background: #fff; color: var(--ink2); border-radius: 10px; padding: 10px; font-size: 14px; }
.res-btn-line:hover { border-color: var(--btn); color: var(--btn); }

/* 确认 */
.confirm-card { text-align: center; max-width: 340px; }
.confirm-title { font-size: 19px; margin: 0 0 6px; color: var(--ink); }
.confirm-sub { font-size: 14px; color: var(--ink2); margin: 0 0 18px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn-line, .confirm-actions .btn { flex: 1; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(28px + var(--tab-h)); transform: translateX(-50%) translateY(20px); background: rgba(46, 33, 28, .92); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 120; opacity: 0; pointer-events: none; transition: .25s; max-width: 80vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 404 / privacy 复用 */
.notfound { text-align: center; padding: 80px 20px; }
.nf-code { font-size: 72px; font-weight: 800; color: var(--seal); font-family: var(--serif); }
.nf-msg { font-size: 17px; color: var(--ink2); margin: 8px 0 24px; }
.privacy-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; box-shadow: var(--sh); }
.privacy-card h3 { color: var(--ink); font-size: 17px; margin: 22px 0 8px; }
.privacy-card p, .privacy-card li { color: var(--ink2); font-size: 15px; line-height: 1.8; }
.privacy-card em { color: var(--seal); font-style: normal; font-weight: 600; }
.muted { color: var(--ink2); font-size: 13px; }
.sub-foot { text-align: center; color: var(--ink2); font-size: 13px; margin: 22px 0; }

/* ============================================================
   响应式
   ============================================================ */
@media (min-width: 721px) {
  .chain-col { min-height: 46vh; max-height: none; padding: 18px; }
  .play-col { order: -1; padding: 18px; gap: 14px; }
}

@media (min-width: 1025px) {
  #page-game.active {
    display: flex; flex-direction: column;
    height: calc(100vh - var(--nav-h) - 58px);
    overflow: hidden;
  }
  .game-screen {
    display: flex; flex-direction: row;
    flex: 1 1 auto; min-height: 0;
    gap: 18px; align-items: stretch;
  }
  .chain-col { order: unset; flex: 1.18; min-height: 0; max-height: none; padding: 18px; }
  .play-col { order: unset; position: static; flex: 0.82; min-height: 0; gap: 14px; padding: 18px; overflow-y: auto; }
}

@media (max-width: 720px) {
  :root { --nav-h: 48px; }
  .topnav-links { display: none; }
  .topnav { padding-left: 12px; padding-right: 12px; }
  .brand { gap: 8px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 7px; }
  .brand-name { font-size: 16px; letter-spacing: .5px; }
  .app { padding: 8px 8px 20px; }
  #page-game.active {
    display: flex; flex-direction: column;
    min-height: calc(100svh - var(--nav-h) - var(--tab-h) - 16px);
  }
  .mode-cards, .feature-grid, .guide-grid, .sample-grid, .scene-grid { grid-template-columns: 1fr; }
  .daily-word-card { flex-direction: column; gap: 14px; }
  .dw-divider { width: auto; height: 1px; }
  .steps { flex-direction: column; }
  .step-arrow { transform: rotate(90deg); }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .footer-top { flex-direction: column; gap: 22px; }
  .footer-cols { gap: 28px; }

  /* 移动端 TabBar 显示 */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }
  .tab-btn { flex: 1; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink2); font-size: 11px; }
  .tab-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab-btn.active { color: var(--seal); }

  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .game-screen { flex: 1 1 auto; min-height: 0; gap: 8px; }
  .play-col { order: 0; flex: 0 0 auto; padding: 10px; gap: 8px; border-radius: 14px; }
  .chain-col { order: 1; flex: 1 1 0; min-height: 0; max-height: none; padding: 10px; border-radius: 14px; }
  .mode-tabs { gap: 3px; padding: 3px; border-radius: 10px; }
  .mode-tab { padding: 7px 0; font-size: 13px; border-radius: 7px; }
  .play-area { gap: 7px; }
  .prompt { padding: 6px 0; font-size: 14px; min-height: 0; line-height: 1.65; text-align: center; }
  .input-row { gap: 5px; }
  .answer-input { padding: 10px 11px; font-size: 15px; border-radius: 9px; }
  .answer-input::placeholder { font-size: 14px; }
  .input-row .btn { padding-left: 12px; padding-right: 12px; font-size: 15px; }
  .play-tools { gap: 5px; }
  .play-tools .btn-line { padding: 7px 8px; font-size: 13px; min-width: 0; }
  .btn-start { padding: 12px; font-size: 16px; letter-spacing: 1px; }
  .req-banner { display: flex; align-items: center; gap: 6px; padding: 10px 12px; margin-bottom: 8px; }
  .req-mode { margin-bottom: 0; flex: 0 0 auto; }
  .req-text { flex: 1; min-width: 0; font-size: 15px; }
  .chain-wrap {
    flex: 1 1 auto; min-height: 0; max-height: none; padding-right: 2px;
    overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory;
  }
  .chain-empty { min-height: 0; justify-content: center; gap: 6px; padding: 8px 6px; }
  .chain-empty .ce-seal { width: 52px; height: 52px; font-size: 28px; margin-bottom: 2px; }
  .chain-empty p { font-size: 15px; }
  .chain-empty span { font-size: 12px; }
  .chain { gap: 6px; }
  .chain-item { min-height: 72px; padding: 9px 10px; scroll-snap-align: start; border-radius: 10px; }
  .ci-who { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
  .ci-line { font-size: 16px; line-height: 1.42; }
  .ci-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .opts {
    display: grid; grid-template-columns: 1.15fr .9fr .95fr; gap: 4px;
  }
  .opts .custom-select { min-width: 0; }
  .cs-header {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
    gap: 3px; padding: 7px 8px 7px 6px; white-space: nowrap; border-radius: 8px;
  }
  .cs-lbl { font-size: 12px; text-align: left; justify-self: start; }
  .cs-val { font-size: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cs-caret { position: static; font-size: 12px; line-height: 1; justify-self: end; transform: none; }
  .custom-select.open .cs-caret { transform: rotate(180deg); }
  .statusbar {
    display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
    padding: 12px;
  }
  .st { flex-direction: row; align-items: baseline; gap: 4px; min-width: 0; }
  .st-lbl { font-size: 11px; }
  .st-val, .st-combo { font-size: 15px; line-height: 1.2; }
  .statusbar .st:nth-child(5) { margin-right: auto; }
  .sb-actions { width: 100%; margin-left: 0; display: flex; gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 2px; }
  .sb-actions .btn-line { flex: 1; padding: 7px 0; font-size: 13px; justify-content: center; }
  .home2 { margin-top: 26px; }
  .sec-title { font-size: 20px; }
  .feature-card, .guide-card, .sample-card, .scene-card, .qa-item, .intro-card { padding: 18px; }
  .feature-title, .sample-title, .scene-title, .qa-q { font-size: 17px; }
  .res-stats { gap: 16px; }
}

@media (max-width: 380px) {
  .opts { gap: 3px; }
  .topnav { padding-left: 10px; padding-right: 10px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand-name { font-size: 15px; }
  .cs-header { padding: 6px 5px; }
  .cs-lbl { font-size: 11px; }
  .cs-val { font-size: 12px; }
  .statusbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statusbar .st:nth-child(5), .sb-actions { grid-column: auto; }
  .play-tools .btn-line { min-width: 0; }
}
