/* number-table.css - Dedicated styles for The Whole Number Table game */

:root {
  --table-border: #b2bec3;
  --table-border-dark: #636e72;
  --cell-bg: #ffffff;
  --cell-row-hl: #fff3bf;
  --cell-col-hl: #dbe4ff;
  --cell-target-bg: #ff922b;
  --cell-target-glow: rgba(255, 146, 43, 0.45);
  --up-down-color: #228be6;
  --up-down-bg: #e7f5ff;
  --left-right-color: #12b886;
  --left-right-bg: #e6fcf5;
}

/* ---------- Game Layout ---------- */
.table-game-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 6px;
}

.mode-tab-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid var(--line, #dfe6e9);
  background: #ffffff;
  color: var(--ink, #2d3436);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-tab-btn:hover {
  border-color: var(--purple, #6c5ce7);
  background: #f8f7ff;
  transform: translateY(-2px);
}

.mode-tab-btn.active {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #ffffff;
  border-color: #6c5ce7;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.35);
}

/* Toolbar & Options */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8f9fa;
  padding: 12px 18px;
  border-radius: 18px;
  border: 1px solid #e9ecef;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #868e96;
  margin-right: 2px;
}

.filter-btn, .opt-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1.5px solid #dee2e6;
  background: #ffffff;
  color: #495057;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover, .opt-btn:hover {
  border-color: #adb5bd;
  background: #f1f3f5;
}

.filter-btn.active {
  background: #e7f5ff;
  border-color: #339af0;
  color: #1864ab;
  font-weight: 800;
}

.opt-btn.active {
  background: #fff4e6;
  border-color: #ff922b;
  color: #d9480f;
}

/* Main Two-Column Playground */
.table-play-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 920px) {
  .table-play-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Whole Number Table Card ---------- */
.table-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid #edf2f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.table-header-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #2d3436;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: -0.3px;
}

/* The 10x10 Table Grid */
.number-grid-wrapper {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 1px;
  background: var(--table-border);
  border: 2px solid var(--table-border-dark);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.grid-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--cell-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: clamp(0.95rem, 2.5vw, 1.4rem);
  font-weight: 800;
  color: #1a1e21;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

/* Zero cell is RED like the screenshot */
.grid-cell.cell-zero {
  color: #d63031;
  font-weight: 900;
}

.grid-cell:hover {
  background: #fff9db;
  z-index: 2;
}

/* Highlight: Row and Column */
.grid-cell.row-hl {
  background: var(--cell-row-hl);
}

.grid-cell.col-hl {
  background: var(--cell-col-hl);
}

/* Intersection of Row & Col */
.grid-cell.row-hl.col-hl {
  background: #ffe066;
}

/* Selected Focus Cell */
.grid-cell.cell-selected {
  background: linear-gradient(135deg, #ff922b, #f76707) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  transform: scale(1.12);
  z-index: 10;
  border-radius: 6px;
  box-shadow: 0 0 0 3px #d9480f, 0 6px 16px rgba(217, 72, 15, 0.45);
}

/* Immediate Neighbors - clean, unobstructed, high-contrast readable numbers */
.grid-cell.neighbor-up,
.grid-cell.neighbor-down {
  background: #e7f5ff !important;
  color: #0f172a !important;
  font-weight: 900 !important;
  box-shadow: inset 0 0 0 2.5px #228be6;
  z-index: 5;
}

.grid-cell.neighbor-left,
.grid-cell.neighbor-right {
  background: #e6fcf5 !important;
  color: #0f172a !important;
  font-weight: 900 !important;
  box-shadow: inset 0 0 0 2.5px #12b886;
  z-index: 5;
}

/* Pattern Highlights */
.grid-cell.pattern-even {
  background-color: #edf2ff;
}
.grid-cell.pattern-odd {
  background-color: #fff4e6;
}
.grid-cell.pattern-5 {
  background-color: #e6fcf5;
}
.grid-cell.pattern-10 {
  background-color: #f3f0ff;
  font-weight: 900;
}
.grid-cell.pattern-diagonal {
  background-color: #fff9db;
}

/* Target cell in Quiz Mode */
.grid-cell.quiz-target {
  box-shadow: 0 0 0 3px #fa5252, 0 0 12px rgba(250, 82, 82, 0.6) !important;
  background: #ffe3e3 !important;
  animation: pulseTarget 1.5s infinite;
  z-index: 9;
}

@keyframes pulseTarget {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.grid-cell.quiz-correct {
  background: #40c057 !important;
  color: #ffffff !important;
  font-weight: 900;
  animation: popCorrect 0.4s ease;
}

@keyframes popCorrect {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Keyboard / Touch hint */
.table-hint-bar {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #868e96;
  text-align: center;
}

/* ---------- Companion Panel: Navigator & Games ---------- */
.companion-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Section Card */
.panel-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid #edf2f7;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #2d3436;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Selected Spotlight Card */
.spotlight-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f8f9fa, #f1f3f5);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border: 1px solid #dee2e6;
}

.spotlight-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.spotlight-num {
  font-size: 2.2rem;
  font-weight: 900;
  color: #d9480f;
  background: #fff4e6;
  border: 2px solid #ffa94d;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 146, 43, 0.25);
}

.spotlight-words {
  display: flex;
  flex-direction: column;
}

.spotlight-word {
  font-size: 1.15rem;
  font-weight: 800;
  color: #2b2c34;
  text-transform: capitalize;
}

.spotlight-breakdown {
  font-size: 0.85rem;
  color: #636e72;
  font-weight: 600;
}

.btn-speak-spotlight {
  background: #ffffff;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-speak-spotlight:hover {
  background: #f1f3f5;
  border-color: #adb5bd;
  transform: scale(1.06);
}

/* ---------- 3x3 Crosshair / Compass D-Pad ---------- */
.compass-grid-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 0 16px;
}

.compass-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  max-width: 310px;
  width: 100%;
}

.compass-cell {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 14px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 6px;
  text-align: center;
  user-select: none;
}

.compass-cell:hover:not(.empty):not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.compass-cell.empty {
  visibility: hidden;
  pointer-events: none;
}

.compass-cell.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f1f3f5;
  border-style: dashed;
}

/* Direction Colors on Compass */
.compass-cell.cell-up, .compass-cell.cell-down {
  background: var(--up-down-bg);
  border-color: #74c0fc;
}

.compass-cell.cell-up:hover:not(.disabled), .compass-cell.cell-down:hover:not(.disabled) {
  border-color: var(--up-down-color);
  background: #d0ebff;
}

.compass-cell.cell-left, .compass-cell.cell-right {
  background: var(--left-right-bg);
  border-color: #63e6be;
}

.compass-cell.cell-left:hover:not(.disabled), .compass-cell.cell-right:hover:not(.disabled) {
  border-color: var(--left-right-color);
  background: #c3fae8;
}

.compass-cell.cell-center {
  background: linear-gradient(135deg, #ff922b, #f76707);
  border-color: #d9480f;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 72, 15, 0.3);
  cursor: default;
}

.compass-cell .dir-icon {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.compass-cell.cell-up .dir-icon, .compass-cell.cell-down .dir-icon {
  color: var(--up-down-color);
}

.compass-cell.cell-left .dir-icon, .compass-cell.cell-right .dir-icon {
  color: var(--left-right-color);
}

.compass-cell.cell-center .dir-icon {
  color: #ffe8cc;
}

.compass-cell .dir-val {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.compass-cell.cell-center .dir-val {
  color: #ffffff;
}

.compass-cell .dir-sub {
  font-size: 0.72rem;
  font-weight: 700;
  color: #868e96;
  margin-top: 2px;
}

.compass-cell.cell-center .dir-sub {
  color: #ffe8cc;
}

/* Tens and Ones Visualizer */
.base10-visualizer {
  background: #f8f9fa;
  border-radius: 14px;
  padding: 12px 16px;
  margin-top: 10px;
  border: 1px solid #e9ecef;
}

.base10-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.base10-row:last-child {
  margin-bottom: 0;
}

.base10-label {
  font-weight: 700;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 6px;
}

.base10-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.rod-mini {
  width: 8px;
  height: 22px;
  background: #228be6;
  border-radius: 3px;
  border: 1px solid #1864ab;
}

.dot-mini {
  width: 10px;
  height: 10px;
  background: #12b886;
  border-radius: 50%;
  border: 1px solid #087f5b;
}

/* Educational Rules Card */
.rules-card {
  background: #fcfcfd;
  border-radius: 16px;
  padding: 14px;
  border: 1px solid #edf2f7;
  font-size: 0.86rem;
  color: #495057;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}

.rule-badge {
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.rule-badge.up-down {
  background: #e7f5ff;
  color: #1971c2;
}

.rule-badge.left-right {
  background: #e6fcf5;
  color: #099268;
}

/* ---------- Quiz & Game Mode HUD / Prompts ---------- */
.quiz-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f3f5;
  border-radius: 14px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 0.95rem;
}

.quiz-score {
  color: #d9480f;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quiz-prompt-card {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.quiz-prompt-question {
  font-size: 1.15rem;
  font-weight: 800;
  color: #212529;
  margin-bottom: 8px;
  line-height: 1.4;
}

.quiz-prompt-question b {
  color: #6c5ce7;
  padding: 2px 6px;
  background: #f3f0ff;
  border-radius: 6px;
}

.quiz-prompt-sub {
  font-size: 0.88rem;
  color: #636e72;
}

/* Multiple choice buttons */
.quiz-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.quiz-choice-btn {
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 900;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid #dee2e6;
  background: #ffffff;
  color: #2d3436;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-choice-btn:hover {
  background: #f1f3f5;
  border-color: #adb5bd;
  transform: translateY(-2px);
}

.quiz-choice-btn.correct {
  background: #40c057 !important;
  color: #ffffff !important;
  border-color: #2b8a3e !important;
}

.quiz-choice-btn.wrong {
  background: #fa5252 !important;
  color: #ffffff !important;
  border-color: #c92a2a !important;
}

/* Feedback Box */
.quiz-feedback {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
  transition: all 0.3s ease;
}

.quiz-feedback.ok {
  background: #d3f9d8;
  color: #2b8a3e;
}

.quiz-feedback.try {
  background: #ffe3e3;
  color: #c92a2a;
}

/* Cross Puzzle Inputs */
.puzzle-input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 14px auto;
}

.puzzle-input-cell {
  background: #f8f9fa;
  border: 2px solid #ced4da;
  border-radius: 12px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
}

.puzzle-input-cell.empty {
  visibility: hidden;
}

.puzzle-input-cell.fixed {
  background: #e9ecef;
  color: #495057;
}

.puzzle-input-cell input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 900;
  color: #1c7ed6;
  outline: none;
}

.puzzle-input-cell.correct {
  border-color: #40c057;
  background: #ebfbee;
}

.puzzle-input-cell.wrong {
  border-color: #fa5252;
  background: #fff5f5;
}

/* Confetti particles */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}
