:root {
  --bg: #e7e2d4;
  --ink: #1a1914;
  --muted: #5c574c;
  --card: #fbf7ee;
  --line: #d4cdb8;
  --flash: #dff25a;
  --flash-ink: #16180c;
  --danger: #8d2b22;
  --focus: #1a1914;
  --shadow: 0 18px 50px rgba(40, 36, 20, 0.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10110e;
    --ink: #f3efe4;
    --muted: #b1ab9b;
    --card: #1a1b16;
    --line: #313228;
    --flash: #dff25a;
    --flash-ink: #16180c;
    --danger: #ffb0a4;
    --focus: #fff8dc;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, color-mix(in srgb, var(--flash) 42%, transparent), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -0.04em; line-height: 1.05; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; letter-spacing: -0.02em; }
h3 { font-size: 1rem; overflow-wrap: anywhere; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-150%);
  background: var(--flash);
  color: var(--flash-ink);
  padding: 8px 12px;
  border-radius: 999px;
  z-index: 5;
}
.skip:focus { transform: none; }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px 20px 48px; }
header { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 14px; }
.logo {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  text-decoration: none;
  line-height: 1;
}
.logo span { box-shadow: inset 0 -0.38em 0 var(--flash); }
.tag { color: var(--muted); margin-top: 8px; max-width: 38ch; }
.stat { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.banner, .status { min-height: 1.4em; margin: 6px 0; }
.banner, .status.bad { color: var(--danger); }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
#form { display: flex; gap: 12px; align-items: end; padding: 16px; }
.fields { display: grid; grid-template-columns: 1fr 200px; gap: 12px; flex: 1; }
label {
  display: grid;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
input {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
  width: 100%;
}
input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.btn {
  background: var(--ink);
  color: var(--flash);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 12px 18px;
  min-height: 48px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .btn { background: var(--flash); color: var(--flash-ink); border-color: var(--flash); }
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); filter: none; }
.hero {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 1fr 176px;
  gap: 18px;
  padding: 14px 18px;
  align-items: center;
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  background: var(--flash);
  color: var(--flash-ink);
  display: inline-block;
  padding: 6px 12px 8px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.sub, .note, footer p, .meta { color: var(--muted); }
.sub { margin: 6px 0 16px; overflow-wrap: anywhere; }
.meta { margin: 0 0 16px; font-variant-numeric: tabular-nums; }
#hero-sub {
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note { margin-top: 12px; font-size: 0.9rem; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-hit {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 18px;
  width: 176px;
  justify-self: end;
}
.qr-hit:hover .qr-frame { outline: 2px solid var(--ink); outline-offset: 3px; }
.qr-frame, #qr-big {
  background: #fff;
  border-radius: 16px;
  padding: 10px;
}
.qr-frame { width: 176px; height: 176px; }
.qr-frame svg, #qr-big svg { width: 100%; height: auto; display: block; }
#qr-big { width: min(78vw, 360px); }
.lib-head { margin: 14px 0 8px; }
.empty { padding: 22px; display: grid; gap: 14px; justify-items: start; }
.list { display: grid; gap: 10px; }
.ticket {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.plate {
  background: var(--flash);
  color: var(--flash-ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  min-height: 72px;
  display: grid;
  place-items: center;
}
.tbody { padding: 12px 14px; min-width: 0; }
.tbody .sub { margin: 4px 0 0; }
.ticket .acts { padding-right: 12px; }
#leave { padding-top: 8px; max-width: 680px; }
.gate { padding: 22px; margin: 8px 0 18px; }
#leave-host { box-shadow: inset 0 -0.28em 0 var(--flash); width: fit-content; max-width: 100%; }
.leave-url {
  margin: 14px 0 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92rem;
  color: var(--ink);
}
#leave-hint { margin-top: 12px; }
footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
footer p { max-width: 62ch; font-size: 0.92rem; }
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  padding: 18px;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog form { margin-top: 12px; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .wrap { padding: 20px 16px 48px; }
  header, footer, #form { flex-direction: column; align-items: stretch; }
  .fields, .hero { grid-template-columns: 1fr; }
  .ticket { grid-template-columns: 92px 1fr; }
  .ticket .acts { grid-column: 1 / -1; grid-row: 2; }
  .stat { white-space: normal; }
  .qr-hit, .qr-frame { width: 168px; }
  .qr-frame { height: 168px; }
  .qr-hit { justify-self: start; }
  .ticket .acts { padding: 0 12px 12px; }
  .plate { min-height: 52px; }
  .hero .acts { display: grid; grid-template-columns: 1fr 1fr; }
  .hero .acts .btn:first-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
