/* ============================================================
   04-core-components.css — Number board, stats, numbers list, ball, controls, cards, modals, toast, history
   ============================================================ */

#phase-select { display: block; }

#phase-game { display: none; padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }

#phase-game .game-main { overflow: visible; }

.board-wrap { padding: 10px 6px 12px; }

.board-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.selected-count { color: #3fb950; font-weight: 700; }

.number-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3.5px; }

.num-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 7px;
  background: #1a2332;
  color: #8b949e;
  border: 1px solid #2a3444;
  transition: all 0.12s;
  user-select: none;
  cursor: pointer;
}

/* Own selected cards — cyan/teal like the design photo */
.num-cell.selected {
  background: linear-gradient(145deg, #0d9488, #14b8a6);
  color: #fff;
  border-color: #2dd4bf;
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.65);
  font-weight: 800;
  transform: scale(1.05);
}

/* Other players' cards — red */
.num-cell.taken {
  background: linear-gradient(145deg, #c0392b, #e74c3c);
  color: #fff;
  border-color: #e74c3c;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
  font-weight: 700;
  cursor: not-allowed;
  opacity: 0.95;
}

/* Currently previewed / focused own card — brighter cyan */
.num-cell.focus {
  background: linear-gradient(145deg, #06b6d4, #22d3ee) !important;
  color: #fff !important;
  border-color: #67e8f9 !important;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.85) !important;
  transform: scale(1.08);
  z-index: 2;
}

.num-cell:active { transform: scale(0.92); }

/* Round isn't open for picks right now (between rounds, or cancelled for too few players) -
   see the updateTimer() override in 06-online.js, which toggles this the moment srv.status
   stops being "selecting" instead of only after a tap fails. */
body.select-locked .number-board { opacity: 0.45; filter: grayscale(0.4); }

.select-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 14px 20px;
  line-height: 1.5;
}

/* Stats row */
.stats-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 10px 8px 6px; }

.stat-box {
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.stat-value { font-size: 13px; font-weight: 700; color: #f0c14b; }

.game-main { display: flex; gap: 8px; padding: 6px 8px 0; }

.numbers-list {
  flex: 0 0 46%;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
}

.list-header {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #1a2332;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.list-header span {
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  padding: 7px 0;
  color: #f0c14b;
}

.list-body { display: grid; grid-template-columns: repeat(5, 1fr); }

.list-num {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 1px;
  color: #8b949e;
  border-bottom: 1px solid #1a2332;
  border-right: 1px solid #1a2332;
  transition: background 0.2s;
}

.list-num.called-b { background: var(--b-color); color: #fff; font-weight: 800; }

.list-num.called-i { background: var(--i-color); color: #fff; font-weight: 800; }

.list-num.called-n { background: var(--n-color); color: #fff; font-weight: 800; }

.list-num.called-g { background: var(--g-color); color: #fff; font-weight: 800; }

.list-num.called-o { background: var(--o-color); color: #fff; font-weight: 800; }

.call-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
  padding-bottom: 24px;
  min-width: 0;
  overflow: visible;
}

.recent-calls {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 32px;
}

.recent-ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.recent-ball.b { background: var(--b-color); }

.recent-ball.i { background: var(--i-color); }

.recent-ball.n { background: var(--n-color); }

.recent-ball.g { background: var(--g-color); }

.recent-ball.o { background: var(--o-color); }

.current-ball-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.current-ball-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.current-ball-ring { position: relative; padding: 4px; border-radius: 50%; }

.current-ball-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6feb, #8957e5);
  animation: rotateRing 3s linear infinite;
}

@keyframes rotateRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.current-ball {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1f6feb, #1158c7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(31,111,235,0.5), inset 0 -4px 8px rgba(0,0,0,0.4);
  border: 3.5px solid #ffffff;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  z-index: 2;
}

.current-ball.ball-b {
  background: linear-gradient(145deg, #e74c3c, #b02a1b);
  box-shadow: 0 0 22px rgba(231,76,60,0.6);
}

.current-ball.ball-i {
  background: linear-gradient(145deg, #1f6feb, #0e44a1);
  box-shadow: 0 0 22px rgba(31,111,235,0.6);
}

.current-ball.ball-n {
  background: linear-gradient(145deg, #d29922, #94680d);
  box-shadow: 0 0 22px rgba(210,153,34,0.6);
}

.current-ball.ball-g {
  background: linear-gradient(145deg, #238636, #124e1e);
  box-shadow: 0 0 22px rgba(35,134,54,0.6);
}

.current-ball.ball-o {
  background: linear-gradient(145deg, #8957e5, #5729a8);
  box-shadow: 0 0 22px rgba(137,87,229,0.6);
}

.current-ball.pop-anim { animation: ballPop 0.35s ease-out; }

@keyframes ballPop {
  0% { transform: scale(0.6); opacity: 0.3; }
  60% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.auto-drawing-status {
  font-size: 11px;
  color: #3fb950;
  font-weight: 700;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.auto-dot {
  width: 6px;
  height: 6px;
  background: #3fb950;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

.draw-btn {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, #238636, #2ea043);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(35,134,54,0.3);
  transition: transform 0.1s;
}

.draw-btn:active { transform: scale(0.95); }

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  margin-top: 2px;
}

.auto-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #e74c3c;
}

.switch { position: relative; width: 42px; height: 22px; }

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: .3s;
}

input:checked + .slider { background: var(--accent); border-color: var(--accent); }

input:checked + .slider:before { transform: translateX(20px); background: #fff; }

.history-btn-small {
  background: var(--surface);
  border: 1px solid var(--border);
  color: #f0c14b;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.player-card-wrap {
  width: 100%;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px;
  margin-top: 2px;
}

.player-card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }

.pc-header {
  text-align: center;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 0;
  border-radius: 4px;
  color: #fff;
}

.pc-header.B { background: var(--b-color); }

.pc-header.I { background: var(--i-color); }

.pc-header.N { background: var(--n-color); }

.pc-header.G { background: var(--g-color); }

.pc-header.O { background: var(--o-color); }

.pc-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 5px;
  background: #2a3444;
  color: #c9d1d9;
  transition: background 0.2s;
}

.pc-cell.marked {
  background: var(--b-color);
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

.pc-cell.free { background: #8a6d1b; color: #fff; font-weight: 800; }

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.card-removed-badge {
  background: var(--danger);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.remove-btn {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #8a6d1b, #d29922);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.remove-btn.removed { background: #3d2e00; color: #8b949e; }

.bottom-area { padding: 12px 14px; text-align: center; }

/* Player request: hide only the "N ካርድ" text itself. The icon next to it
   keeps animating as before, and the moving promo banner under it is left
   alone (not hidden) — only this text label was asked to go. Hidden via CSS
   rather than removed from the DOM, so updateMoneyUI() (which still sets its
   textContent on every draw) keeps running without errors — it just has
   nothing visible to write into. */
#cards-count {
  display: none !important;
}

.cards-count-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }

.cards-count { font-size: 24px; font-weight: 800; color: #e74c3c; margin-bottom: 0; }

/* Win-condition icon: a mini 5x5 bingo-style grid whose highlighted cells cycle
   through the round's ACTUAL required patterns (row / column / diagonal / four
   corners / inner square — whichever are active), with a small slide so the
   shape visibly "moves" between patterns, not a decoration tied to card count. */
.cards-icon {
  display: inline-grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 2px;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 4px;
  background: #11182b;
  border: 1px solid #243047;
  border-radius: 10px;
  box-sizing: border-box;
}

.ci-cell {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: #1c2740;
  transition: background-color .3s ease, box-shadow .3s ease;
}

.ci-cell.on {
  background: linear-gradient(135deg, #4eea81, #1f9e4f);
  box-shadow: 0 0 4px rgba(78, 234, 129, .65);
  animation: ciPop .32s ease;
}

@keyframes ciPop {
  from { transform: scale(.45); opacity: .25; }
  to   { transform: scale(1);   opacity: 1;   }
}

@keyframes ciSlideRow  { from { transform: translateX(-5px); } to { transform: translateX(0); } }
@keyframes ciSlideCol  { from { transform: translateY(-5px); } to { transform: translateY(0); } }
@keyframes ciSlideDiag { from { transform: translate(-4px, -4px); } to { transform: translate(0, 0); } }

.cards-icon.dir-row  { animation: ciSlideRow  .32s ease; }
.cards-icon.dir-col  { animation: ciSlideCol  .32s ease; }
.cards-icon.dir-diag { animation: ciSlideDiag .32s ease; }

.promo-text {
  display: inline-block;
  background: linear-gradient(90deg, #3d2e00, #5c4500);
  color: #f0c14b;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #8a6d1b;
  margin-bottom: 10px;
}

.refresh-big {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 8px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #1f6feb, #58a6ff);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.game-id { font-size: 11px; color: var(--text-muted); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: linear-gradient(180deg, #1a2a32, #0d1117);
  border-radius: 18px;
  width: 100%;
  max-width: 340px;
  overflow: hidden;
  border: 2px solid var(--purple);
  box-shadow: 0 0 40px rgba(137,87,229,0.4);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { transform: scale(0.88); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  background: linear-gradient(90deg, #1e3a2f, #238636);
  padding: 14px;
  text-align: center;
  position: relative;
}

.modal-header h2 { font-size: 24px; font-weight: 800; letter-spacing: 1.5px; }

.modal-close-x {
  position: absolute;
  right: 12px;
  top: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* Winner modal — polished design matching the reference screenshot */
.modal.winner-modal {
  border: 1.5px solid rgba(63, 185, 80, 0.45);
  box-shadow: 0 0 48px rgba(63, 185, 80, 0.25), 0 12px 40px rgba(0,0,0,0.55);
  background: linear-gradient(180deg, #152028 0%, #0d1117 100%);
  max-width: 320px;
}

.bingo-letters {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px 8px;
}

.bingo-letters .bl {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
}

.bingo-letters .bl.B { background: #3b82f6; }
.bingo-letters .bl.I { background: #f1f5f9; color: #0f172a; }
.bingo-letters .bl.N { background: #22c55e; }
.bingo-letters .bl.G { background: #16a34a; }
.bingo-letters .bl.O { background: #eab308; color: #1c1917; }
.bingo-letters .bl.excl { background: #f59e0b; color: #1c1917; font-size: 20px; }

.modal-body { padding: 12px 16px 18px; text-align: center; }

.winner-line {
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--text-muted);
  line-height: 1.35;
}

.winner-line .wn-name,
.winner-line .wn-pill {
  color: #3fb950;
  font-weight: 800;
  font-size: 16px;
}

.winner-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 2px;
  font-size: 12px;
}

.meta-game-id {
  color: var(--text-muted);
  font-weight: 500;
}

.meta-game-id span {
  color: #e6edf3;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.modal-prize {
  font-size: 14px;
  font-weight: 800;
  color: #3fb950;
  white-space: nowrap;
}

.modal-card-preview {
  background: linear-gradient(160deg, #1a2332, #12181f);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1.5px solid rgba(92, 74, 138, 0.55);
}

.preview-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-bottom: 0; }

.preview-header {
  text-align: center;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 0;
  border-radius: 4px;
  color: #fff;
}

.preview-header.B { background: var(--b-color); }
.preview-header.I { background: var(--i-color); }
.preview-header.N { background: var(--n-color); }
.preview-header.G { background: var(--g-color); }
.preview-header.O { background: var(--o-color); }

.preview-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: #2a3444;
  color: #c9d1d9;
}

.preview-cell.marked { background: #238636; color: #fff; }
.preview-cell.free { background: #238636; color: #fff; }
.preview-cell.center { background: var(--i-color); color: #fff; font-weight: 800; }

/* Winning line cells: uniform bright green (no column mix, no red accent) */
.preview-cell.win,
.preview-cell.win.accent {
  background: #22c55e !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.55);
}

.wn-pill {
  display: inline-block;
  background: #2e7d32;
  color: #fff;
  border-radius: 14px;
  padding: 3px 12px;
  font-weight: 700;
}

.modal-cardnum {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 6px;
}

.win-pattern-badge {
  display: inline-block;
  background: #238636;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.modal-timer {
  margin-top: 6px;
  font-size: 13px;
  color: #3fb950;
  font-weight: 600;
}

.progress-bar {
  height: 5px;
  background: #21262d;
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #238636, #3fb950);
  width: 100%;
  transition: width 0.1s linear;
  border-radius: 3px;
}


.history-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 2px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  opacity: 0;
  transition: all 0.28s;
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
