/* ===================================================
   P5 STUDY HUB — STYLES
   Hybrid responsive: phone · tablet · desktop
   =================================================== */

/* ---------- RESET ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

/* ---------- THEME VARIABLES ---------- */
:root {
  --bg-1: #1e3a8a;
  --bg-2: #0f172a;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --card-front: #ffffff;
  --card-front-text: #0f172a;
  --card-back: #10b981;
  --card-back-text: #ffffff;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.15);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #34d399;
  --warning: #f87171;
  --radius: 14px;
  --radius-lg: 18px;
  --app-max: 520px;
}

body.theme-rainbow { --bg-1: #f97316; --bg-2: #7c3aed; --accent: #ec4899; --accent-2: #db2777; --card-back: #8b5cf6; }
body.theme-space   { --bg-1: #0f172a; --bg-2: #000000; --accent: #6366f1; --accent-2: #4f46e5; --card-back: #a855f7; }
body.theme-ocean   { --bg-1: #0e7490; --bg-2: #082f49; --accent: #06b6d4; --accent-2: #0891b2; --card-back: #14b8a6; }
body.theme-forest  { --bg-1: #15803d; --bg-2: #052e16; --accent: #22c55e; --accent-2: #16a34a; --card-back: #84cc16; --card-back-text: #0f172a; }
body.theme-ghana   { --bg-1: #166534; --bg-2: #7f1d1d; --accent: #eab308; --accent-2: #ca8a04; --card-back: #dc2626; }
body.theme-sunrise { --bg-1: #fb923c; --bg-2: #7c2d12; --accent: #f97316; --accent-2: #ea580c; --card-back: #facc15; --card-back-text: #0f172a; }
body.theme-sports  { --bg-1: #1e40af; --bg-2: #0c4a6e; --accent: #ea580c; --accent-2: #c2410c; --card-back: #facc15; --card-back-text: #0f172a; }
body.theme-safari  { --bg-1: #b45309; --bg-2: #451a03; --accent: #d97706; --accent-2: #b45309; --card-back: #65a30d; --card-back-text: #0f172a; }
body.theme-purple  { --bg-1: #7c3aed; --bg-2: #2e1065; --accent: #a855f7; --accent-2: #9333ea; --card-back: #ec4899; }
body.theme-paper   { --bg-1: #f5f5f4; --bg-2: #e7e5e4; --accent: #0f766e; --accent-2: #115e59; --card-front: #ffffff; --card-front-text: #0f172a; --card-back: #0f766e; --text: #0f172a; --text-muted: rgba(15, 23, 42, 0.6); --panel: rgba(0, 0, 0, 0.05); --panel-strong: rgba(0, 0, 0, 0.08); --border: rgba(0, 0, 0, 0.1); }

/* ---------- BASE ---------- */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  transition: background 0.4s;
}

.hidden { display: none !important; }

/* ===================================================
   SITE HEADER / NAV
   =================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
}
.site-logo-icon { font-size: 1.6rem; }
.site-logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.site-logo-text strong { font-size: 1rem; }
.site-logo-text small { font-size: 0.7rem; opacity: 0.6; }

.site-nav {
  display: none;
  gap: 4px;
}
.site-nav a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}
.site-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-header-cta {
  display: none;
  padding: 10px 18px;
  background: #facc15;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.site-header-cta:hover { background: #eab308; transform: translateY(-1px); }

.site-menu-btn {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.25rem;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}

.site-nav.mobile-open {
  display: flex;
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  flex-direction: column;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 20px 20px;
  gap: 4px;
  z-index: 49;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.2s ease;
}
.site-nav.mobile-open a {
  padding: 12px 14px;
  font-size: 1rem;
  border-radius: 10px;
}

/* ===================================================
   SITE HERO
   =================================================== */
.site-hero {
  padding: 40px 20px 60px;
  background:
    radial-gradient(circle at 90% 10%, rgba(59, 130, 246, 0.15), transparent 55%),
    radial-gradient(circle at 10% 90%, rgba(250, 204, 21, 0.08), transparent 55%);
  scroll-margin-top: 80px;
}
.site-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  text-align: center;
}
.site-hero-text { max-width: 560px; }
.site-hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #facc15;
  margin-bottom: 12px;
}
.site-hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  color: #fff;
}
.site-hero-sub {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 24px;
}
.site-hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.site-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
}
.site-btn:active { transform: translateY(1px); }
.site-btn-primary {
  background: #facc15;
  color: #0f172a;
}
.site-btn-primary:hover {
  background: #eab308;
  box-shadow: 0 10px 25px rgba(250, 204, 21, 0.25);
}
.site-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.site-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}
.site-btn-whatsapp {
  background: #25D366;
  color: #fff;
}
.site-btn-whatsapp:hover {
  background: #1eb356;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.3);
}

.site-hero-image {
  position: relative;
  width: 100%;
  max-width: 320px;
}
.site-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.site-hero-caption {
  margin-top: 12px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  text-align: center;
}

/* ===================================================
   MAIN APP
   =================================================== */
.site-main {
  padding: 0 20px 40px;
  display: flex;
  justify-content: center;
  scroll-margin-top: 80px;
}
.app {
  width: 100%;
  max-width: var(--app-max);
  animation: fadeIn 0.3s ease;
}

.home-section { scroll-margin-top: 100px; }

/* ---------- APP HEADER ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 1.9rem; line-height: 1; }
.brand h1 { font-size: 1.3rem; font-weight: 700; }
.tagline { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.icon-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 1.15rem;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:hover { background: var(--panel-strong); }

/* ---------- SCREENS ---------- */
.screen { display: none; animation: fadeIn 0.25s ease; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

h2 { font-size: 1.05rem; margin: 18px 0 10px; font-weight: 700; }
h3 { font-size: 0.95rem; margin: 22px 0 8px; font-weight: 600; color: var(--text-muted); }
.greeting { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }

.back-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 6px 0;
  margin-bottom: 8px;
  cursor: pointer;
  font-family: inherit;
}
.back-btn:hover { color: var(--text); }

/* ---------- SUBJECT GRID ---------- */
.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subject-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}
.subject-card:hover:not(.disabled) { background: var(--panel-strong); border-color: var(--accent); }
.subject-card:active:not(.disabled) { transform: scale(0.98); }
.subject-card.disabled { opacity: 0.45; cursor: not-allowed; }
.subject-icon { font-size: 1.5rem; line-height: 1; }
.subject-name { font-size: 0.86rem; font-weight: 600; line-height: 1.25; }
.subject-tag { font-size: 0.68rem; color: var(--text-muted); display: block; margin-top: 2px; }

/* ---------- TOPIC LIST ---------- */
.topic-list { display: flex; flex-direction: column; gap: 8px; }
.topic-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.topic-item:hover { background: var(--panel-strong); border-color: var(--accent); }
.topic-item:active { transform: scale(0.99); }
.topic-item-left { display: flex; align-items: center; gap: 12px; }
.topic-item-icon { font-size: 1.3rem; }
.topic-item-name { font-size: 0.95rem; font-weight: 600; }
.topic-item-count { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.topic-item-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* ---------- PROGRESS LINK ---------- */
.progress-link {
  margin-top: 22px;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text);
  padding: 14px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.progress-link:hover { background: var(--panel); border-color: var(--accent); }

/* ---------- TOPIC MODE CARDS ---------- */
.topic-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.mode-card:hover { background: var(--panel-strong); border-color: var(--accent); }
.mode-card:active { transform: scale(0.98); }
.mode-icon { font-size: 2rem; }
.mode-name { font-size: 1rem; font-weight: 700; }
.mode-desc { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- FLASHCARD ---------- */
.study-topic { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.card-container { perspective: 1000px; height: 260px; margin-bottom: 18px; }
.card {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}
.card.flipped { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 22px;
  font-size: 1.1rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  line-height: 1.5;
}
.card-front { background: var(--card-front); color: var(--card-front-text); }
.card-back { background: var(--card-back); color: var(--card-back-text); transform: rotateY(180deg); }
.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.68rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.card-back .badge { background: rgba(255, 255, 255, 0.25); }

/* ---------- CONTROLS ---------- */
.controls { display: flex; gap: 8px; }
.controls button {
  flex: 1;
  padding: 14px 10px;
  font-size: 0.9rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.controls button:hover { background: var(--accent-2); }
.controls button:active { transform: scale(0.97); }
.progress { text-align: center; margin-top: 14px; color: var(--text-muted); font-size: 0.85rem; }

/* ---------- QUIZ ---------- */
.quiz-topic { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.quiz-question {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 22px 18px;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 14px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 500;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 15px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 2px solid transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  line-height: 1.4;
}
.quiz-option:hover:not(:disabled) { background: var(--panel-strong); border-color: var(--accent); }
.quiz-option:active:not(:disabled) { transform: scale(0.99); }
.quiz-option:disabled { cursor: default; }
.quiz-option.correct { background: #10b981; border-color: #34d399; color: #fff; }
.quiz-option.wrong { background: #dc2626; border-color: #ef4444; color: #fff; }
.quiz-feedback { text-align: center; margin-top: 14px; min-height: 22px; font-weight: 600; font-size: 0.92rem; }
.quiz-feedback.correct { color: var(--success); }
.quiz-feedback.wrong   { color: var(--warning); }

/* ---------- QUIZ RESULT ---------- */
#resultTitle { text-align: center; margin-top: 20px; }
.score { font-size: 2rem; font-weight: 700; margin: 14px 0; text-align: center; }
#scoreMessage { text-align: center; color: var(--text-muted); margin-bottom: 22px; font-size: 0.95rem; }
.result-actions { display: flex; gap: 10px; }
.result-actions button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.result-actions button:hover { background: var(--accent-2); }
.result-actions button:active { transform: scale(0.97); }
.result-actions button.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}
.result-actions button.secondary:hover { background: var(--panel-strong); }

/* ---------- PROGRESS SCREEN ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px 12px;
  border-radius: var(--radius);
  text-align: center;
}
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; display: block; }

.progress-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.progress-name-label { font-size: 0.85rem; color: var(--text-muted); }
.progress-name-value { font-weight: 700; font-size: 0.95rem; flex: 1; }
.progress-name-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.progress-name-edit:hover { background: var(--panel-strong); }

.history { list-style: none; margin-top: 4px; }
.history li {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  gap: 8px;
}
.history li .hist-date { color: var(--text-muted); font-size: 0.76rem; }
.history li.empty {
  display: block;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  background: transparent;
}

/* ---------- BUTTONS ---------- */
button.danger {
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
button.danger:hover { background: var(--danger-hover); }
button.danger:active { transform: scale(0.98); }

/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.modal-card h2 { margin-top: 0; }
.modal-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 16px; }
.name-modal-actions { display: flex; gap: 10px; margin-top: 16px; }

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-swatch {
  border-radius: 12px;
  padding: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-align: left;
}
.theme-swatch.selected { border-color: #fff; }
.theme-swatch .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.4);
}
.modal-close {
  margin-top: 18px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

/* ---------- LOADING ---------- */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 90;
  color: #fff;
  font-size: 0.9rem;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- CALCULATOR ---------- */
.calc-display {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  font-size: 2rem;
  font-weight: 700;
  text-align: right;
  margin-bottom: 14px;
  overflow-x: auto;
  white-space: nowrap;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}
.calc-expr { font-size: 0.95rem; font-weight: 500; opacity: 0.55; margin-right: 10px; flex-shrink: 0; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.calc-btn {
  padding: 20px 0;
  font-size: 1.3rem;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.calc-btn:hover { background: var(--panel-strong); }
.calc-btn:active { transform: scale(0.96); }
.calc-btn.calc-op { background: var(--accent); color: #fff; border-color: transparent; }
.calc-btn.calc-op:hover { background: var(--accent-2); }
.calc-btn.calc-fn { background: rgba(255, 255, 255, 0.15); font-size: 1.1rem; }
.calc-btn.calc-equal { background: var(--card-back); color: var(--card-back-text); border-color: transparent; }
.calc-btn.calc-zero { grid-column: span 2; }

/* ---------- DICTIONARY ---------- */
.dict-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.dict-search { display: flex; gap: 8px; margin-bottom: 16px; }
.dict-search input {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}
.dict-search input::placeholder { color: var(--text-muted); }
.dict-search input:focus { border-color: var(--accent); background: var(--panel-strong); }
.dict-search-btn {
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.dict-result {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  animation: fadeIn 0.25s ease;
}
.dict-word-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.dict-word { font-size: 1.4rem; font-weight: 700; text-transform: capitalize; }
.dict-phonetic { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 14px; font-style: italic; }
.dict-pronounce {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dict-pronounce.playing { background: var(--card-back); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.dict-meaning { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.dict-meaning:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.dict-pos {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  margin-bottom: 8px;
}
.dict-def { font-size: 0.95rem; line-height: 1.5; margin-bottom: 8px; }
.dict-example {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
  padding-left: 12px;
  border-left: 3px solid var(--border);
  margin-bottom: 8px;
}
.dict-error { text-align: center; color: var(--warning); padding: 20px; font-size: 0.9rem; }
.dict-loader { text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ---------- TYPING ---------- */
.typing-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
.typing-levels { display: flex; flex-direction: column; gap: 10px; }
.typing-level-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.typing-level-card:hover { background: var(--panel-strong); border-color: var(--accent); }
.typing-level-icon { font-size: 1.8rem; flex-shrink: 0; }
.typing-level-info { flex: 1; }
.typing-level-title { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.typing-level-desc { font-size: 0.82rem; color: var(--text-muted); }
.typing-level-arrow { color: var(--text-muted); font-size: 1.2rem; }
.typing-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.typing-level-name, .typing-lesson-count { font-size: 0.85rem; color: var(--text-muted); }
.typing-target {
  background: var(--card-front);
  color: var(--card-front-text);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  font-size: 1.5rem;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 18px;
  letter-spacing: 0.5px;
  font-family: "Consolas", "Monaco", monospace;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  word-break: break-word;
}
.typing-target .char.correct { color: #10b981; }
.typing-target .char.incorrect { color: #fff; background: #dc2626; border-radius: 3px; }
.typing-target .char.current { border-bottom: 3px solid var(--accent); animation: blink 1s infinite; }
@keyframes blink { 0%, 50% { border-bottom-color: var(--accent); } 51%, 100% { border-bottom-color: transparent; } }
.typing-input {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: "Consolas", "Monaco", monospace;
  font-size: 1.1rem;
  outline: none;
  margin-bottom: 16px;
}
.typing-input:focus { border-color: var(--accent); background: var(--panel-strong); }
.typing-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.typing-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.typing-stat-value { display: block; font-size: 1.3rem; font-weight: 700; }
.typing-stat-label { font-size: 0.7rem; color: var(--text-muted); display: block; margin-top: 2px; }
.typing-actions { display: flex; gap: 10px; }
.typing-btn-secondary, .typing-btn-primary {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.typing-btn-secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.typing-btn-secondary:hover { background: var(--panel-strong); }
.typing-btn-primary { background: var(--accent); color: #fff; }
.typing-btn-primary:hover { background: var(--accent-2); }
.typing-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- STUDY BANNER ---------- */
.study-banner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  transition: background 0.3s, border-color 0.3s;
}
.study-banner.unlocked { background: rgba(16, 185, 129, 0.15); border-color: var(--card-back); }
.study-banner-icon { font-size: 1.2rem; flex-shrink: 0; }
.study-banner-text { flex: 1; font-weight: 600; }
.study-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}
.study-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.4s ease, background 0.3s ease;
}
.study-progress-fill.unlocked { background: var(--card-back); width: 100% !important; }

/* ---------- GAMES HUB ---------- */
.games-locked, .games-unlocked {
  text-align: center;
  padding: 30px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.games-locked-icon, .games-unlocked-icon { font-size: 3.5rem; margin-bottom: 12px; }
.games-locked-title, .games-unlocked-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.games-locked-msg, .games-unlocked-msg { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.games-locked-time { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; font-weight: 600; }
.games-locked .typing-btn-primary { max-width: 260px; margin: 0 auto; }
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.game-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.game-card:hover:not(.disabled) { background: var(--panel-strong); border-color: var(--accent); }
.game-card.disabled { opacity: 0.45; cursor: not-allowed; }
.game-icon { font-size: 1.8rem; }
.game-name { font-size: 0.9rem; font-weight: 600; }
.game-tag { font-size: 0.7rem; color: var(--text-muted); }

/* ---------- MATH SPRINT / shared ---------- */
.ms-hint { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 14px; text-align: center; }
.ms-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ms-mode-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.ms-mode-card:hover { background: var(--panel-strong); border-color: var(--accent); }
.ms-mode-icon { font-size: 2rem; }
.ms-mode-name { font-size: 1rem; font-weight: 700; }
.ms-mode-desc { font-size: 0.72rem; color: var(--text-muted); text-align: center; }
.ms-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  margin-bottom: 14px;
}
.ms-input:focus { border-color: var(--accent); background: var(--panel-strong); }
.ms-actions { display: flex; gap: 10px; }
.ms-pass-screen {
  text-align: center;
  padding: 30px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.ms-pass-icon { font-size: 3.5rem; margin-bottom: 12px; }
.ms-pass-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.ms-pass-msg { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 20px; }
.ms-play-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ms-current-player { font-size: 0.95rem; font-weight: 700; }
.ms-timer {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}
.ms-timer.warning { color: var(--warning); }
.ms-question {
  background: var(--card-front);
  color: var(--card-front-text);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 2px;
  font-family: "Consolas", "Monaco", monospace;
}
.ms-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ms-option {
  padding: 18px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 2px solid transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.3rem;
  font-family: inherit;
  font-weight: 700;
  text-align: center;
}
.ms-option:hover:not(:disabled) { background: var(--panel-strong); border-color: var(--accent); }
.ms-option.correct { background: #10b981; border-color: #34d399; color: #fff; }
.ms-option.wrong { background: #dc2626; border-color: #ef4444; color: #fff; }
.ms-score-inline { text-align: center; font-size: 0.9rem; color: var(--text-muted); margin-top: 10px; }
.ms-score-inline strong { color: var(--text); font-size: 1.1rem; }
.ms-result {
  text-align: center;
  padding: 30px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.ms-result-icon { font-size: 3.5rem; margin-bottom: 12px; }
.ms-result-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.ms-result-msg { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.ms-result-actions { display: flex; gap: 10px; }

/* ---------- MEMORY MATCH ---------- */
.mm-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.mm-current-player { font-size: 0.95rem; font-weight: 700; }
.mm-meta { font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mm-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.mm-card {
  aspect-ratio: 1 / 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: transform 0.4s, background 0.2s, border-color 0.2s;
  padding: 0;
  font-family: inherit;
}
.mm-card:hover:not(:disabled):not(.flipped):not(.matched) { background: var(--panel-strong); border-color: var(--accent); }
.mm-card-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 12px;
  backface-visibility: hidden;
  transition: opacity 0.3s, transform 0.4s;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}
.mm-front { background: var(--accent); color: #fff; font-size: 1.6rem; }
.mm-back { background: var(--card-front); color: var(--card-front-text); opacity: 0; transform: rotateY(180deg); }
.mm-card.flipped .mm-front { opacity: 0; transform: rotateY(180deg); }
.mm-card.flipped .mm-back { opacity: 1; transform: rotateY(0deg); }
.mm-card.matched { pointer-events: none; border-color: var(--card-back); box-shadow: 0 0 0 2px var(--card-back); }
.mm-card.matched .mm-back { background: var(--card-back); color: var(--card-back-text); }
.mm-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.mm-score {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
  font-size: 0.85rem;
}
.mm-score.active { background: var(--panel-strong); border-color: var(--accent); }
.mm-score-name { font-weight: 700; display: block; margin-bottom: 2px; }
.mm-score-val { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------- SPELLING BEE ---------- */
.sb-level-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.sb-level-card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.sb-level-card:hover { background: var(--panel-strong); border-color: var(--accent); }
.sb-level-card.selected { border-color: var(--accent); background: var(--panel-strong); box-shadow: 0 0 0 2px var(--accent); }
.sb-level-icon { font-size: 1.3rem; }
.sb-level-name { font-size: 0.85rem; font-weight: 700; }
.sb-level-desc { font-size: 0.68rem; color: var(--text-muted); }
.sb-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.sb-current-player { font-size: 0.95rem; font-weight: 700; }
.sb-progress-label { font-size: 0.85rem; color: var(--text-muted); }
.sb-speaker-card {
  background: var(--card-front);
  color: var(--card-front-text);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  margin-bottom: 16px;
}
.sb-play-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 2.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.sb-play-btn.playing { background: var(--card-back); animation: pulse 1.2s ease-in-out infinite; }
.sb-speaker-hint { margin-top: 12px; font-size: 0.82rem; opacity: 0.6; }
.sb-input {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  margin-bottom: 12px;
}
.sb-input:focus { border-color: var(--accent); background: var(--panel-strong); }
.sb-input.correct { border-color: #10b981; background: rgba(16, 185, 129, 0.15); }
.sb-input.wrong { border-color: #dc2626; background: rgba(220, 38, 38, 0.15); }
.sb-feedback { text-align: center; min-height: 22px; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.sb-feedback.correct { color: var(--success); }
.sb-feedback.wrong { color: var(--warning); }

/* ---------- TIMES TABLES ---------- */
.tt-level-card.selected { border-color: var(--accent); background: var(--panel-strong); box-shadow: 0 0 0 2px var(--accent); }

/* ===================================================
   SITE PROMO
   =================================================== */
.site-promo {
  padding: 60px 20px;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.08), rgba(59, 130, 246, 0.08));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  scroll-margin-top: 80px;
}
.site-promo-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
  text-align: center;
}
.site-promo-text { max-width: 560px; }
.site-promo-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #facc15;
  margin-bottom: 12px;
}
.site-promo h2 {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  color: #fff;
}
.site-promo-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 24px;
}
.site-promo-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.site-promo-image { width: 100%; max-width: 280px; }
.site-promo-image img {
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* ===================================================
   FOOTER
   =================================================== */
.site-footer {
  background: #050a17;
  padding: 50px 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  scroll-margin-top: 80px;
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
.site-footer-col h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #facc15;
  margin-bottom: 12px;
}
.site-footer-col p, .site-footer-col ul {
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.7);
}
.site-footer-col ul { list-style: none; }
.site-footer-col a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
}
.site-footer-col a:hover { color: #facc15; }
.site-footer-brand .site-footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 8px;
}
.site-footer-brand .site-footer-logo span { font-size: 1.5rem; }
.site-footer-tag { margin-bottom: 16px; font-size: 0.85rem; }
.site-footer-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(250, 204, 21, 0.4);
  margin-bottom: 12px;
}
.site-footer-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.site-footer-credit-line { font-size: 0.85rem; line-height: 1.5; }
.site-footer-credit-line .muted { color: rgba(255, 255, 255, 0.5); font-style: italic; }
.site-footer-cta {
  display: inline-flex;
  margin-top: 12px;
  padding: 10px 18px;
  font-size: 0.85rem;
}
.site-footer-bottom {
  max-width: 1200px;
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ===================================================
   RESPONSIVE — TABLET (641px+)
   =================================================== */
@media (min-width: 641px) {
  :root { --app-max: 700px; }

  .site-hero { padding: 60px 24px 80px; }
  .site-hero-inner {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 50px;
  }
  .site-hero-text { flex: 1; max-width: none; }
  .site-hero-image { flex: 0 0 320px; max-width: 320px; }
  .site-hero-buttons { justify-content: flex-start; }
  .site-hero-caption { text-align: right; }
  .site-hero-title { font-size: 2.6rem; }

  .site-promo-inner { flex-direction: row; text-align: left; align-items: center; gap: 50px; }
  .site-promo-text { flex: 1; max-width: none; }
  .site-promo-image { flex: 0 0 280px; }
  .site-promo-buttons { justify-content: flex-start; }

  .site-footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ===================================================
   RESPONSIVE — DESKTOP (1025px+)
   =================================================== */
@media (min-width: 1025px) {
  :root { --app-max: 960px; }

  .site-nav { display: flex !important; }
  .site-menu-btn { display: none; }
  .site-header-cta { display: inline-block; }

  .site-hero { padding: 80px 32px 100px; }
  .site-hero-title { font-size: 3.2rem; }
  .site-hero-sub { font-size: 1.1rem; }
  .site-hero-image { flex: 0 0 380px; max-width: 380px; }

  .site-promo { padding: 80px 32px; }
  .site-promo h2 { font-size: 2.2rem; }
  .site-promo-body { font-size: 1rem; }

  .site-footer-inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .site-footer { padding: 70px 32px 30px; }

  .subject-grid { grid-template-columns: 1fr 1fr 1fr; }
  .topic-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .tools-grid { grid-template-columns: 1fr 1fr 1fr; }
  .games-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .mode-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .mm-board { grid-template-columns: repeat(6, 1fr); }
  .ms-options { grid-template-columns: repeat(4, 1fr); }
}

/* ===================================================
   RESPONSIVE — SMALL PHONE (≤ 380px)
   =================================================== */
@media (max-width: 380px) {
  .brand h1 { font-size: 1.15rem; }
  .brand-icon { font-size: 1.6rem; }
  .card-container { height: 230px; }
  .card-face { font-size: 1rem; padding: 18px; }
  .subject-card { padding: 12px 10px; }
  .subject-name { font-size: 0.8rem; }
  .mode-card { padding: 18px 10px; }
  .mode-icon { font-size: 1.7rem; }
  .site-hero-title { font-size: 1.9rem; }
  .site-promo h2 { font-size: 1.4rem; }
  .mm-card-inner { font-size: 0.78rem; }
  .mm-front { font-size: 1.4rem; }
  .tt-level-card .ms-mode-name { font-size: 0.9rem; }
  .tt-level-card .ms-mode-desc { font-size: 0.65rem; }
}