:root {
  color-scheme: light;
  --bg: #f4efe4;
  --surface: #fffdf8;
  --ink: #2c2a25;
  --muted: #8b8478;
  --line: #d9d2c3;
  --hit: #477a52;
  --present: #8a6414;
  --absent: #6f695e;
  --accent: #8c3b2e;
  --shadow: 0 18px 50px rgba(60, 48, 30, 0.12);
  --raised-highlight: rgba(255, 255, 255, 0.55);
  --raised-shade: rgba(60, 48, 30, 0.14);
  --cell: clamp(56px, 17vw, 72px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #1d1b17;
    --surface: #26231d;
    --ink: #ece6d9;
    --muted: #9d9587;
    --line: #3b362d;
    --hit: #4f8a5c;
    --present: #8a6414;
    --absent: #514b41;
    --accent: #d98873;
    --shadow: none;
    --raised-highlight: rgba(255, 255, 255, 0.14);
    --raised-shade: rgba(0, 0, 0, 0.45);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1b17;
  --surface: #26231d;
  --ink: #ece6d9;
  --muted: #9d9587;
  --line: #3b362d;
  --hit: #4f8a5c;
  --present: #8a6414;
  --absent: #514b41;
  --accent: #d98873;
  --shadow: none;
  --raised-highlight: rgba(255, 255, 255, 0.14);
  --raised-shade: rgba(0, 0, 0, 0.45);
}

html[data-theme="eyecare"] {
  color-scheme: light;
  --bg: #e9e2cf;
  --surface: #f8f1de;
  --ink: #332f25;
  --muted: #6f6757;
  --line: #cfc4a9;
  --hit: #4f6f45;
  --present: #8a6414;
  --absent: #6f695e;
  --accent: #7a4a2d;
  --shadow: 0 18px 50px rgba(80, 65, 40, 0.12);
}

html.a11y-contrast {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #333333;
  --line: #767676;
  --hit: #0f5c2e;
  --present: #6b4a00;
  --absent: #4a4a4a;
  --accent: #8a1c0e;
  --shadow: none;
}

html.a11y-contrast[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0d0d0d;
  --ink: #ffffff;
  --muted: #d6d6d6;
  --line: #a0a0a0;
  --hit: #9ee6b3;
  --present: #ffd166;
  --absent: #c7c7c7;
  --accent: #ffb4a5;
  --shadow: none;
}

@media (prefers-color-scheme: dark) {
  html.a11y-contrast:not([data-theme]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #0d0d0d;
    --ink: #ffffff;
    --muted: #d6d6d6;
    --line: #a0a0a0;
    --hit: #9ee6b3;
    --present: #ffd166;
    --absent: #c7c7c7;
    --accent: #ffb4a5;
    --shadow: none;
  }
}

/* 色盲/色弱友好配色：蓝 / 橙 / 灰，避开红绿混淆 */
html.a11y-colorblind {
  --pattern: rgba(255, 255, 255, 0.4);
  --hit: #0072b2;
  --present: #b35c00;
  --absent: #5a5a5a;
}

html.a11y-colorblind.a11y-contrast {
  --hit: #00537f;
  --present: #7a3e00;
  --absent: #3a3a3a;
}

html.a11y-colorblind.a11y-contrast[data-theme="dark"] {
  --pattern: rgba(0, 0, 0, 0.35);
  --hit: #8ec5ff;
  --present: #ffb86b;
  --absent: #d0d0d0;
}

@media (prefers-color-scheme: dark) {
  html.a11y-colorblind.a11y-contrast:not([data-theme]) {
    --pattern: rgba(0, 0, 0, 0.35);
    --hit: #8ec5ff;
    --present: #ffb86b;
    --absent: #d0d0d0;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  padding: 32px 16px 48px;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 5%, rgba(140, 59, 46, 0.07), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(71, 122, 82, 0.07), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

.app {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.top {
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 8px 0 6px;
  background: var(--bg);
}

.top-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  column-gap: 8px;
}

.top-title { grid-column: 2; min-width: 0; }

.top-tools {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  display: flex;
  gap: 4px;
  padding-top: 2px;
}

.top-tool {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface), var(--bg));
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 var(--raised-highlight),
    0 2px 3px var(--raised-shade);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s ease, color 0.15s ease;
}

.top-tool:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow:
    inset 0 1px 0 var(--raised-highlight),
    0 4px 7px var(--raised-shade);
}

.top-tool:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px var(--raised-shade),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.top-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top-row h1 { font-size: clamp(1.45rem, 4.8vw, 2rem); }
.top-row .date { margin: 4px 0 0; }

.mode-tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--bg), var(--surface));
  box-shadow:
    inset 0 2px 5px var(--raised-shade),
    0 1px 0 var(--raised-highlight);
}

.mode-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 6px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface), var(--bg));
  color: var(--muted);
  font-family: inherit;
  font-size: clamp(0.7rem, 2.6vw, 0.84rem);
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 var(--raised-highlight),
    inset 0 -2px 0 rgba(0, 0, 0, 0.06),
    0 2px 3px var(--raised-shade);
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.15s ease, background-color 0.15s ease;
}

.mode-tab:hover {
  transform: translateY(-1px);
  color: var(--accent);
  box-shadow:
    inset 0 1px 0 var(--raised-highlight),
    inset 0 -2px 0 rgba(0, 0, 0, 0.05),
    0 4px 7px var(--raised-shade);
}

.mode-tab:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px var(--raised-shade),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mode-tab.active {
  background-color: var(--accent);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0) 55%,
    rgba(0, 0, 0, 0.08)
  );
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 3px 6px var(--raised-shade);
}

.mode-tab.active:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.mode-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .top-tool,
  .mode-tab,
  .guess-btn,
  .share-btn {
    transition: none;
  }
  .top-tool:hover,
  .top-tool:active,
  .mode-tab:hover,
  .mode-tab:active,
  .mode-tab.active,
  .guess-btn:not(:disabled):hover,
  .guess-btn:not(:disabled):active,
  .share-btn:not(:disabled):hover,
  .share-btn:not(:disabled):active {
    transform: none;
  }
}

html.a11y-contrast .top-tool,
html.a11y-contrast .mode-tabs,
html.a11y-contrast .mode-tab,
html.a11y-contrast .guess-btn,
html.a11y-contrast .share-btn {
  box-shadow: none;
  background-image: none;
}

html.a11y-contrast .top-tool { background: var(--surface); }
html.a11y-contrast .mode-tabs { background: var(--surface); }
html.a11y-contrast .mode-tab:not(.active) { background: transparent; }

html.a11y-contrast .mode-tab.active {
  color: var(--bg);
  outline: 1px solid var(--ink);
  outline-offset: -2px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tab-panel[hidden] { display: none !important; }

.top-user {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 150px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.user-chip:hover { border-color: var(--accent); }
.user-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.user-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
}

.user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .user-chip { max-width: 104px; }
  .user-name { max-width: 62px; }
}

@media (max-width: 360px) {
  .user-chip { padding-right: 4px; }
  .user-name { display: none; }
}

@media (max-width: 389px) {
  .top-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "tools . chip"
      "title title title";
    row-gap: 2px;
  }
  .top-tools { grid-area: tools; }
  .top-title { grid-area: title; margin-top: 4px; }
  .top-user { grid-area: chip; }
}

h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(1.9rem, 6vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
}

.date {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
}

.hint { text-align: center; }
.hint[hidden] { display: none; }

.hint-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.2em;
}

.pinyin {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), var(--cell));
  gap: 10px;
  justify-content: center;
}

.pinyin span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--cell) * 0.46);
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: system-ui, "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: clamp(0.7rem, calc(var(--cell) * 0.24), 1rem);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.pinyin span:not(.masked) {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pinyin span.masked {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.board { display: flex; flex-direction: column; gap: 10px; }

.row { display: flex; gap: 10px; justify-content: center; }

.cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: calc(var(--cell) * 0.48);
  font-weight: 600;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.cell.filled { border-color: transparent; color: #fff; }
.cell.hit { background: var(--hit); }
.cell.present { background: var(--present); }
.cell.absent { background: var(--absent); }
.cell.flip { animation: flip-in 0.45s ease both; }

.cell-mark {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-family: system-ui, sans-serif;
  font-size: 0.62em;
  font-weight: 700;
  line-height: 1;
  opacity: 0.92;
}

@keyframes flip-in {
  from { transform: rotateX(90deg); opacity: 0.2; }
  to { transform: rotateX(0); opacity: 1; }
}

.guess-form {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.guess-form[hidden] { display: none; }

.guess-form .share-btn {
  padding: 0 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.guess-form .share-btn.exhausted { opacity: 0.5; }

.guess-input-wrap {
  position: relative;
  flex: 0 1 auto;
  width: calc(var(--cols, 4) * 2.3rem + 2.4rem);
  min-width: 0;
  max-width: 100%;
}

.guess-input-wrap .guess-input {
  width: 100%;
  min-width: 0;
  padding-right: 42px;
}

.voice-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.voice-btn svg { width: 18px; height: 18px; }
.voice-btn:hover { color: var(--accent); background: rgba(140, 59, 46, 0.08); }
.voice-btn[aria-pressed="true"] { color: var(--accent); background: rgba(140, 59, 46, 0.12); }
.voice-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.voice-btn:disabled { opacity: 0.4; cursor: default; }

.voice-hint {
  margin: -4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

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

.guess-input {
  /* 宽度随成语字数变化，避免短成语的输入框占满整行 */
  flex: 0 1 auto;
  width: calc(var(--cols, 4) * 2.3rem + 2.4rem);
  min-width: 0;
  max-width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.15rem;
  letter-spacing: 0.35em;
  text-align: center;
  outline: none;
}

.guess-input::placeholder {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}

.guess-input:focus { border-color: var(--accent); }
.guess-input:disabled { opacity: 0.55; }

.guess-btn {
  padding: 0 26px;
  border: none;
  border-radius: 16px;
  background-color: var(--accent);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0) 55%,
    rgba(0, 0, 0, 0.12)
  );
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 3px 6px var(--raised-shade);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
}

.guess-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -3px 0 rgba(0, 0, 0, 0.16),
    0 5px 9px var(--raised-shade);
}

.guess-btn:not(:disabled):active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.guess-btn:disabled { opacity: 0.5; cursor: default; }

.message {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend[hidden] { display: none; }

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  flex: none;
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.swatch.hit { background: var(--hit); }
.swatch.present { background: var(--present); }
.swatch.absent { background: var(--absent); }

/* 色盲/色弱友好：实心 / 斜纹 / 点阵三种图案，仍保留 ✓、○、× */
html.a11y-colorblind .cell.present {
  background-image: repeating-linear-gradient(45deg, var(--pattern) 0 4px, transparent 4px 9px);
}

html.a11y-colorblind .cell.absent {
  background-image: radial-gradient(circle, var(--pattern) 1.5px, transparent 1.6px);
  background-size: 10px 10px;
}

html.a11y-colorblind .cell.hit {
  background-image: none;
}

html.a11y-colorblind .swatch.present {
  background-image: repeating-linear-gradient(45deg, var(--pattern) 0 2px, transparent 2px 5px);
}

html.a11y-colorblind .swatch.absent {
  background-image: radial-gradient(circle, var(--pattern) 1px, transparent 1.1px);
  background-size: 5px 5px;
}

html.a11y-colorblind .cell-mark {
  font-size: 0.72em;
}

.answer {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 20px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}

.answer h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.answer-pinyin {
  margin: 8px 0 10px;
  color: var(--accent);
  font-size: 0.95rem;
}

.answer-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.share-btn {
  padding: 9px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface), var(--bg));
  color: var(--accent);
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 var(--raised-highlight),
    0 2px 3px var(--raised-shade);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.share-btn:not(:disabled):hover {
  transform: translateY(-1px);
  background: var(--accent);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.14),
    0 4px 8px var(--raised-shade);
}

.share-btn:not(:disabled):active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px var(--raised-shade),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.source {
  margin: -4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

@media (prefers-reduced-motion: reduce) {
  .cell.flip { animation: none; }
}

@media (max-width: 420px) {
  body { padding-top: 22px; }
  .guess-input { font-size: 1rem; }
  .guess-btn { padding: 0 18px; }
  .mode-tab { font-size: 0.74rem; padding: 7px 4px; }
  .feed-panel {
    height: calc(100vh - 150px);
    height: calc(100dvh - 150px);
    min-height: 380px;
  }
  .feed-slide { padding: 10px; }
  .feed-card { padding: 18px 16px; }
  .feed-word { font-size: clamp(1.9rem, 11vw, 2.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  .feed-scroller { scroll-behavior: auto; }
}

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.actions.inline { justify-content: center; }
.share-btn { white-space: nowrap; }

.hint-btn {
  align-self: center;
  margin-top: -6px;
  padding: 6px 16px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.hint-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.board.finished .row.empty {
  display: none;
}

.pinyin span.masked {
  color: var(--muted);
  opacity: 0.35;
  font-size: clamp(0.68rem, calc(var(--cell) * 0.2), 0.85rem);
}

.levels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: min(100%, calc(var(--cols, 4) * var(--cell) + (var(--cols, 4) - 1) * 10px));
  max-width: 100%;
  margin: 10px auto 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.levels-label {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.level-btn {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.level-btn:hover {
  border-color: transparent;
  color: var(--accent);
}

.level-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pinyin span.char-hint {
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(0.95rem, calc(var(--cell) * 0.32), 1.3rem);
  font-weight: 700;
}


.progress {
  margin: -6px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}


.progress { line-height: 1.7; }

.badges {
  margin: -8px 0 0;
  text-align: center;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.board.won { animation: board-glow 1.1s ease; }

@keyframes board-glow {
  0%, 100% { filter: none; }
  40% { filter: drop-shadow(0 0 18px rgba(71, 122, 82, 0.75)); }
}

.celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 80;
}

.confetti {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  opacity: 0.95;
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1);
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  0% { transform: translate3d(0, -20px, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(720deg); opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .board.won { animation: none; }
  .confetti { display: none; }
}


.wrong-hint {
  margin: -8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}


.correction {
  margin: -6px 0 0;
  padding: 10px 14px;
  border: 1px solid rgba(140, 59, 46, 0.35);
  border-radius: 12px;
  background: rgba(140, 59, 46, 0.07);
  text-align: center;
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1.8;
}

.correction-title {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.correction-demo {
  margin-top: 4px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
}

.correction .wrong-char {
  color: var(--accent);
  text-decoration: line-through;
  font-weight: 700;
}

.correction .right-char {
  color: var(--hit);
  font-weight: 700;
}

.correction .arrow {
  color: var(--muted);
}

.guess-input.shake {
  animation: input-shake 0.35s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .guess-input.shake { animation: none; }
}


.level-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}


.answer-source {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.source-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  cursor: pointer;
  text-align: left;
}

.source-toggle:hover { color: var(--accent); }

.source-hint {
  flex: none;
  color: var(--accent);
  font-size: 0.8rem;
}

.source-body {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.8;
}

.source-derivation { margin: 0 0 6px; }
.source-example { margin: 0; }


.story-panel { width: 100%; }

.story-panel .story-card { width: 100%; margin: 0; }

.story-card {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 20px 22px;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(28, 24, 18, 0.25);
}

.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.story-kicker {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.15rem;
  letter-spacing: 0.18em;
}

.story-streak {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.story-close {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.story-close:hover { border-color: var(--accent); color: var(--accent); }

.story-type {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
}

.story-source {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.02rem;
}

.story-quote {
  margin: 0 0 14px;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.95rem;
  line-height: 1.9;
}

.story-word h3 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.5rem;
  letter-spacing: 0.2em;
}

.story-word-pinyin { margin: 6px 0; color: var(--accent); font-size: 0.9rem; }

.story-word-explanation { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.7; }

.story-form { display: flex; gap: 10px; margin-top: 8px; }
.story-form .guess-btn { flex: 0 0 auto; white-space: nowrap; }

.story-options { display: grid; gap: 8px; margin-top: 8px; }

.story-option {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.story-option:hover { border-color: var(--accent); color: var(--accent); }
.story-option.correct { border-color: var(--hit); background: rgba(71, 122, 82, 0.12); color: var(--hit); }
.story-option.wrong { border-color: var(--accent); background: rgba(140, 59, 46, 0.08); color: var(--accent); text-decoration: line-through; }
.story-option.correct::after { content: " ✓"; font-weight: 700; }
.story-option.wrong::after { content: " ×"; font-weight: 700; }
.story-option.eliminated::after { content: " 已排除"; font-size: 0.75em; }
.story-option:disabled { cursor: default; }

.story-message { min-height: 1.4em; margin: 10px 0 0; color: var(--accent); font-size: 0.88rem; }

.story-result { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.story-verdict { margin: 0 0 8px; font-weight: 600; }
.story-verdict.good { color: var(--hit); }
.story-verdict.bad { color: var(--accent); }
.story-answer-word { margin: 0; font-family: "Noto Serif SC", "Songti SC", serif; font-size: 1.35rem; letter-spacing: 0.2em; }
.story-answer-pinyin { margin: 6px 0; color: var(--accent); font-size: 0.9rem; }
.story-answer-explanation { margin: 0 0 8px; color: var(--muted); font-size: 0.88rem; line-height: 1.7; }
.story-answer-source { margin: 0 0 6px; color: var(--accent); font-size: 0.86rem; }
.story-answer-derivation { margin: 0 0 6px; color: var(--muted); font-size: 0.84rem; line-height: 1.8; }
.story-answer-example { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.8; }

.story-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 420px) {
  .story-card { padding: 16px; }
}

.story-card [hidden] {
  display: none !important;
}


.story-difficulty {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.story-diff-label { letter-spacing: 0.08em; }

.story-diff-btn {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.story-diff-btn:hover { border-color: var(--accent); color: var(--accent); }
.story-diff-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }

.story-hint-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.story-option.eliminated {
  opacity: 0.35;
  text-decoration: line-through;
}

.story-actions { gap: 8px; }
.story-actions #storyHint { margin-right: auto; }


.feed-panel {
  height: calc(100vh - 180px);
  height: calc(100dvh - 180px);
  min-height: 420px;
  max-height: 820px;
  gap: 10px;
}

.feed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.feed-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.15rem;
  letter-spacing: 0.16em;
}

.feed-date {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.feed-listen { flex: 0 0 auto; }
.feed-listen.active { background: var(--accent); color: #fff; }

.feed-scroller {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg);
  scrollbar-width: none;
}

.feed-scroller::-webkit-scrollbar { display: none; }
.feed-scroller:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.feed-slide {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.feed-card {
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feed-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
}

.feed-word {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(2rem, 9vw, 2.7rem);
  font-weight: 600;
  letter-spacing: 0.18em;
}

.feed-pinyin {
  margin: 8px 0 16px;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.feed-explanation {
  margin: 0 0 14px;
  font-size: 0.98rem;
  line-height: 1.9;
}

.feed-source,
.feed-example {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
}

.feed-label {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.feed-derivation {
  margin: 0 0 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.feed-derivation .feed-label { margin-bottom: 6px; }

.feed-derivation-text {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.95rem;
  line-height: 2;
}

.feed-example { border-left: 2px solid var(--line); padding-left: 10px; }

.feed-loading {
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.feed-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.feed-nav .share-btn { padding: 6px 14px; }
.feed-nav .share-btn:disabled { opacity: 0.4; cursor: default; }

.feed-progress {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.feed-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
  text-align: center;
}


.hint-positions {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), var(--cell));
  gap: 10px;
  justify-content: center;
  margin-bottom: 6px;
}

.hint-positions span {
  text-align: center;
  color: var(--muted);
  font-size: clamp(0.56rem, calc(var(--cell) * 0.17), 0.76rem);
  opacity: 0.85;
  white-space: nowrap;
}


.story-sound {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.story-sound:hover { border-color: var(--accent); color: var(--accent); }

.story-card.correct { animation: story-good 0.9s ease; }
.story-card.wrong { animation: story-bad 0.4s ease; }

@keyframes story-good {
  0%, 100% { box-shadow: 0 18px 50px rgba(28, 24, 18, 0.25); }
  40% { box-shadow: 0 0 0 3px var(--hit), 0 18px 50px rgba(28, 24, 18, 0.25); }
}

@keyframes story-bad {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  60% { transform: translateX(7px); }
}

.board.shake { animation: board-shake 0.35s ease; }

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

@media (prefers-reduced-motion: reduce) {
  .story-card.correct,
  .story-card.wrong,
  .board.shake { animation: none; }
}


.records-modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  padding: 22px 16px;
  overflow-y: auto;
  background: rgba(28, 24, 18, 0.48);
}

.records-modal[hidden] { display: none; }

body.records-open,
body.a11y-open,
body.minute-open { overflow: hidden; }

.records-card {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 20px 22px;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(28, 24, 18, 0.25);
}

.records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.records-head h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.2rem;  letter-spacing: 0.14em;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.record-block {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(140, 59, 46, 0.03);
}

.record-block h3 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.05em;
}

.record-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.8;
  white-space: pre-line;
}

.record-overall {
  margin: 14px 0 4px;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.7;
}

.record-badges {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1.7;
}

.record-recent { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.record-recent h3 { margin: 0 0 8px; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; }
.record-recent ul { margin: 0; padding: 0; list-style: none; max-height: 190px; overflow-y: auto; }
.record-recent li { padding: 5px 0; color: var(--muted); font-size: 0.82rem; line-height: 1.6; border-bottom: 1px dashed var(--line); }
.record-recent li:last-child { border-bottom: none; }


.profile-card {
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(140, 59, 46, 0.07), rgba(71, 122, 82, 0.05));
}

.profile-guest-card { text-align: center; }
.profile-guest-title { margin: 0 0 8px; font-weight: 600; }
.profile-guest-text { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.7; }

.user-avatar.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-info { min-width: 0; }

.profile-avatar-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.profile-avatar-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.profile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.profile-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.profile-top h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.5rem;
  letter-spacing: 0.16em;
}

.profile-persona {
  margin: 12px 0 10px;
  color: var(--accent);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1rem;
  line-height: 1.7;
}

.profile-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-score-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.profile-score-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}


.profile-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.profile-role {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.7;
}

.profile-next {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.profile-gallery-wrap {
  margin-top: 10px;
}

.profile-gallery-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

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

.persona-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
  white-space: nowrap;
}

.persona-avatar {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1;
}

.persona-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.persona-chip.current .persona-avatar { border-color: rgba(255, 255, 255, 0.55); }
.persona-chip.locked .persona-avatar { filter: grayscale(0.25); }

.persona-name { white-space: nowrap; }

.persona-chip.unlocked {
  color: var(--ink);
  border-color: var(--accent);
  background: rgba(140, 59, 46, 0.07);
}

.persona-chip.current {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.persona-chip.locked {
  border-style: dashed;
  opacity: 0.62;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.profile-notice {
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1.5;
}

.share-btn:disabled {
  opacity: 0.45;
  cursor: default;
}


/* ===== 设置 ===== */
html.a11y-font-large { font-size: 18px; }
html.a11y-font-xlarge { font-size: 20px; }

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9rem;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.answer:focus-visible,
.story-result:focus-visible,
.records-card:focus,
.story-card:focus,
.a11y-card:focus {
  outline: none;
}

.a11y-caption {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 120;
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.a11y-caption[hidden] { display: none; }

.a11y-modal { z-index: 70; }
.a11y-card { max-width: 560px; }

.a11y-note {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.a11y-group { margin: 14px 0 0; }

.a11y-label {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.a11y-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.a11y-choice {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  cursor: pointer;
}

.a11y-choice:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.a11y-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.a11y-toggles {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.a11y-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.5;
  cursor: pointer;
}

.a11y-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

.a11y-hint,
.a11y-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.a11y-help {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

html.a11y-reduce-motion .celebration,
html.a11y-reduce-motion .confetti {
  display: none !important;
}

html.a11y-contrast[data-theme="dark"] .cell.filled {
  color: #000;
}

html.a11y-contrast[data-theme="dark"] .swatch {
  color: #000;
}

@media (prefers-color-scheme: dark) {
  html.a11y-contrast:not([data-theme]) .cell.filled,
  html.a11y-contrast:not([data-theme]) .swatch {
    color: #000;
  }
}

@media (max-width: 420px) {
  .a11y-card { padding: 16px; }
  .a11y-choice { padding: 6px 11px; }
}


/* 深色主题下，实心强调按钮改用深色文字，避免浅色文字对比不足 */
html[data-theme="dark"] :is(.guess-btn, .share-btn:hover, .level-btn.active, .story-diff-btn.active, .persona-chip.current, .a11y-choice[aria-pressed="true"]) {
  color: #1d1b17;
}

html.a11y-contrast[data-theme="dark"] :is(.guess-btn, .share-btn:hover, .level-btn.active, .story-diff-btn.active, .persona-chip.current, .a11y-choice[aria-pressed="true"]) {
  color: #000;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) :is(.guess-btn, .share-btn:hover, .level-btn.active, .story-diff-btn.active, .persona-chip.current, .a11y-choice[aria-pressed="true"]) {
    color: #1d1b17;
  }
  html.a11y-contrast:not([data-theme]) :is(.guess-btn, .share-btn:hover, .level-btn.active, .story-diff-btn.active, .persona-chip.current, .a11y-choice[aria-pressed="true"]) {
    color: #000;
  }
}

/* ===== 账号 ===== */
.account-card { max-width: 420px; }

.account-status {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.account-field input,
.account-field select,
.account-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
}

.account-field textarea {
  min-height: 120px;
  line-height: 1.6;
  resize: vertical;
}

.account-field input:focus,
.account-field select:focus,
.account-field textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.account-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.account-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

#accountName {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

/* ===== 排行榜 ===== */
.leaderboard-card { max-width: 520px; }

.leaderboard-date {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.leaderboard-status {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.leaderboard-rank {
  width: 2.2em;
  color: var(--accent);
  font-weight: 700;
}

.leaderboard-name {
  flex: 1;
  font-weight: 600;
}

.leaderboard-attempts {
  color: var(--muted);
  font-size: 0.82rem;
}

.leaderboard-empty {
  justify-content: center;
  color: var(--muted);
}

.password-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.password-field input { flex: 1; min-width: 0; }

.password-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
}

.password-toggle .eye-off { display: none; }
.password-toggle.is-visible .eye { display: none; }
.password-toggle.is-visible .eye-off { display: block; }

.password-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.account-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

#accountViewRecords {
  display: block;
  margin: 16px auto 0;
}

.records-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(140, 59, 46, 0.04);
}

.records-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.records-account-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.records-account-actions .share-btn {
  padding: 5px 10px;
  font-size: 0.76rem;
}

.account-section-title {
  margin: 4px 0 10px;
  font-weight: 600;
  font-size: 0.92rem;
}

.account-recovery-code {
  display: block;
  margin: 8px 0;
  padding: 12px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ===== 内测反馈 ===== */
.feedback-card { max-width: 560px; }

/* ===== 分享战绩图 ===== */
.share-card { max-width: 680px; }
.share-tip {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}
.share-image {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

/* ===== 反馈截图与成功态 ===== */
.feedback-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.feedback-preview[hidden] { display: none; }

.feedback-preview img {
  max-width: 180px;
  max-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feedback-preview span {
  flex: 1;
  min-width: 120px;
  color: var(--muted);
  font-size: 0.78rem;
}

.feedback-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.feedback-preview-list[hidden] { display: none; }

.feedback-preview-item {
  width: 150px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.feedback-preview-item img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
}

.feedback-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.feedback-preview-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-preview-meta button {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
}

.feedback-preview-item img {
  cursor: zoom-in;
}

.feedback-preview-item img:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feedback-viewer { z-index: 70; }

.feedback-viewer-card { max-width: 760px; }

.feedback-viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.feedback-viewer-stage img {
  display: block;
  min-width: 0;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.viewer-nav {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.viewer-nav:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.viewer-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.feedback-viewer-count {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.feedback-success {
  padding: 30px 0 20px;
  text-align: center;
  color: var(--hit);
  font-size: 1.05rem;
  font-weight: 600;
}

#feedbackSuccess:focus { outline: none; }

.minute-card {
  max-width: 560px;
  text-align: center;
}

.minute-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.minute-stage {
  padding: 8px 0 4px;
}

.minute-countdown {
  min-height: 1.4em;
  margin: 0;
  color: var(--accent);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.minute-timer {
  margin: 6px 0 4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.2rem, 11vw, 3.4rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.minute-status {
  min-height: 1.5em;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.minute-score {
  margin: 12px 0 0;
  color: var(--hit);
  font-size: 1.15rem;
  font-weight: 600;
}

.minute-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  margin: 10px 0 2px;
}

.minute-chip {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.84rem;
}

.minute-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 420px) {
  .minute-card { padding: 16px; }
  .minute-timer { font-size: 2.6rem; }
  .minute-list { max-height: 120px; overflow-y: auto; }
}

.minute-timer.minute-urgent {
  color: var(--accent);
  animation: minute-pulse 0.9s ease-in-out infinite;
}

.minute-countdown.minute-urgent {
  color: var(--accent);
  animation: minute-pulse 0.9s ease-in-out infinite;
}

.minute-card.minute-urgent {
  animation: minute-glow 0.9s ease-in-out infinite;
}

@keyframes minute-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes minute-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140, 59, 46, 0.05); }
  50% { box-shadow: 0 0 0 7px rgba(140, 59, 46, 0.2); }
}

@media (prefers-reduced-motion: reduce) {
  .minute-timer.minute-urgent,
  .minute-countdown.minute-urgent,
  .minute-card.minute-urgent {
    animation: none;
  }
  .minute-timer.minute-urgent { font-weight: 700; }
}

.minute-invalid-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  text-align: left;
}

.minute-invalid-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.minute-invalid-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.minute-chip.invalid {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.minute-review {
  margin: 12px 0 2px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg);
  text-align: left;
}

.minute-review[hidden] { display: none; }

.minute-review-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.minute-review audio {
  width: 100%;
  height: 38px;
}

.minute-review audio[hidden] { display: none; }

.minute-review-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}
