/* ============================================================
   汉语闯关乐园 · Chinese Quest Land
   原创卡通贴纸风设计系统（纯 CSS，无外部素材、无音频）
   ============================================================ */

:root {
  /* 蓝紫贴纸色板 —— 与首页 landing 天空蓝梦幻基调呼应 */
  --ink: #2d2a4a;
  --ink-soft: #5b5878;
  --cream: #eaf4ff;
  --paper: #f7fbff;
  --coral: #6366f1;
  --coral-deep: #4338ca;
  --coral-light: #dcd9fe;
  --sun: #4aa8ff;
  --sun-light: #d6ecff;
  --mint: #2ecfa0;
  --mint-deep: #1da77f;
  --mint-light: #c9f4e6;
  --sky: #4aa8ff;
  --sky-deep: #2b86d6;
  --sky-light: #d5eaff;
  --grape: #8c5bf0;
  --grape-light: #e7dcff;
  --rose: #ff6b9d;
  --rose-light: #ffe0ec;
  --aqua: #34c6d4;
  --aqua-light: #d2f2f5;
  --red: #ff5a5a;
  --blue: #4a8dff;

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --border: 3px solid var(--ink);
  --shadow-pop: 0 6px 0 rgba(45, 42, 74, .16);
  --shadow-card: 0 10px 0 rgba(45, 42, 74, .12);
  --shadow-float: 0 18px 36px rgba(45, 42, 74, .16);

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(170deg, #eaf4ff 0%, #d9ebff 45%, #e8f6ff 100%);
  min-height: 100vh;
  overflow-x: hidden;
  font-weight: 700;
}

.en {
  font-weight: 700;
  font-size: .78em;
  color: var(--ink-soft);
  letter-spacing: .02em;
}

.ic { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }

/* ============ 背景装饰 ============ */
.bg-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.deco { position: absolute; opacity: .5; }
.deco-cloud { width: 130px; color: #fff; opacity: .75; }
.deco-cloud.c1 { top: 8%; left: -60px; animation: drift 46s linear infinite; }
.deco-cloud.c2 { top: 58%; left: -140px; width: 90px; animation: drift 64s linear infinite 8s; }
.deco-star { width: 26px; color: var(--sun); animation: twinkle 3.2s ease-in-out infinite; }
.deco-star.s1 { top: 14%; right: 9%; }
.deco-star.s2 { top: 72%; left: 6%; width: 20px; animation-delay: 1.1s; }
.deco-dot { width: 14px; border-radius: 50%; }
.deco-dot.d1 { top: 26%; left: 12%; color: var(--rose); opacity: .35; animation: twinkle 2.6s infinite .4s; }
.deco-dot.d2 { top: 66%; right: 14%; color: var(--mint); opacity: .4; width: 18px; animation: twinkle 3s infinite 1.4s; }
.deco-dot.d3 { top: 44%; right: 4%; color: var(--grape); opacity: .3; width: 10px; animation: twinkle 2.2s infinite .8s; }
.deco-wave { width: 220px; bottom: 4%; left: -80px; color: var(--sky); opacity: .3; animation: drift 38s linear infinite; }
.deco-rainbow { width: 170px; top: 6%; right: 4%; opacity: .5; animation: floaty 6s ease-in-out infinite; }
.deco-flag { width: 36px; color: var(--coral); opacity: .85; transform-origin: left bottom; animation: flagWave 3s ease-in-out infinite; }
.deco-flag.f1 { bottom: 12%; left: 7%; }
.deco-flag.f2 { bottom: 7%; left: 15%; color: var(--sky); animation-delay: .7s; width: 28px; }
.deco-flag.f3 { bottom: 17%; left: 21%; color: var(--aqua); animation-delay: 1.3s; width: 24px; }
.deco-bubble { color: #fff; opacity: .9; animation: bob 5s ease-in-out infinite; }
.deco-bubble.b1 { width: 48px; top: 19%; left: 5%; }
.deco-bubble.b2 { width: 26px; top: 33%; right: 11%; animation-delay: 1.2s; }
.deco-bubble.b3 { width: 36px; bottom: 25%; right: 6%; animation-delay: 2.1s; }

@keyframes drift { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 200px)); } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0deg); opacity: .55; } 50% { transform: scale(1.25) rotate(12deg); opacity: .85; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes flagWave { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(5deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }

#app { position: relative; z-index: 1; }

/* ============ 屏幕切换 ============ */
.screen { display: none; min-height: 100vh; }
.screen.is-active { display: block; animation: screenIn 380ms ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ============ 通用：贴纸卡片 ============ */
.panel, .stage-card, .result-card {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ============ 按钮（粗描边 + 立体按压） ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  border: var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  padding: .62em 1.3em;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(45, 42, 74, .18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 160ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(45, 42, 74, .18); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(45, 42, 74, .18); }
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .en { color: inherit; opacity: .75; }

.btn-primary { background: var(--coral); color: #fff; border-color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: var(--coral-deep); }
.btn-secondary { background: var(--sun); color: var(--ink); }
.btn-mint { background: var(--mint); color: #fff; }
.btn-sky { background: var(--sky); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, .82); font-size: .86rem; padding: .5em 1em; }
.btn-xl { font-size: 1.3rem; padding: .72em 2.2em; border-radius: 999px; }
.btn-sm { font-size: .85rem; }

/* ============ 第一屏：教师设置台 ============ */
#screen-setup { max-width: 1060px; margin: 0 auto; padding: clamp(1rem, 3vw, 2.2rem) clamp(1rem, 4vw, 2rem) 3rem; }

.hero {
  display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem);
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: clamp(1.1rem, 3vw, 1.8rem);
  margin-bottom: 1.6rem; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 170px; height: 170px;
  border-radius: 50%; background: var(--sun-light);
}
.hero-text { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.6rem, 4.6vw, 2.5rem); font-weight: 900; line-height: 1.2; }
.hero h1 .en { display: block; color: var(--coral); font-size: .52em; letter-spacing: .06em; }
.tagline { margin-top: .55rem; color: var(--ink-soft); font-size: clamp(.85rem, 2.4vw, 1rem); line-height: 1.6; }
.tagline .en { display: block; }
.hero-pet { flex: none; width: clamp(110px, 22vw, 160px); position: relative; z-index: 1; animation: floaty 3.6s ease-in-out infinite; }

.panel { padding: clamp(1rem, 2.6vw, 1.5rem); margin-bottom: 1.3rem; }
.panel h2 {
  font-size: clamp(1.05rem, 2.8vw, 1.25rem); font-weight: 900;
  display: flex; align-items: center; gap: .5em; margin-bottom: 1rem;
}
.step {
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; flex: none;
  background: var(--grape); color: #fff; border-radius: 50%; font-size: .82em;
  border: 2.5px solid var(--ink); box-shadow: 0 3px 0 rgba(45,42,74,.2);
}

/* 模式 / 类型 卡片网格 */
.card-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card-grid.types { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }

.pick-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .4em;
  text-align: center; padding: 1rem .7rem .9rem; cursor: pointer;
  background: #fff; border: 3px solid rgba(45, 42, 74, .25); border-radius: var(--radius-md);
  font: inherit; font-weight: 800; color: var(--ink);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pick-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--ink); background: #fffdf4; }
.pick-card:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.pick-card .pick-ic {
  width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px;
  background: var(--sun-light); color: var(--ink); flex: none;
}
.pick-card .pick-ic .ic { width: 32px; height: 32px; }
.pick-card .pick-name { font-size: .98rem; line-height: 1.25; }
.pick-card .pick-en { font-size: .72rem; color: var(--ink-soft); font-weight: 700; }
.pick-card .pick-desc { font-size: .72rem; color: var(--ink-soft); font-weight: 650; line-height: 1.4; }
.pick-card.is-selected {
  border-color: var(--ink); background: var(--coral-light);
  box-shadow: var(--shadow-pop);
}
.pick-card.is-selected .pick-ic { background: var(--coral); color: #fff; }
.pick-card.is-selected::after {
  content: "✓"; position: absolute; top: -10px; right: -8px;
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--mint); color: #fff; border: 2.5px solid var(--ink); border-radius: 50%;
  font-size: .85rem; font-weight: 900;
}
.pick-card:disabled { opacity: .45; cursor: not-allowed; }
.pick-card .pick-warn { color: var(--coral-deep); font-size: .7rem; font-weight: 800; }

/* 玩法分组标签（语法检测专区） */
.type-group-label {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: .6em;
  margin: .35rem 0 -.15rem;
  font-size: 1rem; font-weight: 900; color: var(--grape);
}
.type-group-label::before, .type-group-label::after {
  content: ""; flex: 1; height: 3px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--grape) 0 9px, transparent 9px 16px);
  opacity: .55;
}
.type-group-label .en { font-size: .78em; color: var(--ink-soft); }

/* 教师题库横幅（?bank=CODE 打开时显示，跨屏幕常驻） */
.bank-banner {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: .2rem .7rem; max-width: 1060px; margin: .8rem auto 0;
  padding: .65em 1.1em; text-align: center;
  border: var(--border); border-radius: var(--radius-md);
  background: var(--grape-light); box-shadow: var(--shadow-pop);
  font-weight: 800; font-size: .92rem; line-height: 1.5;
}
.bank-banner .bank-en { font-size: .76rem; font-weight: 700; color: var(--ink-soft); }
.bank-banner.is-loading { background: var(--sky-light); }
.bank-banner.is-ok { background: var(--mint-light); }
.bank-banner.is-fail { background: var(--coral-light); }
@media (max-width: 560px) {
  .bank-banner { margin: .6rem .7rem 0; font-size: .84rem; }
}

/* 难度 chips */
.chip-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
  border: 3px solid rgba(45, 42, 74, .3); background: #fff; color: var(--ink);
  border-radius: 999px; padding: .5em 1.25em; font: inherit; font-weight: 800; font-size: .95rem;
  cursor: pointer; transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.chip:hover { transform: translateY(-2px); border-color: var(--ink); }
.chip.is-selected { background: var(--grape); border-color: var(--ink); color: #fff; box-shadow: var(--shadow-pop); }
.chip .en { color: inherit; opacity: .75; }
.note {
  margin-top: .8rem; font-size: .85rem; font-weight: 750; color: var(--coral-deep);
  background: var(--coral-light); border: 2px dashed var(--coral); border-radius: var(--radius-sm);
  padding: .6em .9em; line-height: 1.5;
}

.hint { margin-top: .5rem; font-size: .78rem; color: var(--ink-soft); }

.start-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: .8rem; padding: .6rem 0 1rem; }

/* 教师端专属：页内上传教学资料 + 课程资料入口（学生视角隐藏） */
.upload-cta {
  background: var(--sun-light);
  border: var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: clamp(1rem, 2.6vw, 1.4rem); margin-bottom: 1.3rem;
}
.upload-cta[hidden] { display: none; }
.upload-cta-body b { display: block; font-size: 1.02rem; font-weight: 900; line-height: 1.35; }
.upload-cta-body b .en { color: var(--coral-deep); font-size: .8em; letter-spacing: .04em; }
.upload-cta-body p { margin-top: .35rem; font-size: .8rem; line-height: 1.55; color: var(--ink-soft); font-weight: 600; }
.upload-cta-body p .en { display: block; }
.upload-cta-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .9rem; }
.upload-status { margin-top: .7rem; font-size: .82rem; font-weight: 750; color: var(--coral-deep); line-height: 1.5; }
.upload-status[hidden] { display: none; }
.upload-status .en { display: block; font-weight: 600; color: var(--ink-soft); }
.upload-preview { margin-top: .9rem; border-top: 2px dashed rgba(45, 42, 74, .25); padding-top: .9rem; }
.upload-preview[hidden] { display: none; }
.upload-title-label { display: block; font-size: .82rem; font-weight: 800; }
.upload-title-input {
  margin-top: .3rem; width: 100%; border: 3px solid rgba(45, 42, 74, .3); border-radius: var(--radius-md);
  background: #fff; font: inherit; font-weight: 650; font-size: .9rem; color: var(--ink); padding: .6em .8em;
}
.upload-title-input:focus { outline: none; border-color: var(--sky); }
.upload-stats { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; font-size: .76rem; }
.upload-stats span { border-radius: 999px; background: #fff; border: 2px solid rgba(45, 42, 74, .18); padding: .25em .7em; font-weight: 750; }
.upload-stats span .en { font-weight: 600; color: var(--ink-soft); }
.upload-samples { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; font-size: .76rem; }
.upload-samples span { border-radius: var(--radius-sm); background: #fff; border: 2px solid rgba(45, 42, 74, .18); padding: .25em .6em; font-weight: 650; }
.upload-samples span .lv { font-size: .85em; color: var(--ink-soft); }
.upload-warnings { margin-top: .6rem; border-radius: var(--radius-sm); background: #fff; border: 2px dashed var(--coral); padding: .5em .8em; font-size: .76rem; font-weight: 650; color: var(--coral-deep); line-height: 1.6; list-style: none; }
.upload-warnings[hidden] { display: none; }
.upload-preview-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.upload-saved { margin-top: .9rem; border-top: 2px dashed rgba(45, 42, 74, .25); padding-top: .9rem; }
.upload-saved[hidden] { display: none; }
.upload-saved b { font-size: .95rem; font-weight: 900; }
.upload-saved b .en { color: var(--ink-soft); font-size: .8em; }
.upload-saved-code { margin-top: .5rem; font-size: .84rem; font-weight: 750; }
.upload-saved code { background: #fff; border: 2px solid rgba(45, 42, 74, .18); border-radius: var(--radius-sm); padding: .2em .6em; font-weight: 800; }
.upload-saved-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .7rem; }
.upload-saved-row code { min-width: 0; flex: 1 1 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; font-weight: 650; }
.upload-login { margin-top: .7rem; font-size: .8rem; font-weight: 750; color: var(--coral-deep); }
.upload-login[hidden] { display: none; }
.upload-manage-link { font-size: .78rem; font-weight: 750; color: var(--ink-soft); }
.foot-note { text-align: center; font-size: .76rem; color: var(--ink-soft); font-weight: 650; }

/* ============ 第二屏：HUD ============ */
#screen-game { max-width: 1080px; margin: 0 auto; padding: clamp(.7rem, 2vw, 1.4rem) clamp(.7rem, 3vw, 1.4rem) 2rem; }

.hud {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 253, 247, .92); backdrop-filter: blur(8px);
  border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: .7rem clamp(.8rem, 2vw, 1.2rem);
  margin-bottom: .9rem;
}
.hud-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.hud-row + .hud-row { margin-top: .6rem; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1; justify-content: center; }
.badge {
  font-size: .74rem; font-weight: 800; padding: .32em .8em; border-radius: 999px;
  border: 2px solid var(--ink); white-space: nowrap;
}
.badge-mode { background: var(--grape-light); }
.badge-type { background: var(--sky-light); }
.badge-level { background: var(--sun-light); }

.stats-row { justify-content: space-between; }
.stat { display: flex; align-items: center; gap: .35em; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.stat .ic { width: 1.05em; height: 1.05em; color: var(--coral); }
.stat b { font-size: 1.08rem; font-weight: 900; }
.stat span { color: var(--ink-soft); font-size: .74em; }
.stat.teams b { color: var(--red); }
.stat.teams:last-of-type b { color: var(--blue); }

.hearts { display: flex; gap: .25em; }
.hearts .ic { width: 22px; height: 22px; color: var(--rose); transition: transform 200ms ease; }
.hearts .ic.lost { color: rgba(45, 42, 74, .18); transform: scale(.82); }
.hearts .ic.break { animation: heartBreak 420ms ease; }
@keyframes heartBreak { 30% { transform: scale(1.45) rotate(-8deg); } 100% { transform: scale(.82); } }

.timer { position: relative; width: 46px; height: 46px; flex: none; display: grid; place-items: center; }
.timer-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: rgba(45, 42, 74, .12); stroke-width: 5; }
.timer-fg {
  fill: none; stroke: var(--mint); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 119.4; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke 300ms ease;
}
.timer.urgent .timer-fg { stroke: var(--red); }
.timer.urgent b { color: var(--red); animation: pulse 700ms ease infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }

.progress-dots { display: flex; gap: .3em; justify-content: center; margin-top: .55rem; flex-wrap: wrap; }
.progress-dots i {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(45, 42, 74, .14); border: 2px solid transparent; transition: all 200ms ease;
}
.progress-dots i.done { background: var(--mint); }
.progress-dots i.wrong { background: var(--rose); }
.progress-dots i.now { background: var(--sun); border-color: var(--ink); transform: scale(1.3); }

/* ============ 舞台 ============ */
.stage-area { display: flex; gap: 1rem; align-items: flex-start; position: relative; }
.stage { flex: 1; min-width: 0; }

.stage-card {
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: clamp(1rem, 2.6vw, 1.6rem);
  animation: cardIn 340ms cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

/* 滚动进入视口时为游戏屏 sticky HUD 留出空间，避免聚焦/点击被遮挡 */
#screen-game .opt, #screen-game .btn, #screen-game .tile, #screen-game .mm-card,
#screen-game .chess-cell, #screen-game .plank, #screen-game .tstep, #screen-game .shop-item,
#screen-game .shop-mod, #screen-game input, #screen-game textarea, #screen-game select,
#screen-game .py-tone-btn, #screen-game .py-word {
  scroll-margin-top: 18rem;
}

.stage-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.stage-level { font-size: .8rem; font-weight: 800; color: var(--ink-soft); }
.stage-level b { color: var(--coral-deep); font-size: 1.05rem; }

.prompt { font-size: clamp(1.05rem, 3vw, 1.3rem); font-weight: 850; line-height: 1.5; }
.prompt .en { display: block; margin-top: .15em; }
.instruction {
  margin-top: .3rem; font-size: .88rem; font-weight: 700; color: var(--ink-soft);
  background: var(--sky-light); border-radius: var(--radius-sm); padding: .55em .8em; display: inline-block;
}

/* 大字题干卡 */
.stem {
  margin: 1rem 0; text-align: center; padding: clamp(1.2rem, 4vw, 2rem) 1rem;
  border-radius: var(--radius-md); border: 3px dashed rgba(45, 42, 74, .3);
  background: linear-gradient(160deg, #fff7e0, #ffe9f2);
}
.stem-hanzi { font-size: clamp(2.6rem, 9vw, 4.2rem); font-weight: 900; line-height: 1.15; letter-spacing: .05em; }
.stem-pinyin { font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 850; color: var(--grape); letter-spacing: .08em; }
.stem-sentence { font-size: clamp(1.2rem, 3.6vw, 1.7rem); font-weight: 850; line-height: 1.9; color: #3b2f63; }
.stem-sentence .blank { color: var(--coral); border-bottom: 4px solid var(--coral); padding: 0 .4em; }
.stem-sub { margin-top: .5rem; color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.stem-word-tap { cursor: pointer; border-radius: 8px; padding: 0 .12em; transition: background 150ms ease; }
.stem-word-tap:hover { background: rgba(255, 122, 89, .16); }
.stem-word-tap.is-picked { background: var(--coral); color: #fff; }
.stem-word-tap.is-wrong { background: var(--red); color: #fff; animation: shake 400ms ease; }
/* 纯展示的分句块（不可点击，不要 tap 暗示） */
.stem-chunk { padding: 0 .12em; }

/* 选项网格 */
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; margin-top: .9rem; }
.options.cols-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.opt {
  display: flex; align-items: center; gap: .6em; text-align: left;
  border: 3px solid rgba(45, 42, 74, .28); border-radius: var(--radius-md);
  background: #fff; padding: .8em 1em; font: inherit; font-weight: 800; font-size: 1.05rem;
  color: var(--ink); cursor: pointer; min-height: 56px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.opt:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--ink); background: #fffaf0; }
.opt:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.opt .opt-key {
  display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; flex: none;
  background: var(--sky-light); border-radius: 10px; font-weight: 900; color: var(--sky-deep);
}
.opt .opt-sub { display: block; font-size: .78em; color: var(--ink-soft); font-weight: 700; }
.opt.is-correct { position: relative; border-color: var(--mint-deep); background: var(--mint-light); animation: pop 320ms ease; }
.opt.is-wrong { border-color: var(--red); background: #ffe3e3; animation: shake 420ms ease; }
.opt.is-picked { border-color: var(--sky-deep); background: var(--sky-light); }
.opt:disabled { cursor: default; }
/* 答对：绿色光圈扩散 */
.opt.is-correct::after, .mm-card.ok::after, .flip-card.matched::after {
  content: ""; position: absolute; inset: -5px; border-radius: inherit;
  border: 4px solid var(--mint); pointer-events: none; z-index: 2;
  animation: haloRing 760ms ease-out both;
}
@keyframes haloRing { from { transform: scale(.9); opacity: .95; } to { transform: scale(1.22); opacity: 0; } }
@keyframes pop { 55% { transform: scale(1.045); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 22% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 68% { transform: translateX(-4px); } }

/* 词语 / 拼音 瓷砖块（排序、拼图共用） */
.tile {
  display: inline-flex; align-items: center; justify-content: center; gap: .3em;
  border: 3px solid var(--ink); border-radius: var(--radius-sm);
  background: #fff; padding: .5em .9em; font: inherit; font-weight: 850; font-size: 1.15rem;
  color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 rgba(45, 42, 74, .16);
  transition: transform 120ms ease, box-shadow 120ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tile:hover:not(:disabled) { transform: translateY(-2px); background: var(--sun-light); }
.tile:disabled { cursor: default; opacity: .85; }
.tile .py { font-size: .72em; color: var(--grape); font-weight: 750; }
.tile.is-used { background: var(--sky-light); border-style: dashed; opacity: .55; box-shadow: none; transform: none; }
.tile.is-placed { background: var(--sky-light); }

/* 打拼音：手打输入框 + 每个字一个可选声调 */
.py-input { width: 100%; margin-top: .8rem; text-align: left; }
.py-input.is-empty-warn { border-color: var(--red); animation: shake 420ms ease; }
/* 逐字进度：一个字一个格子，显示汉字 + 已输入拼音 */
.py-word-row { display: flex; flex-wrap: wrap; gap: .38rem; margin-top: .85rem; }
.py-word {
  display: grid; gap: .06rem; min-width: 2.9rem; padding: .3rem .36rem;
  border: 2px solid rgba(45, 42, 74, .18); border-radius: 10px; background: rgba(255, 255, 255, .65);
  font: inherit; color: var(--ink); cursor: pointer; text-align: center;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.py-word b { font-size: 1rem; font-weight: 900; line-height: 1.1; }
.py-word span {
  min-height: .95em; font-size: .74rem; font-weight: 800; line-height: 1.2;
  color: var(--grape); white-space: nowrap;
}
.py-word.is-current { border-color: var(--coral-deep); background: #fff; box-shadow: 0 0 0 3px rgba(240, 120, 90, .16); }
.py-word.is-done span { color: var(--mint-deep); }
.py-tone-bar { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .7rem; }
.py-tone-btn {
  min-width: 1.9rem; height: 1.9rem; padding: 0 .24rem; border: 2px solid rgba(45, 42, 74, .2);
  border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: .9rem; font-weight: 800;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.py-tone-btn.is-on { background: var(--mint-deep); border-color: var(--mint-deep); color: #fff; }
.py-tone-btn:disabled { opacity: .6; cursor: default; }
.py-tone-hint { margin-top: .45rem; font-size: .78rem; color: var(--ink-soft); }
@media (max-width: 560px) {
  .py-word-row { gap: .3rem; }
  .py-word { min-width: 2.5rem; padding: .26rem .28rem; }
  .py-tone-btn { min-width: 1.7rem; height: 1.7rem; font-size: .82rem; }
}

.slot-row { display: flex; flex-wrap: wrap; gap: .55rem; margin: .8rem 0; min-height: 62px; align-items: center; }
.slot {
  display: inline-grid; place-items: center; min-width: 76px; min-height: 58px;
  border: 3px dashed rgba(45, 42, 74, .35); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .6); font-size: 1.3rem; font-weight: 900; color: var(--ink);
}
.slot.filled { border-style: solid; border-color: var(--ink); background: #fff; }
.slot.slot-ok { border-color: var(--mint-deep); background: var(--mint-light); }
.slot.slot-bad { border-color: var(--red); background: #ffe3e3; animation: shake 400ms ease; }

.tile-pool { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }

/* 消除 / 翻牌 网格 */
.grid-cards { display: grid; gap: .7rem; margin-top: 1rem; }
.grid-cards.g3 { grid-template-columns: repeat(4, 1fr); }
.grid-cards.g4 { grid-template-columns: repeat(3, 1fr); }
.flip-card {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; border: 0; background: none;
  cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  filter: drop-shadow(0 6px 0 rgba(27, 23, 52, .18));
  transition: transform 160ms ease, filter 160ms ease;
}
.flip-card:hover:not(.matched) { transform: translateY(-4px); filter: drop-shadow(0 10px 0 rgba(27, 23, 52, .15)); }
.flip-card:active:not(.matched) { transform: translateY(-1px) scale(.985); }
.flip-inner { position: absolute; inset: 0; transition: transform 260ms cubic-bezier(.34, 1.4, .64, 1); }
.flip-card.flipped .flip-inner { transform: scale(1.03); }
.flip-face {
  position: absolute; inset: 0; border-radius: 12px;
  transition: opacity 170ms ease;
}

/* —— 牌背：深靛底 + 斜向菱形暗纹 + 米金内框 + 中央徽章 —— */
.flip-back {
  opacity: 1;
  border: 3px solid #171331;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .085) 0 5px, transparent 5px 11px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .085) 0 5px, transparent 5px 11px),
    radial-gradient(circle at 50% 40%, #443d80 0%, #2b2557 58%, #1c1740 100%);
  box-shadow:
    inset 0 0 0 3px #f3ead2,
    inset 0 0 0 5px rgba(255, 255, 255, .22),
    inset 0 0 0 7px #1b1734;
}
.flip-back::after {
  content: "汉"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 46%; aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 50%; font-size: 1.5em; font-weight: 900; color: #f7d98a;
  background: radial-gradient(circle at 35% 30%, #4a4389, #241f4a 72%);
  box-shadow: 0 0 0 2px rgba(247, 217, 138, .55), 0 0 18px rgba(247, 217, 138, .18);
}

/* —— 牌面：米白纸面 + 细内框 + 四角「汉/拼 + 四君子」花色索引 + 中央大字号 —— */
.flip-front {
  opacity: 0; pointer-events: none;
  display: grid; place-items: center; padding: .55rem .4rem;
  background: radial-gradient(circle at 50% 18%, #fffdf6 0%, #fbf3df 72%, #f4e7c9 100%);
  border: 3px solid #201b3d;
  box-shadow: inset 0 0 0 2px rgba(32, 27, 61, .1), inset 0 0 14px rgba(196, 160, 90, .16);
  color: var(--ink); text-align: center; overflow: hidden;
}
.pc-corner {
  display: flex; flex-direction: row; align-items: center; gap: .14em;
  font-size: clamp(.55rem, 1.8vw, .7rem); line-height: 1; font-weight: 900;
}
.pc-corner i { font-style: normal; font-size: 1.12em; color: #221d40; }
.pc-tl { position: absolute; top: .45rem; left: .48rem; }
.pc-br { position: absolute; bottom: .55rem; right: .5rem; transform: rotate(180deg); }
/* 四君子花色着色：梅红 / 兰青 / 竹绿 / 菊黄 */
.pc-suit-mei .pc-corner i, .pc-suit-mei .pc-watermark { color: #b8324f; }
.pc-suit-lan .pc-corner i, .pc-suit-lan .pc-watermark { color: #3d6b8c; }
.pc-suit-zhu .pc-corner i, .pc-suit-zhu .pc-watermark { color: #4d8a5a; }
.pc-suit-ju  .pc-corner i, .pc-suit-ju  .pc-watermark { color: #c08a2e; }
.pc-watermark {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 3.2em; line-height: 1; opacity: .07; color: #221d40;
  pointer-events: none; user-select: none;
}
.pc-centre {
  position: relative; z-index: 1; display: block; max-width: 100%;
  font-weight: 900; line-height: 1.2; overflow-wrap: anywhere;
}
.pc-centre.pc-hz { font-size: clamp(1.2rem, 5.4vw, 1.6rem); letter-spacing: .02em; }
.pc-centre.pc-py { font-size: clamp(.86rem, 3.1vw, 1.04rem); letter-spacing: .01em; color: #3a3468; }
.flip-card.flipped .flip-back { opacity: 0; pointer-events: none; }
.flip-card.flipped .flip-front { opacity: 1; pointer-events: auto; }

/* 配对成功：薄荷牌面 + 右上角对勾 */
.flip-card.matched { animation: pop 340ms ease; pointer-events: none; }
.flip-card.matched .flip-front {
  border-color: var(--mint-deep);
  background: radial-gradient(circle at 50% 18%, #f6fffb 0%, #e6fbf3 80%);
  box-shadow: inset 0 0 0 2px rgba(46, 207, 160, .5), inset 0 0 18px rgba(46, 207, 160, .22);
}
.flip-card.matched::after {
  content: "✓"; position: absolute; top: -7px; right: -7px; z-index: 2;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mint-deep); color: #fff; font-size: .8rem; font-weight: 900;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .16);
}
/* 翻错：红牌面 + 抖动 */
.flip-card.wrongpick .flip-front {
  border-color: var(--red);
  background: radial-gradient(circle at 50% 18%, #fff7f7 0%, #ffe3e3 82%);
  animation: shake 420ms ease;
}

/* 翻牌配对：手机端改为两列，保证汉字/拼音看得清 */
@media (max-width: 560px) {
  .grid-cards.flip-grid { grid-template-columns: repeat(2, 1fr) !important; gap: .85rem; }
  .flip-back::after { font-size: 1.35em; }
}

/* 消消乐卡片：贴纸风牌面 + 主题色花纹（花纹只走底纹和左上角徽章，不压字） */
.mm-card {
  position: relative;
  aspect-ratio: 1; display: grid; place-items: center; text-align: center;
  border: 3px solid var(--ink); border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #fff 34%, var(--suit-soft) 100%);
  font: inherit; font-weight: 850; font-size: clamp(.85rem, 2.4vw, 1.05rem); color: var(--ink);
  cursor: pointer; padding: 1.2rem .4rem .4rem; overflow-wrap: break-word; line-height: 1.25;
  box-shadow: 0 4px 0 rgba(45, 42, 74, .16);
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  --suit: var(--grape); --suit-soft: var(--grape-light);
}
/* 全幅淡花纹：极低不透明度，只做质感 */
.mm-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  opacity: .17; pointer-events: none;
}
/* 左上角花纹徽章：固定角落，文字靠 padding 让位 */
.mm-card .mj {
  position: absolute; top: .36rem; left: .36rem; z-index: 2;
  width: 1.05rem; height: 1.05rem; pointer-events: none;
}
.mm-card .mm-text { position: relative; z-index: 1; display: block; max-width: 100%; }

/* —— 八种主题花纹：点阵 / 竖条 / 菱格 / 圆环 / 花瓣 / 方格 / 人字 / 圆点格 —— */
.mm-card.s-dot { --suit: var(--mint); --suit-soft: var(--mint-light); }
.mm-card.s-dot::before {
  background-image: radial-gradient(circle, var(--suit) 0 1.4px, transparent 1.5px);
  background-size: 13px 13px;
}
.mj-dot { background: radial-gradient(circle, var(--suit) 0 30%, transparent 31%); }

.mm-card.s-stripe { --suit: var(--sky); --suit-soft: var(--sky-light); }
.mm-card.s-stripe::before {
  background-image: repeating-linear-gradient(90deg, var(--suit) 0 1.5px, transparent 1.5px 11px);
}
.mj-stripe { background: repeating-linear-gradient(90deg, var(--suit) 0 2px, transparent 2px 5.5px); }

.mm-card.s-diamond { --suit: var(--grape); --suit-soft: var(--grape-light); }
.mm-card.s-diamond::before {
  background-image:
    repeating-linear-gradient(45deg, transparent 0 8px, var(--suit) 8px 9px),
    repeating-linear-gradient(-45deg, transparent 0 8px, var(--suit) 8px 9px);
}
.mj-diamond { background: var(--suit); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

.mm-card.s-ring { --suit: var(--rose); --suit-soft: var(--rose-light); }
.mm-card.s-ring::before {
  background-image: radial-gradient(circle, transparent 0 5px, var(--suit) 5px 6px, transparent 6px);
  background-size: 20px 20px;
}
.mj-ring { background: radial-gradient(circle, transparent 0 32%, var(--suit) 33% 56%, transparent 57%); }

.mm-card.s-petal { --suit: var(--red); --suit-soft: var(--rose-light); }
.mm-card.s-petal::before {
  background-image:
    radial-gradient(circle at 30% 30%, var(--suit) 0 18%, transparent 19%),
    radial-gradient(circle at 70% 30%, var(--suit) 0 18%, transparent 19%),
    radial-gradient(circle at 30% 70%, var(--suit) 0 18%, transparent 19%),
    radial-gradient(circle at 70% 70%, var(--suit) 0 18%, transparent 19%);
  background-size: 22px 22px;
}
.mj-petal {
  background:
    radial-gradient(circle at 30% 30%, var(--suit) 0 24%, transparent 25%),
    radial-gradient(circle at 70% 30%, var(--suit) 0 24%, transparent 25%),
    radial-gradient(circle at 30% 70%, var(--suit) 0 24%, transparent 25%),
    radial-gradient(circle at 70% 70%, var(--suit) 0 24%, transparent 25%);
}

.mm-card.s-grid { --suit: var(--aqua); --suit-soft: var(--aqua-light); }
.mm-card.s-grid::before {
  background-image:
    linear-gradient(var(--suit) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--suit) 1.5px, transparent 1.5px);
  background-size: 12px 12px;
}
.mj-grid {
  background:
    linear-gradient(var(--suit) 2px, transparent 2px),
    linear-gradient(90deg, var(--suit) 2px, transparent 2px);
  background-size: 5.5px 5.5px;
}

.mm-card.s-chevron { --suit: var(--ink-soft); --suit-soft: var(--cream); }
.mm-card.s-chevron::before {
  background-image:
    linear-gradient(135deg, transparent 0 68%, var(--suit) 68% 74%, transparent 74%),
    linear-gradient(45deg, transparent 0 68%, var(--suit) 68% 74%, transparent 74%);
  background-size: 15px 15px;
}
.mj-chevron { background: var(--suit); clip-path: polygon(0 64%, 50% 26%, 100% 64%, 100% 100%, 50% 62%, 0 100%); }

.mm-card.s-dotgrid { --suit: var(--coral); --suit-soft: var(--coral-light); }
.mm-card.s-dotgrid::before {
  background-image:
    radial-gradient(circle, var(--suit) 0 1.2px, transparent 1.3px),
    radial-gradient(circle, var(--suit) 0 1.2px, transparent 1.3px);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.mj-dotgrid {
  background-image:
    radial-gradient(circle, var(--suit) 0 1.6px, transparent 1.7px),
    radial-gradient(circle, var(--suit) 0 1.6px, transparent 1.7px);
  background-size: 7px 7px;
  background-position: 0 0, 3.5px 3.5px;
}

.mm-card .py { display: block; font-size: .78em; color: var(--grape); font-weight: 750; }
.mm-card:hover:not(:disabled) { transform: translateY(-2px); }
.mm-card.sel {
  background: var(--coral-light); border-color: var(--coral-deep); transform: scale(1.04);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .18), 0 4px 0 rgba(45, 42, 74, .16);
}
.mm-card.ok {
  background: var(--mint-light); border-color: var(--mint-deep); animation: vanish 380ms ease forwards;
}
.mm-card.bad {
  background: #ffe3e3; border-color: var(--red); animation: shake 380ms ease;
}
.mm-card.sel::before, .mm-card.ok::before, .mm-card.bad::before { opacity: .08; }
.mm-card:disabled { cursor: default; }
/* 手机端改两列：卡片更大，拼音不会被挤成多行 */
@media (max-width: 560px) {
  .grid-cards.g4 { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .mm-card { padding: 1.05rem .35rem .35rem; }
}
@keyframes vanish { 60% { transform: scale(1.14) rotate(3deg); opacity: 1; } 100% { transform: scale(0) rotate(-8deg); opacity: 0; } }

/* 案件棋盘（红蓝词棋） */
.chess-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; max-width: 340px; margin: 1rem auto; }
.chess-cell {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 2rem;
  border: 3px dashed rgba(45, 42, 74, .3); border-radius: var(--radius-sm); background: #fff;
  cursor: pointer; transition: transform 120ms ease;
}
.chess-cell span { width: 68%; height: 68%; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; }
.chess-cell.red span { background: var(--red); color: #fff; font-size: .5em; font-weight: 900; animation: pop 300ms ease; }
.chess-cell.blue span { background: var(--blue); color: #fff; font-size: .5em; font-weight: 900; animation: pop 300ms ease; }
.chess-cell:hover:not(.taken) { transform: scale(1.05); border-color: var(--ink); }
.chess-cell.win span { animation: winGlow 900ms ease infinite; }
@keyframes winGlow { 50% { box-shadow: 0 0 0 8px rgba(255, 197, 61, .55); } }

/* 修桥 / 爬山 / 藏宝图 可视化 */
.bridge-track { margin: 1.2rem 0; }
.bridge-planks { display: flex; gap: 4px; align-items: flex-end; min-height: 74px; }
.plank {
  width: 44px; height: 44px; border: 3px dashed rgba(45, 42, 74, .3); border-radius: 10px;
  background: rgba(255, 255, 255, .55); transition: all 260ms ease;
}
.plank.laid { border-style: solid; border-color: var(--ink); background: repeating-linear-gradient(90deg, var(--sun) 0 10px, #ffb830 10px 20px); height: 58px; animation: pop 300ms ease; }
.plank.wobble { border-color: var(--red); background: #ffe3e3; animation: shake 420ms ease; }
.bridge-pet { display: flex; justify-content: space-between; margin-top: .4rem; font-weight: 800; color: var(--ink-soft); font-size: .8rem; }

.treasure-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; max-width: 460px; margin: 1rem auto; }
.tstep {
  aspect-ratio: 1; border-radius: 10px; border: 2.5px solid rgba(45, 42, 74, .22);
  background: rgba(255, 255, 255, .5); display: grid; place-items: center;
  font-size: 1.15rem; color: rgba(45, 42, 74, .3); transition: all 240ms ease;
}
.tstep.found { background: var(--sun-light); border-color: var(--sun); color: var(--coral-deep); }
.tstep.trap { background: #ffe3e3; border-color: var(--red); }
.tstep.now { border-color: var(--ink); border-style: dashed; animation: pulse 1.2s ease infinite; }
.tstep.chest { background: var(--mint-light); border-color: var(--mint-deep); }

.race-track { margin: 1rem 0; position: relative; }
.race-lane { position: relative; height: 64px; margin: .5rem 0; border-radius: var(--radius-md); background: rgba(255, 255, 255, .65); border: 3px solid rgba(45, 42, 74, .18); }
.race-lane .flag { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; }
.racer {
  position: absolute; top: 50%; transform: translateY(-50%);
  transition: left 500ms cubic-bezier(.34, 1.3, .64, 1);
  width: 44px; height: 44px;
}
.racer .pet { width: 44px; height: 44px; }
.racer.red { left: 2%; }
.racer.blue { left: 2%; }
.racer .racer-tag { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .68rem; font-weight: 900; white-space: nowrap; }
.racer.red .racer-tag { color: var(--red); }
.racer.blue .racer-tag { color: var(--blue); }

/* 店铺点单 */
.shop-board { margin-top: .8rem; }
.shop-customer {
  display: flex; gap: .8rem; align-items: center; background: linear-gradient(160deg, #e8f3ff, #f5eaff);
  border: 3px dashed rgba(45, 42, 74, .3); border-radius: var(--radius-md); padding: 1rem; margin-bottom: .9rem;
}
.shop-customer .avatar {
  width: 62px; height: 62px; flex: none; border-radius: 50%; border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff, var(--rose-light)); display: grid; place-items: center;
}
.shop-customer .avatar::after { content: ""; width: 26px; height: 26px; border-radius: 50%; background: var(--rose); border: 2.5px solid var(--ink); }
.shop-say { font-size: clamp(1.05rem, 3vw, 1.3rem); font-weight: 850; line-height: 1.5; }
.shop-say .py { display: block; font-size: .68em; color: var(--grape); font-weight: 750; letter-spacing: .04em; }
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; }
.shop-item {
  border: 3px solid rgba(45, 42, 74, .25); border-radius: var(--radius-md); background: #fff;
  padding: .6rem .4rem; font: inherit; font-weight: 800; font-size: .88rem; color: var(--ink);
  cursor: pointer; text-align: center; transition: transform 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.shop-item:hover { transform: translateY(-2px); border-color: var(--ink); }
.shop-item .py { display: block; font-size: .72em; color: var(--grape); }
.shop-item .price { display: block; font-size: .72em; color: var(--ink-soft); }
.shop-item .badge-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-top: .3rem;
  border-radius: 999px; background: var(--coral); color: #fff; font-size: .8rem; font-weight: 900;
}
.shop-order {
  margin-top: .9rem; border-top: 3px dashed rgba(45, 42, 74, .25); padding-top: .8rem;
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; min-height: 56px;
}
.shop-order .order-chip {
  background: var(--mint-light); border: 2.5px solid var(--mint-deep); border-radius: 999px;
  padding: .35em .9em; font-weight: 850; font-size: .95rem;
}
.shop-order .order-empty { color: var(--ink-soft); font-size: .85rem; }
.shop-actions { display: flex; gap: .6rem; margin-top: .9rem; flex-wrap: wrap; }

/* 团队计分板 */
.team-board { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.team-card { border: var(--border); border-radius: var(--radius-md); padding: .8rem; text-align: center; background: #fff; }
.team-card.red { background: #fff0f0; }
.team-card.blue { background: #f0f5ff; }
.team-card .t-name { font-size: .82rem; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: .35em; }
.team-card .t-score { font-size: 1.9rem; font-weight: 900; }
.team-card.red .t-score { color: var(--red); }
.team-card.blue .t-score { color: var(--blue); }
.team-card.turn { box-shadow: 0 0 0 4px var(--sun); }
.team-card .pet-mini { width: 54px; height: 54px; margin: .2rem auto; }

/* ============ 宠物团子（3D 形象 + 答题情绪动画） ============ */
.pet { position: relative; }
.pet-img {
  width: 100%; height: auto; display: block;
  transform-origin: 50% 92%;
  animation: petBreathe 3s ease-in-out infinite;
  -webkit-user-drag: none; user-select: none;
}
@keyframes petBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035, .965); } }
/* 团队战：红/蓝光晕区分两队 */
.pet.tint-red .pet-img { filter: drop-shadow(0 0 10px rgba(255, 90, 90, .6)); }
.pet.tint-blue .pet-img { filter: drop-shadow(0 0 10px rgba(74, 141, 255, .6)); }
/* 情绪特效层：泪滴/星星/爱心/问号挂载点 */
.pet-fx { position: absolute; inset: 0; pointer-events: none; }

/* 答对：连续蹦跳两次 + 两侧星星闪 */
.pet.mood-happy .pet-img { animation: petHop 620ms cubic-bezier(.34, 1.56, .64, 1) 2; }
@keyframes petHop { 40% { transform: translateY(-13px) scale(.97); } 70% { transform: translateY(0) scale(1.05, .93); } 100% { transform: none; } }
.pet.mood-happy .pet-fx::before,
.pet.mood-happy .pet-fx::after {
  content: "✦"; position: absolute; top: 10%; font-size: 1.15rem; font-weight: 900;
  color: var(--sun); text-shadow: 0 0 7px rgba(255, 197, 61, .9);
  animation: petTwinkle 900ms ease-in-out infinite;
}
.pet.mood-happy .pet-fx::before { left: -8%; }
.pet.mood-happy .pet-fx::after { right: -8%; animation-delay: .45s; }
@keyframes petTwinkle { 0%, 100% { transform: scale(.55) rotate(0deg); opacity: .25; } 50% { transform: scale(1.2) rotate(22deg); opacity: 1; } }

/* 答错：低头塌肩（外层）+ 左右轻晃（内层）+ 双眼掉泪 */
.pet.mood-sad { animation: petDroop 900ms ease both; }
@keyframes petDroop { 40% { transform: translateY(5px) scale(1.04, .95); } 100% { transform: translateY(4px) scale(1.02, .96); } }
.pet.mood-sad .pet-img { animation: petWobble 1.3s ease-in-out 900ms infinite; }
@keyframes petWobble { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.pet.mood-sad .pet-fx::before,
.pet.mood-sad .pet-fx::after {
  content: ""; position: absolute; top: 34%; width: 9px; height: 9px;
  background: #7cc7ff; border: 2px solid rgba(45, 42, 74, .6);
  border-radius: 0 50% 50% 50%; transform: rotate(45deg);
  animation: tearFall 1.3s ease-in infinite;
}
.pet.mood-sad .pet-fx::before { left: 22%; }
.pet.mood-sad .pet-fx::after { right: 22%; animation-delay: .55s; }
@keyframes tearFall {
  0% { translate: 0 0; opacity: 0; }
  25% { opacity: 1; }
  100% { translate: 0 17px; opacity: 0; }
}

/* 思考（开局加油）：歪头 + 问号 */
.pet.mood-think .pet-img { animation: petTilt 1.6s ease-in-out infinite; }
@keyframes petTilt { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(5deg); } }
.pet.mood-think .pet-fx::after {
  content: "?"; position: absolute; top: -6%; right: -12%;
  font-size: 1.25rem; font-weight: 900; color: var(--sky-deep);
  animation: petTwinkle 1.4s ease-in-out infinite;
}

/* 连对兴奋：快速蹦跳 + 彩色光环 + 星星 */
.pet.mood-excited .pet-img { animation: petHop 460ms cubic-bezier(.34, 1.56, .64, 1) infinite; }
.pet.mood-excited::before {
  content: ""; position: absolute; inset: -14%; border-radius: 50%; z-index: -1;
  background: conic-gradient(#ff7a59, #ffc53d, #2ecfa0, #4aa8ff, #8c5bf0, #ff6b9d, #ff7a59);
  filter: blur(7px); opacity: .38; animation: petSpin 2.6s linear infinite;
}
@keyframes petSpin { to { transform: rotate(360deg); } }
.pet.mood-excited .pet-fx::before,
.pet.mood-excited .pet-fx::after {
  content: "★"; position: absolute; top: 4%; font-size: 1rem; font-weight: 900;
  color: #fff; text-shadow: 0 0 6px var(--grape), 0 0 2px var(--ink);
  animation: petTwinkle 620ms ease-in-out infinite;
}
.pet.mood-excited .pet-fx::before { left: -10%; }
.pet.mood-excited .pet-fx::after { right: -10%; animation-delay: .3s; }

/* 连错安慰：轻轻摇摆 + 头顶爱心（陪伴感，不嘲讽） */
.pet.mood-comfort .pet-img { animation: petSway 1.5s ease-in-out infinite; }
@keyframes petSway { 0%, 100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }
.pet.mood-comfort .pet-fx::after {
  content: "♥"; position: absolute; top: -12%; left: 50%; translate: -50% 0;
  font-size: 1.05rem; color: var(--rose);
  animation: heartFloat 1.6s ease-in-out infinite;
}
@keyframes heartFloat { 0%, 100% { translate: -50% 0; opacity: .55; } 50% { translate: -50% -9px; opacity: 1; } }

/* 结算页欢呼：持续蹦跳 + 星星两侧闪 */
.pet.mood-cheer .pet-img { animation: petHop 560ms cubic-bezier(.34, 1.56, .64, 1) infinite; }
.pet.mood-cheer .pet-fx::before,
.pet.mood-cheer .pet-fx::after {
  content: "✦"; position: absolute; top: 6%; font-size: 1.1rem; font-weight: 900;
  color: var(--sun); text-shadow: 0 0 7px rgba(255, 197, 61, .9);
  animation: petTwinkle 800ms ease-in-out infinite;
}
.pet.mood-cheer .pet-fx::before { left: -7%; }
.pet.mood-cheer .pet-fx::after { right: -7%; animation-delay: .4s; }

.pet-bar { flex: none; width: 168px; display: flex; flex-direction: column; align-items: center; gap: .4rem; position: relative; }
.pet-bubble {
  position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 18px;
  padding: .55em .8em; font-size: .86rem; font-weight: 800; line-height: 1.45; text-align: center;
  box-shadow: var(--shadow-pop); max-width: 100%; animation: bubbleIn 260ms cubic-bezier(.34, 1.56, .64, 1) both;
}
.pet-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
}
.pet-bubble .en { display: block; }
.pet-bubble.pop { animation: bubblePop 300ms cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes bubblePop { 0% { transform: scale(.8); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.pet-name { font-size: .78rem; font-weight: 850; color: var(--ink-soft); }
.pet-name .en { display: block; font-size: .85em; }

#hero-pet .pet { width: 100%; }
#result-pet .pet { width: 150px; margin: 0 auto; }
.pet-mini .pet { width: 54px; height: 54px; }

/* ============ 陪伴宠物选择卡片 ============ */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .8rem; }
.pet-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .25em;
  text-align: center; padding: .9rem .5rem .8rem; cursor: pointer;
  background: #fff; border: 3px solid rgba(45, 42, 74, .25); border-radius: var(--radius-md);
  font: inherit; font-weight: 800; color: var(--ink);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pet-card:hover { transform: translateY(-3px); border-color: var(--ink); background: #fffdf4; }
.pet-card:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.pet-card-art { width: 88px; height: 88px; display: grid; place-items: center; flex: none; }
.pet-card-art .pet { width: 88px; height: 88px; }
.pet-card:hover .pet-img { animation: petHop 560ms cubic-bezier(.34, 1.56, .64, 1) 2; }
.pet-card-name { font-size: .92rem; line-height: 1.25; }
.pet-card-name .en { display: block; font-size: .68rem; color: var(--ink-soft); font-weight: 700; }
.pet-card-tag { font-size: .68rem; color: var(--ink-soft); font-weight: 650; }
.pet-card.is-selected { border-color: var(--ink); background: var(--sun-light); box-shadow: var(--shadow-pop); }
.pet-card.is-selected::after {
  content: "✓"; position: absolute; top: -10px; right: -8px;
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--mint); color: #fff; border: 2.5px solid var(--ink); border-radius: 50%;
  font-size: .8rem; box-shadow: 0 2px 0 rgba(45, 42, 74, .25);
}

/* ============ 反馈层 ============ */
.float-score {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, 0);
  font-size: 1.6rem; font-weight: 900; color: var(--mint-deep);
  text-shadow: 0 2px 0 #fff; pointer-events: none; z-index: 40;
  animation: floatUp 900ms ease-out forwards;
}
.float-score.minus { color: var(--red); }
@keyframes floatUp { to { transform: translate(-50%, -70px); opacity: 0; } }

.feedback-banner {
  display: flex; align-items: center; gap: .5em; justify-content: center;
  margin: .9rem auto 0; max-width: 560px; text-align: center;
  border: 3px solid var(--ink); border-radius: var(--radius-md);
  padding: .6em 1.1em; font-weight: 850; font-size: 1.02rem;
  animation: bubbleIn 240ms cubic-bezier(.34, 1.56, .64, 1) both;
}
.feedback-banner.good { background: var(--mint-light); }
/* 答错：温和灰色气泡 + 轻摇（不使用红色警示与惊吓元素） */
.feedback-banner.bad { background: #ecebf2; border-color: var(--ink-soft); animation: bubbleIn 240ms cubic-bezier(.34, 1.56, .64, 1) both, shake 460ms ease 240ms; }
.feedback-banner.info { background: var(--sun-light); }
.feedback-banner .en { display: block; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -24px; width: 12px; height: 12px; border-radius: 3px; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(105vh) rotate(720deg); } }

/* ============ 结算屏 ============ */
#screen-result { display: none; place-items: center; padding: 1.4rem; }
#screen-result.is-active { display: grid; }
.result-card { max-width: 520px; width: 100%; padding: clamp(1.2rem, 4vw, 2rem); text-align: center; }
.result-card h2 { font-size: clamp(1.4rem, 4.5vw, 1.9rem); font-weight: 900; }
.result-card h2 .en { display: block; color: var(--coral); }
.stars { display: flex; justify-content: center; gap: .3rem; margin: 1rem 0; min-height: 48px; }
.stars .ic { width: 46px; height: 46px; color: rgba(45, 42, 74, .15); transform: scale(.9); transition: all 300ms ease; }
.stars .ic.lit { color: var(--sun); transform: scale(1.12); filter: drop-shadow(0 3px 0 rgba(45, 42, 74, .2)); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1rem 0; }
.result-stats .rs { background: var(--cream); border: 2.5px solid rgba(45, 42, 74, .2); border-radius: var(--radius-sm); padding: .7rem .4rem; }
.result-stats .rs b { display: block; font-size: 1.4rem; font-weight: 900; }
.result-stats .rs span { font-size: .74rem; color: var(--ink-soft); font-weight: 750; }
.result-teams { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1rem 0; }
.result-teams .team-card .t-score { font-size: 2.4rem; }
.result-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: .6rem; }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .stage-area { flex-direction: column-reverse; }
  .pet-bar { width: 100%; flex-direction: row; align-items: center; justify-content: center; gap: .8rem; }
  .pet-bar .pet { width: 84px; }
  .pet-name { display: none; }
  .pet-bubble { flex: 1; max-width: 420px; }
  .pet-bubble::after { left: 22px; }
}
@media (max-width: 560px) {
  .hud-row.stats-row { justify-content: center; }
  .stat { font-size: .76rem; }
  .options { grid-template-columns: 1fr; }
  .card-grid.modes { grid-template-columns: repeat(2, 1fr); }
  .card-grid.types { grid-template-columns: repeat(3, 1fr); }
  .pick-card { padding: .7rem .4rem .6rem; }
  .pick-card .pick-ic { width: 44px; height: 44px; border-radius: 14px; }
  .pick-card .pick-ic .ic { width: 26px; height: 26px; }
  .pick-card .pick-name { font-size: .82rem; }
  .pick-card .pick-desc { display: none; }
  .hero { flex-direction: column; text-align: center; }
  .hero-pet { width: 130px; }
  .tagline .en { display: inline; }
  .chess-board { max-width: 300px; }
  .result-stats { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .result-stats .rs b { font-size: 1.15rem; }
  .stars .ic { width: 38px; height: 38px; }
}

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

/* ============ 游戏说明弹窗 How to Play Modal ============ */
body.help-open { overflow: hidden; }

.help-modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: clamp(.7rem, 3vw, 2rem);
}
.help-modal[hidden] { display: none; }
.help-backdrop { position: absolute; inset: 0; background: rgba(45, 42, 74, .45); animation: fadeIn 200ms ease both; }

.help-card {
  position: relative; width: min(760px, 100%); max-height: min(86vh, 920px);
  display: flex; flex-direction: column;
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(45, 42, 74, .32);
  animation: popIn 260ms cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(14px); } to { opacity: 1; transform: none; } }

.help-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem clamp(1rem, 3vw, 1.5rem) .8rem;
  border-bottom: 3px dashed rgba(45, 42, 74, .18);
}
.help-head h2 { font-size: clamp(1.1rem, 3vw, 1.35rem); font-weight: 900; }
.help-head h2 .en { color: var(--grape); }
.help-x { width: 2.3em; height: 2.3em; padding: 0; border-radius: 50%; flex: none; }

.help-body { overflow-y: auto; padding: 1rem clamp(1rem, 3vw, 1.5rem); -webkit-overflow-scrolling: touch; }
.help-sec + .help-sec { margin-top: 1.15rem; }
.help-sec h3 { font-size: 1rem; font-weight: 900; display: flex; align-items: center; gap: .5em; margin-bottom: .55rem; }
.help-num {
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; flex: none;
  background: var(--coral); color: #fff; border-radius: 50%; font-size: .78em;
  border: 2.5px solid var(--ink); box-shadow: 0 3px 0 rgba(45, 42, 74, .2);
}

.help-steps { list-style: none; display: grid; gap: .5rem; }
.help-steps li {
  background: #fff; border: 2.5px solid rgba(45, 42, 74, .22); border-radius: var(--radius-sm);
  padding: .55em .8em; font-size: .84rem; line-height: 1.6; font-weight: 650;
}
.help-steps b { color: var(--coral-deep); }

.help-types { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.help-type {
  position: relative; background: #fff; border: 2.5px solid rgba(45, 42, 74, .22);
  border-radius: var(--radius-sm); padding: .55em .65em .6em;
  display: flex; flex-direction: column; gap: .28em;
}
.help-type-ic {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 10px; background: var(--grape-light); color: var(--ink);
}
.help-type-ic .ic { width: 18px; height: 18px; }
.help-type-name { font-size: .8rem; font-weight: 800; line-height: 1.3; }
.help-type-desc { font-size: .7rem; color: var(--ink-soft); font-weight: 650; line-height: 1.45; }
.help-type.is-locked { background: #f4f3f8; border-style: dashed; }
.help-type-warn {
  position: absolute; top: -9px; right: -6px; background: var(--sun);
  border: 2px solid var(--ink); border-radius: 999px;
  font-size: .6rem; font-weight: 800; padding: .15em .55em; white-space: nowrap;
}

.help-list { list-style: none; display: grid; gap: .4rem; }
.help-list li { position: relative; padding-left: 1.5em; font-size: .84rem; line-height: 1.65; font-weight: 650; }
.help-list li::before { content: "★"; position: absolute; left: 0; top: 0; color: var(--sun); }
.help-sec.pet .help-list li::before { content: "♥"; color: var(--rose); }

.help-foot-note { margin-top: 1rem; font-size: .74rem; color: var(--ink-soft); text-align: center; font-weight: 650; line-height: 1.6; }
.help-foot { padding: .8rem clamp(1rem, 3vw, 1.5rem) 1rem; border-top: 3px dashed rgba(45, 42, 74, .18); display: flex; justify-content: center; }

@media (max-width: 560px) {
  .help-types { grid-template-columns: repeat(2, 1fr); }
  .help-card { max-height: 88vh; }
  .help-foot .btn { width: 100%; }
}

/* ============ 语言切换（中 / EN / ไทย） ============ */
.lang-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(99, 102, 241, 0.16);
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.12);
}
.lang-switch button {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: transparent;
  line-height: 1.2;
  transition: background 0.18s ease, color 0.18s ease;
}
.lang-switch button:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--ink);
}
.lang-switch button.is-active {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
@media (max-width: 640px) {
  .lang-switch { margin-left: 0; margin-top: 8px; }
  .lang-switch button { padding: 5px 10px; font-size: 12px; }
}

/* ================= 课堂演示（教师大屏 · 线下小组赛） ================= */
.class-stage {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.4rem) clamp(.8rem, 3vw, 2rem) 4rem;
}
.class-card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: clamp(1.2rem, 3vw, 2.4rem);
  box-shadow: 0 8px 0 rgba(45, 42, 74, .14);
}
.class-center { text-align: center; }
.class-kicker {
  margin: 0 0 .4rem;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--coral-deep);
  text-transform: uppercase;
}
.class-title { margin: 0 0 .5rem; font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 900; color: var(--ink); }
.class-big { margin: .4rem 0 .6rem; font-size: clamp(3rem, 11vw, 6rem); font-weight: 900; color: var(--ink); }
.class-sub { margin: 0 0 1.1rem; font-size: clamp(.92rem, 2vw, 1.05rem); line-height: 1.6; color: var(--ink-soft); }
.class-field { margin-top: 1.1rem; }
.class-label { margin-bottom: .45rem; font-size: .86rem; font-weight: 800; color: var(--ink-soft); }
.class-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.class-chip {
  padding: .5rem .9rem;
  border: 2.5px solid rgba(45, 42, 74, .22);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: .95rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.class-chip.is-on { background: var(--coral); border-color: var(--coral-deep); color: #fff; box-shadow: 0 3px 0 var(--coral-deep); }
.class-chip.class-wide { min-width: 7.4rem; }
.class-hint { margin: 1.1rem 0 0; font-size: .85rem; color: var(--ink-soft); }
.class-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1.4rem; }
.class-xl { font-size: clamp(1rem, 2.6vw, 1.25rem); padding: .9rem 1.8rem; }
.class-last { margin: .2rem 0 0; font-size: .9rem; font-weight: 700; color: var(--grape); }

/* 答题 */
.class-quiz { position: relative; text-align: center; }
.class-qtop {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: 1.2rem;
}
.class-badge {
  padding: .3rem .8rem; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: .82rem; font-weight: 800;
}
.class-qnum { font-size: .88rem; font-weight: 800; color: var(--ink-soft); }
.class-clock { font-size: .88rem; font-weight: 700; color: var(--ink-soft); }
.class-clock b { font-size: 1rem; color: var(--coral-deep); font-variant-numeric: tabular-nums; }
.class-prompt { font-size: clamp(.9rem, 2vw, 1.05rem); font-weight: 800; color: var(--ink-soft); }
.class-stem {
  margin: .5rem 0 1.4rem;
  line-height: 1.15;
  word-break: break-word;
}
.class-stem.is-hz { font-size: clamp(3.2rem, 12vw, 6.4rem); font-weight: 900; letter-spacing: .06em; color: var(--ink); }
.class-stem.is-py { font-size: clamp(1.9rem, 7vw, 4rem); font-weight: 850; color: var(--grape); }
.class-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.class-opt {
  display: flex; align-items: center; gap: .7rem;
  padding: .85rem 1rem; text-align: left;
  border: 3px solid var(--ink); border-radius: 16px; background: #fff;
  font: inherit; font-size: clamp(1.05rem, 2.8vw, 1.8rem); font-weight: 850; color: var(--ink);
  cursor: pointer; box-shadow: 0 4px 0 rgba(45, 42, 74, .14);
  transition: transform 120ms ease, background 140ms ease;
  -webkit-tap-highlight-color: transparent;
}
.class-opt i {
  display: grid; place-items: center; flex: none;
  width: 1.9rem; height: 1.9rem; border-radius: 9px;
  background: var(--cream); color: var(--ink-soft); font-style: normal; font-size: .82rem; font-weight: 900;
}
.class-opt:hover:not(:disabled) { transform: translateY(-2px); }
.class-opt.is-right { background: var(--mint-light); border-color: var(--mint-deep); }
.class-opt.is-wrong { background: #ffe3e3; border-color: var(--red); }
.class-opt:disabled { cursor: default; }
.class-verdict {
  margin: 1.1rem auto 0; display: inline-block;
  padding: .5rem 1.1rem; border-radius: 999px; font-size: 1rem; font-weight: 900;
}
.class-verdict.good { background: var(--mint-light); color: var(--mint-deep); }
.class-verdict.bad { background: #ffe3e3; color: var(--red); }
.class-hotkey { margin: .9rem 0 0; font-size: .78rem; color: var(--ink-soft); }

/* 组结算 */
.class-scoreline { margin: .6rem 0; font-size: clamp(1.1rem, 2.6vw, 1.4rem); font-weight: 800; color: var(--ink-soft); }
.class-scoreline b { font-size: clamp(3rem, 10vw, 5rem); color: var(--coral-deep); }
.class-metarow { display: flex; flex-wrap: wrap; gap: 1.4rem; justify-content: center; font-size: 1rem; font-weight: 700; color: var(--ink-soft); }
.class-metarow b { color: var(--ink); }

/* 排行榜 */
.class-rank { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: .55rem; }
.class-rank li {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto auto;
  align-items: center; gap: .8rem;
  padding: .8rem 1rem;
  border: 3px solid var(--ink); border-radius: 14px; background: #fff;
}
.class-rank li.gold { background: #fff6d6; }
.class-rank li.silver { background: #f2f5fa; }
.class-rank li.bronze { background: #fdf0e6; }
.class-rank .rk {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 900; font-size: .9rem;
}
.class-rank li.gold .rk { background: #e8a800; }
.class-rank li.silver .rk { background: #8494a8; }
.class-rank li.bronze .rk { background: #c07a45; }
.class-rank .rname { font-size: clamp(.95rem, 2.2vw, 1.15rem); font-weight: 850; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-rank .rscore { font-size: clamp(1rem, 2.4vw, 1.25rem); font-weight: 900; color: var(--coral-deep); }
.class-rank .rtime { font-size: .9rem; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .class-options { grid-template-columns: 1fr; }
  .class-rank li { grid-template-columns: 2rem minmax(0, 1fr) auto; }
  .class-rank .rtime { grid-column: 2 / 4; text-align: right; }
}

/* 课堂演示链接面板（教师设置台） */
.class-link-panel {
  max-width: 860px; margin: 1rem auto 0; padding: .9rem 1.1rem;
  border: 3px solid var(--ink); border-radius: var(--radius-md); background: var(--sun-light);
  box-shadow: 0 4px 0 rgba(45, 42, 74, .18); text-align: left;
}
.class-link-panel p { font-size: .84rem; font-weight: 750; color: var(--ink); line-height: 1.55; }
.class-link-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .55rem; }
.class-link-row code {
  flex: 1 1 260px; padding: .5rem .7rem; border-radius: 10px; background: #fff;
  border: 2px solid rgba(45, 42, 74, .25); font-size: .76rem; word-break: break-all; color: var(--ink);
}
.class-link-row .btn { padding: .45em .9em; font-size: .8rem; }
.class-hint.class-warn { color: var(--red); }
.class-block-actions { justify-content: center; }
