/* Santa Maria Lodge Texas Hold'em - tablet-first, high-contrast, big-tap UI */
:root {
  --bg: #f3efe6;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #5b5b5b;
  --line: #d9d2c3;
  --green: #1e8449;
  --green-dark: #14603a;
  --red: #c0392b;
  --gold: #b7950b;
  --gold-light: #fff3c4;
  --purple: #7d3c98;
  --blue: #2471a3;
  --grey: #9a9a9a;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(0,0,0,.10);
  --tap: 64px;
  --nav-h: 86px;
  --top-h: 76px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 20px; line-height: 1.35; }
body { padding-top: var(--top-h); padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); min-height: 100vh; }
body.no-chrome { padding: 0; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 34px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* top bar */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); background: var(--green); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; z-index: 20; box-shadow: var(--shadow); }
#topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
#topbar .suit { font-size: 28px; }
.mini-clock { background: rgba(0,0,0,.25); border-radius: 14px; padding: 6px 14px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; cursor: pointer; min-width: 150px; }
.mini-time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.mini-level { font-size: 14px; opacity: .95; white-space: nowrap; }
.mini-clock.running .mini-time { color: #d9ffe3; }
.mini-clock.paused .mini-time { color: #ffe082; }
.mini-clock.break { background: var(--gold); color: #1a1a1a; }
.top-actions { display: flex; gap: 8px; }

/* nav */
#nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 2px solid var(--line); display: flex; z-index: 20; }
#nav button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 17px; font-weight: 700; color: var(--muted); cursor: pointer; }
#nav button .ico { font-size: 30px; line-height: 1; }
#nav button.active { color: var(--green); background: #e8f5ec; }

/* layout */
#main { padding: 16px; max-width: 1200px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.big-number { font-size: 56px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }

/* buttons */
.btn { min-height: var(--tap); padding: 10px 22px; border-radius: 16px; border: 3px solid transparent; background: #e9e4d8; color: var(--ink); font-size: 22px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.btn:active { transform: translateY(1px); filter: brightness(.95); }
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.gold { background: var(--gold); color: #1a1a1a; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.outline { background: #fff; border-color: var(--ink); }
.btn.ghost { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.5); }
.btn.small { min-height: 44px; font-size: 17px; padding: 6px 14px; border-radius: 12px; }
.btn.xl { min-height: 84px; font-size: 28px; width: 100%; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { flex: 1 1 200px; }

/* forms */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 17px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], select, textarea { width: 100%; font: inherit; font-size: 24px; padding: 12px 14px; border: 3px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); min-height: var(--tap); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
textarea { min-height: 90px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 8px 14px; border: 3px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-weight: 700; }
.toggle .sw { width: 70px; height: 38px; border-radius: 19px; background: #cfcfcf; position: relative; flex: none; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.on .sw { background: var(--green); }
.toggle.on .sw::after { left: 36px; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; }
.choices .btn { flex: 1 1 110px; }
.choices .btn.selected { background: var(--green); color: #fff; border-color: var(--green-dark); }

/* player rows */
.plist { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 12px; min-height: 70px; padding: 8px 12px; border-radius: 14px; background: #faf8f3; border: 2px solid var(--line); cursor: pointer; }
.prow:active { background: #efe9dc; }
.prow .seat { width: 54px; height: 54px; border-radius: 50%; background: #e9e4d8; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; flex: none; }
.prow .name { font-size: 24px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .contact { color: var(--muted); font-size: 16px; }
.prow.out { opacity: .5; background: #ededed; }
.prow.out .name { text-decoration: line-through; }
.prow.dealer { border-left: 12px solid var(--gold); background: var(--gold-light); }
.prow.empty { opacity: .6; border-style: dashed; cursor: default; }
.prow.empty .name { color: var(--muted); font-weight: 500; font-size: 20px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 15px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
.badge.dealer { background: var(--gold); color: #1a1a1a; }
.badge.out { background: var(--grey); color: #fff; }
.badge.soldier { background: var(--red); color: #fff; }
.badge.hh { background: var(--purple); color: #fff; }
.badge.lock { background: var(--blue); color: #fff; }
.badge.first-out { background: #333; color: #fff; }

/* tables */
.tcard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border-top: 14px solid var(--blue); }
.tcard.closed { opacity: .55; }
.tcard .thead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; cursor: pointer; }
.tcard .thead h2 { margin: 0; font-size: 28px; }
.tcard .thead .count { font-size: 40px; font-weight: 900; line-height: 1; }
.tcard .thead .count small { font-size: 16px; font-weight: 600; color: var(--muted); display: block; }
.tcard .plist { padding: 0 12px 12px; }
.tcard .prow { min-height: 58px; }
.tcard .prow .name { font-size: 21px; }
.hintbar { background: var(--gold-light); border: 2px solid var(--gold); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-weight: 700; }

/* clock */
.clock-big { font-size: clamp(90px, 22vw, 220px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 2px; text-align: center; }
.clock-big.warn { color: var(--red); }
.clock-level { font-size: clamp(28px, 5vw, 48px); font-weight: 800; text-align: center; }
.clock-next { font-size: 22px; text-align: center; color: var(--muted); }
.clock-break { background: var(--gold); border-radius: var(--radius); padding: 14px; text-align: center; font-size: 26px; font-weight: 800; }
.levels { display: flex; flex-direction: column; gap: 6px; }
.levels .lv { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; }
.levels .lv.current { background: #e8f5ec; border-color: var(--green); font-weight: 800; }
.levels .lv.break { background: var(--gold-light); }
.levels .lv .n { width: 44px; font-weight: 800; }

/* payouts */
table.pay { width: 100%; border-collapse: collapse; font-size: 20px; }
table.pay th, table.pay td { padding: 10px 8px; border-bottom: 2px solid var(--line); text-align: left; }
table.pay th { font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
table.pay td.num, table.pay th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.pay tr.total td { font-weight: 900; font-size: 22px; }
.payline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 14px; background: #faf8f3; border: 2px solid var(--line); }
.payline .amt { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; }
.payline .who { font-size: 24px; font-weight: 700; }
.payline .why { color: var(--muted); font-size: 16px; }
.payline.zero { opacity: .5; }

/* modal */
#modal-root .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal { background: var(--card); border-radius: 22px; width: min(720px, 100%); max-height: calc(100vh - 28px); overflow: auto; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.modal h2 { font-size: 30px; }
.modal .actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.modal .actions .btn { flex: 1 1 180px; min-height: 72px; font-size: 24px; }
.picklist { display: flex; flex-direction: column; gap: 10px; }
.picklist .btn { justify-content: flex-start; font-size: 24px; min-height: 70px; }
.picklist .btn.selected { background: var(--green); color: #fff; }
.picklist .btn .ord { background: #fff; color: var(--green); border-radius: 50%; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }
.suggest { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.suggest .btn { justify-content: flex-start; text-align: left; font-size: 22px; min-height: 60px; }
.suggest .btn:hover { filter: brightness(.97); }
.movelist { display: flex; flex-direction: column; gap: 10px; }
.move { display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; }
.move .txt { flex: 1; font-size: 22px; font-weight: 700; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%); background: #1a1a1a; color: #fff; padding: 14px 22px; border-radius: 14px; font-size: 20px; font-weight: 700; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.error { background: var(--red); }

/* login */
.login { max-width: 520px; margin: 40px auto; }
.login h1 { text-align: center; font-size: 36px; }
.code-display { font-size: 48px; letter-spacing: 12px; text-align: center; min-height: 72px; font-weight: 900; font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.keypad .btn { min-height: 78px; font-size: 34px; }

/* print */
@media print {
  #topbar, #nav, #toast, #modal-root, .noprint { display: none !important; }
  body { padding: 0; background: #fff; font-size: 14px; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
}
@media (max-width: 700px) {
  #topbar .brand span:last-child { display: none; }
  .mini-clock { min-width: 120px; }
  .mini-level { font-size: 12px; }
  .btn { font-size: 20px; }
}
