:root {
  --bg: #0b0b0d;
  --panel: #17171b;
  --panel-2: #1f1f25;
  --line: rgba(255, 255, 255, .13);
  --txt: #f6f2ea;
  --dim: rgba(246, 242, 234, .74);
  --red: #e3101c;
  --red-hi: #ff3a45;
  --cream: #f7f0e3;
  --ink: #17130f;
  --ok: #46c06f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 95% 46% at 50% 0%, rgba(227, 16, 28, .42), transparent 72%) no-repeat, var(--bg);
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(28px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.wrap { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
a { color: var(--txt); }
h1, h2, p { margin: 0; }

.top { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 4px; }
.top .brand { height: 62px; width: auto; }
.top .x { color: var(--dim); font-size: 20px; }
.top .cola { height: 54px; width: 54px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }

.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
h1 { font-size: clamp(34px, 10.4vw, 54px); font-weight: 900; line-height: .98; letter-spacing: -.02em; text-transform: uppercase; margin: 6px 0 12px; text-wrap: balance; }
h1 .n { display: block; font-size: 2.1em; line-height: .86; color: #fff; text-shadow: 0 0 34px rgba(255, 58, 69, .75), 0 3px 0 var(--red); }
.lead { color: var(--dim); max-width: 30ch; }
.bottle { height: clamp(210px, 60vw, 290px); width: auto; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .6)); transform: rotate(6deg); margin-right: 2px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.panel h2 { font-size: 22px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; margin: 4px 0 8px; }
.panel p + p { margin-top: 8px; }
.when { font-size: 18px; font-weight: 700; }
.result { font-size: 20px; font-weight: 800; line-height: 1.25; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); text-wrap: balance; }
.count { color: var(--dim); }

form { display: flex; flex-direction: column; gap: 12px; }
label.field { font-size: 14px; font-weight: 700; display: flex; flex-direction: column; gap: 6px; }
input[type="email"], input[type="password"] {
  width: 100%; min-height: 50px; padding: 12px 14px; font: inherit; font-size: 17px; color: var(--txt);
  background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 12px; outline: none;
}
input[type="email"]:focus, input[type="password"]:focus { border-color: #fff; }
input.invalid { border-color: var(--red-hi); }
.consent { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 14px; color: var(--dim); cursor: pointer; }
.consent input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--red); }
.consent input.invalid { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.ts { min-height: 65px; }
.ts:empty { display: none; }
.btn {
  appearance: none; border: 0; border-radius: 14px; min-height: 54px; padding: 14px 20px; width: 100%;
  background: var(--red); color: #fff; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; box-shadow: 0 10px 26px rgba(227, 16, 28, .38); transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--red-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); box-shadow: none; }
.err { color: #ff8088; font-size: 14px; font-weight: 600; min-height: 0; }
.err:empty { display: none; }
.note { color: var(--dim); font-size: 14px; text-align: center; }
.pips { display: flex; justify-content: center; gap: 8px; }
.pips i { width: 30px; height: 6px; border-radius: 3px; background: var(--line); }
.pips i.on { background: var(--red-hi); }

.play { display: flex; flex-direction: column; gap: 12px; }
.stage { position: relative; width: 100%; aspect-ratio: 1; max-width: 520px; margin: 0 auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; outline: none; scroll-margin-top: 10px; }
.stage.live { cursor: crosshair; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hint { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; color: #fff; pointer-events: none; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.score { display: grid; grid-template-columns: repeat(3, 1fr) 1.25fr; gap: 8px; }
.slot { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; }
.slot span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.slot strong { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.slot.total { background: var(--red); border-color: transparent; }
.slot.total span { color: rgba(255, 255, 255, .85); }
.msg { text-align: center; font-size: 17px; font-weight: 700; min-height: 1.5em; text-wrap: balance; }

.ticket { background: var(--cream); color: var(--ink); border-radius: 18px; overflow: hidden; box-shadow: 0 18px 40px rgba(0, 0, 0, .55); animation: pop .45s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.ticket + .ticket { margin-top: 14px; }
.ticket-head { background: var(--red); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.ticket-head b { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.ticket-head img { height: 40px; width: 40px; border-radius: 8px; }
.ticket-body { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 16px; align-items: center; }
.ticket-body h2 { font-size: 26px; font-weight: 900; line-height: 1.05; letter-spacing: -.01em; }
.ticket-body .sub { font-size: 14px; color: rgba(23, 19, 15, .72); margin-top: 4px; }
.ticket-body img { grid-row: span 2; height: 132px; width: auto; }
.code { grid-column: 1; margin-top: 10px; padding: 10px 12px; border: 2px dashed rgba(23, 19, 15, .45); border-radius: 12px; text-align: center; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 26px; font-weight: 800; letter-spacing: .08em; overflow-wrap: anywhere; }
.ticket-foot { border-top: 2px dashed rgba(23, 19, 15, .25); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.ticket-foot b { font-size: 16px; }
.wallet { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wallet a { display: inline-flex; }
.wallet img { height: 48px; width: auto; display: block; }

.how h2 { font-size: 13px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }
.how ol { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.how li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; color: var(--dim); }
.how li::before { content: counter(step); width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); color: #fff; font-weight: 800; display: grid; place-items: center; }
.how b { color: var(--txt); }

footer { border-top: 1px solid var(--line); padding-top: 16px; font-size: 13px; color: var(--dim); text-align: center; display: flex; flex-direction: column; gap: 6px; }

.doc { max-width: 720px; }
.doc h1 { font-size: clamp(24px, 6.4vw, 34px); text-transform: none; line-height: 1.12; margin: 10px 0 4px; }
.doc h2 { font-size: 17px; font-weight: 800; margin: 26px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.doc ol { margin: 0; padding-left: 1.35em; color: var(--dim); }
.doc ul { margin: 6px 0 0; padding-left: 1.2em; }
.doc li { margin: 0 0 8px; }
.doc b { color: var(--txt); }
.doc .todo { color: #ffc44d; font-weight: 700; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }

.admin { max-width: 980px; }
.admin h1 { font-size: 26px; text-transform: none; line-height: 1.15; }
.admin h2 { font-size: 18px; margin: 18px 0 8px; }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin th, .admin td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin th { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.admin .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.admin .stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.admin .stat b { display: block; font-size: 26px; }
.admin .stat span { font-size: 12px; color: var(--dim); }
.admin .flag { color: #ffc44d; }
.admin .scroll { overflow-x: auto; }
.admin .mini { min-height: 36px; width: auto; padding: 6px 12px; font-size: 13px; }
.admin .row { display: flex; flex-direction: row; gap: 10px; flex-wrap: wrap; }
.admin .row input { flex: 1 1 240px; }
.admin .row .btn { width: auto; }

@media (prefers-reduced-motion: reduce) { .hint, .ticket { animation: none; } }
