/* ── INDEX-PAGE SPECIFIC STYLES ── */
/* Reset, font, and base body/link colours are in base.html */

body, button, .stat-label, .stat-value, .stat-value2, .title {
  font-family: 'True North', sans-serif;
}

/* ── NAVBAR (added by index.html <style>) ── */
/* Body needs no top padding when navbar is present — navbar handles its own spacing */

/* ── CONTAINER ── */
.container {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem;
}

/* ── HEADER (logo + stats row) ── */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

img {
  width: 3rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.title {
  color: white;
  font-size: 1.875rem;
  font-weight: bold;
}

/* ── STATS BAR ── */
.stats {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  justify-content: flex-end;
}

.stat {
  text-align: center;
}

.stat-label {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.stat-label-inside {
  font-size: 0.75rem;
  color: white;
}

.stat-value {
  aspect-ratio: 2/1;
  min-width: 7rem;
  padding: 0.25rem;
  font-size: 2rem;
  border-radius: 0.375rem;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-value2 {
  aspect-ratio: 3/1;
  min-width: 9rem;
  padding: 0.25rem;
  font-size: 2rem;
  border-radius: 0.375rem;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── GAME BOARD ── */
.game-board {
  display: flex;
  gap: 0.5rem;
}

#gameGrid {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.heads-section {
  display: flex;
  gap: 0.5rem;
  align-items: start;
}

.tails-section {
  display: flex;
  gap: 0.5rem;
  align-items: start;
  padding-top: 1rem;
}

.label {
  width: 2rem;
  height: 100%;
  border-radius: 0.375rem;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  flex-shrink: 0;
}

.label span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  white-space: nowrap;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.5rem;
}

.grid button {
  aspect-ratio: 2/1;
  width: 100%;
  border: 3px solid transparent;
  border-radius: 0.375rem;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: default;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #d7e4ec;
}

/* ── COLOURS ── */
.red   { color: rgb(239, 68, 68); }
.blue  { color: rgb(59, 130, 246); }
.pink  { color: rgb(236, 72, 153); }

.red-bg.chosen        { background-color: rgb(220, 38, 38); }
.blue-bg.chosen       { background-color: rgb(37, 99, 235); }
.pink-bg.chosen       { background-color: rgb(219, 39, 119); }
.green-bg.chosen      { background-color: rgb(22, 163, 74); }
.yellow-bg.chosen     { background-color: rgb(234, 179, 8); }
.purple-bg.chosen     { background-color: rgb(168, 85, 247); }
.orange-bg.chosen     { background-color: rgb(249, 115, 22); }
.light-blue-bg.chosen { background-color: rgb(147, 197, 253); }
.deep-purple-bg.chosen{ background-color: rgb(107, 33, 168); }

/* ── TABLET (≤900px) ── */
@media (max-width: 900px) {
  .stat-value  { min-width: 6rem; }
  .stat-value2 { min-width: 6rem; font-size: 1.57rem; }
  .grid button { font-size: 1.2rem; }
}

/* ── MOBILE (≤500px) ── */
@media (max-width: 500px) {
  body {
    padding: 0;        /* navbar + container handle padding */
  }

  .container {
    padding: 0.75rem 0.6rem;
  }

  /* Header: logo on top row, stats below */
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  .logo {
    justify-content: flex-start;
  }

  /* Stats row: spread evenly across full width */
  .stats {
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.3rem;
    width: 100%;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .stat-label-inside {
    font-size: 0.6rem;
  }

  /* Uniform size for all stat boxes on mobile */
  .stat-value,
  .stat-value2 {
    min-width: 0;
    width: 100%;
    aspect-ratio: unset;
    padding: 0.4rem 0.2rem;
    font-size: 1.25rem;
    border-radius: 0.35rem;
  }

  .stat-value  { height: 3rem; }
  .stat-value2 { height: 3rem; font-size: 1rem; }

  /* Game board */
  .game-board {
    padding-top: 0.5rem;
  }

  .label {
    width: 1.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
  }

  .heads-section,
  .tails-section {
    gap: 0.3rem;
  }

  .tails-section {
    padding-top: 0.6rem;
  }

  .grid {
    gap: 0.2rem;
  }

  .grid button {
    aspect-ratio: 1/1;   /* square cells — easier to read on small screens */
    width: 100%;
    font-size: 0.7rem;
    border-width: 2px;
    border-radius: 0.2rem;
  }
}

/* ── TICKET PANEL ── */
.ticket-panel {
  margin-top: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
}

.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  gap: 0.75rem;
}

.ticket-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: bold;
}

.ticket-chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.ticket-chevron.open { transform: rotate(180deg); }

.ticket-body {
  padding: 1rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
}

/* Scan / paste row */
.scan-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.9rem;
}
.scan-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface2);
  color: var(--text-muted);
  font-family: 'True North', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.scan-mini-btn:hover { border-color: rgb(37,99,235); color: var(--text); background: rgba(37,99,235,0.12); }
.ticket-url-input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.65rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text);
  font-family: 'True North', sans-serif;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}
.ticket-url-input:focus { border-color: rgb(37,99,235); }
.ticket-url-input::placeholder { color: var(--text-muted); }

/* ── KENO TICKET CARD ── */
.keno-card {
  background: white;
  border-radius: 0.6rem;
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.keno-card-top {
  background: rgb(0, 102, 204);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.keno-card-brand {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.kc-keno {
  font-size: 1.15rem;
  font-weight: 900;
  color: white;
  letter-spacing: 0.04em;
}
.kc-classic {
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kc-hint {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  font-style: italic;
  text-align: right;
  min-height: 1em;
}

.keno-card-body {
  padding: 0.9rem 1rem 0.85rem;
}

.kc-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0,0,0,0.45);
  margin-bottom: 0.5rem;
}
.kc-label-nums { margin-top: 0.75rem; }

/* Mini 80-number grid inside ticket card */
.mini-section-wrap {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.mini-section {
  flex: 1;
}
.mini-section-tag {
  font-size: 0.6rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  display: inline-block;
  margin-bottom: 0.4rem;
  color: white;
}
.mini-tag-heads { background: rgb(220, 38, 38); }
.mini-tag-tails { background: rgb(37, 99, 235); }
.mini-num-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.18rem;
}
.mini-num-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.18);
  background: white;
  color: rgba(0,0,0,0.6);
  font-size: 0.52rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.12s;
  line-height: 1;
  font-family: 'True North', sans-serif;
}
.mini-num-btn:hover { border-color: rgb(234,179,8); color: #000; }
.mini-num-btn.selected { background: rgb(234,179,8); border-color: rgb(201,153,0); color: #000; }
.mini-num-btn.matched { background: rgb(234,179,8); border-color: rgb(201,153,0); color: #000; box-shadow: 0 0 4px rgba(234,179,8,0.7); }
.mini-num-btn.unmatched { opacity: 0.3; }

/* Stake — on white card */
.stake-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  font-size: 0.85rem;
  color: rgba(0,0,0,0.5);
}
.stake-input {
  width: 5rem;
  padding: 0.3rem 0.5rem;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 0.4rem;
  color: #000;
  font-family: 'True North', sans-serif;
  font-size: 0.9rem;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.stake-input::-webkit-inner-spin-button,
.stake-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.stake-input:focus { border-color: rgb(0,102,204); }

/* Number circles (selected numbers display) */
.ticket-nums-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  min-height: 2.2rem;
}
.res-num {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: bold;
  border: 2px solid rgba(0,0,0,0.25);
  color: rgba(0,0,0,0.6);
  background: white;
  transition: all 0.3s ease;
}
.res-num.matched {
  background: rgb(234,179,8);
  border-color: rgb(234,179,8);
  color: #000;
  box-shadow: 0 0 8px rgba(234,179,8,0.55);
}
.res-num.unmatched {
  border-color: rgba(0,0,0,0.12);
  color: rgba(0,0,0,0.25);
  background: white;
}

/* Result strip — on white card */
.ticket-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.45rem;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  font-size: 0.88rem;
  min-height: 2.5rem;
  transition: background 0.4s, border-color 0.4s;
  color: rgba(0,0,0,0.6);
}
.ticket-result.win { background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.35); }
.ticket-result.loss { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
.t-match { font-weight: bold; color: #000; }
.t-win { font-weight: bold; color: rgb(22,163,74); margin-left: auto; }
.t-loss { color: rgba(0,0,0,0.35); margin-left: auto; }

/* Board button ticket states — override default border */
#headGrid button.ticket-num,
#tailGrid button.ticket-num { border-color: rgb(234,179,8) !important; }
#headGrid button.ticket-matched,
#tailGrid button.ticket-matched {
  border-color: rgb(234,179,8) !important;
  box-shadow: 0 0 12px rgba(234,179,8,0.55) !important;
  animation: ticketPop 0.55s ease-out forwards;
}
#headGrid button.ticket-unmatched,
#tailGrid button.ticket-unmatched {
  border-color: rgba(234,179,8,0.3) !important;
  opacity: 0.6;
}
@keyframes ticketPop {
  0%   { box-shadow: 0 0 0 0 rgba(234,179,8,0.85); }
  60%  { box-shadow: 0 0 0 10px rgba(234,179,8,0); }
  100% { box-shadow: 0 0 10px rgba(234,179,8,0.45); }
}
body.ticket-active #headGrid button,
body.ticket-active #tailGrid button { cursor: pointer; }

/* Camera scan modal */
.scan-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,0.78);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.scan-modal.open { display: flex; }
.scan-modal-box {
  background: var(--bg2, rgb(24,33,52));
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  width: 100%;
  max-width: 22rem;
}
.scan-modal-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.85rem;
}
.scan-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}
.scan-modal-close:hover { color: var(--text); }
.scan-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #000;
  margin-bottom: 0.75rem;
}
#scanModalVideo { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-modal-status {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.5em;
}
.scan-modal-status.ok { color: rgb(74,222,128); }
.scan-modal-status.err { color: rgb(239,68,68); }

@media (max-width: 500px) {
  .spot-btn { width: 2.1rem; height: 2.1rem; font-size: 0.82rem; }
  .ticket-body { padding: 0.75rem 0.75rem 0.9rem; }
  .ticket-header { padding: 0.75rem 0.85rem; }
}