:root {
  --bg: #07090b;
  --panel: #101316;
  --panel-edge: #23282d;
  --face-top: linear-gradient(#383e45, #292e34);
  --face-bot: linear-gradient(#22272c, #181b1f);
  --amber: #ffcf3f;
  --amber-dim: #a98a2c;
  --white: #f3efe4;
  --text: #e8e6df;
  --muted: #8d9399;
  --danger: #ff6b5b;
  --font: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -200px, #1a2027 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── top bar ───────────────────────────────────────── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--panel-edge);
  background: #0a0c0f;
}
.brand { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.brand h1 {
  margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.9rem); letter-spacing: .28em;
  text-transform: uppercase; color: var(--amber); font-weight: 700; line-height: 1.1;
}
.brand p { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plane { width: 2.1rem; height: 2.1rem; fill: var(--amber); transform: rotate(45deg); flex: none; }
.tools { display: flex; align-items: center; gap: .6rem; }
.clock {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--amber);
  font-size: clamp(1.2rem, 2.4vw, 1.8rem); letter-spacing: .08em; margin-right: .6rem;
}
.icon-btn {
  width: 2.4rem; height: 2.4rem; display: grid; place-items: center; padding: 0;
  background: transparent; color: var(--text); border: 1px solid var(--panel-edge); border-radius: 8px; cursor: pointer;
}
.icon-btn svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.icon-btn:hover { border-color: var(--amber-dim); color: var(--amber); }
.icon-btn[aria-pressed="false"] { color: var(--muted); }
.icon-btn[aria-pressed="false"] .wave { display: none; }

main { padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) 3rem; max-width: 1500px; margin: 0 auto; }

/* ── buttons ───────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem;
  padding: .75rem 1.1rem; border-radius: 8px; cursor: pointer; border: 1px solid var(--panel-edge);
  background: #171b1f; color: var(--text);
}
.btn:hover:not(:disabled) { border-color: var(--amber-dim); color: var(--amber); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.go { background: var(--amber); color: #15120a; border-color: var(--amber); }
.btn.go:hover:not(:disabled) { background: #ffdb6b; color: #15120a; }
.btn.big { font-size: clamp(1.1rem, 2.2vw, 1.6rem); padding: 1rem 2.4rem; border-radius: 12px; letter-spacing: .1em; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ── check-in ticket ───────────────────────────────── */
.ticket {
  max-width: 760px; margin: 1rem auto 0; padding: clamp(1.2rem, 3vw, 2.2rem);
  background: linear-gradient(#14181c, #0f1215);
  border: 1px solid var(--panel-edge); border-radius: 16px;
  box-shadow: 0 30px 60px -30px #000;
  position: relative;
}
.ticket::before, .ticket::after { /* ticket notches */
  content: ""; position: absolute; top: 5.3rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--bg);
  border: 1px solid var(--panel-edge);
}
.ticket::before { left: -.75rem; clip-path: inset(0 0 0 50%); }
.ticket::after { right: -.75rem; clip-path: inset(0 50% 0 0); }
.kicker { margin: 0; color: var(--amber); text-transform: uppercase; letter-spacing: .25em; font-size: .78rem; font-weight: 700; }
.ticket h2 { margin: .3rem 0 .5rem; font-size: clamp(1.5rem, 3.4vw, 2.2rem); line-height: 1.15; }
.lede { color: var(--muted); margin: 0 0 1.2rem; max-width: 60ch; }
code { background: #1b2025; padding: .1em .4em; border-radius: 4px; font-size: .9em; color: var(--text); }
.field { display: block; margin-bottom: .8rem; }
.field > span { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: .35rem; font-weight: 700; }
.field em { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field.narrow { max-width: 22rem; margin-top: 1rem; }
textarea, input[type="text"] {
  width: 100%; font: inherit; color: var(--white); background: #0a0c0f;
  border: 1px solid var(--panel-edge); border-radius: 10px; padding: .8rem 1rem;
}
textarea { font-size: 1rem; resize: vertical; min-height: 10rem; line-height: 1.5; }
textarea:focus, input[type="text"]:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 207, 63, .2); }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.status { margin: .7rem 0 0; min-height: 1.4em; color: var(--muted); font-size: .92rem; }
.status b { color: var(--amber); }
.status.warn { color: var(--danger); }
.btn.go:not(.big) { margin-top: 1.4rem; width: 100%; padding: 1rem; font-size: 1rem; }
.privacy { margin: 1rem 0 0; color: var(--muted); font-size: .82rem; text-align: center; }

/* ── panels & boards ───────────────────────────────── */
.panel {
  background: linear-gradient(#13171b, #0c0e11);
  border: 1px solid var(--panel-edge); border-radius: 16px;
  padding: clamp(.8rem, 2vw, 1.4rem);
  box-shadow: inset 0 0 0 5px #0a0c0f, inset 0 0 0 6px #1b2025, 0 30px 60px -35px #000;
}
.meta {
  display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .9rem .5rem;
  text-transform: uppercase; letter-spacing: .24em; font-size: .78rem; font-weight: 700; color: var(--amber-dim);
}
.meta.foot { padding: .7rem .9rem .2rem; letter-spacing: .12em; color: var(--muted); }
.meta.foot #gate { color: var(--amber-dim); }

.board { container-type: inline-size; padding: .4rem .6rem; }
.board .row {
  display: flex; justify-content: center; align-items: stretch; gap: .07em;
  font-size: min(var(--maxfs, 5rem), calc(100cqw / var(--cols) / .83));
  margin-bottom: .14em;
}
.board .gap { width: .6em; flex: none; }
#mainBoard { --maxfs: 5.6rem; }
#history  { --maxfs: 2.1rem; }
.history .row { margin-bottom: .1em; }
.history .labels { color: var(--muted); }
.history .labels .lbl { flex: none; display: flex; align-items: flex-end; color: var(--amber-dim); }
.history .labels small { font-size: .3em; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; padding-bottom: .4em; }

.progress { height: 4px; margin: .7rem .9rem 0; background: #1b2025; border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .6s ease; }

.controls { display: flex; flex-direction: column; align-items: center; gap: .9rem; margin: 1.6rem 0; }
.secondary { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.hint { margin: 0; color: var(--muted); font-size: .85rem; }
kbd { border: 1px solid var(--panel-edge); border-bottom-width: 2px; border-radius: 4px; padding: .05em .45em; font-size: .9em; background: #14181c; }

/* ── the split-flap itself ─────────────────────────── */
.flap {
  position: relative; flex: none; width: .74em; height: 1.1em;
  perspective: 7em; color: var(--amber);
  font-weight: 700; line-height: 1; user-select: none; border-radius: .07em; box-shadow: 0 .02em .05em rgba(0,0,0,.7);
}
.flap.w { color: var(--white); }
.flap .half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; backface-visibility: hidden; }
.flap .up { top: 0; border-radius: .07em .07em 0 0; background: var(--face-top); }
.flap .dn { bottom: 0; border-radius: 0 0 .07em .07em; background: var(--face-bot); }
.flap .half b {
  position: absolute; left: 0; right: 0; height: 200%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .92em; font-family: var(--font);
}
.flap .up b { top: 0; }
.flap .dn b { bottom: 0; }
.flap .f-top, .flap .f-bot { display: none; }
.flap .f-top { transform-origin: 50% 100%; z-index: 3; }
.flap .f-bot { transform-origin: 50% 0; z-index: 3; }
.flap::after { /* the hinge */
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: max(2px, .035em); margin-top: calc(max(2px, .035em) / -2);
  background: #000; z-index: 5; box-shadow: 0 1px 0 rgba(255, 255, 255, .05);
}
.flap::before { /* axle pins */
  content: ""; position: absolute; top: 50%; left: -.02em; right: -.02em; height: .1em; margin-top: -.05em; z-index: 6;
  background:
    radial-gradient(circle at .05em 50%, #000 0 .035em, transparent .04em),
    radial-gradient(circle at calc(100% - .05em) 50%, #000 0 .035em, transparent .04em);
}

/* ── drag & drop overlay ───────────────────────────── */
.drop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(7, 9, 11, .88); backdrop-filter: blur(4px);
}
.drop > div {
  display: grid; gap: .4rem; text-align: center; padding: 3rem 4rem;
  border: 3px dashed var(--amber); border-radius: 24px; color: var(--amber); font-size: 1.6rem;
}
.drop span { color: var(--muted); font-size: 1rem; }

@media (max-width: 640px) {
  .clock { display: none; }
  .ticket::before, .ticket::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .progress i { transition: none; }
}
:fullscreen body, body:fullscreen { background: var(--bg); }
