:root {
  --bg: #0b1120;
  --panel: #111a2e;
  --border: #24324d;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #7dd3fc;
  --gold: #fbbf24;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #123a53 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.shell { width: min(100%, 1020px); }
header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
h1 {
  margin: 0; font-size: clamp(22px, 3vw, 34px); letter-spacing: .08em;
  font-weight: 800;
  background: linear-gradient(90deg, #f8fafc, #7dd3fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.records { display: flex; gap: 10px; align-items: center; }
.chip {
  border: 1px solid var(--border); background: #0e1729;
  border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--gold); font-size: 15px; margin-left: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: #0e1729; color: var(--text);
  font-size: 17px; line-height: 1; display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.hub-link {
  width: auto; padding: 0 12px; font-size: 12px; font-weight: 700;
  letter-spacing: .02em; text-decoration: none;
}
.card {
  position: relative; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--border); background: #082f49;
  box-shadow: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
}
canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 960 / 460;
  touch-action: manipulation;
}
.fs-exit {
  display: none; position: absolute; top: 14px; right: 16px; z-index: 9;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(125,211,252,.4); background: rgba(15,23,42,.72);
  color: var(--text); font-size: 22px; line-height: 1;
}
.card:fullscreen {
  width: 100vw; height: 100vh; border-radius: 0; border: 0;
  background: #082f49;
}
.card:fullscreen canvas {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(100vw, calc(100vh * 960 / 460));
}
.card:fullscreen .fs-exit { display: block; }
.hidden { display: none !important; }

/* 开始遮挡层 */
.start-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4,15,32,.55); backdrop-filter: blur(2px);
}
.start-box {
  width: min(100%, 460px); text-align: center;
  padding: 30px 34px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(17,26,46,.96), rgba(8,22,39,.96));
  border: 1px solid rgba(125,211,252,.35);
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.start-box .eyebrow {
  font: 600 11px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .22em; color: var(--gold); text-transform: uppercase;
}
.start-box h2 {
  margin: 12px 0 10px; font-size: clamp(26px, 5vw, 38px); letter-spacing: .06em;
  background: linear-gradient(90deg, #f8fafc, #7dd3fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.start-box p { margin: 0 0 22px; color: #cbd5e1; font-size: 14px; line-height: 1.9; }
.primary {
  cursor: pointer; border: 1px solid rgba(251,191,36,.5); border-radius: 99px;
  padding: 12px 30px; font-size: 15px; font-weight: 800; letter-spacing: .04em;
  color: #3b2606; background: linear-gradient(180deg, #fde68a, #fbbf24);
  box-shadow: 0 6px 18px rgba(251,191,36,.25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(251,191,36,.35); }
.start-note { margin-top: 16px; color: var(--muted); font-size: 12px; }

/* 单词答题卡：像从鱼身边浮出的气泡，贴在鱼旁边 */
.quiz {
  position: absolute; inset: 0; z-index: 8;
  background: radial-gradient(ellipse at 50% 50%, rgba(3,15,30,.04), rgba(3,15,30,.16));
}
.quiz-card {
  position: absolute;
  left: var(--card-x, 50%);
  top: var(--card-y, 50%);
  transform: translate(-50%, -100%);
  margin-top: -14px;
  width: min(470px, calc(100% - 28px));
  padding: 18px 24px 16px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(14,116,144,.82), rgba(8,47,73,.88));
  border: 2px solid rgba(125,211,252,.55);
  box-shadow: 0 14px 36px rgba(2,20,35,.45), inset 0 1px 0 rgba(255,255,255,.28);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-align: center;
  transform-origin: 50% 100%;
  animation: bubbleIn .24s cubic-bezier(.2,1.3,.4,1) both;
}
.quiz.below .quiz-card {
  transform: translate(-50%, 0);
  margin-top: 14px;
  transform-origin: 50% 0;
}
.quiz-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 20% 8%, rgba(255,255,255,.22), transparent 45%);
}
.quiz-card::after {
  content: ""; position: absolute; left: 50%; bottom: -13px;
  transform: translateX(-50%);
  border: 12px solid transparent;
  border-top-color: rgba(8,47,73,.88);
  border-bottom: 0;
}
.quiz.below .quiz-card::after {
  bottom: auto; top: -13px;
  border-top: 0;
  border-bottom-color: rgba(14,116,144,.88);
}
.quiz.left .quiz-card,
.quiz.right .quiz-card {
  transform: translate(-50%, -50%);
  margin-top: 0;
}
.quiz.left .quiz-card::after {
  bottom: auto; top: 50%; left: auto; right: -13px;
  transform: translateY(-50%);
  border: 12px solid transparent;
  border-left-color: rgba(8,47,73,.88);
  border-bottom: 0;
}
.quiz.right .quiz-card::after {
  bottom: auto; top: 50%; left: -13px; right: auto;
  transform: translateY(-50%);
  border: 12px solid transparent;
  border-right-color: rgba(14,116,144,.88);
  border-bottom: 0;
}
/* 四周都放不下时缩小卡片，尽量不让鱼被盖住 */
.quiz.compact .quiz-card { width: min(420px, calc(100% - 28px)); padding: 12px 18px 10px; }
.quiz.compact .quiz-word { font-size: 32px; margin: 4px 0 0; }
.quiz.compact .quiz-question { margin-bottom: 10px; font-size: 12px; }
.quiz.compact .quiz-options button { padding: 9px 8px; font-size: 13px; }
.quiz.compact .quiz-feedback { margin-top: 8px; min-height: 18px; font-size: 12px; }
@keyframes bubbleIn {
  from { opacity: 0; scale: .82; translate: 0 12px; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}
.quiz-eyebrow {
  font: 600 11px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .2em; color: var(--gold); text-transform: uppercase;
}
.quiz-word {
  margin: 8px 0 2px; font-size: clamp(34px, 7vw, 48px); font-weight: 800;
  color: #e0f2fe; letter-spacing: .02em; line-height: 1.2;
  text-shadow: 0 2px 8px rgba(2,20,35,.5);
}
.quiz-question { margin: 0 0 16px; color: #cbd5e1; font-size: 14px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-options button {
  cursor: pointer; padding: 12px 10px; border-radius: 12px;
  border: 1px solid rgba(125,211,252,.32); background: rgba(8,30,50,.62); color: var(--text);
  font-size: 15px; font-weight: 600; transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.quiz-options button:hover:not(:disabled) {
  border-color: var(--accent); background: rgba(14,116,144,.6); transform: translateY(-1px);
}
.quiz-options button:disabled { cursor: default; opacity: .72; }
.quiz-options button.correct {
  border-color: #4ade80; background: rgba(74,222,128,.2); color: #bbf7d0; opacity: 1;
}
.quiz-options button.wrong {
  border-color: #f87171; background: rgba(248,113,113,.2); color: #fecaca; opacity: 1;
}
.quiz-feedback {
  min-height: 22px; margin-top: 16px; font-size: 14px; font-weight: 700;
}
.quiz-feedback.good { color: #86efac; }
.quiz-feedback.bad { color: #fca5a5; }

/* 得分飘字 */
.toast {
  position: absolute; top: 16px; left: 50%; z-index: 6;
  transform: translate(-50%, -8px); pointer-events: none;
  padding: 8px 18px; border-radius: 99px; font-weight: 800; font-size: 15px;
  background: rgba(15,23,42,.8); border: 1px solid rgba(251,191,36,.5);
  color: var(--gold); opacity: 0; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { color: #fca5a5; border-color: rgba(248,113,113,.5); }

.footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.hint b { color: var(--gold); }
.hint.sub-hint { text-align: right; }

@media (max-width: 620px) {
  .records { gap: 6px; }
  .chip { padding: 7px 10px; font-size: 12px; }
  .start-box { padding: 22px 20px; }
  .quiz-card { padding: 20px 18px; }
  .quiz-options { gap: 8px; }
  .quiz-options button { font-size: 14px; padding: 11px 6px; }
  .sub-hint { display: none; }
}
