
/* Layout: drawn tickets left (newest on top), prize board + current draw centre, tickets still in the pool right. */
:root {
  --bg: #eef2f7; --panel: #ffffff; --panel2: #e3e9f2; --ink: #14223a; --muted: #55657f; --line: #cdd7e4;
  --now: #0b8a80; --now-ink: #ffffff; --now-soft: #d6f3ef;
  --gold: #b9780a; --gold-bg: #fff0c4; --gold-line: #e0a21f; --gold-ink: #5b3a00;
  --danger: #b3261e;
  --font-display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1626; --panel: #13233a; --panel2: #1b2f4c; --ink: #e9f0fa; --muted: #93a6c2; --line: #28405f;
    --now: #3fe0cf; --now-ink: #04211e; --now-soft: #12383a;
    --gold: #ffc542; --gold-bg: #3b2e08; --gold-line: #f2b632; --gold-ink: #ffdf8a;
    --danger: #ff8a80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1626; --panel: #13233a; --panel2: #1b2f4c; --ink: #e9f0fa; --muted: #93a6c2; --line: #28405f;
  --now: #3fe0cf; --now-ink: #04211e; --now-soft: #12383a;
  --gold: #ffc542; --gold-bg: #3b2e08; --gold-line: #f2b632; --gold-ink: #ffdf8a;
  --danger: #ff8a80; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.4; padding-inline: 16px; padding-block: 12px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--now); outline-offset: 2px; }

.app { display: grid; gap: 14px; grid-template-rows: auto minmax(0, 1fr); min-height: 100%; }
.top { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: end; justify-content: space-between; }
.top h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); text-transform: uppercase; line-height: 1; }
.top .sub { color: var(--muted); margin-top: 4px; }
.top .sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.finder { position: relative; width: min(100%, 320px); }
.finder input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.finder .hits { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); padding: 4px; }
.finder .hit { display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 6px; }
.finder .hit:nth-child(odd) { background: var(--panel2); }
.finder .hit small { color: var(--muted); white-space: nowrap; }
.finder .hit .in { color: var(--now); font-weight: 600; }

.cols { display: grid; gap: 14px; grid-template-columns: 1fr; min-height: 0; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.col > header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.col > header h2 { font-size: 1.4rem; text-transform: uppercase; }
.col > header span { color: var(--muted); font-size: .9rem; }
.scroll { overflow: auto; padding: 10px 12px 14px; min-height: 0; }
.col.left .scroll { max-height: 70vh; }
.col.right .scroll { max-height: 70vh; }
.col.mid { background: transparent; border: 0; gap: 14px; }
@media (min-width: 1000px) {
  .app { height: 100%; }
  .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr); }
  .col.left .scroll, .col.right .scroll { max-height: none; }
  .col.left, .col.right { height: 100%; }
  .col.mid { overflow: auto; }
  .cols > .col { min-height: 0; }
}
@media (max-width: 999px) { .col.mid { order: -1; } .col.left { order: 0; } .col.right { order: 1; } }

/* Drawn list */
.drawn { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 3.4rem 4rem minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 2px solid transparent; }
.row .d { color: var(--muted); font-size: .8rem; line-height: 1.1; }
.row .d b { display: block; font-size: 1.1rem; color: var(--ink); font-family: var(--font-display); }
.row .t { font-size: 2rem; font-weight: 700; line-height: 1; text-align: center; }
.row .n { overflow-wrap: anywhere; font-weight: 500; }
.row .n small { display: block; color: var(--muted); font-weight: 400; }
.chip { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; padding: 3px 10px; border-radius: 999px; background: var(--gold-line); color: #2b1b00; white-space: nowrap; }
.row.prize { background: var(--gold-bg); border-color: var(--gold-line); }
.row.prize .t { color: var(--gold); }
.row.current { border-color: var(--now); background: var(--now-soft); }
.row.current .t { color: var(--now); }
.row.current.prize { border-color: var(--gold-line); background: var(--gold-bg); }
.tag { display: block; width: max-content; font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; font-size: .8rem; padding: 1px 7px; border-radius: 4px; background: var(--now); color: var(--now-ink); margin-bottom: 2px; }
.row.fresh { animation: slide .5s ease-out, ring 1.8s ease-out 2; }
@keyframes slide { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 var(--now); } 100% { box-shadow: 0 0 0 14px transparent; } }
.empty { color: var(--muted); padding: 18px 6px; text-align: center; }

/* Prize board */
.board { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; }
.board h2 { font-size: 1.4rem; text-transform: uppercase; margin-bottom: 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.slot { border: 2px dashed var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.slot .p { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; line-height: 1; }
.slot .w { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.slot .big { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; margin-top: 4px; }
.slot .who { overflow-wrap: anywhere; font-weight: 500; }
.slot.won { border: 2px solid var(--gold-line); background: var(--gold-bg); }
.slot.won .p, .slot.won .big { color: var(--gold); }
.slot.won .w { color: var(--gold-ink); }
.next { margin-top: 10px; color: var(--muted); }
.next b { color: var(--ink); }

/* Now drawn */
.now { border: 3px solid var(--now); background: var(--now-soft); border-radius: 14px; padding: 14px 16px 16px; text-align: center; }
.now.prize { border-color: var(--gold-line); background: var(--gold-bg); }
.now .lab { font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--now); }
.now.prize .lab { color: var(--gold); }
.now .tn { font-family: var(--font-display); font-weight: 700; font-size: clamp(5rem, 14vw, 9rem); line-height: .95; color: var(--now); font-variant-numeric: tabular-nums; }
.now.prize .tn { color: var(--gold); }
.now .nm { font-size: 1.6rem; font-weight: 600; overflow-wrap: anywhere; }
.now .meta { color: var(--muted); margin-top: 4px; }
.now .win { display: inline-block; margin-top: 8px; font-family: var(--font-display); font-weight: 700; font-size: 2rem; padding: 2px 18px; border-radius: 999px; background: var(--gold-line); color: #2b1b00; }
.now.fresh { animation: slide .5s ease-out; }
.bar { height: 10px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: var(--now); }

/* Pool */
.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.9rem, 1fr)); gap: 5px; }
.tile { text-align: center; padding: 6px 0; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); font-size: 1.15rem; line-height: 1.1; font-weight: 700; }
.tile.share { background: var(--gold-line); color: #2b1b00; border-color: var(--gold-line); }
.op .hint { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--gold-bg); color: var(--gold-ink); border: 1px solid var(--gold-line); }
.tile.hl { background: var(--now); color: var(--now-ink); border-color: var(--now); }

/* Operator */
.op { background: var(--panel); border: 2px solid var(--now); border-radius: 12px; padding: 12px 14px 14px; }
.op h2 { font-size: 1.4rem; text-transform: uppercase; }
.op form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.op label { display: block; width: 100%; color: var(--muted); font-size: .9rem; }
.op input { flex: 1 1 8rem; min-width: 0; font: 700 2rem var(--font-display); padding: 4px 12px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.btn { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--now); color: var(--now-ink); border-color: var(--now); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.warn { border-color: var(--danger); color: var(--danger); }
.op .msg { min-height: 2.6em; margin-top: 8px; }
.op .msg.bad { color: var(--danger); }
.op .msg.ok b { color: var(--now); }
.op .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rec { font-size: .85rem; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: reduce) { .row.fresh, .now.fresh { animation: none; } }

/* Self-hosted additions */
.live { display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--now); display: inline-block; }
.live.off i { background: var(--danger); }
.op .acts a.btn { text-decoration: none; display: inline-block; }
.op .login { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.op details { margin-top: 10px; }
.op summary { cursor: pointer; font-weight: 600; }
.hist { max-height: 14rem; overflow: auto; margin-top: 6px; font-size: .9rem; }
.hist table { border-collapse: collapse; width: 100%; }
.hist td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.hist td.k-undo, .hist td.k-unsplit { color: var(--danger); }
.op .tiny { font-size: .8rem; color: var(--muted); margin-top: 8px; }
