/* Class Practice Generator — shared styles */
:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --accent: #4f6ef7;
  --accent-soft: #eef1fe;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --border: #e5e7eb;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -50px, rgba(179,136,235,0.20), transparent 60%),
    radial-gradient(900px 420px at -60px 30%, rgba(139,209,255,0.22), transparent 60%),
    radial-gradient(800px 400px at 60% 110%, rgba(123,211,137,0.14), transparent 60%),
    linear-gradient(165deg, #f4f2ff 0%, #f6f8fb 45%, #f2f7ff 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
}

/* ---------- floating science doodles (injected by shared.js) ---------- */
.deco-layer {
  position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
}
.deco-item { position: absolute; opacity: 0.5; will-change: transform; user-select: none; }
.deco-item svg { display: block; }
.deco-drift { animation: decoDrift 16s ease-in-out infinite alternate; }
.deco-drift2 { animation: decoDrift2 21s ease-in-out infinite alternate; }
.deco-drift3 { animation: decoDrift3 13s ease-in-out infinite alternate; }
.deco-twinkle { animation: decoTwinkle 3.2s ease-in-out infinite; }
.deco-spin { animation: decoSpin 26s linear infinite; }
@keyframes decoDrift  { from { transform: translate(0,0) rotate(-4deg); }  to { transform: translate(26px,34px) rotate(6deg); } }
@keyframes decoDrift2 { from { transform: translate(0,0); }                to { transform: translate(-32px,-22px); } }
@keyframes decoDrift3 { from { transform: translate(0,0) rotate(3deg); }   to { transform: translate(18px,-26px) rotate(-5deg); } }
@keyframes decoTwinkle { 0%,100% { opacity: 0.12; } 50% { opacity: 0.75; } }
@keyframes decoSpin { to { transform: rotate(360deg); } }
header.topbar, .wrap, footer { position: relative; z-index: 1; }
header.topbar {
  /* illustrated banner under a translucent blue-purple veil so white text stays readable */
  background:
    linear-gradient(115deg, rgba(59,73,223,0.72) 0%, rgba(79,110,247,0.55) 45%, rgba(124,92,240,0.62) 100%),
    url('assets/topbar-bg.jpg') center 42% / cover no-repeat,
    linear-gradient(120deg, #4f6ef7, #7c5cf0);
  color: #fff;
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  box-shadow: 0 4px 18px rgba(79, 110, 247, 0.25);
}
.topbar-logo {
  height: 40px; width: 40px; border-radius: 11px; object-fit: cover;
  box-shadow: 0 3px 10px rgba(20, 16, 60, 0.35);
  animation: logoFloat 4.5s ease-in-out infinite;
}
@keyframes logoFloat { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-3px) rotate(2deg); } }
header.topbar .brand { display: flex; align-items: center; gap: 12px; }
header.topbar h1 { font-size: 20px; font-weight: 700; }
header.topbar .sub { font-size: 13px; opacity: 0.9; }
header.topbar .who { font-size: 13px; background: rgba(255,255,255,0.18); padding: 6px 12px; border-radius: 999px; }
.wrap { max-width: 940px; margin: 0 auto; padding: 22px 16px 70px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(16,24,40,0.06);
}
.card h2 { font-size: 17px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=date], .field input[type=number], .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .field { flex: 1 1 160px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; cursor: pointer; color: var(--ink); font-family: inherit;
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn.small { padding: 8px 14px; font-size: 13px; }
.status { margin-top: 12px; font-size: 14px; color: var(--muted); }
.status.error { color: var(--red); font-weight: 600; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(79,110,247,0.3);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); font-family: inherit;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
table.list th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge.hw { background: #fdf3e7; color: var(--amber); }
.badge.practice { background: var(--accent-soft); color: var(--accent); }
.badge.done { background: #ecfdf3; color: var(--green); }
.badge.pending { background: #f3f4f6; color: var(--muted); }

/* Quiz */
.q-item { padding: 16px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; background: #fff; }
.q-text { font-size: 16px; font-weight: 600; line-height: 1.5; }
.q-num { color: var(--accent); margin-right: 6px; }
.opts { margin-top: 10px; display: grid; gap: 8px; }
.opt {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; font-size: 15px; line-height: 1.4; background: #fff; transition: all 0.15s;
}
.opt:hover { border-color: var(--accent); }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--green); background: #ecfdf3; }
.opt.wrong { border-color: var(--red); background: #fef2f2; }
.opt.locked { cursor: default; }
.q-item input[type=text] {
  margin-top: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 15px; font-family: inherit;
}
.q-item input[type=text]:disabled { background: #f9fafb; color: var(--ink); }
.feedback { margin-top: 10px; font-size: 14px; line-height: 1.5; }
.feedback.good { color: var(--green); font-weight: 600; }
.feedback.bad { color: var(--red); font-weight: 600; }
.explain { margin-top: 6px; color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: 2px; }
.tag.mc { background: var(--accent-soft); color: var(--accent); }
.tag.open { background: #fdf3e7; color: var(--amber); }
.score-box {
  background: var(--accent-soft); border-radius: 12px; padding: 14px 18px;
  font-size: 16px; font-weight: 700; color: var(--accent); margin-bottom: 14px;
}
.passage-box {
  background: #f9fafb; border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 16px; font-size: 15px; line-height: 1.7; white-space: pre-wrap;
}
.self-grade { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* Worksheet / print */
.sheet-head { text-align: center; margin-bottom: 18px; }
.sheet-head h3 { font-size: 20px; margin-bottom: 4px; }
.sheet-meta { margin-top: 10px; font-size: 14px; color: var(--muted); display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.sheet-meta span { border-bottom: 1px solid var(--border); padding: 2px 30px 2px 4px; }
.sheet ol { margin: 0 0 0 22px; }
.sheet ol li { margin-bottom: 14px; font-size: 15px; line-height: 1.55; }
.opt-line { margin: 4px 0 0 6px; }
.write-line { border-bottom: 1px solid #9ca3af; height: 22px; margin: 8px 0 0 6px; }
.answer-key { page-break-before: always; break-before: page; margin-top: 40px; }
.answer-key h3 { font-size: 18px; margin-bottom: 10px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.answer-key ol { margin-left: 22px; }
.answer-key li { margin-bottom: 6px; font-size: 14px; line-height: 1.5; }
@media print {
  body { background: #fff; }
  header.topbar, .no-print { display: none !important; }
  .deco-layer { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; padding: 0; }
  .answer-key { page-break-before: always; }
}
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }
code.k { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 15px; }

/* ---------- compact teacher gate ---------- */
.gate {
  max-width: 480px; margin: 26px auto 18px; padding: 0; overflow: hidden;
  border-radius: 18px; box-shadow: 0 10px 30px rgba(79,110,247,0.14);
}
.gate-banner {
  position: relative; height: 150px; overflow: hidden;
  background: linear-gradient(120deg, #4f6ef7, #7c5cf0);
}
.gate-banner img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  display: block; opacity: 0.92;
}
.gate-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(23,18,60,0.05) 0%, rgba(23,18,60,0.55) 100%);
}
.gate-welcome {
  position: absolute; left: 18px; bottom: 10px; z-index: 2; color: #fff;
  text-shadow: 0 2px 10px rgba(20,10,50,0.55);
}
.gate-welcome h2 { font-size: 20px; margin-bottom: 2px; }
.gate-welcome p { font-size: 13px; opacity: 0.95; }
.gate > .tabs, .gate > div { padding-left: 22px; padding-right: 22px; }
.gate > .tabs { margin-top: 18px; margin-bottom: 4px; }
.gate > div:last-child { padding-bottom: 22px; }

/* ---------- student login with art ---------- */
.login-flex { display: flex; gap: 0; padding: 0 !important; overflow: hidden; }
.login-flex .login-art { flex: 0 0 200px; min-height: 240px; position: relative; }
.login-flex .login-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.login-flex .login-body { flex: 1; padding: 22px; min-width: 0; }
@media (max-width: 640px) {
  .login-flex { flex-direction: column-reverse; }
  .login-flex .login-art { flex: none; height: 150px; min-height: 0; }
}

/* ---------- index hero ---------- */
.hero-art {
  position: relative; border-radius: 20px; overflow: hidden; margin-bottom: 26px;
  box-shadow: 0 12px 34px rgba(79,110,247,0.18); min-height: 240px;
}
.hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 28%; }
.hero-art .hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 26px 28px; color: #fff; text-shadow: 0 2px 12px rgba(20,10,50,0.6);
  background: linear-gradient(180deg, rgba(15,12,45,0) 30%, rgba(15,12,45,0.62) 100%);
}
.hero-art .hero-overlay h1 { font-size: 30px; margin-bottom: 6px; }
.hero-art .hero-overlay p { font-size: 15px; max-width: 620px; opacity: 0.96; }
.role-card { position: relative; }
.role-card .icon {
  width: 64px; height: 64px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 34px; margin-bottom: 4px; background: var(--accent-soft);
}
.role-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #4f6ef7, #7c5cf0, #63d2ff);
  border-radius: 16px 16px 0 0;
}
.features { background: rgba(255,255,255,0.82); border: 1px solid var(--border); border-radius: 18px; padding: 20px 26px; backdrop-filter: blur(4px); }
.features ul, .features { list-style: none; }
.features li { list-style: none; }

/* ---------- Flashcard study mode ---------- */
.fc-scene { perspective: 1200px; max-width: 480px; margin: 0 auto; }
.fc-card { position: relative; height: 330px; transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(.4,.2,.2,1); cursor: pointer; }
.fc-card.flipped { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 18px; border: 1px solid var(--border); background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 22px; text-align: center; box-shadow: 0 4px 14px rgba(16,24,40,0.08);
}
.fc-face.back { transform: rotateY(180deg); justify-content: flex-start; align-items: flex-start; text-align: left; overflow-y: auto; }
.fc-word { font-size: 36px; font-weight: 800; color: var(--ink); }
.fc-taphint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.fc-pic { height: 150px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.fc-pic svg { max-height: 150px; max-width: 210px; }
.fc-def { font-size: 16px; line-height: 1.5; color: var(--ink); }
.fc-row { font-size: 14px; margin-top: 8px; line-height: 1.5; color: var(--ink); }
.fc-row .lab { color: var(--muted); }
.fc-sent { font-size: 13px; margin-top: 10px; color: var(--muted); font-style: italic; }
.fc-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.fc-progress { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 8px; }
.fc-dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.fc-dot { width: 12px; height: 12px; border-radius: 50%; background: #d1d5db; border: none; padding: 0; cursor: pointer; }
.fc-dot.known { background: var(--green); }
.fc-dot.missed { background: var(--red); }
.fc-dot.current { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-summary { text-align: center; padding: 10px 0; }
.fc-summary h3 { margin: 6px 0; }
.fc-emoji { font-size: 44px; }

/* ================= hover names in the 3D lab ================= */
.sim-tip {
  position: absolute; z-index: 8; pointer-events: none; padding: 5px 10px;
  background: rgba(12, 18, 40, 0.9); color: #f2f6ff;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 8px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.2px;
  box-shadow: 0 6px 18px rgba(8, 12, 28, 0.4); white-space: nowrap;
  animation: tipIn 0.12s ease-out;
}
@keyframes tipIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.sim-labels-btn {
  position: absolute; top: 10px; right: 10px; z-index: 8;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(12, 18, 40, 0.66); color: #e8eeff;
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px;
  padding: 5px 11px; font: 600 11.5px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer; backdrop-filter: blur(4px);
}
.sim-labels-btn:hover { background: rgba(20, 28, 58, 0.9); }
.sim-labels-btn.on { background: #4f6ef7; border-color: #7d95ff; color: #fff; }

/* ================= tokens & medals ================= */
.token-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, #fff8db, #ffe9a8);
  border: 1px solid #f0cf74; color: #7c5300;
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700;
  animation: chipGlow 4s ease-in-out infinite;
}
@keyframes chipGlow { 0%, 100% { box-shadow: 0 0 0 rgba(240, 207, 116, 0); } 50% { box-shadow: 0 0 14px rgba(240, 207, 116, 0.75); } }
.token-chip .tc-coin { font-size: 15px; }
.token-chip .tc-rank { font-weight: 600; font-size: 12px; color: #996a10; }
@media (max-width: 640px) { .token-chip .tc-rank { display: none; } }

.rank-card {
  display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(120deg, #eef2ff, #f8f1ff 52%, #e8fbff);
  border: 1px solid #dee4ff; border-radius: 16px; padding: 16px 18px;
}
.rank-main { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 240px; }
.rank-badge {
  width: 58px; height: 58px; border-radius: 16px; background: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  box-shadow: 0 6px 16px rgba(79, 110, 247, 0.18);
}
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 17px; font-weight: 800; color: #232a45; }
.rank-sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 6px; }
.rank-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); overflow: hidden; max-width: 320px; }
.rank-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4f6ef7, #7c5cf0, #63d2ff); }
.rank-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.rank-stats div { background: rgba(255, 255, 255, 0.86); border: 1px solid #e7ebff; border-radius: 12px; padding: 8px 12px; min-width: 84px; text-align: center; }
.rank-stats b { display: block; font-size: 16px; color: #2a3660; }
.rank-stats span { font-size: 10.5px; color: var(--muted); }

.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 14px; }
.medal-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-align: center; padding: 12px 10px 14px; border: 1px solid var(--border);
  border-radius: 16px; background: #fff; transition: transform 0.15s, box-shadow 0.15s;
}
.medal-card.earned:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(79, 110, 247, 0.18); }
.medal-card.earned.tier-gold { background: linear-gradient(180deg, #fffdf3, #fff); border-color: #f3e2ac; }
.medal-card.earned.tier-diamond { background: linear-gradient(180deg, #f3fdff, #fff); border-color: #c8ecf8; }
.medal-card.locked { opacity: 0.92; }
.medal-art-wrap { position: relative; width: 86px; height: 86px; }
.medal-art { width: 86px; height: 86px; display: block; filter: drop-shadow(0 5px 9px rgba(16, 24, 40, 0.18)); }
.medal-card.locked .medal-art { filter: grayscale(1) opacity(0.38); }
.medal-glow {
  position: absolute; inset: 8px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.9), transparent 58%);
  animation: medalShine 3.8s ease-in-out infinite;
}
@keyframes medalShine { 0%, 100% { opacity: 0.2; transform: rotate(0); } 50% { opacity: 0.75; transform: rotate(16deg); } }
.medal-lock {
  position: absolute; right: 0; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; box-shadow: 0 2px 6px rgba(16, 24, 40, 0.2);
}
.medal-name { font-size: 13px; color: #232a45; }
.medal-desc { font-size: 11px; color: var(--muted); line-height: 1.35; min-height: 30px; }
.medal-done { font-size: 10.5px; font-weight: 800; color: var(--green); background: #ecfdf3; border-radius: 999px; padding: 2px 9px; }
.medal-bar { width: 100%; height: 6px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.medal-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c5cf0, #63d2ff); }
.medal-progress { font-size: 10px; color: var(--muted); }

table.leaderboard tr.me { background: #f4f7ff; }
table.leaderboard td:nth-child(3) { font-size: 15px; letter-spacing: 1px; }
.lb-medals span { margin-right: 3px; }

/* ================= welcome pop-up ================= */
.greet-back {
  position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(14, 18, 42, 0.55); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.25s;
}
.greet-back.show { opacity: 1; }
.greet-card {
  position: relative; width: 100%; max-width: 400px; background: #fff; border-radius: 24px;
  overflow: hidden; box-shadow: 0 26px 64px rgba(10, 14, 38, 0.42);
  transform: translateY(16px) scale(0.97); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.greet-back.show .greet-card { transform: none; }
.greet-top { position: relative; height: 104px; background: linear-gradient(120deg, #4f6ef7, #7c5cf0 55%, #63d2ff); overflow: hidden; }
.greet-orbit { position: absolute; width: 230px; height: 230px; right: -74px; top: -96px; border: 1.5px solid rgba(255, 255, 255, 0.38); border-radius: 50%; }
.greet-orbit::after {
  content: ""; position: absolute; left: -6px; top: 104px; width: 12px; height: 12px; border-radius: 50%;
  background: #ffe27a; box-shadow: 0 0 16px #ffe27a;
}
.greet-avatar {
  position: absolute; left: 24px; bottom: -26px; width: 64px; height: 64px; border-radius: 20px;
  background: #fff; color: #4f6ef7; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; box-shadow: 0 8px 22px rgba(18, 20, 60, 0.25);
}
.greet-spark { position: absolute; color: rgba(255, 255, 255, 0.9); animation: decoTwinkle 3s ease-in-out infinite; }
.greet-spark.s1 { left: 56%; top: 24%; font-size: 16px; }
.greet-spark.s2 { left: 74%; top: 58%; font-size: 12px; animation-delay: 0.6s; }
.greet-spark.s3 { left: 87%; top: 18%; font-size: 11px; animation-delay: 1.1s; }
.greet-body { padding: 36px 24px 22px; }
.greet-hi { font-size: 11.5px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 800; color: var(--muted); }
.greet-body h2 { font-size: 25px; margin: 3px 0 10px; color: #1e2742; }
.greet-wave { display: inline-block; transform-origin: 72% 72%; animation: greetWave 2.4s ease-in-out infinite; }
@keyframes greetWave { 0%, 62%, 100% { transform: rotate(0); } 70% { transform: rotate(16deg); } 80% { transform: rotate(-8deg); } 90% { transform: rotate(12deg); } }
.greet-compliment { font-size: 14.5px; line-height: 1.55; color: #3d4657; }
.greet-stats { display: flex; gap: 8px; margin: 14px 0 12px; }
.greet-stats div { flex: 1; background: #f7f8fd; border: 1px solid #eef1fa; border-radius: 12px; padding: 8px 4px; text-align: center; }
.greet-stats b { display: block; font-size: 16px; color: #2a3660; }
.greet-stats span { font-size: 10px; color: var(--muted); }
.greet-rank {
  font-size: 12.5px; color: #4b3d8f; background: #f4f1ff; border: 1px solid #e6ddff;
  border-radius: 10px; padding: 8px 12px; margin-bottom: 14px;
}
.greet-go { width: 100%; }
.greet-hint { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 10px; }
.greet-x {
  position: absolute; top: 10px; right: 10px; z-index: 3; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.22); color: #fff; font-size: 13px; cursor: pointer;
}
.greet-x:hover { background: rgba(255, 255, 255, 0.36); }

/* ================= toasts & medal unlock ================= */
.toast-wrap {
  position: fixed; right: 16px; bottom: 16px; z-index: 9500;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
.toast {
  background: rgba(17, 22, 45, 0.95); color: #fff; border-radius: 12px; padding: 10px 16px;
  font-size: 13.5px; font-weight: 700; box-shadow: 0 12px 30px rgba(8, 12, 28, 0.38);
  opacity: 0; transform: translateY(10px); transition: opacity 0.28s, transform 0.28s;
}
.toast.show { opacity: 1; transform: none; }
.toast-medal { background: linear-gradient(120deg, #8a5e00, #d9a12b 65%, #f4c95d); color: #fff8e1; }
.medal-pop {
  position: fixed; inset: 0; z-index: 9600; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(12, 16, 38, 0.55); opacity: 0; transition: opacity 0.25s;
}
.medal-pop.show { opacity: 1; }
.medal-pop-card {
  width: 100%; max-width: 320px; background: #fff; border-radius: 22px; padding: 22px 22px 20px;
  text-align: center; box-shadow: 0 26px 60px rgba(10, 14, 35, 0.45);
  transform: scale(0.94); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.medal-pop.show .medal-pop-card { transform: none; }
.medal-pop-art svg { width: 122px; height: 122px; filter: drop-shadow(0 8px 18px rgba(216, 160, 30, 0.35)); }
.medal-pop-kicker { font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; font-weight: 800; color: var(--amber); margin-top: 4px; }
.medal-pop-card h3 { font-size: 21px; margin: 4px 0 6px; color: #232a45; }
.medal-pop-card p { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.medal-pop-card .medal-pop-more { color: var(--accent); font-weight: 700; margin-top: 4px; }
.medal-pop-card .btn { margin-top: 14px; width: 100%; }

/* ================= richer stickers ================= */
.deco-sticker {
  background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px; padding: 9px; box-shadow: 0 10px 26px rgba(79, 110, 247, 0.13);
  backdrop-filter: blur(3px);
}
.deco-blob { border-radius: 50%; filter: blur(38px); opacity: 0.5; }
@media (max-width: 760px) {
  .deco-item[data-hide-sm="1"] { display: none; }
  .medal-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .rank-stats div { min-width: 72px; padding: 6px 8px; }
  .medal-art, .medal-art-wrap { width: 72px; height: 72px; }
}

.rewards-hero { min-height: 180px; margin-bottom: 18px; }
.rewards-hero .hero-overlay h1 { text-shadow: 0 2px 14px rgba(20,10,50,0.7); }

/* ============================================================
   Pop-quiz mode: one decorated question at a time
   ============================================================ */
.pq-head { margin-bottom: 14px; }
.pq-title { font-size: 20px; font-weight: 800; }
.pq-progress { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.pq-count { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.pq-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.pq-dot { width: 10px; height: 10px; border-radius: 50%; background: #dde2f2; transition: all .2s; }
.pq-dot.cur { background: var(--accent); transform: scale(1.35); box-shadow: 0 0 0 4px var(--accent-soft); }
.pq-dot.ok { background: var(--green); }
.pq-dot.bad { background: var(--red); }
.pq-live { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: auto; }
.pq-sound {
  margin-left: auto; width: 34px; height: 34px; padding: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid #dfe4ff; border-radius: 999px; background: #fff; cursor: pointer;
  font-size: 15px; line-height: 1; transition: border-color .15s, transform .12s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.pq-sound:hover { border-color: var(--accent); }
.pq-sound:active { transform: scale(.94); }
.pq-sound.off { opacity: .5; }
@media (max-width: 560px) { .pq-sound { width: 30px; height: 30px; font-size: 13px; } }

.pq-stage { position: relative; }
.pq-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #fdfdff 0%, #f6f8ff 60%, #f3f0ff 100%);
  border: 1.5px solid #dfe4ff;
  border-radius: 20px;
  padding: 26px 26px 24px;
  margin-bottom: 14px;
  box-shadow: 0 14px 34px rgba(58, 68, 160, 0.13);
  opacity: 0.4;
  transform: translateY(14px) scale(0.97);
  transition: opacity .28s ease, transform .28s ease;
}
.pq-card.pq-show { opacity: 1; transform: none; }
.pq-in { animation: pqPop .34s cubic-bezier(.34,1.4,.5,1); }
@keyframes pqPop { from { opacity: 0; transform: translateY(18px) scale(.92); } to { opacity: 1; transform: none; } }
.pq-deco { position: absolute; top: 12px; right: 14px; font-size: 20px; opacity: .8; animation: pqFloat 3.2s ease-in-out infinite; }
.pq-deco.d2 { top: auto; bottom: 12px; right: auto; left: 14px; font-size: 15px; animation-delay: 1.4s; }
@keyframes pqFloat { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(8deg); } }
.pq-text { font-size: 18.5px; font-weight: 700; line-height: 1.5; }
.pq-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 12px; margin-right: 6px; vertical-align: -6px;
  background: linear-gradient(135deg, var(--accent), #7c5cf0); color: #fff;
  font-size: 16px; font-weight: 800;
}
.pq-opts { margin-top: 18px; gap: 12px; }
.pq-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; font-size: 15.5px; font-weight: 600;
  border-radius: 14px; cursor: pointer;
}
.pq-opt:hover { transform: translateX(3px); }
.pq-letter {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.pq-opt.correct .pq-letter { background: #d1fae0; color: var(--green); }
.pq-opt.wrong .pq-letter { background: #fee2e2; color: var(--red); }
.pq-card input[type=text] { width: 100%; margin-top: 16px; font-size: 16px; padding: 13px 15px; border-radius: 13px; }
.pq-check { margin-top: 12px; }
.pq-nextwrap { margin-top: 18px; display: flex; justify-content: flex-end; }
.pq-next { font-size: 16px; padding: 12px 26px; border-radius: 999px; animation: pqPulse 1.6s ease-in-out infinite; }
@keyframes pqPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(78, 92, 220, 0.35); } 50% { box-shadow: 0 0 0 9px rgba(78, 92, 220, 0); } }
.pq-finish { text-align: center; padding: 44px 26px 40px; }
.pq-face { font-size: 56px; line-height: 1; margin-bottom: 14px; animation: pqFloat 2.6s ease-in-out infinite; }
.pq-score { font-size: 24px; font-weight: 800; }
.pq-score b { color: var(--accent); }
.pq-msg { color: var(--muted); margin-top: 8px; font-size: 15px; }

/* ============================================================
   Front-page look: pastel gradient bg + window-style cards
   ============================================================ */
body {
  background:
    radial-gradient(1100px 520px at 88% -60px, rgba(179,136,235,0.15), transparent 62%),
    linear-gradient(160deg, #f4f6ff 0%, #fdf3f7 55%, #eefaff 100%);
  background-attachment: fixed;
}
.card {
  position: relative;
  background: #fff;
  border: 1px solid #e4e8f6;
  border-radius: 18px;
  padding-top: 54px;
  box-shadow: 0 10px 28px rgba(31, 39, 73, 0.08);
  transition: box-shadow .15s ease;
}
.card:hover { box-shadow: 0 14px 34px rgba(31, 39, 73, 0.12); }
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 36px;
  background: linear-gradient(180deg, #f5f7fd, #eef1f9);
  border-bottom: 1px solid #e4e8f6;
  border-radius: 17px 17px 0 0;
}
.card::after {
  content: ""; position: absolute; top: 13px; left: 15px; width: 48px; height: 10px;
  background:
    radial-gradient(circle 5px at 5px 5px, #ff8787 98%, transparent),
    radial-gradient(circle 5px at 21px 5px, #ffd43b 98%, transparent),
    radial-gradient(circle 5px at 37px 5px, #69db7c 98%, transparent);
}
.card > h2 {
  position: absolute; top: 8px; left: 74px; right: 18px; margin: 0;
  font-size: 13.5px; font-weight: 700; color: #7a83a8; line-height: 20px;
  letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card.bare { padding-top: 22px; }
.card.bare::before, .card.bare::after { display: none; }

/* pill buttons + rounder controls, like the front page */
.btn {
  border-radius: 999px;
  background: linear-gradient(135deg, #5b6cf0, #8a5cf0);
  box-shadow: 0 6px 16px rgba(91, 108, 240, 0.24);
  font-weight: 700;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(91, 108, 240, 0.32); }
.btn.secondary { background: #fff; box-shadow: none; }
.btn.danger { background: #fff; box-shadow: none; }
.chip, .tab { border-radius: 999px; transition: all .12s ease; }
.tab.active { background: linear-gradient(135deg, #5b6cf0, #8a5cf0); border-color: transparent; box-shadow: 0 5px 14px rgba(91, 108, 240, 0.28); }
.field input[type=text], .field input[type=password], .field input[type=date], .field input[type=number], .field select, .field textarea { border-radius: 12px; }
/* special cards: banner sits right under the bar; login body clears the bar */
.gate { padding-top: 36px; }
.login-flex .login-body { padding-top: 48px; }

/* ---------- quiz-show graphics (v14) ---------- */
.pq-scorechip {
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5b6cf0, #8a5cf0);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(91, 108, 240, 0.35);
  animation: pq-pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.pq-scorechip.final { background: linear-gradient(135deg, #2fa36b, #27a06a); }
.pq-streak {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff3e0;
  color: #e8590c;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid #ffc078;
  animation: pq-pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.pq-pic {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2px auto 12px;
  padding: 12px;
  width: min(190px, 60%);
  min-height: 120px;
  background: #f6f7ff;
  border: 2px dashed #c7cdf7;
  border-radius: 16px;
}
.pq-pic svg { max-width: 160px; max-height: 130px; }
.pq-confetti {
  position: absolute;
  top: -8px;
  width: 9px;
  height: 13px;
  border-radius: 2px;
  opacity: 0.95;
  pointer-events: none;
  animation: pq-confetti-drop 1.3s ease-in forwards;
  z-index: 3;
}
@keyframes pq-confetti-drop {
  0% { transform: translateY(-10px) rotate(0deg) scale(0.6); opacity: 1; }
  100% { transform: translateY(230px) rotate(540deg) scale(1.05); opacity: 0; }
}
.pq-rain {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}
.pq-rain span {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: pq-rain-fall 2s linear forwards;
  opacity: 0.9;
}
@keyframes pq-rain-fall {
  0% { transform: translateY(-16px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(340px) rotate(480deg); opacity: 0; }
}
.pq-stars {
  font-size: 30px;
  color: #f9c74f;
  letter-spacing: 4px;
  margin: 4px 0 2px;
  text-shadow: 0 2px 6px rgba(249, 199, 79, 0.45);
}
.pq-best {
  color: #e8590c;
  font-weight: 700;
  font-size: 14px;
  margin-top: 4px;
}

/* ---------- long-press "are you ok?" bubble (front page) ---------- */
.hold-bubble {
  position: fixed; z-index: 9999; pointer-events: none;
  transform: translate(-50%, -110%);
  background: #fff; color: #4f46e5; font-weight: 800; font-size: 15px;
  padding: 12px 18px; border-radius: 16px 16px 16px 4px;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35);
  border: 2px solid #c7cdf7;
  animation: bubblePop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
  white-space: nowrap;
}
.hold-bubble .hb-emoji { font-size: 20px; margin-right: 6px; }
@keyframes bubblePop {
  0% { transform: translate(-50%, -90%) scale(0.4); opacity: 0; }
  100% { transform: translate(-50%, -110%) scale(1); opacity: 1; }
}

/* ---------- lesson feedback sheet ---------- */
.fb-sheet {
  background: #fff; padding: 26px 30px; border: 1px solid var(--border);
  border-radius: 14px; max-width: 840px; margin: 0 auto;
  font-size: 15px; line-height: 1.62; color: var(--ink);
}
.fb-sheet .fb-title { font-size: 22px; margin: 0 0 14px; }
.fb-sheet p { margin: 0 0 10px; }
.fb-sheet .fb-meta { margin: 0 0 3px; }
.fb-sheet h3 { font-size: 15.5px; margin: 18px 0 8px; color: #1f2937; }
.fb-bullets, .fb-list { margin: 0 0 10px; padding-left: 22px; }
.fb-bullets li, .fb-list li { margin-bottom: 5px; }
.fb-vocab { margin: 0 0 6px; }
.fb-assess li { margin-bottom: 9px; }
#fbThumbs img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(16,24,40,.08);
}

/* ---------- matching board (two columns + connecting lines) ---------- */
.mq-card { max-width: 780px; margin: 0 auto; }
.mq-instr { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.mq-board { position: relative; display: flex; gap: 16px; justify-content: center; }
.mq-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.mq-line { stroke-width: 3; fill: none; }
.mq-line.ok { stroke: #22a55b; }
.mq-line.bad { stroke: #e05252; stroke-dasharray: 6 4; }
.mq-col { display: flex; flex-direction: column; gap: 10px; flex: 1; z-index: 1; min-width: 0; }
.mq-item { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--border);
  border-radius: 12px; padding: 10px 12px; cursor: pointer; font-size: 15px; line-height: 1.35;
  transition: box-shadow .15s, transform .15s, border-color .15s, background .15s; word-break: break-word; }
.mq-item.sel { border-color: #5b6cf0; box-shadow: 0 0 0 3px rgba(91,108,240,.18); transform: translateY(-1px); }
.mq-item.good { border-color: #22a55b; background: #effaf3; cursor: default; }
.mq-item.wrongflash { border-color: #e05252; background: #fdf0f0; animation: mqshake .45s; }
@keyframes mqshake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- mini games: picker + CSS-drawn scenes ---------- */
.gm-pick-title { font-size: 22px; font-weight: 800; text-align: center; }
.gm-pick-sub { color: var(--muted); text-align: center; font-size: 13.5px; margin: 4px 0 16px; }
.gm-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 640px; margin: 0 auto; }
@media (max-width: 600px) { .gm-pick { grid-template-columns: 1fr; } }
.gm-choice { position: relative; display: flex; align-items: center; gap: 11px; border: 2px solid var(--border);
  background: #fff; border-radius: 16px; padding: 11px 34px 11px 11px; cursor: pointer; text-align: left;
  transition: border-color .15s, transform .15s, box-shadow .15s, background .15s; }
.gm-choice:hover { border-color: #5b6cf0; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16,24,40,.12); }
.gm-choice.sel { border-color: #5b6cf0; background: #f4f6ff; box-shadow: 0 0 0 3px rgba(91,108,240,.18); }
.gm-choice.sel .gm-choice-t { color: #3d4bd6; }
.gm-thumb { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 24px; background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), 0 4px 9px rgba(16,24,40,.18); }
.gm-thumb-e { filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.gm-th-mole { background-image: linear-gradient(#9fd9ff 0 50%, #6cbf46 50%); }
.gm-th-balloon { background-image: linear-gradient(#8fd0ff, #dff1ff); }
.gm-th-fish { background-image: linear-gradient(#0f8ba8, #063a5c); }
.gm-th-asteroid { background-image: radial-gradient(ellipse at 30% 25%, #3a4384, #080b1c); }
.gm-th-penguin { background-image: linear-gradient(#0b2350, #7fc4e8); }
.gm-th-pinata { background-image: linear-gradient(#ffd166, #ff7bac); }
.gm-th-treasure { background-image: linear-gradient(#8fd8ff 0 46%, #f0d9a5 46%); }
.gm-th-duel { background-image: linear-gradient(135deg,#0ea5e9 0 49%,#ef4444 51%); }
/* no empty slot: an odd trailing game spans the full row */
.gm-pick .gm-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
.gm-choice.gm-versus { border-color: #f59e0b; background: linear-gradient(135deg,#fff7ed,#fef2f2); }
.gm-choice.gm-versus.sel { box-shadow: 0 0 0 3px rgba(245,158,11,.25); border-color: #f59e0b; }
/* competitive games for older students: cooler card, violet badge */
.gm-choice.gm-arena { background: linear-gradient(135deg,#f8fafc,#eef2ff); }
.gm-choice.gm-arena.sel { box-shadow: 0 0 0 3px rgba(139,92,246,.2); border-color: #8b5cf6; }
.gm-choice.gm-arena.sel .gm-choice-t { color: #6d28d9; }
.gm-new.gm-arena-badge { background: linear-gradient(90deg,#0ea5e9,#8b5cf6); }
.gm-new { display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 999px; font-size: 9px; letter-spacing: .6px;
  vertical-align: 2px; color: #fff; background: linear-gradient(90deg,#f97316,#ef4444); }
.gm-choice-body { min-width: 0; display: block; }
.gm-choice-t { display: block; font-weight: 800; font-size: 14.5px; }
.gm-choice-s { display: block; color: var(--muted); font-size: 11.6px; margin-top: 2px; line-height: 1.32; }
.gm-tick { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); background: #fff; color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1; }
.gm-choice.sel .gm-tick { background: #5b6cf0; border-color: #5b6cf0; }
.gm-pick-go-wrap { text-align: center; margin-top: 18px; }
.gm-pick-go { min-width: 240px; }
.gm-card { max-width: 720px; margin: 0 auto; position: relative; }

/* ---------- fullscreen game mode: ONLY the game, no page text ---------- */
body.gm-fs-on * { visibility: hidden !important; }
body.gm-fs-on .gm-card,
body.gm-fs-on .gm-card * { visibility: visible !important; }
body.gm-fs-on .gm-card {
  position: fixed; inset: 0; z-index: 99999; max-width: none; width: 100vw; height: 100vh;
  margin: 0; border-radius: 0; box-shadow: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.5vh; padding: 4vh 4vw; overflow: auto;
  background: linear-gradient(#6fc4f7 0%, #a8e0ff 30%, #79c247 30.5%, #4d9430 100%);
}
body.gm-fs-on .gm-q {
  font-size: clamp(24px, 4.2vw, 44px); margin: 0; line-height: 1.3;
  color: #16330f; text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
body.gm-fs-on .gm-hint { font-size: 16px; color: #2c4d20; }
body.gm-fs-on .gm-area { zoom: var(--gm-zoom, 1.3); width: 100%; max-width: 1020px; }
body.gm-fs-on .gm-input { font-size: 20px; max-width: none; width: min(90vw, 560px); }
body.gm-fs-on .gm-card .pq-deco { display: none; }
.gm-q { font-size: 19px; font-weight: 800; text-align: center; margin: 4px 0 14px; line-height: 1.4; }
.gm-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 12px; }
.gm-input { max-width: 320px; }
/* every scene: a rounded stage, an absolutely-positioned painted backdrop, and a
   z-index-2 row that holds the clickable props */
.gm-area { position: relative; border-radius: 18px; overflow: hidden; }
.gm-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.gm-row { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 18px 14px;
  justify-content: center; align-items: center; padding: 14px 12px; }
/* whack-a-mole: a real meadow scene — sky, hills, dirt burrows, moles holding signs */
.gm-field { position: relative; border-radius: 18px; overflow: hidden; background: #7bc94d;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.65), 0 10px 24px rgba(16,24,40,.14); }
.gm-skyband { position: relative; height: 92px; overflow: hidden;
  background: linear-gradient(#9fd9ff, #e2f4ff 78%, #cdeeff); }
.gm-sun { position: absolute; top: 10px; right: 24px; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff8bf, #ffd24a 60%, #f7ad24);
  box-shadow: 0 0 26px rgba(255,206,80,.9); }
.gm-cloud { position: absolute; left: 8%; top: 20px; width: 62px; height: 24px; border-radius: 999px;
  background: #fff; opacity: .95; box-shadow: 24px 7px 0 -3px #fff, -16px 6px 0 -5px #fff; }
.gm-cloud2 { left: 54%; top: 46px; width: 48px; height: 19px; opacity: .8;
  box-shadow: 18px 5px 0 -3px #fff, -12px 4px 0 -4px #fff; }
.gm-hills { position: absolute; left: -6%; right: -6%; bottom: -22px; height: 58px;
  background: #8fd966; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.gm-hills::after { content: ''; position: absolute; left: 34%; right: -8%; bottom: 0; height: 40px;
  background: #7cc94f; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.gm-meadow { position: relative; padding: 4px 10px 14px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 2px 6px;
  background: linear-gradient(#7ecc50, #5faa3a); }
.gm-meadow::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.22) 1.2px, transparent 1.4px);
  background-size: 15px 15px; opacity: .7; }
.gm-burrow { position: relative; height: 138px; }
.gm-pit { position: absolute; left: 4%; right: 4%; top: 0; bottom: 17px; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; }
.gm-mole { width: 100%; display: flex; flex-direction: column; align-items: center; cursor: pointer;
  transform: translateY(104%); animation: gm-rise 2.4s ease-in-out infinite; }
@keyframes gm-rise {
  0% { transform: translateY(104%); }
  10% { transform: translateY(2%); }
  84% { transform: translateY(2%); }
  96% { transform: translateY(104%); }
  100% { transform: translateY(104%); }
}
.gm-board { min-width: 58px; max-width: 100%; padding: 4px 7px; margin-bottom: 1px; text-align: center;
  background: linear-gradient(#dcab6b, #b87a3f); color: #3a220f; font-size: 12px; font-weight: 800;
  line-height: 1.15; border: 2px solid #8a5527; border-radius: 5px; position: relative;
  box-shadow: 0 2px 0 #7a471f, 0 4px 8px rgba(0,0,0,.2); word-break: break-word;
  transition: background .15s, transform .15s; }
.gm-board::before, .gm-board::after { content: ''; position: absolute; top: 4px; width: 4px; height: 4px;
  border-radius: 50%; background: #6b3f1a; }
.gm-board::before { left: 4px; } .gm-board::after { right: 4px; }
.gm-paws { display: flex; gap: 15px; margin-bottom: -3px; }
.gm-paws span { width: 13px; height: 9px; border-radius: 50%; background: #8a6242;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.22); }
.gm-face { position: relative; width: 62px; height: 52px; border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 36% 28%, #c0916a, #8f6544 72%);
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.18); }
.gm-face::before, .gm-face::after { content: ''; position: absolute; top: -5px; width: 16px; height: 16px;
  border-radius: 50%; background: #7d5638; }
.gm-face::before { left: 2px; } .gm-face::after { right: 2px; }
.gm-eye { position: absolute; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: #241509;
  box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.gm-eye:nth-of-type(1) { left: 14px; } .gm-eye:nth-of-type(2) { right: 14px; }
.gm-snout { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); width: 26px; height: 18px;
  border-radius: 50%; background: #f2b7ac; box-shadow: inset 0 -3px 4px rgba(0,0,0,.12); }
.gm-snout::after { content: ''; position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 8px; height: 5px; border-radius: 50%; background: #4a2a1c; }
.gm-mole.gm-hit { animation: gm-sink .55s ease-in forwards; }
@keyframes gm-sink { to { transform: translateY(112%); filter: brightness(.85); } }
.gm-mole.gm-miss .gm-board { animation: gm-shake .45s;
  background: linear-gradient(#e2917f, #c25a48); color: #fff; }
.gm-rim { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; z-index: 3; pointer-events: none; }
.gm-dirt { position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 24%, #a2734a, #6d4827 72%);
  box-shadow: inset 0 -4px 6px rgba(0,0,0,.28); }
.gm-dark { position: absolute; left: 20%; right: 20%; top: 12%; bottom: 28%; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 32%, #241408, #452b12 78%);
  box-shadow: inset 0 4px 8px rgba(0,0,0,.7); }
.gm-text { font-size: 13.5px; font-weight: 800; color: #4a2c12; text-align: center; line-height: 1.25; }
@keyframes gm-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* --- balloon pop: sky, sun, clouds, grass --- */
.gm-sky { background: linear-gradient(#6ec1ff 0%, #b8e4ff 58%, #e6f7ff 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.6), 0 10px 24px rgba(16,24,40,.14); }
.gm-sky .gm-row { align-items: flex-end; padding: 24px 12px 30px; }
.gm-sun-sm { top: 14px; left: 22px; right: auto; width: 40px; height: 40px; }
.gm-cloud-a { left: 6%; top: 16px; }
.gm-cloud-b { left: 46%; top: 42px; width: 50px; }
.gm-cloud-c { right: 10%; left: auto; top: 22px; width: 44px; }
.gm-hillstrip { position: absolute; left: -4%; right: -4%; bottom: 0; height: 54px; background: #74c247;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0; box-shadow: inset 0 4px 0 rgba(255,255,255,.22); }
.gm-hillstrip::after { content: ''; position: absolute; left: 40%; right: -6%; bottom: 0; height: 34px;
  background: #63b23a; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.gm-balloon { position: relative; flex: 0 0 auto; width: 128px; min-height: 104px; margin-bottom: 24px;
  border-radius: 50% 50% 46% 46% / 52% 52% 48% 48%;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
  cursor: pointer; animation: gm-float 2.6s ease-in-out infinite alternate;
  color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.32);
  box-shadow: inset -10px -12px 22px rgba(0,0,0,.16), 0 8px 16px rgba(16,24,40,.12); }
.gm-balloon .gm-text { color: #fff; }
.gm-balloon::before { content: ''; position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 9px; border-radius: 50% 50% 60% 60%; background: rgba(255,255,255,.88); }
.gm-balloon::after { content: ''; position: absolute; left: 50%; bottom: -27px; width: 2px; height: 24px;
  background: linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,.2)); }
@keyframes gm-float { 0% { transform: translateY(0) rotate(-3deg); } 100% { transform: translateY(-14px) rotate(3deg); } }
.gm-balloon.gm-hit { animation: gm-popb .35s forwards; }
@keyframes gm-popb { to { transform: scale(1.6); opacity: 0; } }
.gm-balloon.gm-miss { animation: gm-shake .45s; filter: grayscale(.5); }

/* --- deep-sea dive: water, light rays, bubbles, seaweed, fish --- */
.gm-sea { background: linear-gradient(#073a5e 0%, #0a6c8c 34%, #0f9fa0 72%, #1fb9a6 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.22), 0 10px 24px rgba(6,40,60,.3); }
.gm-sea .gm-row { padding: 28px 14px 36px; gap: 24px 18px; }
.gm-ray { position: absolute; left: 8%; top: -30%; width: 74px; height: 170%; transform: rotate(16deg);
  background: linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,0)); filter: blur(7px); }
.gm-ray-2 { left: 58%; width: 54px; transform: rotate(22deg); opacity: .65; }
.gm-bubble { position: absolute; bottom: -24px; left: 10%; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); background: rgba(255,255,255,.14);
  animation: gm-bubble-rise 7s linear infinite; }
.gm-bubble:nth-child(3) { left: 12%; animation-duration: 6.4s; }
.gm-bubble:nth-child(4) { left: 26%; width: 7px; height: 7px; animation-delay: 1.1s; }
.gm-bubble:nth-child(5) { left: 38%; width: 9px; height: 9px; animation-delay: 2.4s; }
.gm-bubble:nth-child(6) { left: 50%; animation-delay: .6s; }
.gm-bubble:nth-child(7) { left: 62%; width: 8px; height: 8px; animation-delay: 3s; }
.gm-bubble:nth-child(8) { left: 72%; animation-delay: 1.8s; }
.gm-bubble:nth-child(9) { left: 84%; width: 13px; height: 13px; animation-delay: 2.9s; }
.gm-bubble:nth-child(10) { left: 92%; width: 7px; height: 7px; animation-delay: .9s; }
.gm-bubble:nth-child(11) { left: 44%; width: 6px; height: 6px; animation-delay: 4.2s; }
@keyframes gm-bubble-rise {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  18% { opacity: .9; }
  100% { transform: translateY(-280px) scale(1); opacity: 0; }
}
.gm-weed { position: absolute; bottom: 0; left: 4%; width: 16px; height: 84px;
  border-radius: 60% 60% 0 0; background: linear-gradient(#2aa06a, #0b5c42);
  transform-origin: bottom center; animation: gm-sway 3.6s ease-in-out infinite alternate; }
.gm-weed-2 { left: auto; right: 4%; height: 104px; animation-delay: .9s; }
.gm-weed-3 { left: 48%; height: 52px; opacity: .6; animation-delay: 1.7s; }
@keyframes gm-sway { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }
.gm-sandy { position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  background: linear-gradient(#f4e0ad, #d9bd80); border-radius: 40% 40% 0 0 / 34% 34% 0 0; }
.gm-fish { position: relative; flex: 0 0 auto; width: 138px; min-height: 66px;
  border-radius: 50% 46% 46% 50% / 62% 50% 50% 62%;
  display: flex; align-items: center; justify-content: center; padding: 10px 20px 10px 25px;
  cursor: pointer; color: #fff; font-weight: 800; font-size: 12.5px; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.35);
  box-shadow: inset -8px -10px 18px rgba(0,0,0,.18), 0 8px 16px rgba(0,0,0,.18);
  animation: gm-swim 3.2s ease-in-out infinite alternate; }
.gm-fish .gm-text { color: #fff; }
.gm-fish::before { content: ''; position: absolute; right: -17px; top: 50%; margin-top: -19px;
  width: 24px; height: 38px; background: inherit; clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.gm-fish::after { content: ''; position: absolute; left: 32%; top: -11px; width: 28px; height: 15px;
  background: inherit; clip-path: polygon(0 100%, 62% 0, 100% 100%); opacity: .95; }
.gm-fish-eye { position: absolute; left: 11px; top: 13px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 3px #17212e; }
@keyframes gm-swim {
  0% { transform: translate(0, 0) rotate(-2deg); }
  100% { transform: translate(10px, -7px) rotate(2deg); }
}
.gm-fish.gm-hit { animation: gm-dive .6s forwards; }
@keyframes gm-dive { to { transform: translate(70px, 46px) scale(.35) rotate(24deg); opacity: 0; } }
.gm-fish.gm-miss { animation: gm-shake .45s; filter: grayscale(.7) brightness(.75); }

/* --- space blast: starfield, planet, drifting asteroids --- */
.gm-space { background: radial-gradient(ellipse at 26% 12%, #2b3270 0%, #151a3e 45%, #06080f 100%);
  box-shadow: inset 0 0 0 3px rgba(120,140,255,.16), 0 12px 28px rgba(4,8,24,.45); }
.gm-space .gm-row { padding: 28px 14px; gap: 20px 18px; }
.gm-stars { position: absolute; inset: 0; animation: gm-twinkle 4s ease-in-out infinite alternate;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 24%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 28% 66%, #cfe0ff, transparent),
    radial-gradient(1.8px 1.8px at 44% 18%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 58% 78%, #dfe9ff, transparent),
    radial-gradient(1.5px 1.5px at 72% 32%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 84% 62%, #bcd4ff, transparent),
    radial-gradient(1.7px 1.7px at 93% 16%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 6% 84%, #fff, transparent),
    radial-gradient(1.1px 1.1px at 36% 44%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 66% 52%, #fff, transparent); }
@keyframes gm-twinkle { from { opacity: .6; } to { opacity: 1; } }
.gm-nebula { position: absolute; left: -60px; bottom: -70px; width: 230px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, rgba(120,90,255,.45), rgba(120,90,255,0) 70%); filter: blur(10px); }
.gm-planet { position: absolute; right: -28px; top: -30px; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffd9a0, #e8793f 52%, #9c3a27 100%);
  box-shadow: 0 0 34px rgba(255,150,90,.35); }
.gm-planet::after { content: ''; position: absolute; left: -18px; right: -18px; top: 42%; height: 12px;
  border-radius: 50%; border: 3px solid rgba(255,225,190,.45); transform: rotate(-18deg); }
.gm-rock { position: relative; flex: 0 0 auto; width: 128px; height: 98px;
  display: flex; align-items: center; justify-content: center; padding: 12px; cursor: pointer;
  border-radius: 48% 52% 44% 56% / 54% 46% 54% 46%;
  background: radial-gradient(circle at 32% 26%, #b3bccc, #6d7688 40%, #3b4253 76%, #222736);
  box-shadow: inset -8px -10px 18px rgba(0,0,0,.45), inset 6px 6px 12px rgba(255,255,255,.10),
    0 10px 20px rgba(0,0,0,.45);
  color: #eef2ff; font-weight: 800; font-size: 12.5px; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  animation: gm-drift 3.6s ease-in-out infinite alternate; }
.gm-rock .gm-text { position: relative; z-index: 2; color: #eef2ff; }
.gm-crater { position: absolute; left: 12px; top: 16px; width: 22px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #2c3243, #59637a);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.6); }
.gm-crater-2 { left: auto; right: 14px; top: auto; bottom: 14px; width: 14px; height: 11px; }
.gm-boom { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 58px; }
.gm-rock.gm-hit { animation: gm-blast .55s forwards; }
.gm-rock.gm-hit .gm-boom { display: flex; }
@keyframes gm-blast {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); box-shadow: 0 0 40px rgba(255,200,90,.85); }
  100% { transform: scale(.15); opacity: 0; }
}
@keyframes gm-drift {
  0% { transform: translate(-4px, 2px) rotate(-3deg); }
  100% { transform: translate(5px, -6px) rotate(3deg); }
}
.gm-rock.gm-miss { animation: gm-shake .45s; filter: grayscale(.6) brightness(.7); }

/* --- ice floe hop: aurora night, moon, snow, penguins on floes --- */
.gm-arctic { background: linear-gradient(#050f2b 0%, #0d2a55 34%, #1d5f92 58%, #79c2e8 70%, #eaf8ff 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.2), 0 12px 26px rgba(8,20,45,.35); }
.gm-arctic .gm-row { padding: 36px 14px 32px; align-items: flex-end; }
.gm-aurora { position: absolute; left: -10%; right: -10%; top: 4%; height: 64px; border-radius: 50%;
  background: linear-gradient(90deg, rgba(90,255,190,0), rgba(90,255,190,.5), rgba(120,180,255,.35), rgba(90,255,190,0));
  filter: blur(14px); animation: gm-aurora 9s ease-in-out infinite alternate; }
.gm-aurora-2 { top: 17%; height: 40px;
  background: linear-gradient(90deg, rgba(180,120,255,0), rgba(180,120,255,.4), rgba(90,255,190,.28), rgba(180,120,255,0));
  animation-delay: 2.4s; }
@keyframes gm-aurora {
  from { transform: translateX(-16px) scaleY(.9); opacity: .7; }
  to { transform: translateX(16px) scaleY(1.12); opacity: 1; }
}
.gm-moon { position: absolute; right: 20px; top: 14px; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fff, #e2ecf9 58%, #bccfe4);
  box-shadow: 0 0 22px rgba(200,225,255,.75); }
.gm-snow { position: absolute; left: -4%; right: -4%; bottom: -26px; height: 86px;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0; background: #f4fbff;
  box-shadow: inset 0 6px 0 rgba(190,220,240,.7); }
.gm-flake { position: absolute; top: -10px; left: 10%; width: 5px; height: 5px; border-radius: 50%;
  background: #fff; opacity: .85; animation: gm-snowfall 8s linear infinite; }
.gm-flake:nth-child(4) { left: 22%; animation-delay: 1.2s; }
.gm-flake:nth-child(5) { left: 33%; width: 4px; height: 4px; animation-delay: 2.6s; }
.gm-flake:nth-child(6) { left: 44%; animation-delay: .5s; animation-duration: 6.5s; }
.gm-flake:nth-child(7) { left: 56%; width: 6px; height: 6px; animation-delay: 3.4s; }
.gm-flake:nth-child(8) { left: 64%; animation-delay: 1.9s; }
.gm-flake:nth-child(9) { left: 74%; width: 4px; height: 4px; animation-delay: 4.1s; }
.gm-flake:nth-child(10) { left: 83%; animation-delay: .9s; }
.gm-flake:nth-child(11) { left: 91%; width: 6px; height: 6px; animation-delay: 2.2s; }
.gm-flake:nth-child(12) { left: 28%; animation-delay: 5s; animation-duration: 9s; }
.gm-flake:nth-child(13) { left: 68%; animation-delay: 3.8s; animation-duration: 7.4s; }
@keyframes gm-snowfall {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: .9; }
  100% { transform: translateY(250px); opacity: 0; }
}
.gm-floe { position: relative; flex: 0 0 auto; width: 132px; padding: 52px 10px 12px; cursor: pointer;
  text-align: center; border-radius: 26px 26px 20px 20px;
  background: linear-gradient(#ffffff 0%, #e2f2ff 62%, #b9dcf2 100%);
  box-shadow: inset 0 -6px 0 rgba(150,195,225,.55), 0 10px 18px rgba(6,25,50,.3);
  animation: gm-bob 3.4s ease-in-out infinite alternate; }
.gm-floe::after { content: ''; position: absolute; left: 4%; right: 4%; bottom: -7px; height: 16px;
  border-radius: 50%; background: rgba(255,255,255,.55); filter: blur(4px); }
.gm-penguin { position: absolute; left: 50%; top: 3px; transform: translateX(-50%);
  width: 44px; height: 46px; border-radius: 50% 50% 44% 44%;
  background: radial-gradient(circle at 50% 24%, #46566e, #131d2b 72%); }
.gm-penguin::before { content: ''; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  width: 27px; height: 25px; border-radius: 50% 50% 46% 46%; background: #f8fcff; }
.gm-penguin::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
  width: 16px; height: 7px; border-radius: 0 0 50% 50%; background: #f2a03d; }
.gm-pg-eye { position: absolute; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  box-shadow: inset 0 0 0 2px #0b1522; z-index: 2; }
.gm-pg-eye:nth-of-type(1) { left: 9px; } .gm-pg-eye:nth-of-type(2) { right: 9px; }
.gm-beak { position: absolute; left: 50%; top: 21px; transform: translateX(-50%); width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 9px solid #f2a03d; z-index: 2; }
.gm-floe-word { position: relative; display: block; font-weight: 800; font-size: 13px; color: #0f3f60; line-height: 1.2; }
@keyframes gm-bob { from { transform: translateY(0) rotate(-1.5deg); } to { transform: translateY(-8px) rotate(1.5deg); } }
.gm-floe.gm-hit { animation: gm-splash .6s forwards; }
@keyframes gm-splash {
  0% { transform: scale(1); }
  40% { transform: scale(1.06) translateY(4px); }
  100% { transform: translateY(60px) rotate(10deg) scale(.8); opacity: 0; }
}
.gm-floe.gm-miss { animation: gm-shake .45s; filter: grayscale(.55) brightness(.9); }

/* --- piñata party: bunting flags, striped piñatas on strings --- */
.gm-fiesta { background: linear-gradient(#ffe6ad 0%, #ffc6d6 55%, #ff9ec9 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.55), 0 12px 26px rgba(120,60,90,.22); }
.gm-fiesta .gm-row { padding: 54px 16px 28px; align-items: flex-start; gap: 20px 18px; }
.gm-flags { position: absolute; left: 0; right: 0; top: 0; height: 34px; display: flex;
  justify-content: space-between; padding: 0 4px; }
.gm-flags::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: #c79a63; }
.gm-flag { width: 0; height: 0; margin-top: 3px; border-left: 10px solid transparent;
  border-right: 10px solid transparent; border-top: 19px solid #ef476f; }
.gm-flag:nth-child(3n+2) { border-top-color: #ffd166; }
.gm-flag:nth-child(3n) { border-top-color: #06d6a0; }
.gm-flag:nth-child(4n) { border-top-color: #118ab2; }
.gm-fiesta-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  background: linear-gradient(#e7b98a, #cf9a68); }
.gm-fiesta-floor::before { content: ''; position: absolute; inset: 0; opacity: .55;
  background-image: radial-gradient(rgba(255,255,255,.5) 2px, transparent 2.6px); background-size: 22px 22px; }
.gm-pinata { position: relative; flex: 0 0 auto; width: 118px; padding-top: 30px; cursor: pointer;
  text-align: center; transform-origin: top center; animation: gm-swing 3s ease-in-out infinite alternate; }
.gm-string { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 2px; height: 32px;
  background: linear-gradient(#b98b57, #8c6237); }
.gm-pinata-body { position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 84px; padding: 8px; border: 3px solid #fff;
  border-radius: 46% 46% 40% 40% / 40% 40% 54% 54%;
  background: repeating-linear-gradient(45deg, #ff6b8b 0 10px, #ffd166 10px 20px,
    #7bd389 20px 30px, #6ec6ff 30px 40px);
  box-shadow: inset -8px -10px 18px rgba(0,0,0,.12), 0 8px 16px rgba(140,60,90,.25); }
.gm-pinata .gm-text { background: rgba(255,255,255,.94); color: #7a2740; border-radius: 999px;
  padding: 3px 9px; font-size: 12.5px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
@keyframes gm-swing { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.gm-pinata.gm-hit { animation: gm-crack .65s forwards; }
@keyframes gm-crack {
  0% { transform: rotate(-4deg); }
  35% { transform: rotate(7deg) scale(1.09); }
  100% { transform: rotate(26deg) translateY(34px) scale(.82); opacity: .2; }
}
.gm-pinata.gm-miss { animation: gm-shake .45s; filter: grayscale(.6); }

/* --- treasure chests: a beach with sea, palm and sand --- */
.gm-beach { background: linear-gradient(#8fd8ff 0 26%, #37a8d8 26% 33%, #f3dfae 33% 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.6), 0 12px 26px rgba(16,24,40,.16); }
.gm-beach .gm-row { padding: 48px 14px 32px; align-items: stretch; gap: 16px; }
.gm-palm { position: absolute; left: 4px; top: -12px; font-size: 46px; line-height: 1;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,.2)); }
.gm-island { position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
  background: linear-gradient(#f6e4b8, #ddc188); }
.gm-chest { position: relative; flex: 0 1 152px; min-width: 128px; min-height: 108px; cursor: pointer;
  border-radius: 10px 10px 14px 14px;
  display: flex; align-items: flex-end; justify-content: center; padding: 10px 8px 16px;
  background: linear-gradient(#a9713d, #7c4f24 62%, #5d3917);
  border: 2px solid #4a2d11; box-shadow: 0 6px 0 #3f260e, 0 10px 18px rgba(0,0,0,.18);
  transition: transform .12s, filter .15s; overflow: hidden; }
.gm-chest::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 34%;
  background: linear-gradient(#c78b4d, #8c5a2a); border-bottom: 3px solid #f5c451;
  border-radius: 8px 8px 4px 4px; transition: transform .3s; }
.gm-chest::after { content: '🏴‍☠️'; position: absolute; top: 2px; left: 0; right: 0; text-align: center; font-size: 18px; }
.gm-chest:hover { transform: translateY(-2px); filter: brightness(1.06); }
.gm-chest .gm-text { position: relative; z-index: 2; color: #fff6e0; font-size: 13px; font-weight: 800;
  background: rgba(74,45,17,.72); border-radius: 8px; padding: 4px 6px; }
.gm-chest.gm-hit { animation: gm-open .5s forwards; }
@keyframes gm-open { to { transform: translateY(-8px) rotate(-4deg); filter: brightness(1.35); } }
.gm-chest.gm-hit::before { transform: translateY(-16px) rotate(-12deg); }
.gm-chest.gm-miss { animation: gm-shake .45s; filter: grayscale(.6); }

/* --- richer scenery for the other games (v28) --- */
/* balloon sky: birds, kite, distant hot-air balloon */
.gm-bird { position: absolute; top: 26%; left: 14%; width: 22px; height: 8px; }
.gm-bird::before, .gm-bird::after { content: ''; position: absolute; top: 0; width: 10px; height: 8px;
  border-top: 2.5px solid rgba(40,60,90,.55); border-radius: 50%; }
.gm-bird::before { left: 0; transform: rotate(-14deg); }
.gm-bird::after { right: 0; transform: rotate(14deg); }
.gm-bird-2 { top: 17%; left: 62%; animation: gm-flyby 10s linear infinite; }
@keyframes gm-flyby { from { transform: translateX(0); } to { transform: translateX(-42vw); } }
.gm-kite { position: absolute; top: 12%; right: 15%; width: 26px; height: 30px;
  background: linear-gradient(135deg, #ff6b8b 50%, #ffd166 50%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); transform: rotate(16deg);
  filter: drop-shadow(0 2px 3px rgba(16,24,40,.18)); }
.gm-kite::after { content: ''; position: absolute; left: 50%; top: 92%; width: 1.5px; height: 36px;
  background: rgba(255,255,255,.8); transform: rotate(-14deg); transform-origin: top center; }
.gm-hotair { position: absolute; top: 9%; right: 34%; width: 34px; height: 40px; opacity: .85;
  animation: gm-float 4.5s ease-in-out infinite alternate; }
.gm-hotair::before { content: ''; position: absolute; inset: 0 0 22%;
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  background: repeating-linear-gradient(90deg, #ff8fa3 0 8px, #ffd166 8px 16px, #6ec6ff 16px 24px); }
.gm-hotair::after { content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 12px; height: 10px; border-radius: 2px; background: #a9713d; }
/* deep-sea: branching coral, drifting jellyfish, starfish */
.gm-coral { position: absolute; bottom: 28px; left: 5%; width: 38px; height: 48px; }
.gm-coral::before, .gm-coral::after { content: ''; position: absolute; bottom: 0;
  width: 12px; border-radius: 8px 8px 4px 4px; background: linear-gradient(#ff9fb0, #c25a78); }
.gm-coral::before { left: 2px; height: 44px; transform: rotate(-9deg);
  box-shadow: 13px -7px 0 -1px #e77a94; }
.gm-coral::after { right: 0; height: 34px; transform: rotate(12deg); }
.gm-coral-2 { left: auto; right: 6%; bottom: 24px; }
.gm-coral-2::before, .gm-coral-2::after { background: linear-gradient(#c9a2ff, #7c5cd6); }
.gm-coral-2::before { box-shadow: 13px -7px 0 -1px #a684e8; }
.gm-jelly { position: absolute; top: 16%; left: 72%; width: 30px; height: 36px; opacity: .75;
  animation: gm-jellyfloat 8s ease-in-out infinite alternate; }
.gm-jelly::before { content: ''; position: absolute; inset: 0 0 42%;
  border-radius: 50% 50% 42% 42%;
  background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.9), rgba(180,150,255,.75)); }
.gm-jelly::after { content: ''; position: absolute; left: 6px; right: 6px; top: 60%; height: 40%;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.55) 0 2px, transparent 2px 7px);
  border-radius: 0 0 6px 6px; }
@keyframes gm-jellyfloat { from { transform: translateY(0); } to { transform: translateY(-28px); } }
.gm-jelly-2 { left: 86%; top: 34%; transform: scale(.62); animation-delay: 2.6s; opacity: .6; }
.gm-starfish { position: absolute; bottom: 20px; left: 46%; width: 26px; height: 26px; opacity: .9;
  background: #ffb26b;
  clip-path: polygon(50% 0, 63% 35%, 98% 35%, 70% 57%, 82% 95%, 50% 72%, 18% 95%, 30% 57%, 2% 35%, 37% 35%);
  filter: drop-shadow(0 2px 2px rgba(60,30,0,.3)); }
/* space: streaking comet, drifting UFO */
.gm-comet { position: absolute; top: 16%; left: 8%; width: 64px; height: 3px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(190,215,255,.85));
  transform: rotate(-18deg); animation: gm-cometfly 7s linear infinite; }
.gm-comet::after { content: ''; position: absolute; right: -4px; top: -2.5px; width: 8px; height: 8px;
  border-radius: 50%; background: #eaf2ff; box-shadow: 0 0 10px rgba(220,235,255,.95); }
@keyframes gm-cometfly {
  0% { opacity: 0; transform: translateX(0) rotate(-18deg); }
  14% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translateX(46vw) rotate(-18deg); }
}
.gm-ufo { position: absolute; bottom: 16%; right: 7%; font-size: 30px; opacity: .9;
  animation: gm-ufodrift 6s ease-in-out infinite alternate; filter: drop-shadow(0 4px 8px rgba(120,220,255,.3)); }
@keyframes gm-ufodrift { from { transform: translate(0, 0) rotate(-6deg); } to { transform: translate(-20px, -12px) rotate(6deg); } }
/* arctic: snowy mountains with a little igloo */
.gm-mtn { position: absolute; bottom: 62px; left: -4%; width: 44%; height: 130px; opacity: .88;
  background: linear-gradient(#17335f, #0d1f3f);
  clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.gm-mtn::after { content: ''; position: absolute; left: 36%; top: 0; width: 28%; height: 24%;
  background: #e8f4ff; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.gm-mtn-2 { left: auto; right: -2%; width: 36%; height: 96px; opacity: .7; }
.gm-igloo { position: absolute; bottom: 62px; left: 12%; width: 56px; height: 30px;
  border-radius: 30px 30px 0 0;
  background: linear-gradient(#f6fbff, #d9ecf8);
  box-shadow: inset 0 -3px 0 rgba(150,195,225,.6), 0 2px 4px rgba(10,30,60,.25); }
.gm-igloo::after { content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 22px; height: 15px; border-radius: 15px 15px 0 0; background: #8fb8d9; }
/* fiesta: floating balloons and curling streamers */
.gm-fb { position: absolute; width: 26px; height: 32px; opacity: .92;
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  animation: gm-float 3.4s ease-in-out infinite alternate;
  background: radial-gradient(circle at 34% 26%, rgba(255,255,255,.55), rgba(255,255,255,0) 50%), #ff6b8b; }
.gm-fb::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 30px;
  background: rgba(255,255,255,.7); }
.gm-fb { left: 7%; top: 13%; }
.gm-fb-2 { left: auto; right: 9%; top: 9%; width: 22px; height: 27px;
  background: radial-gradient(circle at 34% 26%, rgba(255,255,255,.55), rgba(255,255,255,0) 50%), #6ec6ff; }
.gm-fb-3 { left: auto; right: 20%; top: 19%; width: 19px; height: 24px;
  background: radial-gradient(circle at 34% 26%, rgba(255,255,255,.55), rgba(255,255,255,0) 50%), #7bd389; }
.gm-streamer { position: absolute; top: 0; left: 22%; width: 8px; height: 74px; opacity: .75;
  background: linear-gradient(#ffd166, #ff9ec9);
  border-radius: 999px; transform: rotate(8deg);
  animation: gm-sway 3.4s ease-in-out infinite alternate; }
.gm-streamer-2 { left: auto; right: 24%; transform: rotate(-10deg); height: 60px;
  background: linear-gradient(#6ec6ff, #7bd389); animation-delay: 1.2s; }
/* beach: waves on the horizon, a little sailboat, a crab and a shell */
.gm-ship { position: absolute; top: 14%; right: 7%; font-size: 26px; opacity: .92;
  transform: scaleX(-1); filter: drop-shadow(0 2px 2px rgba(0,40,70,.2)); }
.gm-wave { position: absolute; top: 26.5%; left: 0; right: 0; height: 6px; opacity: .65;
  background: repeating-linear-gradient(90deg, transparent 0 26px, rgba(255,255,255,.55) 26px 40px, transparent 40px 62px);
  border-radius: 999px; }
.gm-wave-2 { top: 29%; opacity: .35; }
.gm-crab { position: absolute; bottom: 12px; left: 7%; font-size: 20px; opacity: .95; }
.gm-shell { position: absolute; bottom: 16px; right: 9%; width: 20px; height: 16px; opacity: .9;
  background: radial-gradient(circle at 50% 100%, #ffd9c0 0 46%, rgba(255,190,150,.5) 50% 62%, transparent 64%);
  border-radius: 50% 50% 4px 4px / 80% 80% 8px 8px;
  transform: rotate(12deg); }

/* ---------- saved games list (teacher "Build a game" tab) ---------- */
.sg-list { display: grid; gap: 12px; }
.sg-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: #fff;
  transition: box-shadow .15s ease, border-color .15s ease; }
.sg-item:hover { box-shadow: 0 6px 16px rgba(16,24,40,.08); border-color: #c7cdf7; }
.sg-main { min-width: 0; flex: 1; }
.sg-chip { display: inline-flex; align-items: center; gap: 5px; background: #f1f5f9;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
  font-size: 12.5px; font-weight: 600; color: #475069; }
.sg-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }

/* ---------- launcher for the full-page whack-a-mole arcade ---------- */
.mole-arcade-btn { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; cursor: pointer;
  border-radius: 18px; padding: 14px 18px; margin-bottom: 16px; text-align: left;
  background: linear-gradient(#5db92f, #3d8f1f); color: #fff;
  box-shadow: 0 6px 0 #2f6d16, 0 12px 22px rgba(30, 80, 10, .3);
  transition: transform .12s, box-shadow .12s, filter .15s; }
.mole-arcade-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.mole-arcade-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #2f6d16, 0 6px 12px rgba(30,80,10,.25); }
.mole-arcade-btn .mab-emoji { font-size: 30px; line-height: 1; flex: 0 0 auto;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.mole-arcade-btn .mab-body { min-width: 0; }
.mole-arcade-btn .mab-body b { display: block; font-size: 16px; letter-spacing: .01em; }
.mole-arcade-btn .mab-body > span { display: block; font-size: 12.5px; opacity: .92; margin-top: 3px; line-height: 1.4; }

/* ---------- printable matching board ---------- */
.mq-sheet-block { margin-bottom: 6px; }
.mq-sheet { display: flex; gap: 24px; margin: 8px 0 10px; }
.mq-sheet-col { flex: 1; }
.mq-sheet-row { border-bottom: 1px dotted #bbb; padding: 5px 2px; font-size: 13.5px; }

/* ---------- open practice: big search bar + dialogs ---------- */
.op-search { display: flex; gap: 10px; align-items: center; }
.op-search input[type="search"] {
  flex: 1 1 auto; min-width: 0; padding: 13px 16px; font-size: 15.5px;
  border: 2px solid var(--border); border-radius: 12px; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.op-search input[type="search"]:focus {
  border-color: #6d5ce7; box-shadow: 0 0 0 4px rgba(109, 92, 231, .14);
}
.op-search .btn.secondary { flex: 0 0 auto; height: 46px; padding: 0 16px; }

.modal-back {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(24, 18, 48, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 42px 16px; overflow: auto;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal-box {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  padding: 20px 22px 18px; box-shadow: 0 24px 60px rgba(20, 12, 45, .32);
  animation: modalIn .16s ease-out;
}
.modal-box.wide { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-x {
  border: none; background: #f1eefc; color: #5b4bc4; border-radius: 9px;
  width: 32px; height: 32px; font-size: 15px; cursor: pointer; flex: 0 0 auto;
}
.modal-x:hover { background: #e4dffa; }
.op-card-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.op-card-grid .btn { flex: 0 0 auto; }
.op-for { font-size: 11.5px; color: #5b4bc4; background: #f1eefc; border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }

/* tap-to-pick student chips inside the assign dialog */
.op-spick {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-height: 220px; overflow-y: auto; padding: 2px;
}
.op-spick .op-chip {
  border: 2px solid var(--border); background: #fff; color: var(--text);
  border-radius: 999px; padding: 8px 15px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.op-spick .op-chip:hover { border-color: #6d5ce7; background: #f6f4fe; }
.op-spick .op-chip.sel {
  border-color: #6d5ce7; background: #6d5ce7; color: #fff;
  box-shadow: 0 3px 10px rgba(109, 92, 231, .35);
}
.op-spick .op-chip.op-chip-all {
  background: #f1eefc; border-color: #d8d0f7; color: #5b4bc4;
  margin-left: auto;
}
.op-spick .op-chip.op-chip-all.sel { background: #5b4bc4; border-color: #5b4bc4; color: #fff; }
.op-spick-note { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.op-spick .op-spick-loading { color: var(--muted); font-size: 13px; padding: 4px 2px; }

/* ============================================================
   Design polish (v33)
   Keeps the look, fixes alignment: header in line with the cards,
   one-row tabs, untruncated dropdowns, tidy table actions,
   focus rings, press states, and a sane layout on phones.
   ============================================================ */
:root {
  --wrap: 940px;
  --gutter: 16px;
  --focus-ring: 0 0 0 4px rgba(109, 92, 231, .16);
}
body.dash { --wrap: 1080px; }          /* teacher dashboard: wide working column */
body.student-page { --wrap: 1024px; }  /* student: just wide enough for the header chips */
@media screen { .wrap { max-width: var(--wrap); } }
/* the landing hero is inset 16px inside the column, so line the header up with it */
body.landing header.topbar {
  padding-left: max(var(--gutter), calc((100% - var(--wrap)) / 2 + 32px));
  padding-right: max(var(--gutter), calc((100% - var(--wrap)) / 2 + 32px));
}

/* ---------- small global touches ---------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: rgba(79, 110, 247, .22); }
* { scrollbar-width: thin; scrollbar-color: #c3c9ec transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3c9ec; border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
a { text-underline-offset: 3px; }

/* ---------- header: content lines up with the cards below ---------- */
header.topbar {
  padding: 14px max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter)));
  gap: 12px;
}
header.topbar .brand { gap: 12px; min-width: 0; flex: 0 0 auto; }
header.topbar .brand > div { min-width: 0; overflow: hidden; }
header.topbar h1 {
  font-size: 20px; line-height: 1.2; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(23, 18, 60, .45);
}
header.topbar .sub {
  display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.35; opacity: .9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(23, 18, 60, .5);
}
header.topbar .top-actions { flex-wrap: wrap; justify-content: flex-end; min-width: 0; margin-left: auto; }
header.topbar .top-actions + .lang-switch { margin-left: 0; }
header.topbar #syncBadge, header.topbar .who, header.topbar .token-chip,
header.topbar .class-menu, header.topbar .top-actions > a, header.topbar .lang-switch {
  white-space: nowrap; flex: 0 0 auto;
}
header.topbar .top-actions > a { opacity: .92; font-weight: 600; transition: opacity .15s; }
/* a very long class or teacher name shortens with "…" instead of stretching the header */
header.topbar .who { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
header.topbar .top-actions > a:hover { opacity: 1; }

/* wide screens: one row, always. The chips group gives way first (it wraps
   inside itself on the right) so the language switch never drops below. */
@media (min-width: 1101px) {
  header.topbar { flex-wrap: nowrap; }
  header.topbar .top-actions { flex: 0 1 auto; min-width: 0; }
}
@media (max-width: 1100px) {
  header.topbar { padding-top: 12px; padding-bottom: 12px; row-gap: 10px; }
  header.topbar .top-actions { order: 3; flex: 1 0 100%; justify-content: flex-end; gap: 8px !important; }
  header.topbar .lang-switch { order: 2; }
}
@media (max-width: 720px) {
  /* the title gives way (never the switch): flex-basis 0 lets it shrink, and it
     ends in "…" on very narrow phones instead of pushing the switch to a new row */
  header.topbar .brand { flex: 1 1 0; min-width: 0; gap: 8px; }
  header.topbar .topbar-logo { height: 34px; width: 34px; }
  header.topbar h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
  /* the type steps down only as far as the title box requires; browsers without
     container queries simply fall back to the "…" above */
  header.topbar .brand > div { flex: 1 1 auto; container-type: inline-size; }
  @container (max-width: 215px) { header.topbar h1 { font-size: 15px; } }
  @container (max-width: 182px) { header.topbar h1 { font-size: 13.5px; } }
  @container (max-width: 160px) { header.topbar h1 { font-size: 12px; } }
  header.topbar .sub { max-width: 44vw; }
  header.topbar > .sub { order: 3; flex: 1 0 100%; max-width: none; white-space: normal; overflow: visible; }
  header.topbar .top-actions { justify-content: flex-start; }
}

/* ---------- tabs: always one row, swipe sideways when they do not fit ---------- */
.tabs {
  flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-bottom: 16px; margin-bottom: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.gate > .tabs { padding-bottom: 4px; }
.tab { flex: 0 0 auto; white-space: nowrap; }

/* ---------- form controls: one focus style, tidy dropdown arrow ---------- */
.field input:where([type=tel], [type=email], [type=search], [type=time], [type=url]) {
  width: 100%; padding: 10px 12px; border: 1px solid #dfe4f2; border-radius: 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
.field input[type=text], .field input[type=password], .field input[type=date], .field input[type=number],
.field input:where([type=tel], [type=email], [type=search], [type=time], [type=url]),
.field select, .field textarea {
  border-color: #dfe4f2; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field input:hover:not(:disabled):not(:focus):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
.field select:hover:not(:disabled), .field textarea:hover:not(:focus) { border-color: #c6cde8; }
.field input:where([type=text], [type=password], [type=date], [type=number], [type=tel], [type=email], [type=search], [type=time], [type=url]):focus,
.field select:focus, .field textarea:focus { outline: none; border-color: #6d5ce7; box-shadow: var(--focus-ring); }
.field select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%235b6389' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
.field select:focus { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%236d5ce7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }
.field ::placeholder { color: #98a0b8; opacity: 1; }

/* teacher form: each dropdown gets the width its longest option needs */
.row .field:has(> #aGrade) { flex: 1 1 170px; }
.row .field:has(> #aCount) { flex: .6 1 80px; }
.row .field:has(> #aQType) { flex: 1.3 1 200px; }
.row .field:has(> #aDiff) { flex: .8 1 120px; }
.row .field:has(> #aDue) { flex: 1 1 150px; }
.row .field:has(> #aSubject) { flex: 1 1 180px; }
.row .field:has(> #aAspect) { flex: 1.2 1 200px; }
.row .field:has(> #aKind) { flex: 1.15 1 210px; }
.delivery-row { align-items: flex-start; }
.delivery-row > .field { flex: 0 1 400px; }
.delivery-row > .side-note { flex: 1 1 300px; margin: 0; padding-top: 25px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.delivery-row > .side-note a { white-space: nowrap; text-decoration-color: rgba(79, 110, 247, .45); transition: text-decoration-color .15s; }
.delivery-row > .side-note a:hover { text-decoration-color: currentColor; }
@media (max-width: 720px) {
  .delivery-row > .field, .delivery-row > .side-note { flex: 1 1 100%; }
  .delivery-row > .side-note { padding-top: 2px; }
}

/* ---------- buttons & chips: press feedback, keyboard focus ---------- */
.btn {
  transition: transform .12s ease, box-shadow .12s ease, background-color .15s ease,
              border-color .15s ease, color .15s ease, filter .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); box-shadow: 0 3px 8px rgba(91, 108, 240, .22); }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible { outline: 3px solid rgba(109, 92, 231, .42); outline-offset: 2px; }
.btn.secondary:hover:not(:disabled) { background: #f7f5ff; }
.btn.danger:hover:not(:disabled) { background: #fef2f2; }
.btn.danger:active:not(:disabled) { box-shadow: 0 3px 8px rgba(220, 38, 38, .16); }
.chip { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s; }
.chip:hover:not(.active):not(:disabled) { border-color: #b9c2f5; background: #f7f8ff; }
.chip:active:not(:disabled) { transform: scale(.96); }
.chip.active { box-shadow: 0 2px 8px rgba(79, 110, 247, .18); }

/* ---------- tables: scroll sideways instead of off the page; tidy actions ---------- */
table.list { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list tbody { display: table; width: 100%; min-width: 560px; }
table.list tbody tr { transition: background-color .15s; }
table.list tbody tr:hover { background: #fafbff; }
table.list td:has(> .btn) { white-space: nowrap; }
table.list .btn.small { padding: 6px 12px; font-size: 12.5px; }
@media print {
  table.list { display: table; }
  table.list tbody { display: table-row-group; min-width: 0; }
}
.list-empty {
  padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5;
  border: 1.5px dashed #d9def3; border-radius: 14px; background: #fbfcff;
}
/* phones: the assignment lists become stacked rows instead of a squeezed table */
@media (max-width: 640px) {
  table.list-cards { overflow: visible; }
  table.list-cards tbody { display: block; min-width: 0; }
  table.list-cards tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 2px; }
  table.list-cards tbody tr:first-child { display: none; }
  table.list-cards td { display: block; border: 0; padding: 0; white-space: normal; }
  table.list-cards td:first-child { flex: 1 0 100%; }
  table.list-cards td:last-child { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  table.list-cards td:last-child .btn { margin-left: 0 !important; }
}

/* ---------- menus & dialogs ---------- */
.class-menu-drop:not(.hidden) { animation: polishDropIn .16s ease-out; transform-origin: top right; }
@keyframes polishDropIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-box { border: 1px solid #e6e2f7; }
.modal-head h3 { line-height: 1.3; padding-top: 3px; }

/* ---------- respect "reduce motion" ---------- */
@media (prefers-reduced-motion: reduce) {
  .deco-item, .topbar-logo, .quote, .token-chip, .medal-glow, .greet-wave, .greet-spark { animation: none !important; }
  .card, .btn, .chip, .role-card, .medal-card, .sg-item { transition: none !important; }
  .role-card:hover { animation: none; }
}

/* the teacher dashboard has eight tabs: slightly tighter so they stay on one row */
#dash > .tabs { gap: 5px; }
#dash > .tabs > .tab { padding: 9px 10px; font-size: 13px; }
