/* Raffle Card — player app
   The printed kiosk raffle card: chrome-yellow card stock on market green,
   white picture tiles, red ink stamps. The one loud moment is the draw. */

:root {
  --green: #0A5C3E;
  --green-deep: #07402B;
  --card: #FFC93C;
  --card-edge: #D9A21F;
  --ink: #15212E;
  --paper: #FFFFFF;
  --stamp: #C8102E;
  --muted: #5B6673;
  --on-green: #F3F7F4;
  --on-green-soft: #BFD8CB;

  --display: "Alfa Slab One", "Rockwell", "Roboto Slab", Georgia, serif;
  --body: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --radius-card: 16px;
  --radius-tile: 6px;
  --radius-control: 10px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--green);
  color: var(--on-green);
  font: 400 1rem/1.55 var(--body);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

img { max-width: 100%; display: block; }

/* Rules like "img { display: block }" and ".form label { display: block }"
   would otherwise beat the browser's own [hidden] and show hidden elements. */
[hidden] { display: none !important; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--card);
  outline-offset: 2px;
}

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--card); color: var(--ink); padding: .5rem 1rem; z-index: 50;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(.7rem + env(safe-area-inset-top, 0)) 1rem .7rem;
  background: var(--green-deep);
  border-bottom: 3px solid var(--card);
  /* Own compositor layer + don't act as a scroll anchor: keeps the sticky bar
     from shimmering as the page repaints beneath it. */
  transform: translateZ(0);
  overflow-anchor: none;
}

.brand {
  font-family: var(--display);
  font-size: clamp(1.05rem, 5vw, 1.35rem);
  color: var(--card);
  text-decoration: none;
  letter-spacing: .01em;
}

.topnav { display: flex; align-items: center; gap: .5rem; }

.topnav a, .topnav button {
  font: 700 .9rem/1 var(--body);
  color: var(--on-green);
  text-decoration: none;
  background: none; border: 0; cursor: pointer;
  padding: .55rem .7rem; border-radius: 999px;
  white-space: nowrap;
  /* Hover changes only colour, never size or position, so nothing can reflow
     and re-trigger the hover — which is what made the bar jitter. */
  transition: background-color .15s ease, color .15s ease, filter .15s ease;
}
.topnav a:hover, .topnav button:hover { background: rgba(255, 255, 255, .12); }
.topnav .balance:hover { background: var(--card); filter: brightness(1.05); }

.topnav .balance {
  background: var(--card); color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ layout */

main { display: block; padding: 1.25rem 1rem 4rem; outline: none; }

.page { max-width: 44rem; margin: 0 auto; }
.page-wide { max-width: 60rem; margin: 0 auto; }
/* A card page is as wide as its card needs: about 84px a tile, never cramped
   for the text above it, never wider than the screen. */
.card-page { max-width: min(60rem, max(36rem, calc(var(--cols, 8) * 84px + 2rem))); }

.loading, .empty { color: var(--on-green-soft); text-align: center; padding: 3rem 1rem; }

.back {
  display: inline-block; margin-bottom: 1rem;
  color: var(--on-green-soft); font-weight: 600; text-decoration: none;
}
.back:hover { color: var(--on-green); }

h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.1; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.9rem, 6vw, 3rem); color: var(--paper); }
h2 { font-size: 1.4rem; }

.lede { color: var(--on-green-soft); max-width: 34rem; margin: 0 0 1.75rem; font-size: 1.05rem; }

/* ------------------------------------------------------------------ home */

.intro { margin: .5rem 0 2rem; }
.intro h1 { max-width: 16ch; }

.tickets { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }

/* A card in the list looks like the physical card's stub: yellow stock with
   punched notches down the left edge. */
.ticket {
  position: relative;
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: center;
  padding: 1rem 1.1rem 1rem 1.4rem;
  background: var(--card); color: var(--ink);
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--card-edge);
  -webkit-mask: radial-gradient(circle at 0 50%, transparent .55rem, #000 .6rem) left / 100% 1.6rem repeat-y;
          mask: radial-gradient(circle at 0 50%, transparent .55rem, #000 .6rem) left / 100% 1.6rem repeat-y;
}
.ticket:hover { transform: translateY(-1px); }
.ticket:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--card-edge); }

.ticket-prize {
  width: 5.5rem; height: 5.5rem; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--ink);
  display: grid; place-items: center; overflow: hidden;
}
.ticket-prize img { width: 86%; height: 86%; object-fit: contain; }

.ticket-title { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 0; }
.ticket-prize-name { font-family: var(--display); font-size: 1.3rem; line-height: 1.15; margin: .1rem 0 .35rem; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .9rem; font-weight: 600; }
.ticket-when { color: var(--stamp); }

.meter { height: .45rem; background: rgba(21, 33, 46, .18); border-radius: 999px; margin: .5rem 0 .3rem; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }

/* ------------------------------------------------------------- card page */

.card-head { display: grid; gap: .25rem; margin-bottom: 1rem; }
.card-head h1 { margin: 0; }
@media (min-width: 40rem) {
  .card-head { grid-template-columns: 1fr auto; align-items: baseline; gap: 1.5rem; }
}
.card-price { font-weight: 700; font-size: 1.05rem; margin: 0; }
.card-price strong { font-family: var(--display); font-weight: 400; font-size: 1.5rem; color: var(--card); }

.status {
  margin: 0 0 1rem; padding: .85rem 1rem;
  border-radius: var(--radius-control);
  background: var(--green-deep);
  border-left: 5px solid var(--card);
  font-weight: 600;
}
.status strong { font-family: var(--display); font-weight: 400; font-size: 1.2rem; display: block; color: var(--paper); }
.status.is-live { border-left-color: var(--stamp); }
.status.is-won { background: var(--card); color: var(--ink); border-left-color: var(--ink); }
.status.is-won strong { color: var(--ink); }

/* The card itself — the hero of the whole product. */
.board {
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: var(--radius-card);
  padding: .7rem;
  box-shadow: 0 6px 0 var(--green-deep);
}

.board-label {
  display: flex; justify-content: space-between; gap: 1rem;
  color: var(--ink); font-weight: 800; font-size: .85rem;
  padding: 0 .2rem .55rem;
}

.board-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.grid {
  --gap: 4px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(var(--min-tile, 34px), 1fr));
  gap: var(--gap);
  min-width: calc(var(--cols) * var(--min-tile, 34px) + (var(--cols) - 1) * var(--gap));
}

.tile {
  position: relative;
  aspect-ratio: 1;
  padding: 3px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-tile);
  cursor: pointer;
  container-type: inline-size;
  transition: transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tile img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.img-fallback {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 2px;
  font: 700 clamp(.5rem, 22cqi, .8rem)/1.05 var(--body);
  color: var(--ink); text-align: center; word-break: break-word;
}
.tile:not([disabled]):hover { transform: scale(1.06); z-index: 2; }
.tile[disabled] { cursor: default; }

/* Stamps. Words when the tile is big enough to read them, a mark otherwise. */
.tile::after {
  content: "";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
  font: 800 .78rem/1 var(--body);
}

.tile.is-taken img { opacity: .38; filter: grayscale(1); }
.tile.is-taken::after {
  background:
    linear-gradient(45deg, transparent 46%, var(--stamp) 46% 54%, transparent 54%);
  opacity: .8;
}

.tile.is-held img { opacity: .5; }
.tile.is-held::after {
  background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(200, 16, 46, .18) 5px 8px);
}

.tile.is-mine {
  background: #E6F4EC;
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px var(--green);
}
.tile.is-mine::after {
  content: "✓";
  inset: auto 2px 2px auto;
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  background: var(--green); color: var(--paper);
  font-size: .7rem;
}

@container (min-width: 56px) {
  .tile.is-taken::after {
    content: "Taken";
    background: none;
    color: var(--stamp);
    border: 2px solid var(--stamp);
    border-radius: 4px;
    inset: 32% 6%;
    transform: rotate(-14deg);
    opacity: .9;
  }
  .tile.is-mine::after {
    content: "Yours";
    width: auto; height: auto;
    inset: 5% 18% auto 18%;
    border-radius: 3px;
    padding: .15rem 0;
    font-size: .68rem;
  }
}

/* The prize panel in the middle, with the winning picture on its back. */
.prize {
  grid-column: var(--pc) / span var(--pw);
  grid-row: var(--pr) / span var(--ph);
  perspective: 1200px;
  min-height: 0;
}

.prize-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.2, .9, .25, 1.15);
}
.prize.is-flipped .prize-inner { transform: rotateY(180deg); }

.prize-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; padding: 6%;
  text-align: center;
  overflow: hidden;
}
.prize-face img { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: contain; }
.prize-title { font-family: var(--display); font-size: clamp(.8rem, 2.6vw, 1.25rem); line-height: 1.1; }
.prize-worth { font-size: clamp(.65rem, 1.8vw, .85rem); font-weight: 700; color: var(--muted); }

.prize-back {
  transform: rotateY(180deg);
  background: var(--ink);
  color: var(--card);
  border-color: var(--card);
}
.prize-back .prize-title { color: var(--card); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prize-back .prize-worth { color: var(--on-green-soft); }
.prize-back img { background: var(--paper); border-radius: 8px; padding: 4%; }

/* ------------------------------------------------------------------- draw */

.tile.is-idle { opacity: .28; }

.tile.is-out img { opacity: .25; filter: grayscale(1); }
.tile.is-out::after {
  content: "✕";
  color: var(--stamp);
  font: 400 clamp(1rem, 70cqi, 2.6rem)/1 var(--display);
  animation: thump .32s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: var(--delay, 0ms);
}
.tile.is-out.no-anim::after { animation: none; }

@keyframes thump {
  from { transform: scale(2.4) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(-8deg); opacity: 1; }
}

/* The winner rises out of the card: it grows, lifts and glows while the rest
   of the board dims behind it. */
.tile.is-winner {
  z-index: 6;
  border-color: var(--ink);
  transform: scale(2.1);
  transition: transform .75s cubic-bezier(.15, 1.5, .4, 1);
  box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--ink), 0 14px 30px rgba(0, 0, 0, .45);
  animation: glow 1.6s ease-in-out 2 .75s;
}
.tile.is-winner img { opacity: 1 !important; filter: none !important; }
.tile.is-winner::after { content: none !important; }

@keyframes glow {
  50% { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--ink), 0 0 34px 14px rgba(255, 201, 60, .95); }
}

/* While the draw runs the board tightens up: nothing else competes for
   attention, and swapping tiles lift off the card. */
.board.is-drawing { box-shadow: 0 6px 0 var(--green-deep), 0 0 0 4px rgba(200, 16, 46, .55); }
.board.is-drawing .tile { will-change: transform; }
.board.is-decided .tile:not(.is-winner) { opacity: .55; transition: opacity .6s ease; }
.board.is-decided .tile.is-out { opacity: .3; }

/* ------------------------------------------------------------- below card */

.below { display: grid; gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 46rem) { .below { grid-template-columns: 1fr 1fr; } }

.panel {
  background: var(--green-deep);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.panel h2 { color: var(--paper); font-size: 1.15rem; }
.panel p { margin: .25rem 0 .75rem; color: var(--on-green-soft); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.chips li {
  display: flex; align-items: center; gap: .35rem;
  background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: .2rem .6rem .2rem .25rem;
  font-weight: 700; font-size: .85rem;
}
.chips img { width: 1.6rem; height: 1.6rem; }

/* ------------------------------------------------------------------ forms */

.form { max-width: 24rem; margin: 0 auto; }
.form label { display: block; font-weight: 700; margin: 1rem 0 .35rem; }
.form input {
  width: 100%; padding: .8rem .9rem;
  font: 400 1rem/1.2 var(--body);
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--paper); border-radius: var(--radius-control);
}
.form input:focus { outline: none; border-color: var(--card); }
.form .error { color: #FFD6DC; font-weight: 600; margin: .35rem 0 0; font-size: .9rem; }
.form .switch { margin-top: 1.25rem; color: var(--on-green-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%;
  margin-top: 1.25rem;
  padding: .95rem 1.2rem;
  font: 800 1.05rem/1 var(--body);
  color: var(--ink); background: var(--card);
  border: 0; border-radius: var(--radius-control);
  box-shadow: 0 3px 0 var(--card-edge);
  cursor: pointer; text-decoration: none;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--card-edge); }
.btn[disabled] { opacity: .6; cursor: wait; }

.btn-ink { background: var(--ink); color: var(--card); box-shadow: 0 3px 0 #000; }

.btn-plain {
  background: none; box-shadow: none; color: var(--muted);
  font-weight: 700; margin-top: .5rem;
}

.link-btn { background: none; border: 0; padding: 0; color: var(--card); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ----------------------------------------------------------------- wallet */

.balance-big {
  background: var(--card); color: var(--ink);
  border-radius: var(--radius-card);
  padding: 1.25rem 1.3rem;
  margin-bottom: 1rem;
}
.balance-big p { margin: 0; font-weight: 700; }
.balance-big .amount { font-family: var(--display); font-size: clamp(2.2rem, 9vw, 3.2rem); line-height: 1.1; font-variant-numeric: tabular-nums; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.rows li:last-child { border-bottom: 0; }
.rows .sub { display: block; font-size: .85rem; color: var(--on-green-soft); }
.rows .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .amt.plus { color: var(--card); }
.rows a { text-decoration: none; }

/* --------------------------------------------------------------- fairness */

.proof dt { font-weight: 700; margin-top: .9rem; }
.proof dd {
  margin: .2rem 0 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82rem;
  word-break: break-all;
  color: var(--on-green-soft);
}
.checks { list-style: none; padding: 0; margin: 1rem 0 0; }
.checks li { padding: .45rem 0; font-weight: 600; }
.checks .ok::before { content: "✓ "; color: var(--card); }
.checks .bad::before { content: "✕ "; color: #FF8A9A; }
.checks .unknown::before { content: "? "; color: var(--on-green-soft); }

/* ---------------------------------------------------------- pick sheet */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(21, 33, 46, .6);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 28rem;
  background: var(--paper); color: var(--ink);
  border-radius: 20px 20px 0 0;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0));
  animation: rise .22s ease-out;
}
@media (min-width: 40rem) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

.sheet-pic {
  width: 8rem; height: 8rem; margin: 0 auto .75rem;
  border: 3px solid var(--ink); border-radius: 14px; padding: .5rem;
}
.sheet h2 { text-align: center; color: var(--ink); }
.sheet .rows li { border-bottom-color: #E4E7EA; }
.sheet .rows .sub { color: var(--muted); }
.sheet .note { color: var(--muted); font-size: .9rem; text-align: center; margin: .75rem 0 0; }
.sheet .error { color: var(--stamp); font-weight: 700; text-align: center; margin: .75rem 0 0; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0)); z-index: 60;
  transform: translate(-50%, 1rem);
  opacity: 0; visibility: hidden;
  max-width: calc(100% - 2rem);
  background: var(--ink); color: var(--paper);
  padding: .8rem 1.1rem; border-radius: 12px;
  font-weight: 700;
  transition: transform .25s ease, opacity .25s ease, visibility .25s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

.noscript { background: var(--card); color: var(--ink); padding: 1rem; text-align: center; }

/* -------------------------------------------------------------- sharing */

.btn-share { background: var(--card); color: var(--ink); box-shadow: 0 3px 0 var(--card-edge); margin-top: .75rem; }
.btn-share:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--card-edge); }

.share-row { margin-top: 1rem; }
.share-row[hidden] { display: none; }
.reveal-toggle { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; color: var(--on-green-soft); font-size: .92rem; font-weight: 600; cursor: pointer; }
.reveal-toggle input { width: auto; }

/* win status: the share button sits full width under the message */
.status.is-won .btn-share { width: 100%; }

/* ------------------------------------------------------- wallet: money forms */

.gap { margin-top: 1rem; }
.hint { color: var(--on-green-soft); font-size: .92rem; margin: .5rem 0; }
.minor { font: 700 1rem/1.3 var(--body); color: var(--paper); margin: 1.5rem 0 .25rem; }

.form select, .form textarea {
  width: 100%; padding: .8rem .9rem;
  font: 400 1rem/1.3 var(--body);
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--paper); border-radius: var(--radius-control);
}
.form select:focus, .form textarea:focus { outline: none; border-color: var(--card); }
.form-inline { max-width: none; margin: 0; }
.form-inline h1 { display: none; }
.form-wide { max-width: 34rem; margin: 0; }

.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip-btn {
  font: 700 .95rem/1 var(--body);
  padding: .55rem .8rem; border-radius: 999px;
  background: var(--green); color: var(--paper);
  border: 1.5px solid var(--on-green-soft); cursor: pointer;
}
.chip-btn:hover { border-color: var(--card); color: var(--card); }

.resolved { font-weight: 800; color: var(--card); min-height: 1.4em; margin: .5rem 0 0; }
.btn-quiet { background: transparent; color: var(--card); box-shadow: inset 0 0 0 2px var(--card); }
.links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1rem 0 0; }
.check { display: flex !important; align-items: center; gap: .5rem; font-weight: 600 !important; }
.check input { width: auto; }

/* ----------------------------------------------------------------- admin */

.admin h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 1rem 0; }

.tabs { display: flex; gap: .25rem; overflow-x: auto; margin: 0 -1rem; padding: 0 1rem .25rem; }
.tabs a {
  flex: none; padding: .55rem .85rem; border-radius: 999px;
  color: var(--on-green-soft); font-weight: 700; text-decoration: none; font-size: .92rem;
}
.tabs a.is-active { background: var(--card); color: var(--ink); }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .75rem; }
.toolbar .filters { margin: 0; }
.filters a {
  padding: .35rem .7rem; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .88rem;
  color: var(--on-green-soft); border: 1.5px solid rgba(255, 255, 255, .18);
}
.filters a.is-active { border-color: var(--card); color: var(--card); }

.btn-small { width: auto; margin: 0; padding: .6rem .95rem; font-size: .92rem; }
.btn-danger { background: var(--stamp); color: var(--paper); box-shadow: 0 3px 0 #8a0b20; }
.btn-plain.btn-small { color: var(--on-green-soft); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; }
.stat {
  display: flex; flex-direction: column; gap: .2rem;
  padding: 1rem; border-radius: 12px;
  background: var(--green-deep); text-decoration: none;
}
.stat-value { font-family: var(--display); font-size: 1.5rem; line-height: 1.1; color: var(--paper); }
.stat-label { color: var(--on-green-soft); font-weight: 600; font-size: .9rem; }
.panel.is-stuck { background: #7a1022; }
.panel.is-stuck h2 { color: #FFD6DC; }
.panel.is-stuck p { color: #FFE3E8; }

.stat.is-hot { background: var(--card); }
.stat.is-hot .stat-value, .stat.is-hot .stat-label { color: var(--ink); }

.big-number { font-family: var(--display); font-size: 1.6rem; line-height: 1.15; color: var(--paper); margin: .1rem 0 .4rem; }
.notice { background: var(--card); color: var(--ink); padding: .75rem 1rem; border-radius: var(--radius-control); font-weight: 700; }

.tag {
  display: inline-block; vertical-align: middle;
  padding: .12rem .5rem; border-radius: 999px;
  font: 700 .75rem/1.4 var(--body);
  background: rgba(255, 255, 255, .14); color: var(--paper);
}
.tag-open, .tag-paid, .tag-success, .tag-delivered { background: var(--card); color: var(--ink); }
.tag-drawing, .tag-locked, .tag-processing { background: var(--paper); color: var(--ink); }
.tag-rejected, .tag-failed, .tag-voided, .tag-cancelled { background: #7a1022; color: #FFD6DC; }

.admin-rows li { align-items: center; }
.admin-rows a { display: block; font-weight: 700; }
.admin-rows .btn { margin-top: .4rem; }

.ask { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; width: 100%; margin-top: .75rem; }
.ask label { width: 100%; font-weight: 700; }
.ask input { flex: 1 1 14rem; padding: .65rem .8rem; font: inherit; border: 2px solid var(--paper); border-radius: var(--radius-control); color: var(--ink); }
.ask .error { width: 100%; margin: 0; color: #FFD6DC; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

.card-summary { display: grid; gap: 1rem; grid-template-columns: 7rem 1fr; align-items: start; }
.summary-prize { width: 7rem; height: 7rem; object-fit: contain; background: var(--paper); border-radius: 14px; border: 3px solid var(--ink); padding: .4rem; }

.economics { background: var(--green-deep); border-radius: var(--radius-control); padding: .6rem .9rem; margin-top: .75rem; }
.economics:empty { display: none; }
.economics p { margin: .15rem 0; font-weight: 600; }
.economics.is-bad { background: #7a1022; color: #FFD6DC; }
.upload-preview { max-width: 10rem; max-height: 10rem; margin-top: .6rem; background: var(--paper); border-radius: 10px; padding: .3rem; }

.wd-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.wd { background: var(--green-deep); border-radius: 12px; padding: 1rem 1.1rem; }
.wd-main p { margin: 0 0 .2rem; }
.sub-inline { color: var(--on-green-soft); font-size: .88rem; }
.bank { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: .75rem 0 0; }
.bank dt { color: var(--on-green-soft); font-size: .88rem; }
.bank dd { margin: 0; font-weight: 700; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.copy { font: 700 .75rem/1 var(--body); padding: .25rem .5rem; border-radius: 6px; border: 1px solid var(--on-green-soft); background: none; color: var(--on-green); cursor: pointer; }

.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search input { flex: 1; padding: .65rem .85rem; font: inherit; border: 2px solid var(--paper); border-radius: var(--radius-control); color: var(--ink); }
.compact label { margin-top: .6rem; }
.compact > * + * { margin-top: .5rem; }


/* --------------------------------------------------------------- polish */

/* A faint printed texture on the page, like card stock under ink. */
body {
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255, 201, 60, .07), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(255, 255, 255, .05), transparent 40%);
  background-attachment: fixed;
}

.brand { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.brand::before { content: "🎟️"; font-size: 1.1em; }

/* Home: the headline reads as printed poster lettering. */
.intro h1 { text-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.intro h1 em { font-style: normal; color: var(--card); }

.ticket { transition: transform .15s ease, box-shadow .15s ease; }
.ticket:hover { box-shadow: 0 5px 0 var(--card-edge); }
.ticket-prize { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .9); }

/* A starburst behind the prize, the way prize posters are printed. */
.prize-front {
  background:
    repeating-conic-gradient(from 0deg at 50% 45%, rgba(255, 201, 60, .22) 0deg 9deg, transparent 9deg 18deg),
    var(--paper);
}

.board { position: relative; }
.board::after {
  content: "";
  position: absolute; inset: .35rem;
  border: 2px dashed rgba(21, 33, 46, .35);
  border-radius: calc(var(--radius-card) - 6px);
  pointer-events: none;
}

.tile { transition: transform .12s ease, box-shadow .12s ease; }
.tile:not([disabled]):hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }

/* Buttons feel pressable: a printed edge that sinks when tapped. */
.btn { transition: transform .08s ease, box-shadow .08s ease, filter .15s ease; }
.btn:hover { filter: brightness(1.04); }

.status { box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.status.is-won { animation: won-pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes won-pop { from { transform: scale(.94); opacity: 0; } }

.balance-big { box-shadow: 0 3px 0 var(--card-edge); }
.panel { border: 1px solid rgba(255, 255, 255, .06); }
.meter > span { transition: width .6s ease; }


/* ------------------------------------------------------------ home hero */

.section-title { color: var(--paper); font-size: 1.3rem; margin: 2rem 0 .8rem; }

/* The featured card: the prize, big, on yellow stock — the thing a new player
   should see first. */
.hero {
  display: grid; gap: 1.1rem; align-items: center;
  grid-template-columns: 1fr;
  padding: 1.2rem;
  background: var(--card); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 20px;
  box-shadow: 0 7px 0 var(--green-deep);
  text-decoration: none;
  position: relative; overflow: hidden;
  transition: transform .15s ease;
}
.hero:hover { transform: translateY(-2px); }
.hero:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--green-deep); }
@media (min-width: 40rem) { .hero { grid-template-columns: 15rem 1fr; padding: 1.5rem; } }

.hero-prize {
  aspect-ratio: 1; width: 100%; max-width: 15rem; margin: 0 auto;
  display: grid; place-items: center;
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 201, 60, .35) 0deg 9deg, transparent 9deg 18deg),
    var(--paper);
  border: 3px solid var(--ink); border-radius: 50%;
  box-shadow: inset 0 0 0 5px var(--paper);
}
.hero-prize img { width: 72%; height: 72%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .18)); }

.hero-kicker {
  display: inline-block; margin: 0 0 .4rem;
  padding: .25rem .65rem; border-radius: 999px;
  background: var(--ink); color: var(--card);
  font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.hero.is-live .hero-kicker { background: var(--stamp); color: var(--paper); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(200, 16, 46, .25); } }

.hero-title { font-family: var(--display); font-size: clamp(1.7rem, 7vw, 2.6rem); line-height: 1.05; margin: 0 0 .35rem; color: var(--ink); }
.hero-meta { margin: 0 0 .6rem; font-weight: 700; color: var(--muted); }
.meter-lg { height: .7rem; margin: .5rem 0 .35rem; }
.hero-count { margin: 0; font-weight: 700; }
.hero-cta { margin-top: 1rem; background: var(--ink); color: var(--card); box-shadow: 0 3px 0 #000; }
@media (min-width: 40rem) { .hero-cta { width: auto; } }

/* ------------------------------------------------------------ skeletons */

.sk {
  border-radius: 12px; margin-bottom: 1rem;
  background: linear-gradient(90deg, rgba(255,255,255,.07) 25%, rgba(255,255,255,.16) 37%, rgba(255,255,255,.07) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
.sk-title { height: 2.6rem; width: 70%; }
.sk-line { height: 1rem; width: 90%; }
.sk-hero { height: 17rem; border-radius: 20px; }
.sk-ticket { height: 7rem; }
.sk-status { height: 4.5rem; }
.sk-board { aspect-ratio: 4 / 5; border-radius: 16px; max-width: 42rem; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ------------------------------------------------------------ connection */

.offline {
  position: fixed; top: calc(4rem + env(safe-area-inset-top, 0)); left: 50%; z-index: 70;
  transform: translateX(-50%);
  background: var(--stamp); color: var(--paper);
  padding: .5rem 1rem; border-radius: 999px;
  font-weight: 700; font-size: .9rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}

/* ------------------------------------------------------ small phones */

/* Budget Android phones are often 360px wide or less. The top bar must fit
   without the page sliding sideways. */
.topbar { gap: .5rem; }
.brand { min-width: 0; }
.brand-text { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) {
  .topbar { padding-left: .75rem; padding-right: .75rem; }
  .topnav { gap: .1rem; }
  .topnav a, .topnav button { padding: .5rem .5rem; font-size: .85rem; }
}
@media (max-width: 370px) {
  .brand-text { display: none; }      /* the ticket icon alone is the home link */
}

/* --------------------------------------------------- verify-email banner */

.verify-banner {
  background: var(--card); color: var(--ink);
  padding: .7rem 1rem;
  text-align: center; font-weight: 600; font-size: .95rem;
  display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap;
}
.verify-banner .link-btn { color: var(--ink); text-decoration: underline; font-weight: 800; }

/* ----------------------------------------------------------- recent winners */

.winners { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.winner-row {
  display: flex; align-items: center; gap: .8rem;
  background: var(--green-deep); border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px; padding: .7rem .8rem;
}
.winner-pic { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
  background: var(--paper); display: grid; place-items: center; }
.winner-pic img { width: 100%; height: 100%; object-fit: contain; }
.winner-body { flex: 1 1 auto; min-width: 0; }
.winner-prize { margin: 0; font-weight: 800; color: var(--card); }
.winner-meta { margin: .1rem 0 0; font-size: .85rem; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.winner-line { margin: .25rem 0 0; font-size: .9rem; color: var(--on-green); }
.winner-check { flex: 0 0 auto; font-size: .82rem; font-weight: 700; color: var(--card);
  border: 1px solid var(--card); border-radius: 999px; padding: .35rem .7rem; text-decoration: none; }
.winner-check:hover { background: var(--card); color: var(--ink); }

/* ------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .tile:not([disabled]):hover { transform: none; }
  /* No shuffling, no rising — the winner is simply marked. */
  .tile.is-winner { transform: none; box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--ink); }
  .sk { animation: none; }
  .hero.is-live .hero-kicker { animation: none; }
}
