/* Iolrú Gasta - Times Tables Arena Stylesheet */
:root {
  --navy: #0f172a;
  --electric: #eab308;
  --amber: #f59e0b;
  --cyan: #06b6d4;
  --blue: #3b82f6;
  --emerald: #10b981;
  --coral: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;
  --text: #1e293b;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Lexend', system-ui, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  padding: 0.8rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.back-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  transition: all 0.2s;
}
.back-link:hover { color: var(--navy); background: #e2e8f0; }
.logo-icon {
  font-size: 2rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}
.subtitle {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Header Stats */
.header-stats {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.stat-pill {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-label { color: var(--muted); font-weight: 600; }
.stat-val { color: var(--navy); font-weight: 800; }
.ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.ctrl-btn:hover { background: #f8fafc; border-color: var(--muted); }

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.2rem;
  width: 100%;
  flex: 1;
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: 16px;
  overflow-x: auto;
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--navy); }
.mode-tab.active {
  background: var(--surface);
  color: var(--amber);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Table Selector Bar */
.table-selector-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.8rem;
  box-shadow: var(--shadow);
}
.selector-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.sel-title { font-weight: 800; font-size: 0.92rem; color: var(--navy); }
.operation-toggles { display: flex; gap: 0.4rem; }
.op-btn {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.op-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.table-chip {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s;
}
.table-chip:hover { border-color: var(--amber); color: var(--amber); }
.table-chip.active {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
}

/* Views */
.game-view { display: none; }
.game-view.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-intro {
  margin-bottom: 1.5rem;
}
.view-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--amber);
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}
.view-intro h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
}
.view-intro p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* VIEW 1: SOLO SPEED DASH */
.solo-game-arena {
  max-width: 720px;
  margin: 0 auto;
}
.dash-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.hud-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.hud-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.hud-val { display: block; font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1.2; margin-top: 0.15rem; }
.timer-hud .hud-val { color: var(--coral); }
.score-hud .hud-val { color: var(--emerald); }
.multiplier-hud .hud-val { color: var(--amber); }

.question-display-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.equation-box {
  font-family: var(--font-display);
  font-size: 4.2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.eq-op { color: var(--amber); }
.eq-blank { color: var(--cyan); border-bottom: 4px dashed var(--cyan); min-width: 80px; }

/* Visual Dot Array */
.visual-array-wrap {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin: 1rem auto 1.5rem;
  max-width: 450px;
}
.array-caption { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 0.6rem; }
.array-dots-grid {
  display: inline-grid;
  gap: 6px;
  justify-content: center;
}
.array-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.4);
}
.ghost-btn {
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 1.8rem;
  text-decoration: underline;
}
.ghost-btn:hover { color: var(--navy); }

/* Choices Grid */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.choice-box-btn {
  background: #f8fafc;
  border: 3px solid var(--line);
  border-radius: 16px;
  padding: 1.3rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.choice-box-btn:hover { border-color: var(--navy); background: #f1f5f9; }
.choice-box-btn.correct { background: #ecfdf5; border-color: #10b981; color: #047857; }
.choice-box-btn.wrong { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }

.start-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.9rem 2.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
}
.start-btn:hover { background: var(--amber); }

/* VIEW 2: 2-PLAYER WHITEBOARD DUEL */
.duel-arena-split {
  display: grid;
  grid-template-columns: 1fr 280px 1fr;
  gap: 1.5rem;
  align-items: center;
}
@media (max-width: 900px) {
  .duel-arena-split { grid-template-columns: 1fr; }
}

.duel-player {
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}
.p1-panel { border-color: #f87171; background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%); }
.p2-panel { border-color: #60a5fa; background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%); }

.player-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.p-avatar { font-size: 2.2rem; }
.player-header h3 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; }
.p-score { font-size: 1.1rem; font-weight: 800; color: var(--navy); }

.duel-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.duel-choice-btn {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.duel-choice-btn:hover { background: #f8fafc; }
.p1-panel .duel-choice-btn:active { background: #fee2e2; }
.p2-panel .duel-choice-btn:active { background: #dbeafe; }

.duel-center-equation {
  text-align: center;
  padding: 1rem;
}
.duel-vs {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 0.5rem;
}
.duel-eq-text {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.8rem;
}
.duel-announcement {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 1rem;
}
.action-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { background: var(--amber); }

/* VIEW 3: 12x12 MASTERY GRID */
.grid-controls-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.pat-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s;
}
.pat-btn:hover { background: #f1f5f9; }

.mastery-grid-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.times-table-grid {
  border-collapse: collapse;
  margin: 0 auto;
}
.times-table-grid th, .times-table-grid td {
  width: 44px;
  height: 44px;
  text-align: center;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.times-table-grid th {
  background: #f1f5f9;
  font-weight: 800;
  color: var(--navy);
}
.times-table-grid td:hover {
  background: #fef3c7;
  transform: scale(1.15);
  position: relative;
  z-index: 5;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.times-table-grid td.square-highlight {
  background: #dcfce7;
  font-weight: 800;
  color: #166534;
}
.times-table-grid td.even-highlight {
  background: #eff6ff;
}
.times-table-grid td.odd-highlight {
  background: #fefce8;
}

.grid-readout {
  text-align: center;
  margin-top: 1.2rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  min-height: 32px;
}
