:root {
  --paper: #f6ebd8;
  --paper-deep: #e8d4b0;
  --paper-edge: #d4b88a;
  --card: #fff9ef;
  --card-warm: #fff3e0;
  --ink: #1a1612;
  --ink-soft: #3a3228;
  --muted: #5a4e40;
  --cinnabar: #b02820;
  --seal: #d4472f;
  --seal-bright: #e85a3c;
  --lake: #123548;
  --lake-mid: #1a5570;
  --lake-deep: #0c2836;
  --gold: #9a6a28;
  --gold-light: #e0c070;
  --line: #e0cba8;
  --ok: #0e6a3c;
  --ok-bg: #e2f6ea;
  --bad: #b02820;
  --bad-bg: #fde8e6;
  --note: #faf0d4;
  --player-a: #1a5570;
  --player-b: #b02820;
  --shadow: 0 12px 32px rgba(18, 53, 72, 0.14);
  --radius: 1rem;
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", "Source Han Serif TC", serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tap: 52px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  position: relative;
  overflow-x: hidden;
}
body.fx-off .ambient,
body.fx-off .mascot-bob,
body.fx-off .paper-bg::before {
  animation: none !important;
}
body.fx-off .ambient { opacity: 0.25; }

/* Warmer parchment + subtle moving wash */
.paper-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 70% at 15% 10%, rgba(232, 90, 60, 0.12), transparent 50%),
    radial-gradient(ellipse 90% 60% at 90% 85%, rgba(26, 85, 112, 0.14), transparent 48%),
    radial-gradient(ellipse 70% 50% at 50% 50%, rgba(224, 192, 112, 0.1), transparent 60%),
    linear-gradient(165deg, #f8efdc 0%, #f3e2c4 38%, #efe0c8 70%, #f5ead6 100%);
  background-size: 100% 100%, 100% 100%, 120% 120%, 100% 100%;
  animation: paperShift 18s ease-in-out infinite alternate;
}
@keyframes paperShift {
  0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0 0; }
  100% { background-position: 0% 0%, 0% 0%, 18% 12%, 0 0; }
}
.paper-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.paper-bg::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(180, 40, 32, 0.22);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 239, 0.5),
    0 0 0 1px rgba(154, 106, 40, 0.12);
  pointer-events: none;
}
@media (max-width: 480px) {
  .paper-bg::after { inset: 5px; }
}

/* Floating clouds & ink dots */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.cloud {
  position: absolute;
  width: 90px;
  height: 36px;
  border-radius: 50px;
  background: rgba(255, 252, 245, 0.55);
  box-shadow:
    28px 6px 0 -4px rgba(255, 252, 245, 0.45),
    -22px 8px 0 -6px rgba(255, 252, 245, 0.4),
    0 0 20px rgba(26, 85, 112, 0.08);
  opacity: 0.7;
  animation: cloudDrift 22s linear infinite;
}
.cloud::before {
  content: "";
  position: absolute;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: inherit;
  top: -18px; left: 18px;
}
.cloud.c1 { top: 12%; left: -10%; animation-duration: 26s; }
.cloud.c2 { top: 48%; left: -15%; width: 70px; height: 28px; animation-duration: 32s; animation-delay: -8s; opacity: 0.5; }
.cloud.c3 { top: 72%; left: -12%; width: 110px; height: 40px; animation-duration: 28s; animation-delay: -14s; opacity: 0.55; }
@keyframes cloudDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(120vw); }
}
.ink-dot {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(18, 53, 72, 0.18);
  animation: inkFloat 9s ease-in-out infinite;
}
.ink-dot.d1 { top: 22%; left: 18%; width: 6px; height: 6px; animation-delay: 0s; }
.ink-dot.d2 { top: 38%; right: 14%; width: 10px; height: 10px; background: rgba(212, 71, 47, 0.2); animation-delay: -2s; }
.ink-dot.d3 { top: 60%; left: 8%; width: 5px; height: 5px; animation-delay: -4s; }
.ink-dot.d4 { top: 78%; right: 22%; width: 7px; height: 7px; background: rgba(154, 106, 40, 0.25); animation-delay: -1s; }
.ink-dot.d5 { top: 15%; right: 30%; width: 4px; height: 4px; animation-delay: -6s; }
@keyframes inkFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
  50% { transform: translateY(-18px) scale(1.15); opacity: 0.9; }
}

#fxCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
}
#burstLayer {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  overflow: hidden;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background:
    linear-gradient(135deg, var(--lake) 0%, var(--lake-deep) 48%, var(--lake-mid) 100%);
  color: #f8f0e4;
  padding: 0.7rem 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 3px solid var(--gold-light);
  box-shadow: 0 4px 18px rgba(12, 40, 54, 0.3);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--seal) 0 8px,
    transparent 8px 14px
  );
  opacity: 0.7;
}
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.brand-mark {
  width: 2.35rem; height: 2.35rem; border-radius: 0.35rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(224,192,112,0.65);
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 1.15rem; font-weight: 700; color: var(--gold-light);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(212, 71, 47, 0.45);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(212, 71, 47, 0.5);
  border-radius: 2px;
  pointer-events: none;
}
.brand h1 {
  margin: 0; font-size: 1.08rem; font-weight: 700;
  font-family: var(--font-serif); letter-spacing: 0.06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand p { margin: 0; font-size: 0.72rem; opacity: 0.9; letter-spacing: 0.02em; }

.main {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 0.9rem calc(1.25rem + var(--safe-b));
}

button {
  cursor: pointer;
  font: inherit;
  border-radius: 0.85rem;
  border: 2px solid var(--lake);
  background: var(--card);
  color: var(--lake);
  padding: 0.7rem 1rem;
  min-height: var(--tap);
  touch-action: manipulation;
  transition: background 0.12s, transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
button:active:not(:disabled) { transform: scale(0.96); }
button:disabled { opacity: 0.42; cursor: not-allowed; }
button.primary {
  background: linear-gradient(180deg, var(--lake-mid), var(--lake));
  color: #fff; border-color: var(--lake); font-weight: 700;
  box-shadow: 0 4px 14px rgba(18, 53, 72, 0.28);
}
button.seal {
  background: linear-gradient(180deg, var(--seal-bright), var(--cinnabar));
  color: #fff; border-color: var(--cinnabar); font-weight: 700;
}
button.ghost {
  background: transparent; border-color: rgba(255,255,255,0.5); color: #fff;
  min-height: 40px; padding: 0.3rem 0.75rem; font-size: 0.9rem;
}
button.full { width: 100%; }
button.lg { min-height: 58px; font-size: 1.08rem; }

.card {
  background: linear-gradient(165deg, #fffaf0 0%, var(--card) 55%, var(--card-warm) 100%);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.1rem;
  margin-bottom: 0.85rem;
  position: relative;
  animation: cardPop 0.38s ease both;
}
.card.brush {
  border: none;
  background:
    linear-gradient(var(--card), var(--card-warm)) padding-box,
    linear-gradient(135deg, rgba(18,53,72,0.45), rgba(154,106,40,0.35), rgba(212,71,47,0.35)) border-box;
  border: 2.5px solid transparent;
}
.card.brush::before {
  content: "";
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 10px;
  border: 1px solid rgba(154, 106, 40, 0.22);
  border-radius: calc(var(--radius) - 6px);
  pointer-events: none;
}
@keyframes cardPop {
  0% { opacity: 0; transform: translateY(10px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.card h2 {
  margin: 0 0 0.45rem;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--lake);
  letter-spacing: 0.04em;
}
.muted { color: var(--muted); font-size: 0.92rem; }
.scope-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(90deg, #fff0e4, var(--note));
  border: 1.5px solid rgba(212, 71, 47, 0.35);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  color: var(--cinnabar);
  margin-bottom: 0.75rem;
  font-weight: 600;
  animation: cardPop 0.4s ease both;
}
.scope-tag::before {
  content: "印";
  display: inline-grid;
  place-items: center;
  width: 1.15rem; height: 1.15rem;
  font-size: 0.62rem;
  font-family: var(--font-serif);
  font-weight: 700;
  color: #fff;
  background: var(--seal);
  border-radius: 2px;
  letter-spacing: 0;
}

/* ---- Mascot ---- */
.mascot-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0.9rem;
  animation: cardPop 0.45s ease both;
}
.mascot-hero .mascot-img-wrap {
  width: min(58vw, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--seal);
  box-shadow:
    0 0 0 4px rgba(224, 192, 112, 0.55),
    0 10px 28px rgba(18, 53, 72, 0.2);
  background: #f5ead6;
}
.mascot-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mascot-hero .mascot-bubble {
  max-width: 92%;
  background: linear-gradient(180deg, #fffaf0, #fff3e0);
  border: 2px solid var(--seal);
  border-radius: 1rem 1rem 1rem 0.35rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--cinnabar);
  text-align: center;
  box-shadow: 0 4px 12px rgba(176, 40, 32, 0.12);
  position: relative;
}
.mascot-hero .mascot-bubble::before {
  content: "";
  position: absolute;
  bottom: -8px; left: 28px;
  border: 8px solid transparent;
  border-top-color: var(--seal);
}
.mascot-hero .mascot-bubble::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 30px;
  border: 6px solid transparent;
  border-top-color: #fff3e0;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.coach-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: linear-gradient(90deg, #fff8ee, #fff0e6);
  border: 2px solid rgba(212, 71, 47, 0.28);
  border-radius: 999px;
  margin-bottom: 0.65rem;
  box-shadow: 0 4px 12px rgba(18, 53, 72, 0.08);
  animation: cardPop 0.35s ease both;
}
.coach-bar .coach-face {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid var(--seal);
  flex-shrink: 0;
  background: #f5ead6;
  box-shadow: 0 0 0 2px rgba(224, 192, 112, 0.5);
}
.coach-bar .coach-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.coach-bar .coach-msg {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--lake);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.mascot-bob {
  animation: mascotBob 2.8s ease-in-out infinite;
}
@keyframes mascotBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.mascot-cheer-pop {
  animation: cheerPop 0.55s ease;
}
@keyframes cheerPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.12) rotate(-3deg); }
  70% { transform: scale(0.96) rotate(2deg); }
  100% { transform: scale(1); }
}
.mascot-encourage-shake {
  animation: encourageNudge 0.5s ease;
}
@keyframes encourageNudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.result-mascot {
  width: 140px;
  height: 140px;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--seal);
  box-shadow: 0 0 0 4px rgba(224, 192, 112, 0.5), 0 8px 20px rgba(18,53,72,0.15);
}
.result-mascot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mode-list { display: flex; flex-direction: column; gap: 0.7rem; }
.mode-btn {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 1rem 1.05rem;
  min-height: 76px;
  border-width: 2px;
  background: linear-gradient(180deg, #fffef8, var(--card));
  box-shadow: 0 3px 12px rgba(18, 53, 72, 0.08);
  animation: cardPop 0.4s ease both;
  transition: transform 0.15s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.15s, border-color 0.12s;
}
.mode-btn:nth-child(1) { animation-delay: 0.05s; }
.mode-btn:nth-child(2) { animation-delay: 0.1s; }
.mode-btn:nth-child(3) { animation-delay: 0.15s; }
.mode-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 8px 20px rgba(18, 53, 72, 0.14);
}
.mode-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.97);
}
.mode-btn strong {
  font-size: 1.12rem;
  font-family: var(--font-serif);
  color: var(--lake);
  letter-spacing: 0.03em;
}
.mode-btn span { font-size: 0.88rem; color: var(--muted); font-weight: 400; }
.mode-btn.featured {
  border-color: var(--seal);
  background: linear-gradient(160deg, #fff4ee 0%, #fffaf0 50%, #fce8d8 100%);
  box-shadow: 0 5px 18px rgba(176, 40, 32, 0.14);
}
.mode-btn.featured strong { color: var(--cinnabar); }

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.score-pill {
  border-radius: 0.85rem;
  padding: 0.45rem 0.5rem 0.5rem;
  text-align: center;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, #fffaf0, var(--card));
  transition: border-color 0.15s, box-shadow 0.15s;
}
.score-pill.active-a {
  border-color: var(--player-a);
  box-shadow: 0 0 0 3px rgba(26,85,112,0.2);
  background: linear-gradient(180deg, #e8f3f8, var(--card));
}
.score-pill.active-b {
  border-color: var(--player-b);
  box-shadow: 0 0 0 3px rgba(176,40,32,0.18);
  background: linear-gradient(180deg, #fdeceb, var(--card));
}
.score-pill .who-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.1rem;
}
.avatar-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid currentColor;
  flex-shrink: 0;
  background: #f5ead6;
}
.avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.score-pill.a .avatar-badge {
  color: var(--player-a);
  filter: hue-rotate(-8deg) saturate(1.05);
}
.score-pill.b .avatar-badge {
  color: var(--player-b);
  filter: hue-rotate(12deg) saturate(1.15) brightness(1.02);
}
.score-pill .who {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  font-family: var(--font-serif);
}
.score-pill.a .who { color: var(--player-a); }
.score-pill.b .who { color: var(--player-b); }
.score-pill .pts {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}
.score-pill .pts.pulse {
  animation: scorePulse 0.45s ease;
}
@keyframes scorePulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); color: var(--seal); }
  100% { transform: scale(1); }
}
.timer-box {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  font-family: var(--font-serif);
  color: var(--lake);
  min-width: 4.2rem;
  padding: 0.35rem 0.4rem;
  border-radius: 0.6rem;
  background: rgba(255,249,239,0.85);
  border: 1.5px dashed var(--paper-edge);
}
.timer-box.warn { color: var(--cinnabar); animation: pulse 0.8s ease infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.turn-banner {
  text-align: center;
  font-weight: 700;
  padding: 0.5rem 0.65rem;
  border-radius: 0.7rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-serif);
  letter-spacing: 0.04em;
  border: 1.5px solid transparent;
  animation: cardPop 0.3s ease both;
}
.turn-banner.a {
  background: linear-gradient(90deg, #dceef5, #f0f7fa);
  color: var(--player-a);
  border-color: rgba(26,85,112,0.28);
}
.turn-banner.b {
  background: linear-gradient(90deg, #fde4e0, #fdf0ed);
  color: var(--player-b);
  border-color: rgba(176,40,32,0.28);
}

.prompt-card {
  background:
    linear-gradient(160deg, var(--lake-mid) 0%, var(--lake) 55%, var(--lake-deep) 100%);
  color: #f8f0e4;
  border-radius: var(--radius);
  padding: 1.2rem 1.05rem;
  text-align: center;
  margin-bottom: 0.85rem;
  min-height: 5.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  box-shadow: 0 10px 24px rgba(12, 40, 54, 0.28);
  border: 2px solid rgba(224, 192, 112, 0.45);
  position: relative;
  overflow: hidden;
  animation: cardFlipIn 0.42s ease both;
}
@keyframes cardFlipIn {
  0% { opacity: 0; transform: rotateX(12deg) translateY(8px); }
  100% { opacity: 1; transform: rotateX(0) translateY(0); }
}
.prompt-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(224, 192, 112, 0.28);
  border-radius: calc(var(--radius) - 6px);
  pointer-events: none;
}
.prompt-card .label {
  font-size: 0.78rem; opacity: 0.85; letter-spacing: 0.12em;
  position: relative;
}
.prompt-card .text {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.03em;
  position: relative;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.choice-btn {
  text-align: left;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.4;
  padding: 0.9rem 1rem;
  min-height: 56px;
  border-color: var(--line);
  color: var(--ink);
  background: linear-gradient(180deg, #fffef8, var(--card));
  letter-spacing: 0.02em;
  animation: cardPop 0.35s ease both;
  transition: transform 0.12s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.12s;
}
.choice-btn:nth-child(1) { animation-delay: 0.04s; }
.choice-btn:nth-child(2) { animation-delay: 0.08s; }
.choice-btn:nth-child(3) { animation-delay: 0.12s; }
.choice-btn:nth-child(4) { animation-delay: 0.16s; }
.choice-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(18, 53, 72, 0.1);
  border-color: var(--lake-mid);
}
.choice-btn.correct {
  background: var(--ok-bg); border-color: var(--ok); color: var(--ok);
  animation: popOk 0.4s ease;
}
.choice-btn.wrong {
  background: var(--bad-bg); border-color: var(--bad); color: var(--bad);
  animation: shakeX 0.4s ease;
}
@keyframes popOk {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.gloss-tip {
  margin-top: 0.7rem;
  padding: 0.7rem 0.85rem;
  background: var(--note);
  border-left: 4px solid var(--gold);
  border-radius: 0 0.6rem 0.6rem 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  animation: cardPop 0.3s ease both;
}

.siwu-track {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}
.siwu-step {
  min-width: 4.2rem;
  padding: 0.55rem 0.5rem;
  border-radius: 0.7rem;
  border: 2px dashed var(--line);
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--muted);
  background: rgba(255,249,239,0.7);
  transition: transform 0.2s, background 0.2s;
}
.siwu-step.filled {
  border-style: solid;
  border-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 700;
  animation: popOk 0.35s ease;
}
.siwu-step.current {
  border-color: var(--gold);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(154,106,40,0.25);
  animation: mascotBob 1.6s ease-in-out infinite;
}

.ladder-buckets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}
.bucket {
  border: 2px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.6rem 0.7rem;
  background: linear-gradient(180deg, #fffef8, var(--card));
  min-height: 3.2rem;
  width: 100%;
  text-align: left;
  color: inherit;
  animation: cardPop 0.35s ease both;
  transition: transform 0.12s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.bucket:nth-child(1) { animation-delay: 0.05s; }
.bucket:nth-child(2) { animation-delay: 0.1s; }
.bucket:nth-child(3) { animation-delay: 0.15s; }
.bucket:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--lake-mid);
}
.bucket.hl {
  border-color: var(--gold);
  background: var(--note);
  animation: popOk 0.35s ease;
}
.bucket .b-label {
  font-size: 0.82rem; font-weight: 700; color: var(--lake);
  margin-bottom: 0.25rem;
  font-family: var(--font-serif);
  letter-spacing: 0.06em;
}
.bucket .b-hint { font-size: 0.72rem; color: var(--muted); }
.bucket .placed {
  margin-top: 0.35rem;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  padding: 0.35rem 0.45rem;
  background: var(--ok-bg);
  border-radius: 0.45rem;
  color: var(--ok);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1rem;
}
.row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.result-panel { text-align: center; padding: 1.35rem 0.6rem 1.1rem; }
.result-panel .seal-stamp {
  display: inline-grid;
  place-items: center;
  width: 4.2rem; height: 4.2rem;
  margin: 0 auto 0.55rem;
  border: 3px solid var(--seal);
  border-radius: 0.35rem;
  color: var(--seal);
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  transform: rotate(-8deg);
  box-shadow: inset 0 0 0 2px rgba(212, 71, 47, 0.4);
  background: rgba(212, 71, 47, 0.08);
  animation: stampIn 0.45s ease;
}
@keyframes stampIn {
  0% { transform: rotate(-8deg) scale(1.4); opacity: 0; }
  70% { transform: rotate(-8deg) scale(0.95); opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); }
}
.result-panel .winner {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--cinnabar);
  margin: 0.35rem 0;
  letter-spacing: 0.08em;
}
.result-panel .scores {
  font-size: 1.15rem;
  margin: 0.5rem 0 1rem;
  font-family: var(--font-serif);
}

.setup-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.7rem 0 0.2rem;
}
.chip {
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.92rem;
  transition: transform 0.12s;
}
.chip:active { transform: scale(0.95); }
.chip.on {
  border-color: var(--lake);
  background: #e4f0f6;
  color: var(--lake);
  font-weight: 700;
}

.prefs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.pref-toggle {
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.pref-toggle.on {
  border-color: var(--seal);
  background: #fff0e8;
  color: var(--cinnabar);
  font-weight: 700;
}
.pref-toggle .dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--paper-edge);
}
.pref-toggle.on .dot { background: var(--ok); }

.feedback-flash {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 70;
  padding: 0.9rem 1.4rem;
  border-radius: 1rem;
  font-weight: 700;
  font-size: 1.25rem;
  font-family: var(--font-serif);
  letter-spacing: 0.06em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.feedback-flash.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.feedback-flash.ok { background: var(--ok); color: #fff; }
.feedback-flash.bad { background: var(--cinnabar); color: #fff; }

.progress-bar {
  height: 8px;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(154, 106, 40, 0.2);
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--lake), var(--gold-light), var(--seal));
  width: 0%;
  transition: width 0.25s;
}

.burst-emoji {
  position: absolute;
  font-size: 1.35rem;
  animation: burstFly 0.9s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes burstFly {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.15); opacity: 0; }
}
.confetti-streak {
  position: absolute;
  width: 6px;
  height: 14px;
  border-radius: 2px;
  animation: streakFly 0.85s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes streakFly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.6); opacity: 0; }
}

@media (min-width: 420px) {
  .choice-grid.two-col { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .choice-btn.correct, .choice-btn.wrong, .bucket.hl,
  .result-panel .seal-stamp, .burst-emoji, .confetti-streak,
  .timer-box.warn, .mascot-bob, .mascot-cheer-pop, .mascot-encourage-shake,
  .card, .prompt-card, .mode-btn, .scope-tag, .coach-bar, .turn-banner,
  .siwu-step.current, .score-pill .pts.pulse,
  .paper-bg, .cloud, .ink-dot {
    animation: none !important;
  }
  .mode-btn:hover:not(:disabled),
  .choice-btn:hover:not(:disabled),
  .bucket:hover:not(:disabled) {
    transform: none;
  }
}
