/* Stub · one stylesheet, no framework, no web fonts (fast on slow mobile data). */
:root {
  color-scheme: dark;
  --bg: #0f0f11;
  --surface: #17171a;
  --surface-2: #202024;
  --line: #2c2c32;
  --text: #f4f2ee;
  --muted: #a3a3ab;
  --accent: #f5b83d;
  --accent-ink: #1b1303;
  --ok: #2fbf71;
  --bad: #ef5350;
  --warn: #f2a33a;
  --paper: #fbfaf6;
  --ink: #141414;
  --ink-muted: #6b6a66;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Sinhala", "Nirmala UI", "Iskoola Pota", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r-ctl: 12px;
  --r-panel: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--font); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
html[lang="si"] body { line-height: 1.75; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
html[lang="si"] h1 { letter-spacing: 0; line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 650; }
a { color: inherit; }
img, svg, video, canvas { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); letter-spacing: .08em; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 28px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.center { text-align: center; }

/* layout */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; max-width: 1040px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.01em; text-decoration: none; font-size: 1.125rem; }
.brand svg { color: var(--accent); }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 16px 64px; }
.wrap-wide { width: 100%; max-width: 1040px; margin: 0 auto; padding: 8px 16px 80px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--r-ctl); background: var(--accent); color: var(--accent-ink); font: 650 1rem/1 var(--font); text-decoration: none; cursor: pointer; transition: transform .12s var(--ease), background .15s, border-color .15s; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: #ffc653; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: #5a2a2a; }
.btn-danger:hover { background: #2a1717; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn-icon { min-width: 44px; min-height: 44px; padding: 0; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lang { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: 600 .85rem var(--font); cursor: pointer; }
.lang:hover { color: var(--text); }

.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; }
.err { color: var(--bad); font-size: .9rem; }
input, textarea, select { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px 14px; font: inherit; font-size: 16px; min-height: 48px; }
textarea { min-height: 110px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #70707a; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #f5b83d33; }
input[aria-invalid="true"] { border-color: var(--bad); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge-ok { color: var(--ok); border-color: #1f4d36; background: #12261c; }
.badge-bad { color: var(--bad); border-color: #5a2a2a; background: #2a1717; }
.badge-warn { color: var(--warn); border-color: #5a4220; background: #2a2012; }
.badge-accent { color: var(--accent); border-color: #5a4a20; background: #2a2412; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .6s var(--ease); }
.banner { padding: 12px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); font-size: .92rem; }
.banner-bad { border-color: #5a2a2a; background: #2a1717; }
.banner-warn { border-color: #5a4220; background: #2a2012; }
.banner-ok { border-color: #1f4d36; background: #12261c; }

.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-ctl); min-height: 20px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* toasts + dialog */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 420px); }
.toast { background: #26262b; border: 1px solid var(--line); padding: 12px 16px; border-radius: var(--r-ctl); box-shadow: 0 8px 30px #0008; animation: toast-in .25s var(--ease); }
.toast-bad { border-color: #6a2f2f; } .toast-ok { border-color: #1f5d3f; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px; width: min(92vw, 460px); max-height: 88dvh; overflow: auto; }
dialog::backdrop { background: #000a; backdrop-filter: blur(2px); }
dialog[open] { animation: dlg-in .22s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 560px) { dialog { margin: auto auto 0; width: 100%; max-width: none; border-radius: var(--r-panel) var(--r-panel) 0 0; } }

/* landing */
.hero { padding: 28px 0 8px; display: grid; gap: 18px; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 36ch; }
.points { display: grid; gap: 12px; padding: 0; margin: 8px 0 0; list-style: none; }
.points li { display: flex; gap: 12px; align-items: flex-start; }
.points svg { flex: none; color: var(--accent); margin-top: 3px; }

/* event page */
.poster { width: 100%; aspect-ratio: 4 / 5; max-height: 70vh; object-fit: cover; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); }
.facts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.facts li { display: flex; gap: 12px; align-items: flex-start; }
.facts svg { flex: none; color: var(--accent); margin-top: 3px; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; color: #d8d6d0; }
.going { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); margin-bottom: 8px; }

/* ticket */
.ticket { width: 100%; max-width: 380px; margin: 0 auto; color: var(--ink); filter: drop-shadow(0 18px 40px #0009); }
.ticket-main, .ticket-stub { background: var(--paper); position: relative; }
.ticket-main { border-radius: 24px 24px 0 0; padding: 22px 22px 22px; border-top: 6px solid var(--accent);
  -webkit-mask: radial-gradient(circle 13px at 0 100%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 13px at 100% 100%, #0000 97%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 13px at 0 100%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 13px at 100% 100%, #0000 97%, #000) right / 51% 100% no-repeat; }
.ticket-stub { border-radius: 0 0 24px 24px; padding: 24px 22px 20px; text-align: center;
  -webkit-mask: radial-gradient(circle 13px at 0 0, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 13px at 100% 0, #0000 97%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 13px at 0 0, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 13px at 100% 0, #0000 97%, #000) right / 51% 100% no-repeat; }
.ticket-stub::before { content: ""; position: absolute; top: -1px; left: 20px; right: 20px; border-top: 2px dashed #c9c6bd; }
.ticket h2 { font-size: 1.55rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
html[lang="si"] .ticket h2 { letter-spacing: 0; line-height: 1.35; }
.ticket dl { display: grid; gap: 12px; margin: 18px 0 0; }
.ticket dt { font-size: .75rem; color: var(--ink-muted); font-weight: 600; }
.ticket dd { margin: 2px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.qr { width: min(240px, 70%); margin: 0 auto; display: block; border-radius: 10px; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.ticket-code { margin-top: 12px; font: 700 1.25rem var(--mono); letter-spacing: .22em; color: var(--ink); }
.ticket-note { margin-top: 4px; color: var(--ink-muted); font-size: .82rem; }
.ticket.is-void .qr, .ticket.is-void .ticket-code { opacity: .15; filter: grayscale(1); }
.stamp { position: absolute; inset: auto 0 36% 0; margin: auto; width: fit-content; transform: rotate(-12deg); border: 3px solid var(--bad); color: var(--bad); padding: 6px 16px; border-radius: 8px; font-weight: 900; font-size: 1.4rem; background: #fbfaf6e6; letter-spacing: .04em; }
.stamp-ok { border-color: #1b8a52; color: #1b8a52; }
.ticket.reveal { animation: ticket-in .6s var(--ease) both; }
.ticket.reveal .qr { animation: qr-print .8s .5s steps(16, end) both; }
@keyframes ticket-in { from { opacity: 0; transform: translateY(-30px) rotate(-1.4deg); } to { opacity: 1; transform: none; } }
@keyframes qr-print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.actions { display: grid; gap: 10px; max-width: 380px; margin: 22px auto 0; }
.actions .row { flex-wrap: nowrap; }
.actions .row > * { flex: 1; }

/* admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.tab { background: none; border: 0; color: var(--muted); padding: 12px 14px; font: 650 .95rem var(--font); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.9rem; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; background: var(--surface); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .meta { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.event-link { display: block; text-decoration: none; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); transition: border-color .15s, transform .15s var(--ease); }
.event-link:hover { border-color: #4a4a52; }
.qrbox { background: #fff; padding: 10px; border-radius: 14px; width: 176px; }
.qrbox svg { display: block; width: 100%; height: auto; }
.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox input { font-family: var(--mono); font-size: .85rem; }
.poster-thumb { width: 120px; aspect-ratio: 4/5; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }

/* gate scanner */
.gate { display: grid; gap: 14px; }
.viewfinder { position: relative; aspect-ratio: 1; border-radius: var(--r-panel); overflow: hidden; background: #000; border: 1px solid var(--line); }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder::after { content: ""; position: absolute; inset: 14%; border-radius: 18px; border: 3px solid #ffffffcc; clip-path: polygon(0 0, 22% 0, 22% 3px, 3px 3px, 3px 22%, 0 22%, 0 0, 100% 0, 100% 22%, calc(100% - 3px) 22%, calc(100% - 3px) 3px, 78% 3px, 78% 0, 100% 100%, 78% 100%, 78% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 78%, 100% 78%, 100% 100%, 0 100%, 0 78%, 3px 78%, 3px calc(100% - 3px), 22% calc(100% - 3px), 22% 100%, 0 100%); pointer-events: none; }
.viewfinder .idle { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 12px; padding: 24px; }
.counter { font: 800 1.6rem var(--font); font-variant-numeric: tabular-nums; }
.verdict { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; text-align: center; gap: 14px; padding: 28px; color: #fff; animation: verdict-in .18s var(--ease); }
.verdict-ok { background: #138a4e; } .verdict-bad { background: #c23b38; } .verdict-warn { background: #b77a12; }
.verdict .big { font-size: clamp(2rem, 9vw, 3.2rem); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.verdict .mark { width: 88px; height: 88px; margin: 0 auto; }
.verdict .sub { font-size: 1.15rem; opacity: .92; }
@keyframes verdict-in { from { opacity: 0; transform: scale(1.04); } }

@media (min-width: 860px) {
  .wrap { max-width: 880px; }
  .event-grid { display: grid; grid-template-columns: 340px 1fr; gap: 36px; align-items: start; }
  .event-grid .poster { position: sticky; top: 16px; }
  .item { grid-template-columns: minmax(0, 1fr) 120px 110px auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
@media print { body { background: #fff; color: #000; } .top, .actions, .toasts { display: none !important; } }
.boot-skel { height: 240px; }
.wrapnarrow { max-width: 420px; margin: 0 auto; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.item > .row { flex-wrap: nowrap; justify-content: flex-end; }
@media (max-width: 859px) { .item > .row { flex-wrap: wrap; } }
