/* â”€â”€ Reset & Base â”€â”€ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --amber:     #FBBF24;
  --amber-dk:  #D97706;
  --amber-lt:  #FEF3C7;
  --black:     #0A0A0A;
  --white:     #FFFFFF;
  --green:     #10B981;
  --red:       #EF4444;
  --bg:        #FFFFFF;
  --surface:   #FFFFFF;
  --text:      #0A0A0A;
  --muted:     #6B7280;
  --border:    #E5E7EB;
  --radius:    14px;
  --shadow:    0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --bg:      #0F0F0F;
  --surface: #1A1A1A;
  --text:    #F0F0F0;
  --muted:   #9A9A9A;
  --border:  #2A2A2A;
}

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* â”€â”€ Screens â”€â”€ */
.screen { min-height: 100vh; }
.screen.hidden { display: none !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0%   { transform: scale(0.95); }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.screen > * { animation: fadeUp 0.18s ease; }

/* â”€â”€ Shared Buttons â”€â”€ */
.primary-btn {
  background: var(--amber);
  color: var(--black);
  border: none;
  border-radius: 50px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(251,191,36,0.35);
  letter-spacing: 0.3px;
}
.primary-btn:hover { background: var(--amber-dk);  }
.primary-btn:active { filter: brightness(0.92); }
.primary-btn.small { padding: 10px 20px; font-size: 0.88rem; }
.primary-btn.full { width: 100%; text-align: center; }

.secondary-btn {
  background: var(--surface);
  color: var(--black);
  border: 2px solid var(--amber);
  border-radius: 50px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  display: inline-block;
}
.secondary-btn:hover { background: var(--amber); color: var(--black);  }

.back-btn {
  background: var(--amber);
  border: none;
  color: var(--black);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  padding: 8px 14px;
  border-radius: 50px;
  transition: background 0.15s;
}
.back-btn:hover { background: var(--amber-dk); }

/* â”€â”€ Auth Screen â”€â”€ */
#screen-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 0;
}

.auth-hero {
  width: 100%;
  text-align: center;
  padding: 52px 24px 52px;
  background: linear-gradient(150deg, #0d0d1a 0%, #1c0d32 55%, #0d0d1a 100%);
}
.auth-hero h1 {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -1.5px;
  color: var(--amber);
  text-shadow: 0 0 40px rgba(251,191,36,0.35);
}
.auth-hero p { color: rgba(255,255,255,0.55); margin-top: 8px; font-size: 1.05rem; font-weight: 600; }

.auth-card {
  background: var(--surface);
  border-radius: 24px;
  width: calc(100% - 40px);
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  border: 2px solid var(--border);
  overflow: hidden;
  animation: pop 0.3s ease;
  margin: -28px 0 48px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  padding: 6px;
  gap: 4px;
  margin: 16px 16px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: var(--amber);
  color: var(--black);
  box-shadow: 0 2px 8px rgba(251,191,36,0.3);
}

.auth-form { padding: 24px 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-form.hidden { display: none; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 0.82rem; font-weight: 800; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; }
.field-group input {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 0.98rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-weight: 600;
}
.field-group input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 4px rgba(251,191,36,0.15); background: var(--surface); }

.auth-error {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-left: 4px solid var(--red);
}

/* â”€â”€ Dashboard â”€â”€ */
.dash-header {
  background: var(--black);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dash-header-left { display: flex; align-items: center; gap: 8px; }
.switch-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  border-radius: 50px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.switch-btn:hover { background: rgba(255,255,255,0.22); }
.dash-greeting { font-size: 1.05rem; font-weight: 800; }
.dash-points {
  font-size: 0.9rem;
  font-weight: 800;
  background: var(--amber);
  padding: 7px 16px;
  border-radius: 50px;
  color: var(--black);
}

/* ── Dashboard layout ── */
.dash-layout {
  display: flex;
  height: calc(100vh - 62px);
  overflow: hidden;
}

.dash-sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--bg);
  border-right: 2px solid var(--border);
  overflow-y: auto;
  padding: 12px 0 80px;
  flex-shrink: 0;
}

.dash-main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 100px;
  min-width: 0;
}

/* Sidebar category group */
.sb-cat { margin-bottom: 4px; }
.sb-cat-title {
  padding: 10px 14px 3px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px 9px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  transition: background 0.12s, transform 0.12s;
  border-radius: 8px;
}
.sb-item:hover { background: rgba(0,0,0,0.06); transform: translateX(2px); }
[data-theme="dark"] .sb-item:hover { background: rgba(255,255,255,0.07); }
.sb-item.active {
  background: rgba(0,0,0,0.07);
  border-left: 3px solid currentColor;
  padding-left: 13px;
  color: var(--sc, var(--amber));
}
[data-theme="dark"] .sb-item.active { background: rgba(255,255,255,0.09); }
.sb-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: none;
}
.sb-label { flex: 1; }
.sb-lock { font-size: 0.65rem; opacity: 0.5; }
.sq-ic { vertical-align: -0.125em; flex-shrink: 0; }
.sb-item.locked { opacity: 0.45; cursor: pointer; }
.sb-lock-tip {
  padding: 5px 14px 5px 34px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  animation: sb-tip-in 0.15s ease;
}
[data-theme="dark"] .sb-lock-tip { color: #fde68a; background: rgba(245,158,11,0.12); }
@keyframes sb-tip-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

/* Mobile sidebar */
@media (max-width: 680px) {
  .dash-layout { flex-direction: column; height: auto; overflow: visible; }
  .dash-sidebar {
    width: 100%;
    min-width: 0;
    max-height: 55vh;
    border-right: none;
    border-bottom: 2px solid var(--border);
    display: none;
    padding: 8px 0 20px;
  }
  .dash-sidebar.sb-open { display: block; }
  .dash-main { overflow-y: visible; padding: 20px 16px 100px; }
}
@media (min-width: 681px) {
  #btn-sidebar-toggle { display: none; }
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.subject-card {
  background: var(--sbg, #FFF8E1);
  border: none;
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-family: inherit;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transition: transform 0.17s, box-shadow 0.17s;
  overflow: hidden;
  position: relative;
}
.subject-card::before {
  content: '';
  display: block;
  height: 5px;
  background: var(--sc, var(--amber));
  width: 100%;
}
.subject-card-body {
  padding: 16px 16px 18px;
}
.subject-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.subject-card:active { transform: scale(0.97); }
.subject-icon { display: block; font-size: 1.7rem; margin-bottom: 8px; }
.subject-label { font-size: 1rem; font-weight: 800; color: var(--sc); }
.subject-desc { font-size: 0.72rem; color: var(--muted); font-weight: 600; margin-top: 3px; }

.dash-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.dash-action-btn {
  background: var(--amber);
  border: none;
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--black);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  box-shadow: var(--shadow);
}
.dash-action-btn:hover { background: var(--amber-dk); }

/* ── Mode Select ── */
.mode-header {
  background: #1e0a40;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid rgba(255,255,255,0.08);
}
.mode-subject-label { color: var(--white); font-size: 1.2rem; font-weight: 900; }

/* Blooket-style game grid */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
  padding: 28px;
  background: #2D1B69;
  min-height: calc(100vh - 70px);
}

.mode-card {
  background: none;
  border: none;
  border-radius: 18px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.mode-card:hover  { transform: scale(1.06) translateY(-4px); box-shadow: 0 14px 36px rgba(0,0,0,0.45); }
.mode-card:active { transform: scale(0.97); }

.mode-art {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Each card: dark bg, big coloured text fills it */
.mode-quiz    { background: #0d0d0d; }
.mode-flash   { background: #060e24; }
.mode-match   { background: #041a10; }
.mode-tower   { background: #1a0505; }
.mode-race    { background: #1a1000; }
.mode-fishing { background: #03111e; }
.mode-monster { background: #0e0318; }
.mode-crypto  { background: #031208; }
.mode-factory { background: #0d0f12; }

.mode-big-text {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  letter-spacing: -1px;
  padding: 10px 14px;
  width: 100%;
  text-transform: lowercase;
}

/* Per-game text colours */
.mode-quiz    .mode-big-text { color: #FBBF24; text-shadow: 0 0 40px rgba(251,191,36,0.6); }
.mode-flash   .mode-big-text { color: #60A5FA; text-shadow: 0 0 40px rgba(96,165,250,0.6); }
.mode-match   .mode-big-text { color: #34D399; text-shadow: 0 0 40px rgba(52,211,153,0.6); }
.mode-tower   .mode-big-text { color: #F87171; text-shadow: 0 0 40px rgba(248,113,113,0.6); }
.mode-race    .mode-big-text { color: #FCD34D; text-shadow: 0 0 40px rgba(252,211,77,0.6); }
.mode-fishing .mode-big-text { color: #38BDF8; text-shadow: 0 0 40px rgba(56,189,248,0.6); }
.mode-monster .mode-big-text { color: #C084FC; text-shadow: 0 0 40px rgba(192,132,252,0.6); }
.mode-crypto  .mode-big-text { color: #4ADE80; text-shadow: 0 0 40px rgba(74,222,128,0.6); }
.mode-factory .mode-big-text { color: #94A3B8; text-shadow: 0 0 40px rgba(148,163,184,0.6); }

/* â”€â”€ Quiz â”€â”€ */
.quiz-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.quiz-top { display: flex; justify-content: space-between; align-items: center; }
.quiz-top .back-btn { background: var(--border); color: var(--text); }
.quiz-top .back-btn:hover { background: #D1D5DB; }
.quiz-progress { font-weight: 800; font-size: 0.9rem; color: var(--muted); }
.quiz-score { font-weight: 800; font-size: 0.9rem; color: var(--amber-dk); }
.quiz-timer-bar { height: 8px; background: var(--border); border-radius: 50px; overflow: hidden; }
.quiz-timer-fill { height: 100%; background: var(--black); border-radius: 50px; transition: width 1s linear; }
.quiz-question { background: var(--surface); border-radius: var(--radius); padding: 28px 24px; font-size: 1.25rem; font-weight: 700; box-shadow: var(--shadow); line-height: 1.5; border: 2px solid var(--border); }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-btn {
  background: var(--amber);
  border: 2px solid var(--amber);
  border-radius: var(--radius);
  padding: 16px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  color: var(--black);
  box-shadow: var(--shadow);
}
.choice-btn:hover:not(:disabled) { background: var(--amber-dk); border-color: var(--amber-dk); }
.choice-btn.correct { background: #D1FAE5; border-color: var(--green); color: #065F46; }
.choice-btn.wrong { background: #FEE2E2; border-color: var(--red); color: #991B1B; }
.choice-btn:disabled { cursor: default; }

.quiz-hint-area { display: flex; flex-direction: column; gap: 10px; }
.hint-btn-quiz {
  background: none;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  width: fit-content;
  transition: background 0.15s, border-color 0.15s;
}
.hint-btn-quiz:hover { background: var(--amber-lt); border-color: var(--amber); }
.quiz-hint-text { background: var(--amber-lt); border-radius: 10px; padding: 12px 16px; font-size: 0.9rem; color: #92610c; border: 2px solid var(--amber); font-weight: 600; }
.quiz-feedback { border-radius: 12px; padding: 14px 18px; font-weight: 800; font-size: 0.95rem; }
.quiz-feedback.correct { background: #D1FAE5; color: #065F46; }
.quiz-feedback.wrong { background: #FEE2E2; color: #991B1B; }
.quiz-feedback.hidden { display: none; }

/* â”€â”€ Flashcards â”€â”€ */
.fc-wrap {
  max-width: 580px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.fc-top { display: flex; justify-content: space-between; align-items: center; }
.fc-top .back-btn { background: var(--border); color: var(--text); }
.fc-top .back-btn:hover { background: #D1D5DB; }
.fc-progress { font-weight: 800; color: var(--muted); }
.fc-stats { font-size: 0.85rem; color: var(--muted); font-weight: 700; }

.fc-card {
  perspective: 1000px;
  height: 240px;
  cursor: pointer;
  position: relative;
}
.fc-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
  border-radius: 20px;
}
.fc-inner.flipped { transform: rotateY(180deg); }
.fc-front, .fc-back {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}
.fc-front { background: var(--surface); color: var(--text); border: 2px solid var(--border); }
.fc-back { background: var(--black); color: var(--white); transform: rotateY(180deg); }
.fc-tap-hint { position: absolute; bottom: 12px; right: 18px; font-size: 0.72rem; color: var(--muted); font-weight: 700; }

.fc-actions { display: flex; gap: 14px; }
.fc-learning-btn, .fc-known-btn {
  flex: 1;
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}
.fc-learning-btn { background: #FEE2E2; color: #991B1B; }
.fc-known-btn { background: #D1FAE5; color: #065F46; }
.fc-learning-btn:hover, .fc-known-btn:hover { opacity: 0.85; }
.fc-result-breakdown { display: flex; gap: 24px; }
.fc-result-known { color: #065F46; font-weight: 800; }
.fc-result-learning { color: #991B1B; font-weight: 800; }

/* â”€â”€ Match Game â”€â”€ */
.match-wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px; }
.match-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.match-top .back-btn { background: var(--border); color: var(--text); }
.match-top .back-btn:hover { background: #D1D5DB; }
.match-title { font-size: 1.1rem; font-weight: 800; }
.match-timer { font-size: 1.3rem; font-weight: 900; color: var(--black); }
.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.match-card {
  background: var(--amber);
  border: 2px solid var(--amber);
  border-radius: var(--radius);
  padding: 16px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.4;
  transition: background 0.15s;
  color: var(--black);
  box-shadow: var(--shadow);
}
.match-card:hover:not(:disabled) { background: var(--amber-dk); border-color: var(--amber-dk);  }
.match-card.selected { background: var(--amber-dk); border-color: var(--black); }
.match-card.matched { border-color: var(--green); background: #D1FAE5; color: #065F46; cursor: default; }
.match-card.wrong { border-color: var(--red); background: #FEE2E2; color: #991B1B; }

/* ── Tower Defense (Blooket-style) ── */
.td-wrap { display: flex; flex-direction: column; height: 100dvh; background: #0f0f0f; overflow: hidden; }
/* Map chooser */
.td-map-chooser { padding: 24px 16px; max-width: 520px; margin: 0 auto; }
.td-map-title { font-size: 1.3rem; font-weight: 900; margin-bottom: 20px; text-align: center; }
.td-map-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.td-map-card {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 10px; cursor: pointer;
  font-family: inherit; text-align: center;
}
.td-map-card:hover { border-color: var(--amber); }
.td-map-preview { width: 100%; height: 72px; display: block; border-radius: 8px; overflow: hidden; }
.td-map-name { font-weight: 800; font-size: 0.88rem; margin-top: 8px; }
.td-map-desc { color: var(--muted); font-size: 0.7rem; font-weight: 600; margin-top: 2px; }

/* HUD */
.td-hud { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #111; color: #fff; flex-shrink: 0; }
.td-hud span { font-size: 0.8rem; font-weight: 800; }
.td-hud-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.td-spd-group { display: flex; gap: 3px; }
.td-spd {
  background: #2a2a2a; color: #aaa; border: 1px solid #444;
  border-radius: 5px; padding: 3px 7px; font-size: 0.72rem; font-weight: 800;
  cursor: pointer; font-family: inherit;
}
.td-spd.sel { background: var(--amber); color: #000; border-color: var(--amber); }
.td-ctrl-btn {
  background: #2a2a2a; color: #fff; border: 1px solid #444;
  border-radius: 5px; padding: 3px 8px; font-size: 0.85rem;
  cursor: pointer; font-family: inherit;
}
.td-ctrl-btn:hover { background: #3a3a3a; }

/* Field */
.td-field { position: relative; flex: 1 1 0; min-height: 160px; background: #1a2e1a; overflow: hidden; }
.td-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.td-spot {
  position: absolute; width: 30px; height: 30px;
  transform: translate(-50%,-50%);
  background: rgba(255,255,255,0.07);
  border: 2px dashed rgba(255,255,255,0.25);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 900; color: rgba(255,255,255,0.4);
  z-index: 3;
}
.td-spot.has-tower { background: rgba(0,0,0,0.5); border-style: solid; font-size: 0.78rem; font-weight: 900; }
.td-enemy {
  position: absolute; width: 32px; height: 32px;
  border-radius: 50%; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 900; color: #000;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
}
.td-hpbar { position: absolute; bottom: -6px; left: -1px; width: 34px; height: 4px; background: #222; border-radius: 2px; overflow: hidden; }
.td-hpfill { height: 100%; width: 100%; border-radius: 2px; transition: width 0.1s; }
.td-bullet { position: absolute; width: 8px; height: 8px; border-radius: 50%; z-index: 10; box-shadow: 0 0 5px currentColor; }
.td-castle { position: absolute; font-size: 1.8rem; z-index: 8; line-height: 1; color: #f1f5f9; }
.td-pause-overlay {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.78); color: #fff;
  padding: 4px 16px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 900; letter-spacing: 3px;
  pointer-events: none; z-index: 20;
}
.td-pause-overlay.hidden { display: none; }
.td-pause-msg { font-size: inherit; }

/* Panel */
.td-panel { flex-shrink: 0; background: #111; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.td-shop { display: flex; gap: 8px; }
.td-buy {
  flex: 1; padding: 8px 6px; border: 2px solid var(--tc, #888);
  background: rgba(0,0,0,0.6); color: #fff;
  border-radius: 10px; cursor: pointer; font-family: inherit;
  font-size: 0.78rem; font-weight: 700; line-height: 1.5;
}
.td-buy.sel { background: rgba(255,255,255,0.12); }
.td-buy:hover { background: rgba(255,255,255,0.08); }
.td-buy small { font-size: 0.72rem; color: #bbb; }
.td-qbox { background: #1a1a1a; border-radius: 10px; padding: 10px 12px; }
.td-qhint { color: #9ca3af; font-size: 0.8rem; font-weight: 600; margin-bottom: 8px; }
.td-q { color: #f0f0f0; font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; }
.td-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.td-choice {
  padding: 9px 8px; border: 2px solid #333; background: #222; color: #fff;
  border-radius: 8px; cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: 0.8rem;
}
.td-choice:hover:not(:disabled) { background: #2e2e2e; }
.td-choice.correct { border-color: #4ade80; background: #052e16; color: #4ade80; }
.td-choice.wrong   { border-color: #f87171; background: #2d1515; color: #f87171; }
.td-choice:disabled { cursor: default; }
.td-flash {
  position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
  font-size: 1.2rem; font-weight: 900; pointer-events: none;
  animation: tdflash 1.6s forwards; white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
@keyframes tdflash {
  0%   { opacity:1; top:20%; }
  100% { opacity:0; top:5%; }
}

/* ── Fishing ── */
.fish-wrap { display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; padding: 0; height: 100dvh; }
.fish-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #0d1b2a; color: #fff; flex-shrink: 0; }
.fish-info { font-size: 0.85rem; font-weight: 800; color: #93c5fd; }
.fish-scene { position: relative; flex: 1 1 0; overflow: hidden; min-height: 0; }
.fish-sky { background: linear-gradient(to bottom, #bfdbfe 0%, #93c5fd 100%); height: 38%; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 0; position: relative; z-index: 2; }
.fish-boat { font-size: 2.2rem; position: relative; z-index: 3; line-height: 1; }
.fish-water { background: linear-gradient(to bottom, #1e4d6b 0%, #0d2137 100%); height: 62%; position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 0; z-index: 1; }
.fish-line-col { display: flex; flex-direction: column; align-items: center; width: 4px; position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2; }
.fish-line { width: 2px; background: #d1d5db; transition: height 0.6s ease; }
.fish-ripples { color: #60a5fa; font-size: 1.3rem; font-weight: 700; animation: fishRipple 0.6s infinite alternate; position: absolute; top: 16px; }
.fish-action { padding: 12px 16px; background: #0d1b2a; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fish-status { color: #93c5fd; font-weight: 700; font-size: 0.95rem; text-align: center; }
.fish-reel-btn {
  background: #10b981; color: #fff; border: none; border-radius: 12px;
  padding: 16px 40px; font-size: 1.3rem; font-weight: 900;
  cursor: pointer; font-family: inherit;
  animation: fishPulse 0.5s infinite alternate;
  box-shadow: 0 0 20px rgba(16,185,129,0.5);
}
.fish-bite-hint { color: #6ee7b7; font-weight: 700; font-size: 0.9rem; text-align: center; }
.fish-qcard { background: #1a2e1a; border-radius: 12px; padding: 14px; width: 100%; }
.fish-qfish { font-weight: 800; font-size: 0.85rem; margin-bottom: 8px; }
.fish-qtext { color: #f0f0f0; font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; }
.fish-qchoices { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.fish-choice {
  padding: 9px 8px; border: 2px solid #2d4a2d; background: #1a2e1a; color: #f0f0f0;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.8rem;
}
.fish-choice:hover:not(:disabled) { background: #243d24; }
.fish-choice.correct { border-color: #4ade80; background: #052e16; color: #4ade80; }
.fish-choice.wrong   { border-color: #f87171; background: #2d1515; color: #f87171; }
.fish-choice:disabled { cursor: default; }
.fish-haul { padding: 8px 16px; background: #0d1b2a; display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; flex-shrink: 0; }
.fish-tag { font-size: 0.72rem; font-weight: 800; border: 1px solid; border-radius: 50px; padding: 3px 10px; }
.fish-results { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 16px; width: 100%; max-width: 300px; }
.fish-result-row { display: flex; justify-content: space-between; font-weight: 700; padding: 8px 12px; background: var(--surface); border-radius: 8px; border: 1px solid var(--border); }
@keyframes fishPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}
@keyframes fishRipple {
  from { opacity: 0.6; }
  to   { opacity: 1; letter-spacing: 4px; }
}

/* â”€â”€ Gold Race â”€â”€ */
.race-wrap { max-width: 660px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.race-top { display: flex; align-items: center; justify-content: space-between; }
.race-top .back-btn { background: var(--border); color: var(--text); }
.race-top .back-btn:hover { background: #D1D5DB; }
.race-title { font-size: 1.1rem; font-weight: 800; }
.race-score { font-weight: 800; color: var(--muted); }
.race-track { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; border: 2px solid var(--border); }
.race-lane { display: flex; align-items: center; gap: 12px; }
.racer-name { font-size: 0.8rem; font-weight: 800; width: 52px; flex-shrink: 0; color: var(--muted); }
.race-bar-wrap { flex: 1; background: var(--border); border-radius: 50px; height: 40px; position: relative; overflow: hidden; }
.race-bar { height: 100%; border-radius: 50px; display: flex; align-items: center; justify-content: flex-end; padding-right: 4px; transition: width 0.4s ease; min-width: 40px; }
.racer-emoji { font-size: 1.6rem; }
.race-question { background: var(--surface); border-radius: var(--radius); padding: 22px; font-size: 1.15rem; font-weight: 700; box-shadow: var(--shadow); border: 2px solid var(--border); }
.race-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.race-choice {
  background: var(--amber);
  border: 2px solid var(--amber);
  border-radius: var(--radius);
  padding: 15px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  color: var(--black);
  box-shadow: var(--shadow);
}
.race-choice:hover:not(:disabled) { background: var(--amber-dk); border-color: var(--amber-dk);  }
.race-choice.correct { background: #D1FAE5; border-color: var(--green); color: #065F46; }
.race-choice.wrong { background: #FEE2E2; border-color: var(--red); color: #991B1B; }
.race-feedback { border-radius: 12px; padding: 14px 18px; font-weight: 800; font-size: 0.95rem; }
.race-feedback.correct { background: #D1FAE5; color: #065F46; }
.race-feedback.wrong { background: #FEE2E2; color: #991B1B; }
.race-feedback.hidden { display: none; }
.race-ai-banner { background: #FEE2E2; color: #991B1B; border-radius: var(--radius); padding: 10px 16px; font-size: 0.85rem; font-weight: 700; }
.race-qcount { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.racer-pct { font-size: 0.72rem; color: var(--muted); width: 36px; text-align: right; flex-shrink: 0; font-weight: 700; }
.race-final-positions { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.race-final-lane { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; font-weight: 700; }
.race-final-bar { height: 18px; border-radius: 50px; min-width: 8px; }
.race-final-lane span:last-child { font-weight: 800; color: var(--muted); }

/* â”€â”€ Results (shared) â”€â”€ */
.results-wrap {
  max-width: 460px;
  margin: 60px auto;
  padding: 44px 28px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: pop 0.3s ease;
}
.results-icon { font-size: 4.5rem; }
.results-wrap h2 { font-size: 2rem; font-weight: 900; letter-spacing: -0.5px; }
.results-score { font-size: 2.4rem; font-weight: 900; color: var(--black); }
.results-pct { font-size: 1.1rem; color: var(--muted); font-weight: 700; }
.results-wrap p { color: var(--muted); font-weight: 600; }
.results-wrap .primary-btn, .results-wrap .secondary-btn { width: 100%; text-align: center; }

/* â”€â”€ Calming Period â”€â”€ */
.calm-header {
  background: #0d0d1a;
  padding: 20px 24px;
  display: flex;
  align-items: center;
}
.calm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 70px);
  background: linear-gradient(180deg, #0d0d1a 0%, #1c0d32 100%);
  padding: 20px 24px;
  gap: 12px;
}
.calm-instruction { color: rgba(255,255,255,0.7); font-size: 1.1rem; font-weight: 700; text-align: center; }
.calm-done { color: #a78bfa; font-size: 1.15rem; font-weight: 800; text-align: center; }
.calm-phase { color: #c4b5fd; font-size: 1.3rem; font-weight: 800; min-height: 36px; text-align: center; }
.calm-start { background: #7c3aed; color: white; }
.calm-start:hover { background: #6d28d9; }
.calm-circle-wrap {
  width: 280px; height: 280px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.calm-circle {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, #7c3aed 0%, #1c0d32 70%);
  border: 3px solid #7c3aed;
  transition: transform 0.1s;
  box-shadow: 0 0 40px rgba(124,58,237,0.4);
}
.calm-circle.calm-expand {
  animation: calmExpand 4s ease-in-out forwards;
}
.calm-circle.calm-hold {
  transform: scale(1.7);
}
.calm-circle.calm-shrink {
  animation: calmShrink 4s ease-in-out forwards;
}
.calm-circle.calm-rest {
  transform: scale(1);
}
@keyframes calmExpand {
  from { transform: scale(1); }
  to   { transform: scale(1.7); }
}
@keyframes calmShrink {
  from { transform: scale(1.7); }
  to   { transform: scale(1); }
}

/* â”€â”€ Concentration Test â”€â”€ */
.conc-header {
  background: var(--black);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--white);
}
.conc-header h2 { font-size: 1.2rem; font-weight: 900; }
.conc-container { max-width: 560px; margin: 32px auto; padding: 0 20px 80px; }
.conc-menu { display: flex; flex-direction: column; gap: 16px; }
.conc-intro { color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.conc-level { font-size: 1rem; font-weight: 800; text-align: center; margin-bottom: 18px; }
.conc-round { color: var(--muted); font-size: 0.9rem; font-weight: 700; text-align: center; margin-top: 18px; }
.conc-grid-wrap { display: flex; flex-direction: column; align-items: center; }
.conc-grid {
  display: grid;
  grid-template-columns: repeat(var(--gsize, 4), 1fr);
  gap: 10px;
  margin-top: 8px;
}
.conc-cell {
  width: 68px; height: 68px;
  border-radius: 12px;
  background: var(--border);
  transition: background 0.2s, transform 0.15s;
}
.conc-cell.lit { background: var(--amber); box-shadow: 0 0 18px rgba(251,191,36,0.5); }
.conc-cell.clickable { cursor: pointer; }
.conc-cell.clickable:hover { opacity: 0.8; }
.conc-cell.selected { background: #60a5fa; }
.conc-cell.correct { background: var(--green); }
.conc-cell.wrong { background: var(--red); }
.conc-reaction-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; gap: 16px; }
.react-circle {
  width: 180px; height: 180px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 900;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.react-circle.wait { background: var(--border); color: var(--muted); }
.react-circle.go   { background: var(--green); color: white; box-shadow: 0 0 30px rgba(16,185,129,0.5); }
.react-circle.wrong { background: var(--red); color: white; }
.react-circle.done { background: #60a5fa; color: white; }
.conc-result { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.conc-result-title { font-size: 1.3rem; font-weight: 900; }
.conc-result-score { font-size: 1.1rem; font-weight: 700; color: var(--muted); }
.conc-result-sub { font-size: 1rem; font-weight: 700; color: var(--muted); }

/* â”€â”€ StudyBot FAB â”€â”€ */
.bot-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--amber);
  color: var(--black);
  border: none;
  border-radius: 50px;
  padding: 14px 20px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(251,191,36,0.4);
  z-index: 100;
  font-family: inherit;
  transition: transform 0.15s, background 0.15s;
}
.bot-fab:hover { background: var(--amber-dk); }

/* â”€â”€ StudyBot Panel â”€â”€ */
.bot-panel {
  position: fixed;
  bottom: 86px;
  left: 24px;
  width: 330px;
  max-height: 480px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
  animation: fadeUp 0.2s ease;
  border: 2px solid var(--border);
}
.bot-panel.hidden { display: none; }
.bot-header {
  background: var(--black);
  color: var(--white);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 0.95rem;
}
.bot-close-btn { background: rgba(255,255,255,0.15); border: none; color: var(--white); font-size: 0.9rem; cursor: pointer; border-radius: 6px; padding: 3px 8px; font-weight: 800; transition: background 0.15s; }
.bot-close-btn:hover { background: rgba(255,255,255,0.28); }
.bot-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px 24px; text-align: center; }
.bot-loading-title { font-weight: 800; font-size: 0.95rem; }
.bot-loading-sub { font-size: 0.76rem; color: var(--muted); line-height: 1.6; font-weight: 600; }
.bot-progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 50px; overflow: hidden; }
.bot-progress-fill { height: 100%; width: 0%; background: var(--amber); border-radius: 50px; transition: width 0.4s ease; }
.bot-progress-label { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.bot-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bot-messages.hidden { display: none; }
.bot-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 0.87rem; line-height: 1.5; font-weight: 600; }
.bot-msg.user { align-self: flex-end; background: var(--black); color: var(--white); border-bottom-right-radius: 4px; }
.bot-msg.assistant { align-self: flex-start; background: var(--bg); color: var(--text); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.bot-msg.thinking { align-self: flex-start; background: var(--bg); color: var(--muted); font-style: italic; }
.bot-suggestions { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 10px; }
.bot-suggestions.hidden { display: none; }
.bot-suggest { background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 8px 14px; font-size: 0.82rem; cursor: pointer; font-family: inherit; text-align: left; color: var(--text); font-weight: 700; transition: border-color 0.15s, background 0.15s; }
.bot-suggest:hover { background: var(--amber-lt); border-color: var(--amber); }
.bot-input-area { display: flex; gap: 8px; padding: 10px 14px; border-top: 2px solid var(--border); }
.bot-input-area.hidden { display: none; }
.bot-input-area input { flex: 1; border: 2px solid var(--border); border-radius: 50px; padding: 9px 14px; font-size: 0.87rem; font-family: inherit; font-weight: 600; background: var(--bg); color: var(--text); }
.bot-input-area input:focus { outline: none; border-color: var(--amber); }
.bot-send-btn { background: var(--amber); color: var(--black); border: none; border-radius: 50%; width: 38px; height: 38px; font-size: 1rem; cursor: pointer; flex-shrink: 0; transition: background 0.15s; font-weight: 800; }
.bot-send-btn:hover { background: var(--amber-dk); }

/* â”€â”€ Modal â”€â”€ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: pop 0.25s ease;
}
.modal-card h3 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.5px; }
.modal-card p { color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.modal-card input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.5rem;
  font-weight: 900;
  font-family: monospace;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
}
.modal-card input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 4px rgba(251,191,36,0.15); }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .primary-btn, .modal-btns .secondary-btn { flex: 1; text-align: center; }

/* â”€â”€ Room Lobby â”€â”€ */
.room-header {
  background: var(--black);
  color: var(--white);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.leave-room-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  border-radius: 50px;
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}
.leave-room-btn:hover { background: rgba(255,255,255,0.22); }
.room-header-center { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; }
.room-code-display { display: flex; flex-direction: column; align-items: center; }
.room-code-label-text { font-size: 0.68rem; opacity: 0.75; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; }
.room-code-value { font-size: 1.8rem; font-weight: 900; letter-spacing: 8px; font-family: monospace; }
.copy-btn { background: var(--amber); border: none; color: var(--black); border-radius: 8px; padding: 7px 14px; font-size: 0.82rem; font-weight: 800; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.copy-btn:hover { background: var(--amber-dk); }
.room-member-count { font-size: 0.85rem; font-weight: 800; opacity: 0.9; white-space: nowrap; }
.room-body { max-width: 720px; margin: 32px auto; padding: 0 24px 100px; }
.room-body h2 { font-size: 1.4rem; font-weight: 900; margin-bottom: 18px; }
.room-members-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 36px; }
.room-member { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.room-member-name { font-weight: 800; font-size: 1rem; flex: 1; }
.room-member-pts { font-size: 0.88rem; color: var(--muted); font-weight: 700; }
.room-member-you { background: var(--black); color: var(--white); border-radius: 50px; padding: 3px 10px; font-size: 0.72rem; font-weight: 800; }
.room-member-host { background: var(--amber); color: var(--black); border-radius: 50px; padding: 3px 10px; font-size: 0.72rem; font-weight: 800; }
.room-play-section { margin-top: 8px; }
.room-play-hint { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; font-weight: 600; }

/* â”€â”€ Badges â”€â”€ */
.dash-badges-section { margin-bottom: 28px; }
.badges-title { font-size: 1rem; font-weight: 900; margin-bottom: 14px; }
.badges-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-item { background: var(--surface); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow); min-width: 72px; border: 2px solid var(--border); }
.badge-icon { font-size: 1.8rem; }
.badge-name { font-size: 0.68rem; font-weight: 800; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: 0.3px; }

/* â”€â”€ Badge Toast â”€â”€ */
.badge-toast {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: var(--surface);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 1000;
  border-left: 5px solid var(--amber);
  font-size: 0.9rem;
  font-weight: 700;
  transform: translateX(140%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.badge-toast.show { transform: translateX(0); }
.badge-toast-icon { font-size: 2rem; }
.badge-toast strong { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 800; }

/* â”€â”€ Header center â”€â”€ */
.dash-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dash-streak-display { font-size: 0.75rem; font-weight: 800; opacity: 0.9; color: var(--white); }
.dash-grade-badge { font-size: 0.68rem; font-weight: 800; opacity: 0.7; color: var(--white); letter-spacing: 0.5px; text-transform: uppercase; }

/* â”€â”€ Grade Picker â”€â”€ */
.grade-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.grade-btn {
  padding: 10px 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.grade-btn:hover { background: var(--amber-lt); border-color: var(--amber);  }
.grade-btn.active { background: var(--amber); color: var(--black); border-color: var(--amber); box-shadow: 0 4px 14px rgba(251,191,36,0.35); }

/* ── Monster Brawl ── */
.mon-wrap { max-width: 500px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mon-top { display: flex; justify-content: space-between; align-items: center; }
.mon-wave { font-size: 0.8rem; font-weight: 800; color: var(--muted); }
.mon-score { font-weight: 800; }
.mon-arena {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow);
}
.mon-side { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.mon-vs { font-size: 1.6rem; flex-shrink: 0; }
.mon-sprite { font-size: 2.8rem; line-height: 1; transition: transform 0.15s; }
.mon-sprite.mon-shake { animation: mon-hit 0.45s ease; }
@keyframes mon-hit {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  80% { transform: translateX(-5px); }
}
.mon-label { font-weight: 800; font-size: 0.82rem; }
.mon-bar-bg { width: 100%; height: 9px; background: rgba(0,0,0,0.12); border-radius: 5px; overflow: hidden; }
.mon-bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.mon-hp-txt { font-size: 0.7rem; font-weight: 700; color: var(--muted); }
.mon-log {
  background: var(--card); border-radius: 12px; padding: 10px 14px;
  min-height: 56px; display: flex; flex-direction: column; gap: 3px;
  box-shadow: var(--shadow);
}
.mon-log-line { font-size: 0.78rem; font-weight: 700; }
.mon-question { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.mon-qtext { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; text-align: center; }
.mon-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mon-choice {
  padding: 10px 8px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg); font-family: inherit; font-size: 0.83rem; font-weight: 600;
  cursor: pointer; color: var(--text); text-align: left; transition: background 0.12s;
}
.mon-choice:hover { background: rgba(0,0,0,0.05); }
.mon-choice.correct { background: #d1fae5 !important; border-color: #10b981; color: #065f46; }
.mon-choice.wrong   { background: #fee2e2 !important; border-color: #ef4444; color: #991b1b; }

/* ── Crypto Hack ── */
.cry-wrap { max-width: 420px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cry-top { display: flex; justify-content: space-between; align-items: center; }
.cry-title { font-weight: 800; font-size: 0.95rem; }
.cry-score { font-weight: 800; }
.cry-hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0; }
.cry-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cry-block {
  aspect-ratio: 1; border-radius: 10px; border: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; line-height: 1.2;
  cursor: default;
}
.cry-locked {
  background: #1d4ed8; color: #fff; cursor: pointer;
  box-shadow: 0 2px 8px rgba(29,78,216,0.3);
  transition: transform 0.1s;
}
.cry-locked:hover { transform: scale(1.07); }
.cry-hacked { color: #fff; font-size: 0.85rem; }
.cry-blocked { background: #fee2e2; color: #991b1b; }
.cry-status { text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.cry-qcard { background: var(--card); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.cry-qtext { font-size: 0.95rem; font-weight: 700; margin-bottom: 14px; }
.cry-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cry-choice {
  padding: 10px 8px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg); font-family: inherit; font-size: 0.83rem; font-weight: 600;
  cursor: pointer; color: var(--text); text-align: left; transition: background 0.12s;
}
.cry-choice:hover { background: rgba(0,0,0,0.05); }
.cry-choice.correct { background: #d1fae5 !important; border-color: #10b981; color: #065f46; }
.cry-choice.wrong   { background: #fee2e2 !important; border-color: #ef4444; color: #991b1b; }

/* ── Factory ── */
.fac-wrap { max-width: 480px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.fac-top { display: flex; justify-content: space-between; align-items: center; }
.fac-title { font-weight: 800; font-size: 0.95rem; }
.fac-score { font-weight: 800; }
.fac-belt {
  background: #1e293b; border-radius: 12px; height: 72px;
  display: flex; align-items: center; padding: 0 12px; gap: 10px;
  overflow: hidden; position: relative;
}
.fac-belt-inner { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.fac-belt-item { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.fac-belt-emoji { font-size: 1.6rem; line-height: 1; }
.fac-belt-pts { font-size: 0.68rem; font-weight: 800; }
.fac-arrow { color: rgba(255,255,255,0.25); font-size: 1.2rem; flex-shrink: 0; }
.fac-progress { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-align: center; }
.fac-question { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.fac-producing { font-size: 0.82rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.fac-unknown { color: var(--primary); }
.fac-qtext { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; }
.fac-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fac-choice {
  padding: 10px 8px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg); font-family: inherit; font-size: 0.83rem; font-weight: 600;
  cursor: pointer; color: var(--text); text-align: left; transition: background 0.12s;
}
.fac-choice:hover { background: rgba(0,0,0,0.05); }
.fac-choice.correct { background: #d1fae5 !important; border-color: #10b981; color: #065f46; }
.fac-choice.wrong   { background: #fee2e2 !important; border-color: #ef4444; color: #991b1b; }
.fac-report { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 16px; max-height: 240px; overflow-y: auto; }
.fac-report-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem; font-weight: 700; padding: 6px 12px;
  background: var(--card); border-radius: 8px;
}
.fac-rarity { font-size: 0.7rem; font-weight: 800; margin-left: 6px; }

/* ── Utilities ── */
.hidden { display: none !important; }

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 600px) {
  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
  .quiz-choices, .tower-choices, .race-choices { grid-template-columns: 1fr; }
  .match-grid { grid-template-columns: repeat(2, 1fr); }
  .bot-panel { width: calc(100vw - 32px); }
  .race-wrap, .tower-wrap, .quiz-wrap, .fc-wrap, .match-wrap { padding: 14px; }
  .dash-actions { grid-template-columns: 1fr 1fr; }
  .auth-hero h1 { font-size: 2.4rem; }
}

/* -- Coins / Avatar display -- */
.dash-av { font-size: 1.2rem; margin-right: 6px; }
.dash-user-title { font-size: 0.72rem; font-weight: 800; color: var(--amber); letter-spacing: 0.4px; margin-top: 2px; }

/* -- Pack Banner (dashboard black box) -- */
.pack-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  background: #0a0a0f;
  border: 1.5px solid rgba(255,255,255,0.07);
  border-radius: 18px; padding: 18px 20px; margin-bottom: 20px;
  cursor: pointer; font-family: inherit; transition: opacity 0.15s;
  width: 100%; text-align: left; box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}
.pack-banner:hover { opacity: 0.88; }
.pack-banner-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(139,92,246,0.18) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 50%, rgba(251,191,36,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.pack-banner-emojis { font-size: 1.35rem; letter-spacing: 4px; flex-shrink: 0; animation: pack-float 3s ease-in-out infinite; }
@keyframes pack-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.pack-banner-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.pack-banner-title { font-size: 1rem; font-weight: 900; color: #fff; letter-spacing: 0.3px; }
.pack-banner-sub   { font-size: 0.75rem; font-weight: 600; color: rgba(255,255,255,0.45); }
.pack-banner-arrow { font-size: 1.6rem; color: rgba(255,255,255,0.3); flex-shrink: 0; }

/* -- Pack Store Screen -- */
.pks-wrap { max-width: 860px; margin: 0 auto; padding: 20px 20px 80px; }
.pks-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.pks-heading { flex: 1; font-size: 1.2rem; font-weight: 900; text-align: center; }
.pks-balance { font-size: 0.9rem; font-weight: 800; background: var(--amber); color: var(--black); padding: 6px 14px; border-radius: 50px; }

/* Inventory bar */
.pks-inventory { margin-bottom: 22px; }
.pks-inv-empty { font-size: 0.82rem; color: var(--muted); font-weight: 600; text-align: center; padding: 12px 0; }
.pks-inv-label { font-size: 0.7rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.pks-inv-count { background: var(--border); color: var(--muted); border-radius: 50px; padding: 1px 7px; font-size: 0.65rem; }
.pks-inv-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pks-inv-chip { color: #e2e8f0; position: relative; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer; border: 2px solid transparent; transition: transform 0.12s, box-shadow 0.12s; }
.pks-inv-chip:hover { transform: scale(1.12); }
.pks-inv-chip.equipped { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(251,191,36,0.25); }
.pks-equip-dot { position: absolute; bottom: 1px; right: 1px; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.pks-equip-dot.on { background: var(--amber); box-shadow: 0 0 4px rgba(251,191,36,0.7); }
.rarity-chip-common    { background: #1e293b; }
.rarity-chip-uncommon  { background: #1e2a3e; }
.rarity-chip-rare      { background: #1e1b35; }
.rarity-chip-epic      { background: #2a1836; }
.rarity-chip-legendary { background: #2a1e0a; }

/* Pack grid */
.pks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pks-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--pk-from), var(--pk-to));
  border-radius: 18px; padding: 22px 18px 18px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none; font-family: inherit; box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}
.pks-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.pks-card.pks-locked { opacity: 0.55; }
.pks-card-shine { position: absolute; top: -40%; left: -40%; width: 80%; height: 80%; background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 70%); pointer-events: none; }
.pks-card-emoji { font-size: 2.2rem; line-height: 1; }
.pks-card-name  { font-size: 0.95rem; font-weight: 900; color: #fff; }
.pks-card-desc  { font-size: 0.72rem; font-weight: 600; color: rgba(255,255,255,0.7); flex: 1; }
.pks-card-price { font-size: 0.85rem; font-weight: 800; background: rgba(0,0,0,0.3); color: #fff; border-radius: 50px; padding: 4px 12px; display: inline-block; margin-top: 4px; }

/* Pack confirm */
.pks-confirm { max-width: 420px; margin: 60px auto; padding: 0 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.pks-confirm-art { width: 110px; height: 110px; border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; box-shadow: 0 8px 28px rgba(0,0,0,0.3); }
.pks-confirm h2 { font-size: 1.4rem; font-weight: 900; }
.pks-confirm-desc { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.pks-confirm-cost { font-size: 0.9rem; font-weight: 700; }
.pks-confirm-row  { display: flex; gap: 10px; margin-top: 6px; }

/* Pack opening */
.pks-opening { max-width: 600px; margin: 40px auto; padding: 0 20px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.pks-open-head { font-size: 1.15rem; font-weight: 900; }
.pks-cards-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.pks-open-hint { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* Flip card */
.pks-flip { width: 140px; height: 190px; perspective: 700px; cursor: pointer; flex-shrink: 0; }
.pks-flip-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(.4,0,.2,1); }
.pks-flip.flipped .pks-flip-inner { transform: rotateY(180deg); }
.pks-flip-back, .pks-flip-front { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.pks-flip-back { border: 2px solid rgba(255,255,255,0.15); }
.pks-flip-logo { font-size: 3rem; }
.pks-flip-tap  { font-size: 0.72rem; font-weight: 800; color: rgba(255,255,255,0.6); letter-spacing: 1px; text-transform: uppercase; }
.pks-flip-front { transform: rotateY(180deg); padding: 14px 10px; text-align: center; border: 2px solid rgba(255,255,255,0.1); }
.pks-flip-rarity { font-size: 0.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.8; }
.pks-flip-icon   { font-size: 2.8rem; line-height: 1; }
.pks-flip-name   { font-size: 0.8rem; font-weight: 800; color: #fff; text-align: center; }
.pks-flip-kind   { font-size: 0.62rem; font-weight: 700; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.5px; }
.pks-rar-common    { background: linear-gradient(160deg,#1e293b,#334155); color:#fff; }
.pks-rar-uncommon  { background: linear-gradient(160deg,#1e3a5f,#2563eb); color:#fff; }
.pks-rar-rare      { background: linear-gradient(160deg,#2e1065,#7c3aed); color:#fff; }
.pks-rar-epic      { background: linear-gradient(160deg,#4a044e,#a21caf); color:#fff; }
.pks-rar-legendary { background: linear-gradient(160deg,#78350f,#d97706); color:#fff; }

/* Pack toast */
.pack-toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1a1a1a; color: #fff; padding: 12px 22px; border-radius: 50px; font-size: 0.88rem; font-weight: 700; box-shadow: 0 4px 20px rgba(0,0,0,0.4); opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; z-index: 9999; white-space: nowrap; }
.pack-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Background themes */
.sq-bg-forest   { --bg:#f0fdf4; --surface:#dcfce7; }
.sq-bg-ocean    { --bg:#eff6ff; --surface:#dbeafe; }
.sq-bg-fire     { --bg:#fff7ed; --surface:#ffedd5; }
.sq-bg-midnight { --bg:#0d0d1a; --surface:#13131f; --text:#e2e8f0; --muted:#8892a4; --border:#1e1e2e; }
.sq-bg-galaxy   { --bg:#06060f; --surface:#0e0e1c; --text:#e2e8f0; --muted:#7c6fa0; --border:#1a1a2e; }
.sq-bg-golden   { --bg:#fffbeb; --surface:#fef3c7; }
[data-theme="dark"].sq-bg-forest  { --bg:#0d1f13; --surface:#122018; }
[data-theme="dark"].sq-bg-ocean   { --bg:#070f1c; --surface:#0c1628; }
[data-theme="dark"].sq-bg-fire    { --bg:#1a0d05; --surface:#221208; }
[data-theme="dark"].sq-bg-golden  { --bg:#1a1500; --surface:#211b00; }

@media (max-width: 600px) {
  .pks-grid { grid-template-columns: repeat(2, 1fr); }
  .pks-flip { width: 120px; height: 165px; }
  .pack-banner-emojis { display: none; }
}

/* ── Level badge in header ── */
.dash-level-badge {
  font-size: 0.7rem; font-weight: 900;
  background: rgba(255,255,255,0.15); color: #fff;
  padding: 3px 9px; border-radius: 50px; letter-spacing: 0.3px;
}

/* ── Profile Screen ── */
.prof-wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 80px; display: flex; flex-direction: column; gap: 16px; }

.prof-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 8px;
}
.prof-topbar-title { font-size: 1rem; font-weight: 900; }

/* Hero row */
.prof-hero {
  display: flex; align-items: flex-start; gap: 18px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 20px; padding: 20px;
}
.prof-avatar-big { font-size: 3.5rem; line-height: 1; flex-shrink: 0; }
.prof-identity { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prof-name-row { display: flex; align-items: center; gap: 6px; }
.prof-display-name { font-size: 1.25rem; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-edit-btn { background: none; border: none; cursor: pointer; font-size: 0.9rem; padding: 2px 4px; opacity: 0.5; transition: opacity 0.15s; flex-shrink: 0; }
.prof-edit-btn:hover { opacity: 1; }
.prof-equipped-title { font-size: 0.75rem; font-weight: 800; color: var(--amber-dk); }
.prof-sub { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.prof-status-row { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.prof-status-txt { font-size: 0.82rem; font-weight: 600; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-status-empty { color: var(--muted); font-style: italic; }

/* Inline edit input */
.prof-inline-input {
  border: 2px solid var(--amber); border-radius: 10px;
  padding: 6px 10px; font-size: 0.95rem; font-family: inherit;
  font-weight: 700; background: var(--bg); color: var(--text);
  width: 100%; outline: none; box-shadow: 0 0 0 3px rgba(251,191,36,0.18);
}

/* Level card */
.prof-level-card {
  background: var(--black); border-radius: 18px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.prof-level-row { display: flex; align-items: center; gap: 14px; }
.prof-level-badge {
  font-size: 1.5rem; font-weight: 900; color: var(--amber);
  background: rgba(251,191,36,0.12); border-radius: 12px;
  padding: 8px 14px; flex-shrink: 0;
}
.prof-level-meta { display: flex; flex-direction: column; gap: 2px; }
.prof-xp-nums { font-size: 0.9rem; font-weight: 800; color: #fff; }
.prof-xp-hint { font-size: 0.72rem; font-weight: 600; color: rgba(255,255,255,0.45); }
.prof-xp-bar {
  height: 10px; background: rgba(255,255,255,0.1); border-radius: 50px; overflow: hidden;
}
.prof-xp-fill {
  height: 100%; background: linear-gradient(90deg, var(--amber), #f97316);
  border-radius: 50px; transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* Sections */
.prof-section {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 18px; padding: 18px 18px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.prof-section-title {
  font-size: 0.7rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.prof-total-badge {
  background: var(--border); color: var(--muted);
  font-size: 0.65rem; padding: 1px 7px; border-radius: 50px;
}

/* Game stats */
.prof-stats-list { display: flex; flex-direction: column; gap: 7px; }
.prof-stat-row { display: flex; align-items: center; gap: 8px; }
.prof-stat-icon { font-size: 0.95rem; width: 20px; text-align: center; flex-shrink: 0; }
.prof-stat-name { font-size: 0.8rem; font-weight: 700; width: 120px; flex-shrink: 0; }
.prof-stat-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 50px; overflow: hidden; }
.prof-stat-bar { height: 100%; background: var(--amber); border-radius: 50px; transition: width 0.5s ease; min-width: 0; }
.prof-stat-n { font-size: 0.78rem; font-weight: 800; color: var(--muted); width: 28px; text-align: right; flex-shrink: 0; }

/* Avatar grid in profile */
.prof-av-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.prof-av-btn {
  position: relative; width: 46px; height: 46px; border-radius: 12px;
  font-size: 1.5rem; border: 2px solid transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s, box-shadow 0.12s;
}
.prof-av-btn:hover { transform: scale(1.1); }
.prof-av-btn.equipped { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(251,191,36,0.3); }
.prof-av-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 4px rgba(251,191,36,0.8);
}
.prof-av-hint { font-size: 0.73rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.prof-empty { font-size: 0.82rem; color: var(--muted); font-weight: 600; text-align: center; padding: 8px 0; }

@media (max-width: 480px) {
  .prof-hero { flex-direction: column; align-items: center; text-align: center; }
  .prof-name-row, .prof-status-row { justify-content: center; }
  .prof-stat-name { width: 90px; }
}

@media (max-width: 540px) {
  .modes-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
  .mode-logo-text { font-size: 1.15rem; }
}

/* ── StudyBot panel ──────────────────────────────────────────────────────────── */
.studybot-panel {
  margin-top: 24px;
  border: 2px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 420px;
  background: var(--surface);
}

.studybot-header {
  background: #0C4A6E;
  padding: 14px 18px;
  flex-shrink: 0;
}
.studybot-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.2px;
}
.studybot-status {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  margin-top: 2px;
}

.studybot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bot-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}
.bot-msg.bot {
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bot-msg.user {
  background: #0EA5E9;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.studybot-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 2px solid var(--border);
  flex-shrink: 0;
}
.studybot-input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
}
.studybot-input:focus { outline: none; border-color: #0EA5E9; }
.studybot-send {
  background: #0EA5E9;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.studybot-send:hover { background: #0284C7; }
.studybot-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Typing bubble */
.bot-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}
.bot-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.bot-typing span:nth-child(2) { animation-delay: 0.2s; }
.bot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Interactive Quiz Shell (AI Quiz Generator results) ─────────────────────── */
.qz-shell { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 8px; }

.qz-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qz-counter {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  flex-shrink: 0;
}
.qz-counter span { color: var(--muted); font-weight: 700; }

.qz-progress-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 50px;
  overflow: hidden;
}
.qz-progress-bar {
  height: 100%;
  background: #10B981;
  border-radius: 50px;
  transition: width 0.4s ease;
  min-width: 0;
}

.qz-score-pill {
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--amber);
  color: var(--black);
  padding: 3px 10px;
  border-radius: 50px;
  flex-shrink: 0;
}

.qz-question {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--text);
}

.qz-choices { display: flex; flex-direction: column; gap: 8px; }

.qz-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}
.qz-choice:hover:not(:disabled) { border-color: #0EA5E9; background: var(--bg); transform: translateX(3px); }
.qz-choice.selected { border-color: #0EA5E9; background: rgba(14,165,233,0.1); }
.qz-choice.qz-correct { border-color: #10B981 !important; background: rgba(16,185,129,0.12) !important; color: #065F46; font-weight: 800; }
.qz-choice.qz-wrong   { border-color: #EF4444 !important; background: rgba(239,68,68,0.12)  !important; color: #7F1D1D; }

.qz-choice-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  flex-shrink: 0;
  transition: background 0.12s;
}
.qz-choice.selected .qz-choice-letter { background: #0EA5E9; color: #fff; }
.qz-choice.qz-correct .qz-choice-letter { background: #10B981; color: #fff; }
.qz-choice.qz-wrong   .qz-choice-letter { background: #EF4444; color: #fff; }
.qz-choice-text { flex: 1; }

.qz-feedback {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  line-height: 1.5;
}
.qz-feedback.correct { background: rgba(16,185,129,0.12); color: #065F46; border-left: 3px solid #10B981; }
.qz-feedback.wrong   { background: rgba(239,68,68,0.12);  color: #7F1D1D; border-left: 3px solid #EF4444; }
.qz-feedback.hidden  { display: none; }

.qz-submit {
  width: 100%;
  padding: 13px;
  background: #0EA5E9;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.qz-submit:hover:not(:disabled) { background: #0284C7; }
.qz-submit:disabled { opacity: 0.35; cursor: not-allowed; }

/* End screen */
.qz-end { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 8px 0; }

.qz-end-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 5px solid #10B981;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}
.qz-end-pct { font-size: 1.8rem; font-weight: 900; line-height: 1; }
.qz-end-fraction { font-size: 0.75rem; font-weight: 700; color: var(--muted); margin-top: 2px; }
.qz-end-grade { font-size: 1.1rem; font-weight: 900; }

.qz-end-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.qz-end-row { display: flex; align-items: flex-start; gap: 8px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.qz-end-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.qz-end-qtext { flex: 1; line-height: 1.4; }

.qz-new-btn {
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.qz-new-btn:hover { border-color: var(--text); color: var(--text); }

/* ── Guest login ─────────────────────────────────────────────────────────────── */
.guest-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.guest-divider::before, .guest-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.guest-btn {
  width: calc(100% - 48px);
  margin: 0 24px 24px;
  padding: 13px 0;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: block;
}
.guest-btn:hover { border-color: var(--text); color: var(--text); background: var(--bg); }

.guest-banner {
  background: #7C3AED;
  color: #fff;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 0.88rem;
  font-weight: 700;
}
.guest-banner-btn {
  background: #fff;
  color: #7C3AED;
  border: none;
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.guest-banner-btn:hover { background: #f3e8ff; }

/* ── AI Quiz Generator ────────────────────────────────────────────────────────── */
.qg-section {
  width: calc(100% - 40px);
  max-width: 800px;
  margin: 0 auto 60px;
  background: var(--surface);
  border-radius: 20px;
  border: 2px solid var(--border);
  overflow: hidden;
}

.qg-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 16px;
  border-bottom: 2px solid var(--border);
  background: linear-gradient(120deg, #0d0d1a 0%, #1c0d32 100%);
}

.qg-badge {
  background: var(--amber);
  color: var(--black);
  font-size: 0.72rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 50px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.qg-title {
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.3px;
}

.qg-subtitle {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  margin-top: 2px;
}

.qg-body { padding: 20px 24px 16px; }

.qg-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.qg-col-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qg-col-side { width: 180px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }

.qg-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qg-textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.93rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  min-height: 110px;
  transition: border-color 0.15s;
}
.qg-textarea:focus { outline: none; border-color: var(--amber); }

.qg-select {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  font-weight: 700;
}
.qg-select:focus { outline: none; border-color: var(--amber); }

.qg-upload-label {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.qg-upload-label:hover { border-color: var(--amber); color: var(--text); }

.qg-attach-btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  background: var(--amber);
  color: var(--black);
  border-radius: 12px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.qg-attach-btn:hover { background: var(--amber-dk); }

.qg-file-name {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qg-status {
  font-size: 0.85rem;
  font-weight: 700;
  min-height: 24px;
  margin: 8px 0 4px;
}
.qg-status.error { color: var(--red); }
.qg-status.loading { color: var(--amber); }

/* ── QG Results ── */
#qg-results {
  border-top: 2px solid var(--border);
  padding: 20px 24px 24px;
}
.qg-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.qg-results-title { font-size: 1rem; font-weight: 900; }
.qg-score-display {
  font-size: 0.88rem;
  font-weight: 800;
  background: var(--amber);
  color: var(--black);
  padding: 5px 14px;
  border-radius: 50px;
}

.qg-question {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.qg-q-text {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
}

.qg-q-num {
  background: var(--amber);
  color: var(--black);
  font-size: 0.72rem;
  font-weight: 900;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.qg-choices {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.qg-choice {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.qg-choice:hover:not(:disabled) { border-color: var(--amber); background: var(--bg); }
.qg-choice.qg-correct { border-color: var(--green) !important; background: rgba(16,185,129,0.12) !important; color: #065f46; font-weight: 800; }
.qg-choice.qg-wrong   { border-color: var(--red) !important; background: rgba(239,68,68,0.12) !important; color: #7f1d1d; }

.qg-explanation {
  margin-top: 10px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  border-left: 3px solid var(--amber);
  padding-left: 10px;
  line-height: 1.5;
}

.qg-error { color: var(--red); font-size: 0.88rem; font-weight: 700; }

@media (max-width: 600px) {
  .qg-row { flex-direction: column; }
  .qg-col-side { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 10px; }
  .qg-col-side > * { flex: 1; min-width: 140px; }
}

/* ══ Polish (Sept 2026) ══════════════════════════════════════════════════════
   A calm study app: warm paper surfaces, one green accent, the system font,
   no glows / gradients / floating emoji, square-ish corners instead of pills.
   Everything below only overrides earlier rules — delete this block to undo. */
:root {
  --amber:    #2f6f5e;   /* the one accent (the old amber variables now carry it) */
  --amber-dk: #265b4d;
  --amber-lt: #e8f1ee;
  --on-accent: #ffffff;
  --black:    #1f1d1b;
  --white:    #ffffff;
  --green:    #2f855a;
  --red:      #c0392b;
  --bg:       #f7f6f3;
  --surface:  #ffffff;
  --text:     #1f1d1b;
  --muted:    #6b6661;
  --border:   #e4e1dc;
  --card:     var(--surface);
  --primary:  var(--amber);
  --radius:   12px;
  --shadow:   0 1px 2px rgba(31,29,27,0.06);
  --shadow-lg: 0 6px 24px rgba(31,29,27,0.08);
  --ring:     0 0 0 3px rgba(47,111,94,0.18);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
[data-theme="dark"] { --amber: #5fae95; --amber-dk: #4f9a82; --amber-lt: rgba(95,174,149,0.14); --on-accent: #10201b; --ring: 0 0 0 3px rgba(95,174,149,0.25); }
[data-theme="dark"]:not([class*="sq-bg-"]) { --bg: #161514; --surface: #1f1e1c; --text: #ecebe8; --muted: #9c978f; --border: #2f2d2a; }

body { font-family: var(--font); }
.screen > * { animation: none; }

/* buttons: the accent, white text, 10px corners, no glow */
.primary-btn, .back-btn, .dash-action-btn, .choice-btn, .match-card, .race-choice, .copy-btn,
.qg-attach-btn, .bot-fab, .bot-send-btn, .td-spd.sel, .room-member-host, .qz-score-pill, .qg-badge, .qg-score-display, .qg-q-num {
  color: var(--on-accent);
}
.primary-btn { border-radius: 10px; box-shadow: none; letter-spacing: 0; font-weight: 700; }
.secondary-btn { border-radius: 10px; border-width: 1px; border-color: var(--border); color: var(--text); }
.secondary-btn:hover { background: var(--bg); color: var(--text); border-color: var(--muted); }
.back-btn { border-radius: 8px; }
.quiz-top .back-btn, .fc-top .back-btn, .match-top .back-btn, .race-top .back-btn { color: var(--text); }
.dash-action-btn { box-shadow: none; font-weight: 600; }
.choice-btn, .race-choice, .match-card { box-shadow: none; font-weight: 600; }
.choice-btn.correct, .race-choice.correct, .match-card.matched { color: #065F46; }
.choice-btn.wrong, .race-choice.wrong, .match-card.wrong { color: #991B1B; }
.match-card.selected { background: var(--amber-dk); border-color: var(--text); }
.switch-btn, .leave-room-btn { border-radius: 8px; }
.dash-points, .pks-balance { border-radius: 8px; background: rgba(255,255,255,0.12); color: var(--white); }
.pks-balance { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.dash-level-badge, .room-member-you, .room-member-host, .qz-score-pill, .qg-badge, .qg-score-display,
.pks-inv-count, .prof-total-badge, .fish-tag, .pks-card-price { border-radius: 6px; }
.guest-btn, .guest-banner-btn, .studybot-input, .studybot-send, .bot-input-area input, .pack-toast { border-radius: 10px; }
.bot-fab { border-radius: 12px; box-shadow: 0 4px 14px rgba(31,29,27,0.18); }
.grade-btn.active { box-shadow: none; color: var(--on-accent); }
.auth-tab.active { box-shadow: none; color: var(--on-accent); }
.field-group input:focus, .modal-card input:focus, .prof-inline-input { box-shadow: var(--ring); }
.field-group label, .qg-label { letter-spacing: 0.02em; text-transform: none; font-weight: 700; }

/* login: a plain header, no purple-black gradient, no glowing title */
.auth-hero { background: transparent; padding: 56px 24px 40px; }
.auth-hero h1 { color: var(--text); text-shadow: none; letter-spacing: -0.03em; font-weight: 800; }
.auth-hero p { color: var(--muted); font-weight: 500; }
.auth-card { margin-top: 0; border-width: 1px; box-shadow: var(--shadow-lg); border-radius: 16px; animation: none; }

/* dashboard */
.dash-header { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); }
.dash-header .switch-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.dash-header .switch-btn:hover { background: var(--border); }
.dash-header .dash-points { background: var(--amber-lt); color: var(--amber-dk); }
.dash-streak-display, .dash-grade-badge { color: var(--muted); }
.dash-level-badge { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.dash-user-title { color: var(--amber); }
.dash-sidebar { border-right-width: 1px; }
.guest-banner { background: var(--amber-lt); color: var(--text); border-bottom: 1px solid var(--border); }
.guest-banner-btn { background: var(--amber); color: var(--on-accent); }
.guest-banner-btn:hover { background: var(--amber-dk); }
.studybot-panel, .subject-card, .badge-item, .room-member { border-width: 1px; box-shadow: none; }
.studybot-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.studybot-title { color: var(--text); }
.studybot-status { color: var(--muted); }
.bot-msg.user { background: var(--amber); color: var(--on-accent); }
.studybot-send, .qz-submit { background: var(--amber); color: var(--on-accent); }
.studybot-send:hover, .qz-submit:hover:not(:disabled) { background: var(--amber-dk); }
.studybot-input:focus { border-color: var(--amber); }
.qz-choice:hover:not(:disabled), .qz-choice.selected { border-color: var(--amber); }
.qz-choice.selected { background: var(--amber-lt); }
.qz-choice.selected .qz-choice-letter { background: var(--amber); color: var(--on-accent); }
.qg-header { background: var(--surface); }
.qg-title { color: var(--text); }
.qg-subtitle { color: var(--muted); }

/* the card-packs banner: a plain row, no blobs, no floating emoji */
.pack-banner { background: var(--surface); border: 1px solid var(--border); box-shadow: none; border-radius: var(--radius); }
.pack-banner:hover { opacity: 1; border-color: var(--amber); }
.pack-banner-glow, .pack-banner-emojis { display: none; }
.pack-banner-title { color: var(--text); }
.pack-banner-sub { color: var(--muted); }
.pack-banner-arrow { color: var(--muted); }

/* game-mode picker: nine quiet tiles instead of dark tiles with glowing titles */
.mode-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.mode-subject-label { color: var(--text); }
.modes-grid { background: var(--bg); gap: 14px; }
.mode-card { box-shadow: none; border: 1px solid var(--border); border-radius: var(--radius); aspect-ratio: 4 / 3; background: var(--surface); }
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--amber); }
.mode-quiz, .mode-flash, .mode-match, .mode-tower, .mode-race, .mode-fishing, .mode-monster, .mode-crypto, .mode-factory { background: var(--surface); }
.mode-big-text, .mode-card .mode-big-text { color: var(--text); text-shadow: none; text-transform: none; letter-spacing: -0.02em; font-weight: 700; font-size: clamp(1.15rem, 3vw, 1.5rem); }

/* game screens */
.quiz-score { color: var(--amber); }
.quiz-timer-fill { background: var(--amber); }
.results-wrap { border-width: 1px; animation: none; }
.results-icon { display: none; }
.results-score { color: var(--amber); }
.td-bullet { box-shadow: none; }
.td-enemy { box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.fish-reel-btn { box-shadow: none; background: var(--green); }
.fish-sky { background: #cfe3f2; }
.fish-water { background: #24485f; }
.cry-locked { background: #3b5b8a; box-shadow: none; }
.prof-stat-icon { display: none; }

/* card packs store */
.pks-card { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--pk-from); box-shadow: none; border-radius: var(--radius); }
.pks-card:hover { box-shadow: var(--shadow-lg); }
.pks-card-shine, .pks-card-emoji, .pks-confirm-art, .pks-flip-logo { display: none; }
.pks-card-name { color: var(--text); }
.pks-card-desc { color: var(--muted); }
.pks-card-price { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.pks-inv-chip.equipped { border-color: var(--amber); box-shadow: none; }
.pks-equip-dot.on { background: var(--amber); box-shadow: none; }
.pks-flip-back { background: var(--black) !important; box-shadow: none; }
.pks-flip-front { box-shadow: none; }
.pks-rar-common    { background: #4b5563; }
.pks-rar-uncommon  { background: #2f5f8a; }
.pks-rar-rare      { background: #574a86; }
.pks-rar-epic      { background: #84406c; }
.pks-rar-legendary { background: #8f6420; }
.pack-toast { background: var(--black); }

/* profile: XP bar is the accent, no amber-to-orange gradient */
.prof-hero, .prof-section { border-width: 1px; }
.prof-level-card { background: var(--surface); border: 1px solid var(--border); }
.prof-xp-nums { color: var(--text); }
.prof-xp-hint { color: var(--muted); }
.prof-xp-bar { background: var(--border); }
.prof-xp-fill { background: var(--amber); }
.prof-level-badge { color: var(--amber); background: var(--amber-lt); }
.prof-equipped-title { color: var(--amber); }
.prof-av-btn.equipped { box-shadow: none; }
.prof-av-dot { box-shadow: none; }

/* calming period: still and plain, no pulsing purple glow */
.calm-header { background: var(--bg); }
.calm-body { background: var(--bg); }
.calm-instruction { color: var(--muted); }
.calm-phase, .calm-done { color: var(--amber); }
.calm-start { background: var(--amber); color: var(--on-accent); }
.calm-start:hover { background: var(--amber-dk); }
.calm-circle { background: var(--amber-lt); border: 2px solid var(--amber); box-shadow: none; }

/* concentration test */
.conc-header, .room-header { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); }
.conc-cell.lit { box-shadow: none; }
.react-circle.go { box-shadow: none; }
.conc-cell.selected, .react-circle.done { background: #5b7fa6; }
.room-header .leave-room-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
/* concentration test menu reuses .mode-card: make those two rows, not squares */
.conc-menu .mode-card { aspect-ratio: auto; padding: 18px 20px; text-align: left; }
.mode-info { display: flex; flex-direction: column; gap: 4px; }
.mode-info strong { font-size: 1rem; color: var(--text); }
.mode-info span { font-size: 0.88rem; color: var(--muted); font-weight: 500; }

/* sign-in card, leaderboard and the old-account dialog (Oct 2026) */
.auth-lead { color: var(--muted); font-size: 0.92rem; font-weight: 500; line-height: 1.5; }
.primary-btn:disabled, .guest-btn:disabled { opacity: 0.6; cursor: default; }
.dash-lb-section { margin-bottom: 28px; }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.lb-row.me { border-color: var(--amber); }
.lb-rank { min-width: 1.6em; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { color: var(--muted); font-size: 0.88rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-note { color: var(--muted); font-size: 0.85rem; font-weight: 500; margin-top: 8px; }
.lb-note.hidden { display: none; }
.link-card form { display: flex; flex-direction: column; gap: 14px; }
.modal-card .field-group input { font-size: 1rem; font-weight: 500; font-family: inherit; letter-spacing: 0; text-transform: none; text-align: left; padding: 12px 14px; border-width: 1px; border-radius: 10px; }
.prof-link-btn { margin-top: 10px; width: 100%; }

/* study rooms: a round everyone plays together (Oct 2026) */
.room-you { color: var(--muted); font-weight: 600; flex-shrink: 0; white-space: pre; }
.rm-name { display: inline-flex; align-items: baseline; min-width: 0; max-width: 100%; }
.rm-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.room-member-name.rm-name { display: flex; }
.room-member.me { border-color: var(--amber); }
.rm-rename-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.rm-rename-btn:hover { border-color: var(--muted); }
.rm-rename-input { flex: 1; width: auto; min-width: 0; }
.rm-setup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.rm-setup h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }
.rm-setup .room-play-hint { margin: 0; }
.rm-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.rm-field { display: flex; flex-direction: column; gap: 6px; }
.rm-grow { flex: 1; min-width: 180px; }
.rm-label { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.rm-row .qg-select { border-width: 1px; border-radius: 10px; min-height: 42px; }
.rm-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.rm-seg-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; min-height: 42px; }
.rm-seg-btn:hover { border-color: var(--muted); }
.rm-seg-btn[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: var(--on-accent); }
.rm-about { color: var(--muted); font-size: 0.86rem; font-weight: 500; margin: 0; }
.rm-setup #rm-start { width: 100%; }
.rm-wait { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }

.rmp-wrap { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; display: flex; flex-direction: column; gap: 18px; }
.rmp-top { gap: 12px; }
.rmp-title { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.rmp-title strong { font-size: 1rem; font-weight: 800; }
.rmp-title span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.rmp-top .quiz-score { min-width: 64px; text-align: right; }
.rmp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.rmp-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rmp-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rmp-side-title { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rmp-race .rmp-grid { grid-template-columns: minmax(0, 1fr); }
.rmp-race .rmp-side { order: -1; background: none; border: none; padding: 0; }
.rmp-race .rmp-side-title { display: none; }
.rmp-race .rmp-main { max-width: 660px; width: 100%; margin: 0 auto; }
.rmp-qhead { display: flex; justify-content: space-between; align-items: center; }
.rmp-secs { font-weight: 700; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rmp-fill { transition: width 0.2s linear; }
.rmp-question { font-size: 1.2rem; }
.rmp-count, .rmp-note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.rmp-count-label { font-weight: 700; color: var(--muted); }
.rmp-count-n { font-size: 3.4rem; font-weight: 800; color: var(--amber); line-height: 1; font-variant-numeric: tabular-nums; min-height: 1em; }
.rmp-count-sub, .rmp-note p { color: var(--muted); font-weight: 500; }
.rmp-note h3 { font-size: 1.3rem; font-weight: 800; }
.rmp-note .rmp-note-big { color: var(--text); font-weight: 700; font-size: 1.05rem; }
.rmp-board-list, .rmp-final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.rmp-row, .rmp-final-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.rmp-row.me, .rmp-final-row.me { border-color: var(--amber); background: var(--amber-lt); }
.rmp-row.left, .rmp-final-row.left, .rmp-lane.left { opacity: 0.55; }
.rmp-rank { min-width: 1.4em; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.rmp-name { flex: 1; min-width: 0; font-weight: 700; text-align: left; }
.rmp-prog { color: var(--muted); font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rmp-pts { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: right; }
.rmp-empty { color: var(--muted); font-size: 0.9rem; }
.rmp-lane .rmp-racer { width: 130px; flex-shrink: 0; color: var(--text); }
.rmp-lane .rmp-racer .room-you { font-weight: 600; }
.rmp-lane .rmp-racer-pts { width: auto; min-width: 92px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.rmp-track { border-width: 1px; box-shadow: none; }
.rmp-results { max-width: 540px; margin: 40px auto; padding: 32px 24px; gap: 14px; }
.rmp-results h2 { font-size: 1.6rem; }
.rmp-results .rmp-place { font-size: 1.8rem; }
.rmp-results .rmp-mine { color: var(--text); font-weight: 700; }
.rmp-final-stat { color: var(--muted); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 820px) {
  .rmp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .rmp-wrap { padding: 16px 16px 48px; }
  .rmp-title span { display: none; }
  .rmp-lane .rmp-racer { width: 96px; }
  .rmp-lane .rmp-racer-pts { min-width: 70px; }
  .rmp-final-stat { display: none; }
  .room-header { padding: 12px 16px; flex-wrap: wrap; row-gap: 10px; }
  .room-header-center { order: 3; flex: 1 1 100%; }
  .room-code-value { font-size: 1.4rem; letter-spacing: 5px; }
  .room-body { padding: 0 16px 80px; }
}
