/* Keeper's iPad: dark, huge, high contrast. ASCII only. */

:root {
  --bg: #0b0a0c;
  --panel: #18161b;
  --panel2: #221f26;
  --line: #3a3540;
  --text: #f4f0e8;
  --muted: #b9b1a6;
  --ruby: #c8102e;
  --ruby-hi: #e8344f;
  --ruby-dark: #5a0714;
  --green: #2f9e5f;
  --green-dark: #123d26;
  --amber: #f0a500;
  --amber-dark: #4a3300;
  --orange: #ff6a00;
  --radius: 18px;
  --gap: 16px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 22px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior-y: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button, input, .tap { touch-action: manipulation; font-family: inherit; }
[hidden] { display: none !important; }

.boot { padding: 40px 24px; font-size: 28px; }

/* ---------- test banner ---------- */
#testbar {
  background: var(--orange);
  color: #1a0d00;
  padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-weight: 800;
}
#testbar .tb-title { font-size: 24px; margin-right: 6px; letter-spacing: 0.04em; }
#testbar .tb-time { font-size: 26px; margin-right: 8px; font-variant-numeric: tabular-nums; }
#testbar .tb-pin { font-size: 20px; margin-right: 8px; }
#testbar button {
  min-height: 52px; min-width: 64px; padding: 4px 12px;
  font-size: 20px; font-weight: 800; border-radius: 12px;
  border: 2px solid #1a0d00; background: #ffd0a8; color: #1a0d00;
}
#testbar button.on { background: #1a0d00; color: #ffd0a8; }
body.has-test #top { top: 0; }

/* ---------- top bar ---------- */
#top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 10, 12, 0.97);
  border-bottom: 2px solid var(--line);
}
#top .toprow {
  padding: 8px calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l));
  display: flex; align-items: center; gap: 10px;
}

/* ---------- private / player mode banner (always on top) ---------- */
#top .modebar {
  display: flex; align-items: center; gap: 14px;
  padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l));
  color: #fff;
}
body.has-test #top .modebar { padding-top: 8px; }
#top .modebar.private { background: #c8102e; border-bottom: 4px solid #7a0016; }
#top .modebar.player { background: #1c8a4a; border-bottom: 4px solid #0c4a26; }
#top .modebar .mtxt {
  flex: 1 1 auto; font-size: 34px; font-weight: 900; letter-spacing: 0.04em; line-height: 1.1;
}
#top .modebar button.mbtn {
  flex: 0 0 auto; min-height: 76px; min-width: 0; padding: 6px 20px;
  font-size: 26px; font-weight: 900;
  background: #fff; color: #111; border: 3px solid #111; border-radius: 16px;
}
#top .clock {
  flex: 1 1 auto; text-align: center;
  font-size: 40px; font-weight: 800; letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
#top .clock small { font-size: 24px; font-weight: 700; color: var(--muted); margin-left: 4px; }
#top button {
  min-height: 72px; min-width: 104px; padding: 6px 14px;
  font-size: 26px; font-weight: 800;
  background: var(--panel2); color: var(--text);
  border: 2px solid var(--line); border-radius: 16px;
}
#top button.home { background: var(--ruby-dark); border-color: var(--ruby); }
#top .spacer { min-width: 104px; }
#top .lockdot { font-size: 18px; color: var(--amber); font-weight: 800; }

/* ---------- main ---------- */
main#app {
  padding: 18px calc(16px + var(--safe-r)) calc(48px + var(--safe-b)) calc(16px + var(--safe-l));
  max-width: 1200px; margin: 0 auto;
}

h1, .hero-title { font-size: 44px; line-height: 1.12; margin: 6px 0 12px; font-weight: 850; }
h2 { font-size: 32px; line-height: 1.2; margin: 22px 0 10px; font-weight: 800; }
h3 { font-size: 26px; margin: 16px 0 8px; }
p { margin: 10px 0; }
.muted { color: var(--muted); }
.small { font-size: 20px; }
.big { font-size: 30px; font-weight: 700; }
.huge { font-size: 72px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.center { text-align: center; }

.say {
  background: var(--panel2);
  border-left: 8px solid var(--ruby);
  border-radius: 12px;
  padding: 16px 18px; margin: 12px 0;
  font-size: 30px; font-weight: 700; line-height: 1.3;
}
.say .lbl, .lbl {
  display: block; font-size: 20px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--amber); margin-bottom: 6px;
}

.card {
  background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin: 14px 0;
}
.hero { border-width: 3px; padding: 22px; }
.hero.urgent { border-color: var(--ruby-hi); box-shadow: 0 0 0 4px rgba(232, 52, 79, 0.25); }
.hero.soon { border-color: var(--amber); }
.hero.calm { border-color: var(--green); }
.hero .due { font-size: 24px; font-weight: 800; color: var(--amber); }
.hero.urgent .due { color: var(--ruby-hi); }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%;
  min-height: 80px; padding: 14px 18px; margin: 12px 0;
  font-size: 28px; font-weight: 800; line-height: 1.2;
  color: var(--text); background: var(--panel2);
  border: 3px solid var(--line); border-radius: var(--radius);
  text-align: center; cursor: pointer;
}
.btn:active { transform: scale(0.985); filter: brightness(1.25); }
.btn.primary { background: var(--ruby); border-color: var(--ruby-hi); color: #fff; }
.btn.giant { min-height: 112px; font-size: 36px; }
.btn.go { background: var(--green); border-color: #49c07d; color: #fff; }
.btn.warn { background: var(--amber-dark); border-color: var(--amber); color: #ffe2a6; }
.btn.danger { background: var(--ruby-dark); border-color: var(--ruby-hi); color: #fff; }
.btn.ghost { background: transparent; }
.btn.done, .btn:disabled { opacity: 0.42; filter: grayscale(0.6); }
.btn .sub { display: block; font-size: 21px; font-weight: 600; color: inherit; opacity: 0.85; margin-top: 4px; }
.btn.sel { background: var(--green-dark); border-color: var(--green); }
.btn.tick { background: var(--ruby-dark); border-color: var(--ruby-hi); }

.row { display: flex; gap: var(--gap); align-items: stretch; }
.row > * { flex: 1 1 0; margin-top: 0; margin-bottom: 0; }
.row + .row, .row + .btn, .btn + .row { margin-top: 12px; }
.stack > .row { margin: 12px 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.grid .btn { margin: 0; }
.grid.one { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }

/* ---------- confirm / flash / errors ---------- */
.flash {
  display: flex; gap: 14px; align-items: center;
  background: var(--green-dark); border: 3px solid var(--green);
  border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px;
}
.flash .txt { flex: 1 1 auto; font-size: 28px; font-weight: 800; }
.flash .btn { width: auto; min-width: 170px; margin: 0; flex: 0 0 auto; }
.flash.neutral { background: var(--panel2); border-color: var(--line); }

.err {
  background: var(--amber-dark); border: 3px solid var(--amber); color: #ffe7b3;
  border-radius: var(--radius); padding: 16px 18px; margin: 0 0 14px;
  font-size: 28px; font-weight: 800;
}
.change {
  font-size: 34px; font-weight: 850; margin: 12px 0;
  font-variant-numeric: tabular-nums;
}
.change .arrow { color: var(--muted); padding: 0 8px; }
.change .plus { color: #6fe39f; }
.change .minus { color: #ff8a9a; }

/* ---------- secret tap-to-reveal ---------- */
.secret { margin: 12px 0; }
.secret .secret-cover {
  display: block; width: 100%; min-height: 96px;
  background: repeating-linear-gradient(45deg, #1d1a21, #1d1a21 14px, #26222b 14px, #26222b 28px);
  color: var(--muted); border: 3px dashed #5a5262; border-radius: var(--radius);
  font-size: 28px; font-weight: 800; padding: 14px;
}
.secret .secret-body {
  background: #fff7e8; color: #160d10;
  border-radius: var(--radius); padding: 18px 20px;
  font-size: 30px; font-weight: 750; line-height: 1.3;
  border: 3px solid var(--amber);
}
.secret .secret-body .lbl { color: #8a5a00; }
.secret .secret-body .hide-again { font-size: 18px; color: #6b5a4a; margin-top: 10px; font-weight: 600; }

/* ---------- lists ---------- */
.list { list-style: none; padding: 0; margin: 10px 0; }
.list li {
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 16px; margin: 8px 0; display: flex; gap: 12px; align-items: center;
}
.list li .grow { flex: 1 1 auto; }
.list li .t { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; color: var(--amber); }
.list li.okay { border-color: var(--green); }
.list li.past { opacity: 0.6; }

.pill {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 19px; font-weight: 800; background: var(--panel2); border: 2px solid var(--line);
  white-space: nowrap;
}
.pill.green { background: var(--green-dark); border-color: var(--green); color: #b9f5cf; }
.pill.amber { background: var(--amber-dark); border-color: var(--amber); color: #ffe2a6; }
.pill.ruby { background: var(--ruby-dark); border-color: var(--ruby-hi); color: #ffd0d8; }

/* prize editor on the announcement */
.prizes { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.prize-row { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.prize-row .big { flex: 1 1 auto; }
.prize-row .btn { width: 120px; flex: 0 0 auto; min-height: 72px; margin: 0; }
@media (min-width: 900px) {
  .prizes { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .prizes .lbl { grid-column: 1 / -1; }
}

/* session tracker */
.tracker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.tracker .who {
  border-radius: 14px; padding: 14px 14px; font-size: 26px; font-weight: 800;
  border: 3px solid var(--ruby-hi); background: var(--ruby-dark);
  display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 64px;
}
.tracker .who.ok { border-color: var(--green); background: var(--green-dark); }
.tracker .who .st { font-size: 19px; font-weight: 800; opacity: 0.9; }
.tracker.relaxed .who { border-color: var(--line); background: var(--panel2); }
.tracker.relaxed .who.ok { border-color: var(--green); background: var(--green-dark); }

/* text inputs */
.field { display: block; margin: 10px 0; }
.field .lbl { margin-bottom: 4px; }
input[type=text] {
  width: 100%; min-height: 72px; font-size: 28px; font-weight: 700;
  padding: 10px 16px; border-radius: 14px;
  background: #fff7e8; color: #160d10; border: 3px solid var(--line);
}
input[type=text]:focus { outline: none; border-color: var(--amber); }

/* setup: one name box per player, each with its own Remove button */
.name-row { display: flex; gap: 12px; align-items: flex-end; margin: 10px 0; }
.name-row .field { flex: 1 1 auto; margin: 0; }
.name-row .btn { flex: 0 0 150px; width: 150px; min-height: 72px; margin: 0; font-size: 24px; }
.btn.gone { opacity: 0.5; filter: grayscale(0.8); }

/* keypad */
.pad { max-width: 520px; margin: 0 auto; }
.pad .dots { display: flex; justify-content: center; gap: 22px; margin: 18px 0; }
.pad .dot { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--muted); }
.pad .dot.f { background: var(--text); border-color: var(--text); }
.pad .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pad .keys .btn { margin: 0; min-height: 92px; font-size: 40px; }
.pad .msg { text-align: center; min-height: 40px; font-size: 26px; font-weight: 800; color: var(--amber); }
.pad.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-14px); } 75% { transform: translateX(14px); } }

/* countdown */
.countdown { font-size: 160px; font-weight: 900; text-align: center; line-height: 1; margin: 10px 0; font-variant-numeric: tabular-nums; }
.countdown.low { color: var(--ruby-hi); }
.countdown.out { color: var(--amber); font-size: 110px; }

/* progress chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.chips .btn { width: auto; min-height: 64px; font-size: 22px; margin: 0; padding: 8px 16px; flex: 0 0 auto; }

/* ---------- overlay (modal) ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.82);
  display: flex; align-items: flex-start; justify-content: center;
  padding: calc(24px + var(--safe-t)) calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto;
}
#overlay .modal {
  width: 100%; max-width: 760px; margin-top: 4vh;
  background: var(--panel); border: 3px solid var(--line); border-radius: 22px;
  padding: 22px;
}
#overlay .modal h1 { font-size: 38px; }

/* ---------- glance-safe cover ---------- */
#cover {
  position: fixed; inset: 0; z-index: 100;
  background: #2b2723;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 46px, rgba(255,255,255,0.05) 46px, rgba(255,255,255,0.05) 48px);
  color: #8c8378;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; touch-action: manipulation;
  padding: 24px;
}
#cover .c1 { font-size: 48px; font-weight: 700; font-family: Georgia, "Times New Roman", serif; }
#cover .c2 { font-size: 24px; margin-top: 18px; }
#cover .c3 { font-size: 22px; margin-top: 30px; color: #d6a85a; font-weight: 700; }
#cover.armed .c2 { color: #e8e0d4; }

/* ---------- alert flash ---------- */
#flashfx {
  position: fixed; inset: 0; pointer-events: none; z-index: 120;
  background: var(--ruby-hi); opacity: 0;
}
#flashfx.go { animation: flashfx 1.6s ease-out; }
@keyframes flashfx { 0% { opacity: 0.55; } 30% { opacity: 0.1; } 45% { opacity: 0.45; } 100% { opacity: 0; } }

/* ---------- layout: landscape and wide screens ---------- */
@media (min-width: 900px) {
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
  .grid.wide3 { grid-template-columns: 1fr 1fr 1fr; }
  .tracker .who { font-size: 24px; }

  .row.split-wide { gap: 24px; }
}
@media (min-width: 600px) {
  .menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
}
@media (max-width: 600px) {
  body { font-size: 20px; }
  #top button { min-width: 76px; font-size: 22px; padding: 6px 8px; }
  #top .spacer { min-width: 76px; }
  #top .clock { font-size: 30px; }
  #top .modebar .mtxt { font-size: 24px; }
  #top .modebar button.mbtn { font-size: 20px; padding: 6px 12px; }
  h1, .hero-title { font-size: 36px; }
  .grid.three { grid-template-columns: 1fr 1fr; }
}

/* ---------- guided party games (app-games.js): readable across the room and on a TV ---------- */
.gm { margin-top: 6px; }
.gm-panel { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; }
.gm-panel h2 { margin-top: 4px; }
.btn.gm-small { min-height: 64px; font-size: 22px; padding: 8px 14px; }
.gm-hand { margin-top: 34px; border-top: 2px dashed var(--line); padding-top: 8px; }

.gm-last { font-size: 30px; font-weight: 800; text-align: center; margin: 10px 0; color: var(--text); }
.gm-drink {
  background: #ffd23f; color: #1a0a00; border: 6px solid #fff; border-radius: 22px;
  padding: 18px 20px; margin: 12px 0; text-align: center;
  font-size: 52px; font-weight: 900; line-height: 1.1;
  box-shadow: 0 0 0 6px #c8102e;
}
.gm-drink .gm-drink-l { display: block; font-size: 30px; text-transform: uppercase; letter-spacing: 0.06em; }

.gm-hero { text-align: center; margin: 14px 0; }
.gm-hero .gm-pre, .gm-hero .gm-post { display: block; font-size: 26px; font-weight: 800; color: var(--amber); }
.gm-hero .gm-post { color: var(--muted); }
.gm-hero .gm-who { display: block; font-size: 96px; font-weight: 900; line-height: 1.05; word-break: break-word; }
.gm-second { font-size: 40px; font-weight: 850; }

.gm-scores { margin: 16px 0; }
.gm-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.gm-chip {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-radius: 16px;
  background: var(--panel2); border: 3px solid var(--line); font-weight: 850;
}
.gm-chip .nm { font-size: 30px; }
.gm-chip .sc { font-size: 44px; font-variant-numeric: tabular-nums; color: var(--amber); }
.gm-chip.lead { border-color: var(--green); background: var(--green-dark); }
.gm-chip.lead .sc { color: #b9f5cf; }
.gm-chip.drink .sc { color: #ffd23f; }

.gm-order { margin: 14px 0; }
.gm-ochips { display: flex; flex-wrap: wrap; gap: 8px; }
.gm-o { padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); font-size: 24px; font-weight: 800; color: var(--muted); }
.gm-o.cur { border-color: var(--ruby-hi); background: var(--ruby); color: #fff; }

.gm-tie, .gm-placed {
  background: var(--amber-dark); border: 3px solid var(--amber); color: #ffe2a6;
  border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; font-size: 30px; font-weight: 850; text-align: center;
}
.gm-placed { background: var(--green-dark); border-color: var(--green); color: #d4f8e2; }

/* Bucs: the giant card */
.gm-round { text-align: center; font-size: 30px; font-weight: 850; color: var(--amber); margin: 6px 0; }
.gm-table { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; margin: 10px 0; }
.gm-card {
  width: 300px; height: 420px; border-radius: 26px; background: #fffdf7; color: #111;
  border: 6px solid #ddd3c0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.gm-card .v { font-size: 200px; font-weight: 900; letter-spacing: -0.04em; }
.gm-card .s { font-size: 130px; margin-top: 4px; }
.gm-card.red { color: #d0021b; }
.gm-card.small { width: 120px; height: 168px; border-width: 4px; border-radius: 14px; }
.gm-card.small .v { font-size: 76px; }
.gm-card.small .s { font-size: 50px; }
.gm-prev { text-align: center; opacity: 0.8; }
.gm-res { font-size: 110px; font-weight: 900; line-height: 1; letter-spacing: 0.02em; }
.gm-res.higher { color: #6fe39f; }
.gm-res.lower { color: #7fb6ff; }
.gm-res.same { color: var(--amber); }
.btn.gm-hi { background: #123d26; border-color: #6fe39f; color: #d4f8e2; }
.btn.gm-lo { background: #10284a; border-color: #7fb6ff; color: #d8e8ff; }

/* Jukebox: the peek box and the 30 seconds */
.gm-peek {
  display: block; width: 100%; min-height: 110px; margin: 14px 0; padding: 16px;
  background: repeating-linear-gradient(45deg, #1d1a21, #1d1a21 14px, #26222b 14px, #26222b 28px);
  color: var(--text); border: 3px dashed #8a7f96; border-radius: var(--radius);
  font-size: 32px; font-weight: 850; font-family: inherit; text-align: center;
}
.gm-peek.open { background: #fff7e8; color: #160d10; border: 4px solid var(--amber); }
.gm-peek.open .lbl { color: #8a5a00; }
.gm-peek .t { font-size: 48px; font-weight: 900; line-height: 1.1; }
.gm-peek .a { font-size: 30px; font-weight: 700; margin-top: 6px; }
.gm-peek .hide-again { font-size: 18px; color: #6b5a4a; margin-top: 10px; font-weight: 600; }
.btn.gm-wrong { min-height: 70px; font-size: 24px; background: var(--ruby-dark); border-color: var(--ruby-hi); }
.gm-timer { margin: 4px 0; }

/* Pong: the game clock */
.gm-clock { font-size: 96px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.05; }
.gm-clock.low { color: var(--ruby-hi); }
.gm-clock.out { color: var(--amber); font-size: 64px; }
.gm-tctl .btn { min-height: 70px; font-size: 24px; }

/* Slide: 0 1 2 3 */
.gm-coins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gm-coins .btn { margin: 0; min-height: 150px; font-size: 80px; font-weight: 900; }
.gm-coins .btn .sub { font-size: 22px; }

/* Jury: the prompt */
.gm-prompt {
  background: var(--panel2); border-left: 10px solid var(--ruby); border-radius: 14px;
  padding: 18px 20px; margin: 12px 0; font-size: 50px; font-weight: 900; line-height: 1.15;
}

@media (max-width: 600px) {
  .gm-card { width: 210px; height: 294px; }
  .gm-card .v { font-size: 140px; }
  .gm-card .s { font-size: 90px; }
  .gm-res { font-size: 72px; }
  .gm-hero .gm-who { font-size: 64px; }
  .gm-drink { font-size: 38px; }
  .gm-coins { grid-template-columns: 1fr 1fr; }
}
.gm-out { color: var(--muted); }
@media (orientation: landscape) and (max-height: 900px) {
  .gm-card { width: 210px; height: 294px; }
  .gm-card .v { font-size: 140px; }
  .gm-card .s { font-size: 90px; }
  .gm-res { font-size: 96px; }
  .gm-hero .gm-who { font-size: 80px; }
}
