/* ========== 变量 ========== */
:root {
  --bg-page: #f5f0e1;
  --bg-card: #ffffff;
  --bg-grid: #faf8f5;
  --red: #c0392b;
  --indigo: #2c3e50;
  --yellow: #e6b422;
  --green: #27ae60;
  --wood: #8b5e3c;
  --text: #3e2723;
  --text-sub: #8d6e63;
  --border: #d4c5a9;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 48px;
  --tabbar-h: 56px;
  --text-min: 16px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: #fff;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: var(--text-min);
  background: #fff;
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--wood); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; cursor: pointer; border: none; background: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== 布局容器 ========== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
}

.main-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-page);
}

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 16px;
}

/* ========== 顶部标题栏 ========== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: var(--safe-top) 16px 0;
  min-height: calc(var(--header-h) + var(--safe-top));
  background: #fff;
  border-bottom: 1px solid rgba(212, 197, 169, 0.4);
  flex-shrink: 0;
  z-index: 10;
}

.app-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.icon-btn.is-muted {
  color: var(--text-sub);
  opacity: 0.72;
}

.icon-btn .sound-off,
.pc-nav-sound .sound-off {
  display: none;
}

.icon-btn.is-muted .sound-on,
.pc-nav-sound.is-muted .sound-on {
  display: none;
}

.icon-btn.is-muted .sound-off,
.pc-nav-sound.is-muted .sound-off {
  display: block;
}

.brand-mark {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 8px;
}

.brand-mark:active { opacity: 0.85; }

.ico, .tab-ico, .ico-sm, .ico-xs, .ico-inline {
  display: block;
  flex-shrink: 0;
}

.ico { width: 22px; height: 22px; }
.tab-ico { width: 22px; height: 22px; }
.ico-sm { width: 16px; height: 16px; }
.ico-xs { width: 14px; height: 14px; }
.ico-inline { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wood);
  border-radius: 10px;
  flex-shrink: 0;
}

.icon-btn:active { background: rgba(0, 0, 0, 0.05); }

.pc-nav { display: none; }

/* ========== 游戏区 ========== */
.game-screen {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
  padding-top: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.page-lead {
  text-align: center;
  padding: 0 4px 4px;
  flex-shrink: 0;
}

.page-lead h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.page-lead-sub {
  font-size: 16px;
  color: var(--text-sub);
  margin-top: 4px;
}

.page-guide {
  border: 1px solid rgba(212, 197, 169, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  flex-shrink: 0;
}

.page-guide summary {
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--wood);
  cursor: pointer;
  list-style: none;
}

.page-guide summary::-webkit-details-marker { display: none; }

.page-guide-body {
  padding: 0 14px 14px;
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.75;
}

.text-link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--wood);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.example-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 0;
}

.example-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(212, 197, 169, 0.45);
  border-radius: 12px;
}

.example-parts b {
  font-size: 18px;
  color: var(--text);
}

.example-arrow {
  font-size: 18px;
  color: var(--text-sub);
}

.example-answer {
  font-size: 22px;
  font-weight: 700;
  color: var(--red);
}

.example-note {
  grid-column: 1 / -1;
  font-size: 16px;
  color: var(--text-sub);
}

.game-screen::-webkit-scrollbar {
  display: none;
}

body[data-tab="records"] .game-screen,
body[data-tab="tutorial"] .game-screen,
body[data-tab="about"] .game-screen {
  flex: 0 0 0;
  overflow: hidden;
  padding: 0;
  min-height: 0;
}

.puzzle-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.puzzle-card.is-correct {
  border: 2px solid var(--green);
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.16), var(--shadow);
}

.puzzle-card.is-correct .input-row,
.puzzle-card.is-correct .action-row {
  opacity: 0.45;
  pointer-events: none;
}

.puzzle-card.is-wrong {
  border: 2px solid var(--red);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.puzzle-display-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.puzzle-display {
  position: relative;
  background: var(--bg-grid);
  border: 1px solid rgba(212, 197, 169, 0.5);
  border-radius: 12px;
  padding: 28px 16px 20px;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.puzzle-display.is-correct-flash {
  animation: displayFlash 0.5s ease;
}

@keyframes displayFlash {
  0% { background: var(--bg-grid); }
  40% { background: rgba(39, 174, 96, 0.18); }
  100% { background: rgba(232, 245, 233, 0.85); }
}

.correct-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(165deg, rgba(241, 248, 244, 0.98) 0%, rgba(220, 237, 225, 0.97) 100%);
  animation: correctFadeIn 0.35s ease;
}

.correct-overlay[hidden] { display: none; }

.correct-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  animation: correctInnerIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes correctFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes correctInnerIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.correct-seal {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.35);
}

.correct-seal svg { width: 26px; height: 26px; }

.correct-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.04em;
}

.correct-char {
  font-size: 56px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-top: 2px;
}

.mizi-grid {
  position: absolute;
  width: 108px;
  height: 108px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  border: 1px solid rgba(212, 197, 169, 0.4);
  pointer-events: none;
  opacity: 0.75;
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), rgba(212, 197, 169, 0.28) calc(50% - 0.5px), rgba(212, 197, 169, 0.28) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to top left, transparent calc(50% - 0.5px), rgba(212, 197, 169, 0.28) calc(50% - 0.5px), rgba(212, 197, 169, 0.28) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

.mizi-grid::before,
.mizi-grid::after {
  content: "";
  position: absolute;
  background: rgba(212, 197, 169, 0.35);
}

.mizi-grid::before {
  top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%);
}

.mizi-grid::after {
  left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%);
}

.parts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.part-bubble {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.part-bubble.c0 { background: var(--red); }
.part-bubble.c1 { background: var(--indigo); }
.part-bubble.c2 { background: var(--yellow); color: var(--text); }
.part-bubble.c3 { background: var(--green); }

.riddle-text {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 1;
  padding: 8px 12px;
}

.puzzle-hint {
  font-size: 16px;
  color: var(--text-sub);
  position: relative;
  z-index: 1;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.answer-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  font-size: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.answer-input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(230, 180, 34, 0.25);
}

.answer-input.is-correct { border-color: var(--green); background: #e8f5e9; }

.btn-submit {
  flex-shrink: 0;
  width: 56px;
  height: 48px;
  background: var(--red);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  border-radius: 12px;
}

.btn-submit:active { opacity: 0.85; }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-submit.is-success {
  background: var(--green);
  font-size: 0;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.btn-submit.is-success::after {
  content: "✓";
  font-size: 22px;
}

.action-row {
  display: flex;
  gap: 10px;
}

.btn-action {
  flex: 1 1 0;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--wood);
  font-size: 16px;
}

.btn-action:active { background: rgba(139, 94, 60, 0.08); }

.btn-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint-panel {
  background: rgba(230, 180, 34, 0.12);
  border: 1px solid rgba(230, 180, 34, 0.45);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint-panel[hidden] { display: none; }

.hint-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--wood);
}

.hint-count {
  margin-left: auto;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-sub);
}

.hint-line {
  font-size: 16px;
  color: var(--text);
  line-height: 1.5;
  padding-left: 22px;
}

.hint-line[hidden] { display: none; }

.hint-line::before {
  content: "·";
  margin-right: 6px;
  color: var(--yellow);
  font-weight: 700;
}

.btn-speak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  margin-left: 22px;
  padding: 6px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--wood);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(230, 180, 34, 0.55);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-speak:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--yellow);
}

.btn-speak[hidden] { display: none; }

.correct-pronounce {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.correct-pronounce[hidden] { display: none; }

.correct-pinyin {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.02em;
}

.correct-pinyin[hidden] { display: none; }

.correct-overlay .btn-speak {
  margin-left: 0;
  margin-top: 0;
  color: var(--green);
  border-color: rgba(39, 174, 96, 0.45);
  background: rgba(255, 255, 255, 0.85);
}

.correct-overlay .btn-speak:hover {
  border-color: var(--green);
  background: #fff;
}

.combo-badge {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--red);
  background: rgba(230, 180, 34, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  animation: pop 0.5s ease;
}

@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(212, 197, 169, 0.45);
  border-radius: 20px;
  padding: 6px 10px;
}

.stat-chip b { color: var(--text); font-weight: 600; }

.stat-combo b { color: var(--red); }

.stage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 4px;
  flex-shrink: 0;
}

.stage-label {
  font-size: 16px;
  color: var(--text-sub);
  white-space: nowrap;
}

.stage-select {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  font-size: 16px;
  border: 1px solid rgba(212, 197, 169, 0.55);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  outline: none;
}

.stage-select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(230, 180, 34, 0.2);
}

.stat-chip.is-score-bump {
  background: rgba(39, 174, 96, 0.14);
  border-color: rgba(39, 174, 96, 0.35);
  animation: scoreBump 0.55s ease;
}

@keyframes scoreBump {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.06); }
}

/* ========== Tab 内容区 ========== */
.article-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 0;
  display: none;
}

body[data-tab="records"] .article-records,
body[data-tab="tutorial"] .article-tutorial,
body[data-tab="about"] .article-about {
  display: block;
}

.article-content h2 {
  font-size: 18px;
  color: var(--text);
  margin: 16px 0 8px;
}

.article-content h2:first-child { margin-top: 0; }

.panel-sub { font-size: 16px; color: var(--text-sub); margin-bottom: 12px; }

.tutorial-steps, .tutorial-tips {
  padding-left: 1.25em;
  font-size: 16px;
  color: var(--text-sub);
}

.tutorial-steps li, .tutorial-tips li { margin-bottom: 8px; }

.record-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-list li {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.record-empty { color: var(--text-sub); text-align: center; }

.record-best { margin-top: 16px; font-size: 16px; color: var(--text-sub); }

.faq-list dt { font-weight: 600; margin-top: 12px; font-size: 16px; }
.faq-list dd { color: var(--text-sub); font-size: 16px; margin-left: 0; }

.about-site {
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.8;
}

.about-site a { color: var(--wood); }

.about-site-links {
  margin-top: 12px;
  font-size: 16px;
}

.about-site-links a { color: var(--wood); }

/* ========== 广告位 ========== */
.ad-slot {
  display: none;
  min-height: 60px;
  max-height: 60px;
  margin: 10px 0;
  color: #999;
  font-size: 16px;
  border-radius: 8px;
  border: 1px dashed #ccc;
  background: #fafafa;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.ad-slot:not(:empty) {
  display: flex;
  flex: 0 0 60px;
}

/* ========== 底部 TabBar ========== */
.tab-bar {
  display: flex;
  order: 999;
  flex-shrink: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #fff;
  border-top: 1px solid rgba(212, 197, 169, 0.45);
  box-shadow: 0 -2px 12px rgba(62, 39, 35, 0.04);
  z-index: 20;
}

.tab-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 16px;
  color: var(--text-sub);
  padding: 4px 0 2px;
  transition: color 0.15s;
  text-decoration: none;
}

.tab-btn.active {
  color: var(--red);
}

.tab-btn.active .tab-ico {
  transform: translateY(-1px);
}

/* ========== 页脚 ========== */
.site-footer {
  display: none;
  background: var(--text);
  color: #fff;
  text-align: center;
  padding: 16px 24px;
  font-size: 16px;
  line-height: 1.7;
}

.site-footer a { color: #d4c5a9; }

/* ========== PC 侧栏 ========== */
.pc-sidebar { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(62, 39, 35, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 90;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: rgba(39, 174, 96, 0.95);
}

.toast.error {
  background: rgba(192, 57, 43, 0.92);
}

/* ========== PC 适配 ========== */
@media (min-width: 768px) {
  body {
    overflow-y: auto;
    min-height: 100dvh;
    background:
      radial-gradient(ellipse 600px 600px at 85% 15%, rgba(212, 197, 169, 0.15), transparent),
      radial-gradient(ellipse 400px 400px at 10% 80%, rgba(141, 110, 99, 0.08), transparent),
      var(--bg-page);
  }

  .app-container {
    max-width: 480px;
    height: 100dvh;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  }

  .app-header { display: none; }

  .pc-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(212, 197, 169, 0.4);
    flex-shrink: 0;
  }

  .pc-nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-right: auto;
    text-decoration: none;
  }

  .pc-nav-brand:hover { text-decoration: none; opacity: 0.9; }

  .pc-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
    color: var(--text-sub);
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.15s, color 0.15s;
  }

  .pc-nav-link .ico { width: 18px; height: 18px; }

  .pc-nav-share { margin-left: 4px; padding: 8px 10px; }

  .pc-nav-sound {
    padding: 8px 10px;
  }

  .pc-nav-sound.is-muted { color: var(--text-sub); opacity: 0.72; }

  .pc-nav-link.active { color: var(--red); font-weight: 600; }
  .pc-nav-link:hover { background: rgba(139, 94, 60, 0.06); }

  .tab-bar { display: none; }

  .site-footer { display: block; flex-shrink: 0; }

  .page-lead h1 { font-size: 22px; }

  .toast { bottom: 32px; }
}

@media (min-width: 1024px) {
  .app-container {
    max-width: none;
    width: 100%;
    height: auto;
    min-height: 100dvh;
    box-shadow: none;
    flex-direction: column;
  }

  .main-wrap {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 24px 0;
    gap: 40px;
  }

  .main-content {
    max-width: 480px;
    flex: 0 0 480px;
    padding: 0;
  }

  .puzzle-display {
    min-height: 248px;
    padding: 36px 20px 28px;
  }

  .correct-overlay {
    padding: 24px 20px;
  }

  .correct-inner {
    gap: 12px;
  }

  .pc-sidebar {
    display: block;
    flex: 1 1 auto;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(212, 197, 169, 0.4);
    align-self: flex-start;
    max-height: 400px;
    overflow-y: auto;
  }

  .pc-sidebar h3 { font-size: 18px; margin-bottom: 12px; color: var(--text); }

  .sidebar-records {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .sidebar-records li {
    font-size: 16px;
    color: var(--text-sub);
    padding: 8px 0;
    border-bottom: 1px solid rgba(212, 197, 169, 0.3);
  }

  .sidebar-records li:last-child { border-bottom: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.legal-body {
  background: var(--bg-page);
}

.legal-body .app-container {
  background: var(--bg-page);
}

.legal-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 16px;
}

.legal-main::-webkit-scrollbar { display: none; }

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: #fff;
  border-bottom: 1px solid rgba(212, 197, 169, 0.45);
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.legal-brand:hover { opacity: 0.9; text-decoration: none; }

.legal-back {
  font-size: 16px;
  color: var(--wood);
  text-decoration: none;
  white-space: nowrap;
}

.legal-back:hover { text-decoration: underline; }

.legal-main h1 {
  font-size: 26px;
  color: var(--text);
  margin-bottom: 8px;
}

.legal-updated {
  font-size: 16px;
  color: var(--text-sub);
  margin-bottom: 20px;
}

.legal-lead {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-sub);
  margin-bottom: 24px;
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section h2 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 12px;
}

.legal-section p,
.legal-section li {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-sub);
  margin-bottom: 10px;
}

.legal-section ul {
  padding-left: 1.25em;
  margin-bottom: 10px;
}

.legal-section code {
  font-size: 16px;
  background: rgba(212, 197, 169, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
}

.legal-section a { color: var(--wood); }

.legal-icp {
  margin-top: 16px;
  font-size: 16px;
  color: var(--text-sub);
}

.legal-footer {
  padding: 20px 0;
  border-top: 1px solid rgba(212, 197, 169, 0.45);
  text-align: center;
  font-size: 16px;
  color: var(--text-sub);
}

.legal-footer a { color: var(--wood); }
