/* Playground brand (Graphic Standard Manual, Dec 2025): Poppins for text and buttons,
   Oswald Bold for headlines; red #cd0000 (Pantone 485C), black, white, light grey #e6e7e8.
   Fonts are bundled in vendor/fonts so the tablet never fetches anything from outside. */
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('../vendor/fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('../vendor/fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600 700; font-display: swap; src: url('../vendor/fonts/poppins-700.woff2') format('woff2'); }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: swap; src: url('../vendor/fonts/oswald-700.woff2') format('woff2'); }

:root {
  --red: #cd0000;
  --red-dark: #a30000;
  --black: #000000;
  --ink: #111111;
  --muted: #555a63;
  --line: #d2d4d7;
  --bg: #e6e7e8;
  --card: #ffffff;
  --warn-bg: #fff6e0;
  --warn-line: #e8b339;
  --err: #cd0000;
  --ok: #1f7a46;
  --radius: 12px;
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  overscroll-behavior: none;           /* no pull-to-refresh wiping the form */
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1 { font: 700 2rem/1.15 var(--font-head); letter-spacing: .01em; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 .6rem; }
.lead { color: var(--muted); margin: 0 0 1.2rem; }
.req { color: var(--red); font-weight: 700; }

/* Screens */
#app { min-height: 100%; }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--black); color: #fff; padding: 12px 20px;
  border-bottom: 3px solid var(--red);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: .02em; flex: 1; min-width: 0; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Logo #1 as supplied: never stretched or recoloured; the black bar gives it its clear space. */
.brand-logo { height: 40px; width: auto; flex: none; display: block; }
.brand-divider { width: 1px; height: 28px; background: #555; flex: none; }
.brand-mark { width: 32px; height: 32px; flex: none; display: block; }
.bar-tag { font-size: .85rem; background: #2a2a2a; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.page { padding: 24px 20px 120px; width: 100%; margin: 0 auto; flex: 1; }
.narrow { max-width: 820px; }
.center { flex: 1; display: grid; place-items: center; padding: 24px; }

/* Home */
.home { padding: 32px 20px; max-width: 1100px; margin: 0 auto; width: 100%; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.card {
  text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 22px; cursor: pointer; font: inherit; color: inherit; min-height: 150px;
  display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, transform .1s;
}
.card:hover, .card:focus-visible { border-color: var(--red); outline: none; }
.card:active { transform: scale(.98); }
.card strong { font-size: 1.25rem; }
.card span { color: var(--muted); }
.card em { margin-top: auto; color: var(--red); font-style: normal; font-weight: 600; }
.fineprint { color: var(--muted); font-size: .9rem; max-width: 70ch; }
.home-cards { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.big-card { min-height: 220px; padding: 28px; border-top: 6px solid var(--red); }
.big-card strong { font: 700 1.9rem/1.15 var(--font-head); text-transform: uppercase; letter-spacing: .02em; }

/* Bad Beat Jackpot */
.bbj { max-width: 1100px; display: flex; flex-direction: column; gap: 18px; }
.bbj.narrow { max-width: 820px; }
.bbj h1 { margin: 0; }
.bbj .lead { margin: 0; }
.bbj-demo { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 10px 16px; font-size: .92rem; }
.bbj-error { background: #fff5f5; border: 1px solid #efb7bd; border-radius: var(--radius); padding: 12px 16px; }
.bbj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.bbj-grid .field select { max-width: none; }
.bbj-search .help { color: var(--muted); font-size: .88rem; margin: 0 0 12px; }
.bbj-search > .btn { margin-bottom: 14px; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-weight: 600; border: 0; background: #fff; padding: 10px 22px; min-height: 48px; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.bbj-summary { margin: 0; }
.bbj-empty { color: var(--muted); }
.bbj-results { display: flex; flex-direction: column; gap: 16px; }
.jackpot { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.jackpot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; background: #f4f4f5; border-bottom: 1px solid var(--line); }
.bbj-summary-card .jackpot-head { background: none; border: 0; padding: 0 0 8px; }
.jackpot-meta { color: var(--muted); font-size: .9rem; margin-left: auto; }
.cat { font-weight: 700; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: #fff; padding: 3px 10px; border-radius: 99px; }
.cat-plo { background: var(--black); }
.cat-holdem { background: var(--red); }
.winner { display: grid; grid-template-columns: 110px minmax(0, 1.4fr) 120px minmax(0, 1.6fr) 96px; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid #eceef0; }
.jackpot-head + .winner, .jackpot > .winner:first-child { border-top: 0; }
.winner .pos { color: var(--muted); font-size: .9rem; }
.winner.with-jackpot { grid-template-columns: 200px minmax(0, 1.4fr) 120px minmax(0, 1.6fr) 96px; }
.winner > .btn { justify-self: stretch; }
.winner .amt { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.winner.is-paid .amt { color: var(--muted); }
.linklike { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 6px 0; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; }
.chip { display: inline-block; font-size: .85rem; font-weight: 600; padding: 4px 10px; border-radius: 8px; justify-self: start; }
.chip.unpaid { background: #fdeaea; color: var(--red-dark); }
.chip.paid { background: #e7f4ec; color: var(--ok); }
@media (max-width: 760px) {
  .winner, .winner.with-jackpot { grid-template-columns: 1fr auto; }
  .winner .pos { grid-column: 1 / -1; }
  .winner .amt { text-align: left; }
}
.bbj-amount { font: 700 2.4rem/1.1 var(--font-head); margin: 4px 0 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.check-field .check-label { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check-field input[type="checkbox"] { width: 28px; height: 28px; min-height: 0; flex: none; margin: 0; accent-color: var(--red); }
.sig-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 14px; }
.sig-pair figure { margin: 0; }
.sig-img { width: 100%; max-height: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }
.sig-pair figcaption { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.table-wrap { overflow-x: auto; margin: 8px 0; }
.import-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.import-table th, .import-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #eceef0; vertical-align: top; }
.import-table th { background: #f4f4f5; }
.import-table tr.bad td { background: #fff5f5; }
.import-table tr.dup td { color: var(--muted); }
.import-table tr.warn td:last-child { color: #8a5a00; }

/* Fields */
.fields { display: flex; flex-direction: column; gap: 22px; }
.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 6px; }
.section > h2 { font: 700 1.15rem/1.3 var(--font-head); text-transform: uppercase; letter-spacing: .04em; color: var(--red); }
.section-note { color: var(--muted); font-size: .9rem; margin: -6px 0 12px; }
.section.internal { background: #f7f7f9; border-style: dashed; }
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .88rem; margin: -2px 0 6px; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px; min-height: 52px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.field select { max-width: 240px; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink); outline: none; }
.field.invalid input, .field.invalid textarea, .field.invalid select, .field.invalid .sig-box { border-color: var(--err); background: #fff5f5; }
/* Info bubbles (wire form): an (i) next to the label opens the field's explanation */
.label-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.label-row .label, .label-row label { margin-bottom: 0; }
.info-btn {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--red); background: #fff;
  color: var(--red); font: 700 italic 1rem/1 Georgia, serif; cursor: pointer; padding: 0;
}
.info-btn[aria-expanded="true"] { background: var(--red); color: #fff; }
.info-bubble {
  position: relative; background: #fff7f7; border: 1px solid #f0b5b5; border-left: 4px solid var(--red);
  border-radius: 8px; padding: 10px 14px; margin: 0 0 10px; font-size: .92rem; white-space: pre-line;
}
.field .hint { color: var(--err); font-size: .9rem; margin-top: 4px; min-height: 0; }
.field.readonly .value { padding: 10px 14px; background: #f1f2f4; border-radius: 10px; min-height: 46px; }
.fields.big .field input, .fields.big .field textarea { font-size: 1.2rem; min-height: 60px; }
.fields.big .field label { font-size: 1.08rem; }
.notice { background: #f1f2f4; border-left: 4px solid var(--red); padding: 12px 14px; border-radius: 6px; margin: 0 0 16px; font-size: .95rem; }

/* Signature */
.sig-box { position: relative; border: 2px solid var(--line); border-radius: 10px; background: #fff; height: 170px; touch-action: none; }
.fields.big .sig-box { height: 200px; }
.sig-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.sig-box .sig-line { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1.5px solid #9aa0ab; pointer-events: none; }
.sig-box .sig-x { position: absolute; left: 24px; bottom: 44px; color: #9aa0ab; font-size: 1.3rem; pointer-events: none; }
.sig-box .sig-hint { position: absolute; right: 16px; bottom: 12px; color: #9aa0ab; font-size: .85rem; pointer-events: none; }
.sig-tools { display: flex; gap: 8px; margin-top: 8px; }

/* Image (void cheque) */
.img-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.img-preview { max-width: 100%; max-height: 220px; border: 1px solid var(--line); border-radius: 8px; display: block; margin-bottom: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Buttons */
.btn {
  font: inherit; font-weight: 700; border-radius: 10px; padding: 12px 20px; min-height: 52px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:active { background: var(--red-dark); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost.danger { color: var(--err); border-color: #efb7bd; }
.btn.ghost-light { background: transparent; color: #fff; border-color: #555; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.btn.big { min-height: 60px; padding: 14px 28px; font-size: 1.1rem; }
.btn:disabled { opacity: .5; }
.actions {
  position: sticky; bottom: 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line); z-index: 5;
}
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

/* Handback / printed */
.handback { background: var(--card); border-radius: 18px; padding: 36px; text-align: center; max-width: 560px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.handback hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.check { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 40px; line-height: 72px; margin: 0 auto 14px; }
.printer { font-size: 54px; margin-bottom: 8px; }

/* Review */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 20px; flex: 1; align-items: start; }
.review-left { min-width: 0; padding-bottom: 100px; }
.review-right { position: sticky; top: 76px; max-height: calc(100dvh - 170px); display: flex; flex-direction: column; min-width: 0; }
.preview-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.preview { overflow: auto; background: #d6d9de; border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.preview canvas { width: 100%; height: auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); display: block; }
@media (max-width: 980px) {
  .review { grid-template-columns: 1fr; }
  .review-right { position: static; max-height: none; }
}
.warnings { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.warnings h2 { font-size: 1rem; margin-bottom: 6px; }
.warnings ul { margin: 0; padding-left: 20px; }
.warnings li { margin: 4px 0; }
.warnings a { color: inherit; }
.warnings.clean { background: #eaf6ef; border-color: #9fd2b3; }

/* Dialogs & overlays */
.dialog { border: 0; border-radius: 18px; padding: 28px; max-width: 440px; width: calc(100% - 32px); }
.dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.dialog-row { margin-top: 14px; }
.dialog-wide { max-width: 620px; }
.email-preview { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0; font-size: .92rem; }
.email-preview dt { font-weight: 700; color: var(--muted); }
.email-preview dd { margin: 0; overflow-wrap: anywhere; }
.email-body { white-space: pre-wrap; font: inherit; font-size: .95rem; background: #f4f4f5; border-radius: 8px; padding: 12px 14px; margin: 0; }
.reminder-status {
  white-space: pre-wrap; text-align: left; background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; font-size: .95rem; overflow-wrap: anywhere;
}
.pin { text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 10px 0 18px; min-height: 18px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots span.on { background: var(--ink); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.pin-pad button { font: inherit; font-size: 1.5rem; min-height: 64px; border-radius: 12px; border: 1px solid var(--line); background: #f7f7f9; }
.pin-pad button:active { background: #e4e6ea; }
.pin-error { color: var(--err); min-height: 1.4em; margin: 0 0 8px; }
.pin-sub { color: var(--muted); margin: -4px 0 8px; }
.pin-dots.digits { font: 700 1.9rem/1 var(--font); letter-spacing: .12em; min-height: 34px; align-items: center; font-variant-numeric: tabular-nums; }
.pin-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pin-actions .btn { flex: 1 1 120px; }
.bbj-who { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.field input[readonly] { background: #f1f2f4; border-color: transparent; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; }
#busy { color: #fff; text-align: center; align-content: center; gap: 12px; }
.spinner { width: 52px; height: 52px; border: 5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #111; color: #fff; padding: 12px 20px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px); }

/* Printing: only the rendered pages */
#print-root { display: none; }
@media print {
  /* Printers can't print the outer ~0.2in of a sheet. Full-bleed pages lost whatever sat
     there (the Luxon form's IMPORTANT note is 0.15in from the bottom), so each page is
     scaled to fit inside a 0.25in margin instead (about 94% size). */
  @page { size: letter; margin: 0.25in; }
  html, body { background: #fff; height: auto; margin: 0; }
  #app, dialog, .overlay, .toast { display: none !important; }
  #print-root { display: block; }
  #print-root .print-page {
    width: 8in; height: 10.45in; overflow: hidden; break-after: page; page-break-after: always;
    display: flex; align-items: center; justify-content: center;
  }
  #print-root .print-page:last-child { break-after: auto; page-break-after: auto; }
  #print-root img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
}
.bbj-photo-note { background: #fff7f7; border: 1px solid #f0b5b5; border-left: 4px solid var(--red); margin: 6px 0 14px; }
