/* ==========================================================================
   READFLEXES SHARED DESIGN SYSTEM — "Arcade Cabinet meets Modern EdTech"
   One stylesheet for Home / Playground / Teacher's Lounge / Gym.
   Palette is canonical Arcade Neon, adopted from Face-Off
   (docs/superpowers/specs/2026-03-23-faceoff-neon-redesign-design.md).
   Rule: chrome is arcade (neon, scanline, pixel font in tiny accents);
   every word a child must READ TO LEARN is a large rounded sans (Nunito).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

/* ---------- Tokens ---------- */
:root {
  /* Cabinet base (Face-Off canonical) */
  --bg: #0d0d2b;
  --panel: #14143a;            /* a hair lighter than bg, for cards/panels */
  --panel-2: #1a1a48;          /* raised panel / hover */
  --line: rgba(77, 240, 255, 0.15);
  --text: #ffffff;
  --muted: #9aa3b5;            /* slightly lifted from #888 for AA on dark */

  /* Neon accents (canonical — from Face-Off) */
  --neon-cyan: #4df0ff;
  --neon-purple: #a64dff;
  --neon-gold: #ffe100;        /* score / XP / badges / selected-state */
  --neon-fire: #ff9900;        /* streak indicator */

  /* Answer/tile colors (Face-Off quiz tiles) */
  --tile-red: #c0002a;
  --tile-blue: #0055cc;
  --tile-orange: #c07000;
  --tile-green: #008a38;

  /* Subject coding mapped onto neon */
  --subject-english: #4df0ff;
  --subject-spanish: #ff4d6d;
  --subject-math: #a64dff;
  --subject-science: #00e676;

  /* Glows */
  --glow-cyan: 0 0 14px rgba(77, 240, 255, 0.35);
  --glow-purple: 0 0 14px rgba(166, 77, 255, 0.35);
  --glow-gold: 0 0 14px rgba(255, 225, 0, 0.35);

  /* Type */
  --font-arcade: 'Press Start 2P', monospace;                 /* tiny accents ONLY */
  --font-heading: 'Baloo 2', 'Nunito', system-ui, sans-serif; /* chunky headings */
  --font-body: 'Nunito', system-ui, 'Segoe UI', Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
}

/* Calm light mode (Lounge / teacher views) */
:root.light-mode,
.rf-light {
  --bg: #f0f4ff;
  --panel: #ffffff;
  --panel-2: #f4f7ff;
  --line: rgba(13, 13, 43, 0.12);
  --text: #16163a;
  --muted: #5a6275;
  --glow-cyan: 0 0 14px rgba(77, 240, 255, 0.18);
  --glow-purple: 0 0 14px rgba(166, 77, 255, 0.18);
  --glow-gold: 0 0 14px rgba(255, 225, 0, 0.18);
}

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

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% -10%, rgba(166, 77, 255, 0.10), transparent 55%),
    radial-gradient(ellipse at 85% 0%, rgba(77, 240, 255, 0.08), transparent 50%),
    var(--bg);
  overflow-x: hidden;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 1px, 1px);
  white-space: nowrap; border: 0;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 800; }

/* Pixel/arcade type: kickers, labels, counters — never paragraphs */
.rf-kicker {
  font-family: var(--font-arcade);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(77, 240, 255, 0.6);
  text-transform: uppercase;
}
.rf-kicker--gold { color: var(--neon-gold); text-shadow: 0 0 8px rgba(255, 225, 0, 0.55); }
.rf-kicker--purple { color: var(--neon-purple); text-shadow: 0 0 8px rgba(166, 77, 255, 0.55); }

/* ---------- Scanline / CRT utility (reduced-motion aware) ---------- */
.rf-scanline { position: relative; }
.rf-scanline::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(0, 0, 0, 0.10) 3px, rgba(0, 0, 0, 0.10) 4px
  );
  opacity: 0.5;
  z-index: 1;
}
:root.light-mode .rf-scanline::after, .rf-light .rf-scanline::after { opacity: 0.15; }

/* ---------- Nav ---------- */
.rf-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13, 13, 43, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(77, 240, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
}
:root.light-mode .rf-nav, .rf-light .rf-nav {
  background: rgba(240, 244, 255, 0.94);
}
.rf-nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; height: 62px;
}
.rf-nav-logo-link {
  position: relative; display: flex; align-items: center;
  text-decoration: none; flex-shrink: 0;
}
.rf-nav-logo-wrap { position: relative; }
.rf-nav-logo-wrap canvas {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 160px; height: 70px;
  pointer-events: none; z-index: 1;
}
.rf-nav-logo-wrap img {
  height: 36px; width: auto;
  position: relative; z-index: 2;
  filter: drop-shadow(0 0 6px rgba(77, 240, 255, 0.35));
}
.rf-nav-links { display: flex; align-items: center; gap: 0.15rem; margin: 0 auto; }
.rf-nav-link {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  padding: 0.42rem 0.8rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-body);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.rf-nav-link:hover { color: var(--text); background: rgba(77, 240, 255, 0.08); }
.rf-nav-link.active { color: var(--neon-cyan); }
.rf-nav-link.active::after {
  content: '';
  position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.1rem;
  height: 2px; border-radius: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(77, 240, 255, 0.8);
}
.rf-nav-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.rf-nav-login-btn {
  padding: 0.45rem 1.2rem;
  background: transparent;
  color: var(--neon-cyan);
  border: 1.5px solid rgba(77, 240, 255, 0.55);
  border-radius: 999px;
  cursor: pointer; font-size: 0.88rem; font-weight: 800;
  font-family: var(--font-body);
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
}
.rf-nav-login-btn:hover {
  background: rgba(77, 240, 255, 0.12);
  box-shadow: var(--glow-cyan);
}
.rf-nav-hamburger {
  display: none;
  background: none; border: none; color: var(--muted);
  font-size: 1.35rem; cursor: pointer; padding: 0.25rem 0.4rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.rf-nav-hamburger:hover { background: rgba(77, 240, 255, 0.1); color: var(--text); }

/* ---------- Welcome bar ---------- */
.welcome-msg {
  text-align: center;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--neon-gold);
  background: rgba(255, 225, 0, 0.06);
  border-bottom: 1px solid rgba(255, 225, 0, 0.15);
}

/* ---------- Page hero (sub-pages) ---------- */
.page-hero {
  background: rgba(77, 240, 255, 0.04);
  border-bottom: 1px solid var(--line);
  padding: 2.25rem 1.5rem 2rem;
}
.page-hero-inner { max-width: 1200px; margin: 0 auto; }
.page-hero-breadcrumb {
  font-family: var(--font-arcade);
  font-size: 0.5rem;
  color: var(--muted);
  margin-bottom: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.page-hero-breadcrumb a { color: var(--muted); text-decoration: none; }
.page-hero-breadcrumb a:hover { color: var(--neon-cyan); }
.page-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 18px rgba(77, 240, 255, 0.25);
}
.page-hero-sub { font-size: 1.02rem; color: var(--muted); max-width: 560px; line-height: 1.55; }

/* ---------- Buttons ---------- */
.rf-btn, .btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(77, 240, 255, 0.08);
  border: 1.5px solid rgba(77, 240, 255, 0.45);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s, border-color 0.2s;
}
.rf-btn:hover, .btn:hover {
  background: rgba(77, 240, 255, 0.16);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}
.rf-btn:active, .btn:active { transform: translateY(1px) scale(0.98); box-shadow: none; }

.rf-btn-primary {
  background: linear-gradient(135deg, rgba(77, 240, 255, 0.22), rgba(166, 77, 255, 0.22));
  border: 1.5px solid var(--neon-cyan);
  color: var(--text);
  box-shadow: var(--glow-cyan);
}
.rf-btn-primary:hover {
  background: linear-gradient(135deg, rgba(77, 240, 255, 0.32), rgba(166, 77, 255, 0.32));
  box-shadow: 0 0 22px rgba(77, 240, 255, 0.55);
}
.rf-btn-gold {
  border-color: var(--neon-gold);
  color: var(--neon-gold);
  background: rgba(255, 225, 0, 0.08);
}
.rf-btn-gold:hover {
  background: rgba(255, 225, 0, 0.16);
  border-color: var(--neon-gold);
  box-shadow: var(--glow-gold);
}
.rf-btn-ghost {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: var(--muted);
}
.rf-btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}
.rf-btn-lg { padding: 0.85rem 2.2rem; font-size: 1.02rem; }

/* ---------- Section scaffolding ---------- */
.rf-feature-section { padding: 2.75rem 1rem; }
.rf-alt-bg {
  background: rgba(166, 77, 255, 0.04);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rf-section-inner { max-width: 1200px; margin: 0 auto; }
.rf-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.4rem; gap: 0.75rem;
}
.rf-section-title {
  font-size: 1.45rem;
  color: var(--text);
  display: flex; align-items: center; gap: 0.5rem;
}
.rf-section-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.rf-section-link:hover { text-decoration: underline; text-shadow: 0 0 8px rgba(77, 240, 255, 0.6); }
.rf-section-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--neon-cyan), transparent 60%);
  opacity: 0.35;
  margin-bottom: 1.4rem;
}

/* ---------- Arcade card (the Gimkit/Blooket mode-picker card) ---------- */
.rf-arcade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.rf-arcade-card {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1.5px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  cursor: pointer;
}
.rf-arcade-card:hover {
  transform: translateY(-4px);
  border-color: rgba(77, 240, 255, 0.6);
  box-shadow: 0 0 20px rgba(77, 240, 255, 0.25), 0 14px 34px rgba(0, 0, 0, 0.45);
}
/* Gold selected-state — the Gimkit "picked" outline */
.rf-arcade-card.selected, .rf-arcade-card[aria-pressed="true"] {
  border-color: var(--neon-gold);
  box-shadow: 0 0 0 2px var(--neon-gold), var(--glow-gold);
}
.rf-arcade-card-thumb {
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.rf-arcade-card-body { padding: 0.85rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.rf-arcade-card-title {
  font-family: var(--font-heading);
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.rf-arcade-card-line {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}
.rf-arcade-card-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.15rem; }
.rf-chip {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(77, 240, 255, 0.1);
  border: 1px solid rgba(77, 240, 255, 0.3);
  color: var(--neon-cyan);
  white-space: nowrap;
}
.rf-chip--gold { background: rgba(255, 225, 0, 0.1); border-color: rgba(255, 225, 0, 0.35); color: var(--neon-gold); }
.rf-chip--purple { background: rgba(166, 77, 255, 0.12); border-color: rgba(166, 77, 255, 0.35); color: #c996ff; }
.rf-chip--green { background: rgba(0, 230, 118, 0.1); border-color: rgba(0, 230, 118, 0.35); color: var(--subject-science); }
.rf-chip--red { background: rgba(255, 77, 109, 0.1); border-color: rgba(255, 77, 109, 0.35); color: var(--subject-spanish); }
.rf-arcade-card-cta { margin-top: 0.55rem; text-align: center; }

/* Filter chips (Playground) */
.rf-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.4rem; }
.rf-filter-chip {
  font-family: var(--font-body);
  font-size: 0.82rem; font-weight: 800;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.rf-filter-chip:hover { border-color: rgba(77, 240, 255, 0.5); color: var(--text); }
.rf-filter-chip.active {
  border-color: var(--neon-gold);
  color: var(--neon-gold);
  background: rgba(255, 225, 0, 0.08);
  box-shadow: var(--glow-gold);
}

/* ---------- Zone cabinet tiles (Home) ---------- */
.rf-cabinet {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  width: 220px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center top;
  background-color: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}
.rf-cabinet:hover {
  transform: translateY(-4px);
  border-color: rgba(77, 240, 255, 0.6);
  box-shadow: 0 0 22px rgba(77, 240, 255, 0.28), 0 16px 36px rgba(0, 0, 0, 0.45);
}
.rf-cabinet--gold:hover { border-color: var(--neon-gold); box-shadow: 0 0 22px rgba(255, 225, 0, 0.25), 0 16px 36px rgba(0, 0, 0, 0.45); }
.rf-cabinet--purple:hover { border-color: var(--neon-purple); box-shadow: 0 0 22px rgba(166, 77, 255, 0.3), 0 16px 36px rgba(0, 0, 0, 0.45); }
.rf-cabinet-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0.85rem 1rem; z-index: 2;
  background: linear-gradient(to top, rgba(5, 5, 20, 0.95), rgba(5, 5, 20, 0.5), transparent);
  text-align: center;
}
.rf-cabinet-kicker {
  display: block;
  font-family: var(--font-arcade);
  font-size: 0.48rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: 0 0 6px rgba(77, 240, 255, 0.7);
  margin-bottom: 0.35rem;
}
.rf-cabinet-btn {
  display: inline-block;
  padding: 0.42rem 1.05rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(13, 13, 43, 0.7);
  border: 1.5px solid rgba(77, 240, 255, 0.5);
  backdrop-filter: blur(5px);
}
.rf-cabinet:hover .rf-cabinet-btn { box-shadow: var(--glow-cyan); border-color: var(--neon-cyan); }
.rf-cabinet-desc {
  margin-top: 0.32rem;
  color: rgba(226, 232, 240, 0.88);
  font-size: 0.79rem;
  line-height: 1.35;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ---------- "How it works" strip ---------- */
.rf-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
  max-width: 900px;
  margin: 0 auto;
}
.rf-step {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.1rem 1.25rem;
  text-align: center;
  position: relative;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.rf-step:hover { transform: translateY(-3px); border-color: rgba(77, 240, 255, 0.45); box-shadow: var(--glow-cyan); }
.rf-step-num {
  font-family: var(--font-arcade);
  font-size: 0.62rem;
  color: var(--neon-gold);
  text-shadow: 0 0 8px rgba(255, 225, 0, 0.6);
  display: block;
  margin-bottom: 0.6rem;
}
.rf-step-icon { font-size: 2.2rem; display: block; margin-bottom: 0.55rem; }
.rf-step-title {
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}
.rf-step-desc { font-size: 0.88rem; color: var(--muted); line-height: 1.5; }

/* ---------- Gamification primitives ---------- */
/* XP bar */
.rf-xp-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  overflow: hidden;
}
.rf-xp-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  box-shadow: 0 0 10px rgba(77, 240, 255, 0.7);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.rf-xp-label {
  font-family: var(--font-arcade);
  font-size: 0.58rem;
  color: var(--neon-gold);
  text-shadow: 0 0 8px rgba(255, 225, 0, 0.6);
  letter-spacing: 0.06em;
}
.rf-level-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px;
  padding: 0 0.5rem;
  border-radius: 12px;
  background: rgba(255, 225, 0, 0.1);
  border: 1.5px solid var(--neon-gold);
  box-shadow: var(--glow-gold);
  font-family: var(--font-arcade);
  font-size: 0.72rem;
  color: var(--neon-gold);
}

/* Badge chip (badge shelf) */
.rf-badge-chip {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.35rem;
  width: 92px;
  padding: 0.8rem 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1.5px solid rgba(255, 225, 0, 0.35);
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.rf-badge-chip:hover { transform: translateY(-2px); box-shadow: var(--glow-gold); }
.rf-badge-chip .rf-badge-icon { font-size: 1.7rem; filter: drop-shadow(0 0 6px rgba(255, 225, 0, 0.5)); }
.rf-badge-chip .rf-badge-name {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--neon-gold);
  line-height: 1.25;
}
.rf-badge-chip.locked { border-color: rgba(255, 255, 255, 0.12); opacity: 0.45; filter: grayscale(1); }
.rf-badge-chip.locked .rf-badge-name { color: var(--muted); }

/* Streak flame (Face-Off streak-fire pattern) */
.rf-streak-flame {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 120, 0, 0.16);
  border: 1px solid rgba(255, 120, 0, 0.35);
  color: var(--neon-fire);
  font-weight: 800;
  font-size: 0.88rem;
  text-shadow: 0 0 6px rgba(255, 153, 0, 0.8);
  animation: rf-streak-pulse 2s ease-in-out infinite;
}
@keyframes rf-streak-pulse {
  0%, 100% { background: rgba(255, 120, 0, 0.16); }
  50%      { background: rgba(255, 120, 0, 0.28); }
}
.rf-streak-flame.cold {
  animation: none;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  text-shadow: none;
}

/* Confetti / reward burst — spawn .rf-confetti-piece inside a .rf-confetti host */
.rf-confetti {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4000;
}
.rf-confetti-piece {
  position: absolute;
  top: -12px;
  width: 10px; height: 14px;
  border-radius: 2px;
  animation: rf-confetti-fall 2.6s ease-in forwards;
}
@keyframes rf-confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0.7; }
}
/* Reward pop for badge unlock / level-up */
.rf-reward-pop { animation: rf-burst-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes rf-burst-in {
  from { transform: scale(0.5) translateY(16px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- Panels & stat cards (calm surfaces + progress hub) ---------- */
.rf-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}
.rf-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.9rem;
}
.rf-stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  text-align: center;
}
.rf-stat-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(77, 240, 255, 0.4);
  display: block;
}
.rf-stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
  display: block;
}

/* Lounge section blocks (calm: neon dialed down) */
.rf-lounge-section { margin-bottom: 2.4rem; }
.rf-lounge-section-title {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.rf-lounge-section-sub { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.1rem; line-height: 1.5; }
.rf-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.rf-tool-card {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 1.05rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none; color: inherit;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.rf-tool-card:hover {
  background: var(--panel-2);
  transform: translateY(-2px);
  border-color: rgba(77, 240, 255, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.rf-tool-card-icon {
  font-size: 1.5rem; flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(77, 240, 255, 0.09);
  border: 1px solid var(--line);
}
.rf-tool-card-body { flex: 1; min-width: 0; }
.rf-tool-card-title { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 0.2rem; font-family: var(--font-heading); }
.rf-tool-card-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.45; }
.rf-tool-card-arrow { color: var(--muted); font-size: 0.85rem; flex-shrink: 0; margin-top: 0.1rem; }
.rf-tool-card.featured {
  border-color: rgba(255, 225, 0, 0.4);
}
.rf-tool-card.featured:hover { border-color: var(--neon-gold); box-shadow: var(--glow-gold); }
.rf-tool-card.locked { opacity: 0.55; }

/* ---------- Vocab library items ---------- */
.rf-vocab-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 2rem;
}
.vocab-group-title {
  font-family: var(--font-arcade);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.95rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid;
}
.vocab-group-title.english { color: var(--subject-english); border-color: rgba(77, 240, 255, 0.5); text-shadow: 0 0 8px rgba(77, 240, 255, 0.5); }
.vocab-group-title.spanish { color: var(--subject-spanish); border-color: rgba(255, 77, 109, 0.5); text-shadow: 0 0 8px rgba(255, 77, 109, 0.5); }
.vocab-group-title.math    { color: var(--subject-math); border-color: rgba(166, 77, 255, 0.5); text-shadow: 0 0 8px rgba(166, 77, 255, 0.5); }
.vocab-group-title.science { color: var(--subject-science); border-color: rgba(0, 230, 118, 0.5); text-shadow: 0 0 8px rgba(0, 230, 118, 0.5); }
.vocab-items { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.vocab-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  width: 76px; text-decoration: none; color: inherit;
  transition: transform 0.15s;
  cursor: pointer;
}
.vocab-item:hover { transform: translateY(-2px); }
.vocab-icon {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  transition: background 0.15s, box-shadow 0.15s;
}
.vocab-icon.blue   { background: rgba(77, 240, 255, 0.12); border: 1px solid rgba(77, 240, 255, 0.3); }
.vocab-icon.red    { background: rgba(255, 77, 109, 0.12); border: 1px solid rgba(255, 77, 109, 0.3); }
.vocab-icon.purple { background: rgba(166, 77, 255, 0.12); border: 1px solid rgba(166, 77, 255, 0.3); }
.vocab-icon.green  { background: rgba(0, 230, 118, 0.12); border: 1px solid rgba(0, 230, 118, 0.3); }
.vocab-item:hover .vocab-icon.blue   { background: rgba(77, 240, 255, 0.22); box-shadow: var(--glow-cyan); }
.vocab-item:hover .vocab-icon.red    { background: rgba(255, 77, 109, 0.22); box-shadow: 0 0 14px rgba(255, 77, 109, 0.35); }
.vocab-item:hover .vocab-icon.purple { background: rgba(166, 77, 255, 0.22); box-shadow: var(--glow-purple); }
.vocab-item:hover .vocab-icon.green  { background: rgba(0, 230, 118, 0.22); box-shadow: 0 0 14px rgba(0, 230, 118, 0.35); }
.vocab-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.25;
}

/* ---------- Modals (shared shell, arcade tokens) ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(5, 5, 20, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.hidden { display: none; }
.modal-content {
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 0 0 30px rgba(77, 240, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.55);
  padding: 1.5rem; border-radius: var(--radius); text-align: center;
  width: 90%; max-width: 340px; position: relative;
  color: var(--text);
}
.modal-content h2 { font-size: 1.25rem; margin-bottom: 0.9rem; }
.modal-close {
  position: absolute; top: 0.5rem; right: 1rem;
  font-size: 1.5rem; cursor: pointer; color: var(--muted);
}
.modal-close:hover { color: var(--text); }
.modal-btn {
  display: block; width: 100%; margin: 0.75rem 0; padding: 0.75rem;
  background: rgba(77, 240, 255, 0.12);
  color: var(--text);
  border: 1.5px solid rgba(77, 240, 255, 0.45);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 1rem; font-weight: 700;
  font-family: var(--font-body);
  transition: background 0.15s, box-shadow 0.15s;
}
.modal-btn:hover { background: rgba(77, 240, 255, 0.2); box-shadow: var(--glow-cyan); }
.modal-btn:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.modal-btn.secondary { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.2); }
.modal-btn.secondary:hover { background: rgba(255, 255, 255, 0.1); box-shadow: none; }
.modal-content input, .modal-content select {
  width: 100%; padding: 0.7rem 0.75rem;
  margin: 0.4rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 10, 0.45);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
}
:root.light-mode .modal-content input, :root.light-mode .modal-content select,
.rf-light .modal-content input, .rf-light .modal-content select {
  background: #fff;
}
.modal-content input:focus, .modal-content select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px rgba(77, 240, 255, 0.2);
}

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 0.9rem 1rem;
  text-align: center;
  color: var(--muted);
  background: rgba(0, 0, 10, 0.35);
  border-top: 1px solid var(--line);
}
.site-footer small { opacity: 0.9; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--neon-cyan); }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .rf-nav-links { display: none; }
  .rf-nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 62px; left: 0; right: 0;
    background: rgba(13, 13, 43, 0.99);
    padding: 0.75rem 1.25rem 1rem;
    border-bottom: 1px solid var(--line);
    z-index: 99;
    gap: 0.25rem;
  }
  :root.light-mode .rf-nav-links.open, .rf-light .rf-nav-links.open { background: rgba(240, 244, 255, 0.99); }
  .rf-nav-links.open .rf-nav-link { padding: 0.65rem 0.75rem; font-size: 1rem; }
  .rf-nav-hamburger { display: block; }
  .rf-nav { position: relative; }
  .rf-steps { grid-template-columns: 1fr; }
  .rf-cabinet { width: 100%; max-width: 240px; }
  .rf-arcade-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.9rem; }
  .rf-vocab-groups { grid-template-columns: 1fr; }
  .rf-tool-grid { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion: kill neon motion, keep static styling ---------- */
@media (prefers-reduced-motion: reduce) {
  .rf-scanline::after { background: none; }
  .rf-streak-flame,
  .rf-confetti-piece,
  .rf-reward-pop { animation: none !important; }
  .rf-arcade-card, .rf-cabinet, .rf-step, .rf-btn, .btn,
  .rf-tool-card, .rf-badge-chip, .vocab-item, .rf-xp-bar-fill {
    transition: none !important;
  }
  .rf-arcade-card:hover, .rf-cabinet:hover, .rf-step:hover,
  .rf-btn:hover, .btn:hover, .rf-tool-card:hover { transform: none; }
}
