/* ThePit · Copyright (C) 2026 abel0x
   SPDX-License-Identifier: AGPL-3.0-or-later
   Free software with ABSOLUTELY NO WARRANTY; see LICENSE for the terms. */

/* =========================================================
   ThePit: the lobby
   The same cloths, brass and walnut as the tables it leads to.
   ========================================================= */
:root {
  --red: #b7151e;
  --print: rgba(240, 222, 168, .78);
}

body[data-theme="bordeaux"] {
  --red: #c3202a;
}

/* The lobby scrolls; its cloth-coloured backdrop follows the whole page. */
html { min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--cream);
  background:
    radial-gradient(120% 120% at 50% -10%, var(--page-highlight) 0%, var(--page-mid) 45%, var(--page-edge) 100%);
  background-color: var(--page-edge);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----------------------- Top bar ----------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(7px, 1.3vh, 13px) clamp(14px, 3vw, 34px);
  padding-top: max(clamp(7px, 1.3vh, 13px), env(safe-area-inset-top));
  background: linear-gradient(180deg, var(--topbar-top), var(--topbar-bottom));
  border-bottom: 1px solid var(--panel-line);
  backdrop-filter: blur(6px);
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
  filter: drop-shadow(0 3px 8px rgba(217, 182, 95, .3));
}

.brand-number {
  min-width: 32px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px 3px;
  border: 1px solid rgba(217, 182, 95, .46);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(217,182,95,.14), rgba(217,182,95,.035));
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 3px 10px rgba(0,0,0,.2);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 1.04em;
  font-weight: 700;
  letter-spacing: 1.6px;
}
.subtitle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(244, 239, 226, .55);
  white-space: nowrap;
}

.balance-value {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ----------------------- The floor ----------------------- */
.floor {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) clamp(14px, 3vw, 34px) max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3.4vh, 32px);
}

.floor-intro { display: grid; gap: 8px; }
.floor-intro h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 650;
  letter-spacing: 1px;
  color: var(--gold-bright);
}
.floor-intro p { color: rgba(244, 239, 226, .62); font-size: 14px; line-height: 1.5; }

/* The tables in rows: one on a phone, two on a tablet or a small laptop,
   four on a wide screen. A last row that is not full stays centred. */
.table-list {
  --cols: 1;
  --gap: clamp(14px, 2.4vw, 26px);
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
}
.table-list > .table-card { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
@media (min-width: 640px) { .table-list { --cols: 2; } }
@media (min-width: 1200px) { .table-list { --cols: 4; } }

/* Each table is one card: a miniature of its felt above its name and rules.
   The link inside the heading stretches over the whole card. */
.table-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--panel-line);
  background: linear-gradient(180deg, var(--modal-top), var(--modal-bottom));
  box-shadow: 0 20px 44px rgba(0, 0, 0, .45);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.table-card:hover {
  transform: translateY(-3px);
  border-color: rgba(217, 182, 95, .5);
  box-shadow: 0 26px 54px rgba(0, 0, 0, .55), 0 0 0 1px rgba(217, 182, 95, .12);
}
.table-card:has(.table-card-link:focus-visible) {
  outline: 3px solid var(--gold-bright);
  outline-offset: 4px;
}
.table-card-link:focus-visible { outline: none; }

.table-card-felt {
  margin: 12px 12px 0;
  aspect-ratio: 16 / 10;
  border: 8px solid transparent;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 60% at 30% -10%, rgba(255, 247, 218, .1), transparent 66%) padding-box,
    repeating-linear-gradient(4deg, rgba(255,255,255,.016) 0 1px, transparent 1px 4px) padding-box,
    radial-gradient(130% 110% at 40% 10%, var(--felt-highlight) 0%, var(--felt-1) 26%, var(--felt-2) 64%, var(--felt-edge) 100%) padding-box,
    linear-gradient(142deg, rgba(255,232,164,.3), transparent 24%, rgba(0,0,0,.42) 72%, rgba(255,214,117,.2)) border-box,
    repeating-linear-gradient(102deg, #25160b 0 10px, #52371a 10px 18px, #30200f 18px 29px, #694821 29px 34px) border-box;
  box-shadow:
    inset 0 0 0 1px rgba(241, 211, 130, .18),
    inset 0 0 50px rgba(0, 0, 0, .5),
    0 0 0 1px #0b0704,
    0 10px 24px rgba(0, 0, 0, .4);
}
.table-card-art { display: block; width: 100%; height: 100%; }

/* Table 21: two cards and a stack of chips */
.art-card rect { fill: #fbf8ef; stroke: rgba(0, 0, 0, .3); stroke-width: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.art-card text { font-family: var(--font-display); font-weight: 700; }
.art-card .red { fill: #b7151e; }
.art-card .black { fill: #17171a; }
.art-rank { font-size: 14px; }
.art-suit { font-size: 11px; }
.art-pip { font-size: 30px; text-anchor: middle; dominant-baseline: central; }
.art-chip { stroke-width: 1; }
.art-chip.chip-a { fill: #a8232d; stroke: #6a141b; }
.art-chip.chip-b { fill: #24704e; stroke: #134631; }
.art-chip-face { fill: none; stroke: rgba(240, 230, 207, .75); stroke-width: 1.6; stroke-dasharray: 3 3; }
.art-print { fill: none; stroke: var(--print); stroke-width: 1.4; opacity: .55; }

/* Table 9: the two hands */
.art-side { font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: 2px; text-anchor: middle; }
.art-side.player { fill: #b9d0ff; }
.art-side.banker { fill: #ffc0b8; }
.art-side.dealer { fill: #f3dfa2; }

/* Table 7: two dice on the pass line */
.art-die { fill: #c8202a; stroke: #f4e2a6; stroke-width: 1.5; }
.art-pip { fill: #fff8ea; }

/* Slot 5: a window of three reels */
.art-keno-cell { fill: rgba(0, 0, 0, .18); stroke: var(--print); stroke-width: 1.2; opacity: .8; }
.art-keno-ball { fill: #e3bd4d; stroke: #a57d1f; stroke-width: 1.5; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.art-keno-number { font-family: var(--font-display); font-size: 13px; font-weight: 700; text-anchor: middle; fill: var(--cream); }
.art-keno-number.on { fill: #2a1d05; }
.art-wheel-rim { fill: #3a240f; stroke: var(--gold); stroke-width: 3; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.art-wedge { stroke: rgba(40, 26, 8, .7); stroke-width: .4; }
.art-wedge.one { fill: #f1e8cf; }
.art-wedge.two { fill: #2f6fb8; }
.art-wedge.five { fill: #23834b; }
.art-wedge.ten { fill: #6c3ea8; }
.art-wedge.twenty { fill: #c4472b; }
.art-wedge.joker { fill: #121214; }
.art-wedge.logo { fill: #b8902f; }
.art-wheel-hub { fill: #b7151e; stroke: var(--gold); stroke-width: 3; }
.art-wheel-pointer { fill: #f4efe2; stroke: #8c6a1c; stroke-width: 1.2; }
.art-reels { fill: #120b05; stroke: var(--gold); stroke-width: 3; }
.art-reel { fill: #fbf8ef; }
.art-seven { font-family: Georgia, "Times New Roman", serif; font-size: 40px; font-weight: 700; text-anchor: middle; fill: #c8202a; stroke: #e6c35a; stroke-width: 1.2; paint-order: stroke; }

/* Drop 16: a triangle of pegs, the slots and a ball on its way down */
.art-peg { fill: var(--print); }
.art-slot { stroke: rgba(0, 0, 0, .35); stroke-width: 1; }
.art-slot.low { fill: #2f5d73; }
.art-slot.even { fill: #2d7a55; }
.art-slot.mid { fill: #b08a2e; }
.art-slot.top { fill: #b3243a; }
.art-drop { fill: #fbf8ef; stroke: #c9a24b; stroke-width: 1.4; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }

/* Table 4: the croupier's plate of beads and the stick */
.art-plate { fill: #4a2f13; stroke: var(--gold); stroke-width: 5; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.art-bead { fill: #f4efe3; stroke: rgba(0, 0, 0, .25); stroke-width: .6; }
.art-bead.taken { opacity: .5; }
.art-stick { stroke: var(--gold); stroke-width: 4; stroke-linecap: round; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }

/* Table 37: the wheel */
.art-bowl { fill: #4e2711; }
.art-brass { fill: none; stroke: var(--gold); stroke-width: 4; }
.art-pockets { fill: none; stroke-width: 14; }
.art-pockets.black { stroke: #141416; }
.art-pockets.red { stroke: #b5141d; }
.art-pockets.green { stroke: #0e8a45; }
.art-fret { fill: none; stroke: var(--gold-soft); stroke-width: 1.2; }
.art-cone { fill: #5a2f15; }
.art-turret { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.art-hub { fill: var(--gold); }
.art-ball { fill: #f4f1ea; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }

.table-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 18px;
}
.table-card h3 { font-size: inherit; font-weight: inherit; }
.table-card-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.table-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.table-lockup {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 3px;
  color: rgba(244, 239, 226, .92);
}
.table-number {
  min-width: 30px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px 3px;
  border: 1px solid rgba(217, 182, 95, .46);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(217,182,95,.14), rgba(217,182,95,.035));
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0;
}
.table-game {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: rgba(244, 239, 226, .62);
}
.table-card-summary { color: rgba(244, 239, 226, .68); font-size: 13px; line-height: 1.5; }

.table-card-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.table-limit { white-space: nowrap; }
.table-limit small {
  font-size: 9px;
  letter-spacing: 1.6px;
  color: rgba(232, 202, 125, .7);
}
.table-limit strong {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.table-card-status {
  padding: 3px 9px;
  border: 1px solid rgba(226, 104, 95, .55);
  border-radius: 999px;
  background: rgba(0, 0, 0, .3);
  color: #ffd9d6;
  font-size: 11px;
  letter-spacing: .3px;
}
.table-card:not(.round-open) .table-card-status { display: none; }
.table-card-cta {
  margin-left: auto;
  padding: 8px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-soft));
  box-shadow: 0 6px 16px rgba(217, 182, 95, .3);
  color: #2a1d05;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease;
}
.table-card:hover .table-card-cta { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(217, 182, 95, .42); }

.floor-note {
  margin-top: auto;
  text-align: center;
  color: rgba(244, 239, 226, .45);
  font-size: 12px;
  letter-spacing: .3px;
}

/* ----------------------- Settings ----------------------- */
.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: .16s;
  white-space: nowrap;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(217,182,95,.45); }

.modal-card {
  position: relative;
  width: min(500px, 92vw);
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--modal-top), var(--modal-bottom));
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0,0,0,.6);
  scrollbar-width: thin;
  scrollbar-color: rgba(217,182,95,.62) rgba(0,0,0,.22);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-line);
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--modal-top);
}

.seg-btn {
  background: transparent; border: none; color: rgba(244,239,226,.6);
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .16s;
  font-family: var(--font-ui);
}

.theme-option {
  --preview-felt-top: #207653;
  --preview-felt-bottom: #0c3d2a;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
  padding: 6px 6px 8px;
  border: 1px solid rgba(217,182,95,.22);
  border-radius: 11px;
  background: rgba(255,255,255,.035);
  color: rgba(244,239,226,.7);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, color .18s ease;
}

.theme-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 50px;
  overflow: hidden;
  border-radius: 8px;
  background:
    repeating-linear-gradient(5deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px),
    radial-gradient(110% 100% at 45% 0%, var(--preview-felt-top), var(--preview-felt-bottom) 72%);
  box-shadow: inset 0 0 17px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.06);
}
/* A tiny wheel and a pair of cards on each cloth: it dresses both tables. */
.theme-preview::before {
  content: "";
  position: absolute;
  left: 9%;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, #c9a24b 0 3px, #5a2f15 3.5px 9px, transparent 9.5px),
    repeating-conic-gradient(#b7151e 0 9.7deg, #17171a 9.7deg 19.4deg),
    #2a1209;
  box-shadow: 0 0 0 3px #4a2513, 0 0 0 4px rgba(217,182,95,.5), 0 4px 8px rgba(0,0,0,.5);
}
.theme-preview::after {
  content: "";
  position: absolute;
  right: 14%;
  top: 18%;
  width: 20px;
  height: 28px;
  border-radius: 3px;
  background: #fbf8ef;
  transform: rotate(8deg);
  box-shadow: -10px 2px 0 -1px #f1ece0, -10px 2px 0 0 rgba(0,0,0,.25), 0 3px 6px rgba(0,0,0,.45);
}
.theme-option[data-set-theme="midnight"] { --preview-felt-top: #2b6288; --preview-felt-bottom: #0b2b47; }
.theme-option[data-set-theme="bordeaux"] { --preview-felt-top: #8e3a49; --preview-felt-bottom: #3e111c; }
.theme-option[data-set-theme="onyx"] { --preview-felt-top: #5d6268; --preview-felt-bottom: #2a2d31; }
.theme-option[data-set-theme="amethyst"] { --preview-felt-top: #7a54a8; --preview-felt-bottom: #36215a; }

.settings-hint {
  padding-left: 10px;
  border-left: 2px solid rgba(217, 182, 95, .45);
  color: rgba(244, 239, 226, .58);
  font-size: 12px;
  line-height: 1.45;
}

.deposit-row { padding-top: 14px; border-top: 1px solid var(--panel-line); }
.deposit-field {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 4px 4px 4px 12px;
  background: rgba(0,0,0,.28);
}

.deposit-input {
  width: 96px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  -moz-appearance: textfield;
}

.deposit-btn { padding: 7px 16px; font-size: 13px; }

.preset-btn {
  flex: 1 1 0;
  min-width: 64px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(217,182,95,.3);
  color: var(--gold-bright);
  border-radius: 9px;
  padding: 8px 6px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  transition: .16s;
}
.preset-btn:hover { background: rgba(217,182,95,.16); border-color: var(--gold); transform: translateY(-1px); }

.about h3 {
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: 1px; color: var(--gold-bright);
}

.toast {
  position: fixed;
  top: 84px; left: 50%;
  transform: translateX(-50%) translateY(-14px);
  z-index: 30;
  max-width: min(92vw, 560px);
  padding: 11px 24px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .5px;
  text-align: center;
  background: rgba(0,0,0,.82);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}

/* ----------------------- Phones ----------------------- */
/* The language stays one tap away in the settings. */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding-inline: 10px; }
  .subtitle,
  .topbar .lang-switch { display: none; }
  .topbar-actions { gap: 6px; }
  .brand { gap: 8px; }
  .brand-mark svg { width: 34px; height: 34px; }
  .brand-text h1 { font-size: 14px; letter-spacing: 2.2px; gap: 6px; }
  .brand-number { min-width: 28px; padding: 2px 5px; }
  .balance-pill { min-width: 0; padding: 4px 10px; }
  .balance-value { font-size: 17px; }
  .icon-btn { width: 36px; height: 36px; }
  .toast { top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

/* ----------------------- Your save ----------------------- */
/* The file field is read by the label beside it, not shown. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.backup-setting { display: grid; gap: 8px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backup-file { cursor: pointer; }
.backup-file:focus-within, #restoreFile:focus-visible + .backup-file { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.backup-confirm {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--gold-bright);
  border-radius: 10px;
  background: rgba(0, 0, 0, .25);
  color: var(--cream);
  font-size: 13px;
}
.backup-confirm[hidden] { display: none; }

/* ----------------------- Your play ----------------------- */
.play-table-wrap { overflow-x: auto; }
.play-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.play-table th, .play-table td { padding: 5px 6px; text-align: right; white-space: nowrap; }
.play-table thead th { color: rgba(232, 202, 125, .62); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.play-table th[scope="row"], .play-table thead th:first-child { text-align: left; }
.play-table tbody tr + tr { border-top: 1px solid rgba(217, 182, 95, .1); }
.play-table tbody th { color: var(--cream); font-weight: 600; }
.play-table td { color: rgba(244, 239, 226, .82); }
.play-table tfoot tr { border-top: 1.5px solid rgba(217, 182, 95, .45); }
.play-table tfoot th, .play-table tfoot td { color: var(--gold-bright); font-weight: 700; }
.play-table .positive { color: #8fe0b0; }
.play-table .negative { color: #ffb4ad; }
@media (max-width: 420px) {
  .play-table { font-size: 11px; }
  .play-table th, .play-table td { padding: 4px 3px; }
}
