/* =========================================================
   玩转文字 · 水墨视觉
   结构：顶栏 / 诗文纸笺 / 墨池字阵 / 底部工具条
   ========================================================= */

:root {
  --paper: #efe8d9;
  --paper-2: #f8f3e8;
  --paper-3: #e4dac7;
  --ink: #2a2520;
  --ink-soft: #5b5448;
  --ink-faint: #8d8474;
  --cinnabar: #a53a2c;
  --cinnabar-deep: #84291f;
  --jade: #5f857c;
  --rose: #b9907f;
  --gold: #b28b52;
  --line: rgba(58, 48, 36, .18);
  --line-strong: rgba(58, 48, 36, .32);
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "BiauKai", serif;
  --font-song: "Songti SC", "STSong", "SimSun", "宋体", serif;
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --tile-size: clamp(64px, 9.4vh, 100px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(120% 80% at 12% 6%, rgba(255, 255, 255, .78), transparent 55%),
    radial-gradient(90% 70% at 90% 2%, rgba(111, 151, 141, .14), transparent 60%),
    radial-gradient(90% 60% at 50% 112%, rgba(74, 64, 48, .12), transparent 65%),
    linear-gradient(165deg, #f6f0e3 0%, var(--paper) 46%, #e8ddc9 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* 纸纹 */
.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: .3;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* 远山 */
.ink-mountains {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 40vh;
  z-index: 0;
  pointer-events: none;
}

::selection {
  background: rgba(165, 58, 44, .18);
}

:focus-visible {
  outline: 2px solid rgba(165, 58, 44, .55);
  outline-offset: 3px;
}

/* ============ 顶栏 ============ */
.topbar {
  position: relative;
  z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(18px, 3.4vw, 40px) 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-seal {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: none;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 235, 215, .18), transparent 55%),
    linear-gradient(160deg, #b24334, var(--cinnabar) 45%, var(--cinnabar-deep));
  color: #f9f0de;
  font-family: var(--font-kai);
  font-size: 27px;
  line-height: 1;
  border-radius: 5px;
  transform: rotate(-3deg);
  box-shadow:
    0 8px 16px -6px rgba(132, 41, 31, .55),
    inset 0 0 0 2px rgba(255, 246, 228, .28);
}

.brand-text h1 {
  margin: 0;
  font-family: var(--font-kai);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .14em;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 10.5px;
  letter-spacing: .3em;
  color: var(--ink-faint);
}

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

.ghost-btn {
  position: relative;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: .16em;
  padding: 9px 13px;
  border-radius: 4px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}

.ghost-btn::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 5px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  opacity: .4;
  transition: transform .25s ease;
}

.ghost-btn:hover {
  color: var(--ink);
  background: rgba(42, 37, 32, .035);
}

.ghost-btn:hover::after {
  transform: scaleX(1);
}

.ghost-btn:disabled {
  color: var(--ink-faint);
  cursor: default;
  opacity: .55;
}

.hint-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  padding: 0 4px;
  font-size: 10px;
  letter-spacing: 0;
  color: var(--cinnabar);
  background: rgba(165, 58, 44, .1);
  border-radius: 999px;
  vertical-align: 1px;
}

#btn-sound {
  min-width: 42px;
  font-family: var(--font-kai);
  font-size: 15px;
}

#btn-sound .sound-off {
  display: none;
  color: var(--ink-faint);
}

#btn-sound[aria-pressed="false"] .sound-on {
  display: none;
}

#btn-sound[aria-pressed="false"] .sound-off {
  display: inline;
}

/* ============ 主舞台 ============ */
.stage {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  max-width: 1120px;
  min-height: 0;
  margin: 0 auto;
  padding: 14px clamp(18px, 3.4vw, 40px) clamp(16px, 2.4vh, 26px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(12px, 2vh, 22px);
}

/* ---- 诗文纸笺 ---- */
.verse {
  position: relative;
  width: 100%;
  max-width: 940px;
  height: clamp(286px, 34vh, 340px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  padding: 30px clamp(20px, 4vw, 46px) 14px;
  border: 1px solid rgba(165, 58, 44, .4);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 252, 245, .94), rgba(247, 240, 226, .96)),
    repeating-linear-gradient(90deg, rgba(120, 100, 70, .03) 0 1px, transparent 1px 4px);
  box-shadow:
    0 26px 50px -34px rgba(40, 30, 16, .5),
    inset 0 0 44px rgba(130, 100, 55, .05);
}

.verse::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(165, 58, 44, .16);
  border-radius: 2px;
  pointer-events: none;
}

.verse-title {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 3px 30px;
  font-family: var(--font-kai);
  font-size: clamp(18px, 2.2vh, 22px);
  font-weight: 600;
  letter-spacing: .24em;
  line-height: 1.45;
  white-space: nowrap;
  color: #faf2e2;
  background:
    linear-gradient(95deg,
      rgba(159, 45, 32, 0) 0%,
      rgba(159, 45, 32, .92) 10%,
      var(--cinnabar) 48%,
      rgba(159, 45, 32, .92) 90%,
      rgba(159, 45, 32, 0) 100%);
  text-shadow: 0 1px 2px rgba(60, 20, 12, .28);
}

.verse-meta {
  margin: 0 0 10px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: .24em;
  color: var(--ink-faint);
}

.meta-dot {
  margin: 0 7px;
  opacity: .6;
}

.poem {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(58, 48, 36, .2) transparent;
}

.poem::-webkit-scrollbar {
  width: 3px;
}

.poem::-webkit-scrollbar-thumb {
  background: rgba(58, 48, 36, .18);
  border-radius: 2px;
}

.poem-line {
  margin: 0;
  text-align: center;
  font-family: var(--font-kai);
  font-size: clamp(17px, 2.5vh, 25px);
  line-height: 1.92;
  letter-spacing: .14em;
  color: rgba(42, 37, 32, .58);
  white-space: nowrap;
}

.poem-char {
  color: rgba(42, 37, 32, .12);
  transition: color .9s ease, text-shadow .9s ease;
}

.poem-char.current {
  color: rgba(42, 37, 32, .32);
}

.poem-char.lit {
  color: var(--ink);
  text-shadow: 0 0 16px rgba(178, 139, 82, .4);
  animation: char-light .9s ease;
}

@keyframes char-light {
  0% {
    text-shadow: 0 0 0 rgba(178, 139, 82, 0);
    filter: blur(.6px);
  }
  55% {
    text-shadow: 0 0 22px rgba(178, 139, 82, .62);
  }
  100% {
    filter: blur(0);
  }
}

.verse-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding: 10px 2px 0;
  border-top: 1px solid rgba(58, 48, 36, .12);
}

.verse-caption {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .18em;
  color: var(--ink-faint);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.progress-text {
  font-family: var(--font-song);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}

.progress-text b {
  font-size: 19px;
  font-weight: 600;
  color: var(--cinnabar);
}

.progress-text .slash {
  margin: 0 3px;
  opacity: .5;
}

.progress-text .unit {
  margin-left: 4px;
  font-family: var(--font-ui);
  font-size: 10.5px;
  letter-spacing: .1em;
}

.progress-bar {
  width: 110px;
  height: 3px;
  border-radius: 2px;
  background: rgba(42, 37, 32, .1);
  overflow: hidden;
}

.progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--cinnabar));
  transition: width .7s cubic-bezier(.2, .8, .3, 1);
}

.chunk-count {
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid rgba(58, 48, 36, .18);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* ---- 墨池 ---- */
.play {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pool-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 8px 8px;
}

.pool-name {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--font-kai);
  font-size: 15px;
  letter-spacing: .42em;
  color: var(--ink-faint);
}

.pool-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 0 0 4px rgba(165, 58, 44, .08);
}

.pool-tip {
  margin: 0;
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--ink-faint);
}

.tile-pool {
  --pool-gap: clamp(10px, 1.6vw, 18px);
  --pool-cols: 6;
  position: relative;
  flex: 1;
  min-height: 220px;
  max-width: calc(var(--pool-cols) * var(--tile-size) + (var(--pool-cols) - 1) * var(--pool-gap) + 2px);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: var(--pool-gap);
  padding: 0;
}

/* 墨晕 */
.tile-pool::before {
  content: "";
  position: absolute;
  inset: 2% 4%;
  z-index: 0;
  pointer-events: none;
  border-radius: 48% 52% 46% 54% / 54% 46% 56% 44%;
  background:
    radial-gradient(44% 44% at 26% 32%, rgba(54, 48, 40, .11), transparent 72%),
    radial-gradient(40% 46% at 74% 62%, rgba(54, 48, 40, .09), transparent 74%),
    radial-gradient(34% 32% at 52% 88%, rgba(54, 48, 40, .07), transparent 72%),
    radial-gradient(38% 38% at 66% 20%, rgba(95, 133, 124, .07), transparent 70%);
  filter: blur(11px);
  mix-blend-mode: multiply;
}

/* 淡月 */
.tile-pool::after {
  content: "";
  position: absolute;
  top: 2%;
  right: 4%;
  width: clamp(120px, 17vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 42% 38%, rgba(184, 154, 110, .15), rgba(184, 154, 110, .05) 58%, transparent 72%);
  filter: blur(2px);
}

/* ---- 字片 ---- */
.tile {
  --rot: 0deg;
  --dy: 0px;
  position: relative;
  z-index: 1;
  width: var(--tile-size);
  height: var(--tile-size);
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(62, 52, 38, .3);
  border-radius: 6px 9px 7px 10px / 8px 6px 10px 7px;
  background: linear-gradient(157deg, #fdfaf1 0%, #f4ebd9 56%, #e9dfc8 100%);
  color: var(--ink);
  font-family: var(--font-kai);
  font-size: calc(var(--tile-size) * .44);
  line-height: 1;
  cursor: pointer;
  transform: rotate(var(--rot)) translateY(var(--dy));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    inset 0 -10px 16px rgba(122, 96, 60, .06),
    0 10px 18px -9px rgba(48, 38, 22, .42);
  transition:
    transform .22s cubic-bezier(.2, .8, .3, 1.2),
    box-shadow .22s ease,
    border-color .22s ease,
    background .22s ease,
    opacity .3s ease;
  animation: tile-in .55s cubic-bezier(.2, .9, .3, 1.15) backwards;
  animation-delay: var(--in-delay, 0s);
  -webkit-tap-highlight-color: transparent;
}

.tile-char {
  display: block;
  transform: translateY(-1px);
}

/* 实在拆不开的字：一枚带朱印的整字片，点一下落墨 */
.tile-whole {
  border-color: rgba(62, 52, 38, .4);
  background: linear-gradient(157deg, #fff9ee 0%, #f8edda 56%, #f0e2c9 100%);
}

.tile-whole::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(165, 58, 44, .22);
  border-radius: 3px;
  pointer-events: none;
}

.tile-seal {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--cinnabar);
  opacity: .85;
  pointer-events: none;
}

.tile.stamped {
  pointer-events: none;
  border-color: var(--cinnabar);
  animation: tile-stamp .42s ease forwards;
}

@keyframes tile-stamp {
  0% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    filter: blur(0);
  }
  35% {
    transform: rotate(0deg) scale(.9);
    box-shadow: 0 0 0 10px rgba(165, 58, 44, .15);
  }
  100% {
    opacity: 0;
    transform: rotate(-7deg) scale(.55);
    filter: blur(3px);
  }
}

.tile:hover {
  transform: rotate(0deg) translateY(-5px);
  border-color: rgba(95, 133, 124, .55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 16px 24px -12px rgba(48, 38, 22, .5);
}

.tile.selected {
  transform: rotate(0deg) translateY(-6px) scale(1.03);
  border-color: var(--jade);
  background: linear-gradient(157deg, #fffdf5 0%, #f4efe0 60%, #eae3d1 100%);
  box-shadow:
    inset 0 0 0 1px rgba(95, 133, 124, .22),
    0 0 0 3px rgba(95, 133, 124, .14),
    0 18px 26px -12px rgba(40, 62, 55, .45);
}

.tile.matched {
  pointer-events: none;
  animation: tile-out .48s ease forwards;
}

.tile.wrong {
  border-color: rgba(165, 58, 44, .6);
  animation: tile-shake .42s ease;
}

.tile.hint {
  animation: tile-hint 1.1s ease 2;
}

.tile.hint::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(165, 58, 44, .45);
  border-radius: 10px;
  pointer-events: none;
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: scale(.7) rotate(var(--rot));
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot)) translateY(var(--dy));
  }
}

@keyframes tile-out {
  0% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    filter: blur(0);
  }
  55% {
    opacity: .65;
  }
  100% {
    opacity: 0;
    transform: rotate(7deg) scale(.5);
    filter: blur(4px);
  }
}

@keyframes tile-shake {
  10%, 90% { transform: translateX(-2px) rotate(var(--rot)); }
  30%, 70% { transform: translateX(4px) rotate(var(--rot)); }
  50% { transform: translateX(-5px) rotate(var(--rot)); }
}

@keyframes tile-hint {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(165, 58, 44, 0), 0 10px 18px -9px rgba(48, 38, 22, .42);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(165, 58, 44, .13), 0 10px 18px -9px rgba(48, 38, 22, .42);
  }
}

/* ---- 底部工具条 ---- */
.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 8px 0;
  border-top: 1px solid rgba(58, 48, 36, .13);
  font-size: 11.5px;
  letter-spacing: .16em;
  color: var(--ink-faint);
}

.toolbar-side {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.timer-label {
  font-size: 10px;
  letter-spacing: .22em;
}

.timer {
  font-family: var(--font-song);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1em;
  color: var(--ink-soft);
}

.life-label {
  margin-left: 5px;
  font-size: 9.5px;
  letter-spacing: .2em;
  color: var(--ink-faint);
}

.lives {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lives i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(165, 58, 44, .07);
  transition: background .35s ease, border-color .35s ease, box-shadow .35s ease, opacity .35s ease;
}

.lives i.lost {
  background: transparent;
  border: 1px solid rgba(42, 37, 32, .28);
  box-shadow: none;
  opacity: .55;
}

.toolbar-note {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .16em;
  opacity: .8;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---- 点亮墨点 ---- */
.ink-splash {
  position: fixed;
  z-index: 30;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(178, 139, 82, .4), rgba(165, 58, 44, .16) 42%, transparent 70%);
  filter: blur(1px);
  animation: ink-splash .95s ease-out forwards;
}

@keyframes ink-splash {
  0% {
    opacity: 0;
    transform: scale(.25);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(2.2);
  }
}

/* ============ 提示条 ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  z-index: 60;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(42, 37, 32, .92);
  color: #f7eeda;
  font-size: 12.5px;
  letter-spacing: .12em;
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .6);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -4px);
}

/* ============ 浮层 ============ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(32, 27, 21, .38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlay-in .3s ease;
}

.overlay[hidden] {
  display: none !important;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel {
  position: relative;
  width: min(900px, 94vw);
  max-height: 90dvh;
  overflow: auto;
  padding: clamp(24px, 4vw, 44px);
  border-radius: 5px;
  background:
    linear-gradient(170deg, rgba(255, 253, 247, .97), rgba(247, 240, 226, .97));
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow:
    0 50px 90px -40px rgba(30, 22, 12, .6),
    inset 0 0 70px rgba(130, 100, 55, .06);
  animation: panel-in .4s cubic-bezier(.2, .9, .3, 1.05);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.985);
  }
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: .4em;
  color: var(--cinnabar);
}

.panel-title {
  margin: 0 0 24px;
  font-family: var(--font-kai);
  font-size: clamp(28px, 3.4vw, 36px);
  font-weight: 600;
  letter-spacing: .16em;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: color .2s, background .2s;
}

.close-btn:hover {
  color: var(--ink);
  background: rgba(42, 37, 32, .05);
}

/* 选篇卡片 */
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 13px;
}

.level-card {
  position: relative;
  display: block;
  text-align: left;
  padding: 18px 18px 16px;
  border: 1px solid rgba(58, 48, 36, .16);
  border-radius: 4px;
  background: linear-gradient(160deg, rgba(255, 253, 247, .92), rgba(246, 238, 224, .72));
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.level-card:hover {
  transform: translateY(-3px);
  border-color: rgba(165, 58, 44, .35);
  box-shadow: 0 18px 30px -20px rgba(60, 40, 20, .55);
}

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

.card-title,
.card-meta,
.card-note,
.card-done {
  display: block;
}

.card-index {
  font-family: var(--font-song);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-faint);
}

.diff {
  display: flex;
  gap: 4px;
}

.diff i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(42, 37, 32, .16);
}

.diff i.on {
  background: var(--cinnabar);
}

.card-title {
  margin: 12px 0 5px;
  font-family: var(--font-kai);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .12em;
}

.card-meta {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--ink-faint);
}

.card-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-soft);
  opacity: .82;
}

.card-done {
  margin: 12px 0 0;
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--cinnabar);
}

.card-done.muted {
  color: var(--ink-faint);
}

.card-done .tick {
  margin-right: 4px;
}

.panel-foot {
  margin: 24px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.95;
  letter-spacing: .06em;
  color: var(--ink-faint);
}

/* 完成 */
.win-panel {
  width: min(520px, 92vw);
  padding: 38px 34px 32px;
  text-align: center;
}

.seal {
  width: 96px;
  height: 96px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 6px;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 238, 214, .18), transparent 58%),
    linear-gradient(155deg, #b54435, var(--cinnabar) 45%, var(--cinnabar-deep));
  color: #f9efdc;
  font-family: var(--font-kai);
  font-size: 50px;
  line-height: 1;
  transform: rotate(-7deg);
  box-shadow: 0 16px 30px -14px rgba(120, 35, 24, .7);
  animation: seal-stamp .75s cubic-bezier(.2, 1.5, .4, 1) both;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1.5px solid rgba(255, 244, 225, .5);
  border-radius: 3px;
}

.seal-ink {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .08), transparent 58%),
    linear-gradient(155deg, #40382e, #2a2520 50%, #1d1a16);
  color: #f4ead7;
  box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .7);
}

.seal-ink::after {
  border-color: rgba(255, 244, 225, .28);
}

@keyframes seal-stamp {
  0% {
    opacity: 0;
    transform: scale(1.9) rotate(-15deg);
  }
  55% {
    opacity: 1;
    transform: scale(.94) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-7deg);
  }
}

.win-note {
  margin: -6px 0 26px;
  font-family: var(--font-kai);
  font-size: 14px;
  letter-spacing: .1em;
  color: var(--ink-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats > div {
  padding: 16px 6px 14px;
}

.stats > div + div {
  border-left: 1px solid var(--line);
}

.stats dt {
  font-size: 10.5px;
  letter-spacing: .22em;
  color: var(--ink-faint);
}

.stats dd {
  margin: 7px 0 0;
  font-family: var(--font-song);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.win-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.ink-btn {
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: #f8f0df;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: .2em;
  padding: 11px 26px;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 12px 20px -12px rgba(0, 0, 0, .6);
}

.ink-btn:hover {
  background: #3a332b;
  transform: translateY(-1px);
}

.ink-btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(42, 37, 32, .38);
  box-shadow: none;
}

.ink-btn.ghost:hover {
  background: rgba(42, 37, 32, .05);
}

.noscript-tip {
  position: fixed;
  inset: auto 0 20px;
  text-align: center;
  font-size: 13px;
  color: var(--cinnabar);
}

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  .topbar {
    padding: 14px 16px 2px;
  }

  .brand-seal {
    width: 40px;
    height: 40px;
    font-size: 23px;
  }

  .brand-text h1 {
    font-size: 21px;
  }

  .brand-text p {
    font-size: 9.5px;
    letter-spacing: .22em;
  }

  .ghost-btn {
    font-size: 12.5px;
    padding: 8px 9px;
    letter-spacing: .1em;
  }

  .stage {
    flex: 1 0 auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .verse {
    height: 266px;
    padding: 27px 18px 10px;
  }

  .verse-title {
    font-size: 18px;
    padding: 2px 24px;
  }

  .poem-line {
    font-size: clamp(15.5px, 4.4vw, 18px);
    line-height: 1.9;
    letter-spacing: .1em;
    white-space: normal;
  }

  .verse-caption {
    display: none;
  }

  .verse-foot {
    justify-content: flex-end;
    margin-top: 4px;
    padding-top: 8px;
  }

  .tile-pool {
    min-height: 250px;
  }

  .toolbar {
    position: sticky;
    bottom: 0;
    z-index: 8;
    margin: 0 -14px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(239, 232, 217, .55), rgba(239, 232, 217, .96) 40%);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-top: 1px solid rgba(58, 48, 36, .14);
  }

  .toolbar-note {
    display: none;
  }

  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .overlay {
    padding: 12px;
  }

  .panel {
    width: 100%;
    max-height: 92dvh;
    padding: 26px 20px;
  }

  .level-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .level-card {
    padding: 14px 14px 13px;
  }

  .card-title {
    font-size: 21px;
    margin: 9px 0 4px;
  }

  .card-note {
    display: none;
  }

  .card-done {
    margin-top: 8px;
  }
}

@media (max-width: 560px) {
  .brand {
    gap: 10px;
  }

  .brand-seal {
    width: 36px;
    height: 36px;
    font-size: 21px;
  }

  .brand-text h1 {
    font-size: 19px;
    letter-spacing: .1em;
  }

  .brand-text p {
    display: none;
  }

  .ghost-btn {
    font-size: 12px;
    padding: 7px;
  }

  .ghost-btn::after {
    left: 7px;
    right: 7px;
  }

  .progress-bar {
    width: 70px;
  }

  .pool-name {
    font-size: 13px;
    letter-spacing: .3em;
  }

  .pool-tip {
    font-size: 10px;
    letter-spacing: .1em;
  }

  .level-grid {
    grid-template-columns: 1fr;
  }

  .stats dd {
    font-size: 20px;
  }

  .win-actions {
    flex-direction: column-reverse;
  }

  .ink-btn {
    width: 100%;
  }

  .seal {
    width: 82px;
    height: 82px;
    font-size: 43px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* 截图 / 无动画预览 */
.no-anim *,
.no-anim *::before,
.no-anim *::after {
  animation: none !important;
  transition: none !important;
}
