/* FairDrop Tickets — local drop rehearsal
   Matches the Real World Activated dark-green desk aesthetic:
   deep green-black canvas, hairline rules, serif display headings,
   monospace figures. Self-contained stylesheet. */

:root {
  --ink: #f2f7f1;
  --muted: #93a396;
  --muted-strong: #c3cfc4;
  --canvas: #060d09;
  --canvas-soft: #0a130d;
  --panel: #0d1912;
  --panel-raised: #122217;
  --line: rgba(196, 224, 200, 0.13);
  --line-strong: rgba(196, 224, 200, 0.27);
  --green: #00c805;
  --green-bright: #72ff78;
  --green-pale: #d7ffda;
  --green-dim: rgba(0, 200, 5, 0.12);
  --amber: #f2c94c;
  --amber-dim: rgba(242, 201, 76, 0.12);
  --danger: #ff6b72;
  --danger-dim: rgba(255, 107, 114, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 90% 40% at 85% -5%, rgba(0, 200, 5, 0.07), transparent),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; }
[hidden] { display: none !important; }
code { font-family: var(--mono); }

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

.skip-link {
  position: fixed; z-index: 1000; top: 12px; left: 12px;
  padding: 10px 14px;
  color: #061009;
  background: var(--green-bright);
  border-radius: var(--radius-sm);
  transform: translateY(-180%);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

:is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Top bar ─────────────────────────────────────────────── */
.top-bar {
  position: relative; z-index: 30;
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  align-items: center; justify-content: space-between;
  width: min(1160px, calc(100% - 48px));
  min-height: 78px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; letter-spacing: -0.02em; }
.wordmark svg { width: 32px; color: var(--green-bright); }
.wordmark span { font-size: 16px; font-weight: 520; white-space: nowrap; }
.wordmark b { font-weight: 800; }
.product-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.product-nav a {
  padding: 8px 12px;
  color: var(--muted-strong);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.product-nav a:hover { color: var(--ink); }
.product-nav a.is-active { color: var(--green-pale); background: var(--green-dim); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.mode-chip {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 8px 12px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.mode-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }

/* ── Scope banner ────────────────────────────────────────── */
.scope-banner {
  width: min(1160px, calc(100% - 48px));
  margin: 18px auto 0;
  padding: 12px 16px;
  color: var(--muted-strong);
  background: var(--amber-dim);
  border: 1px solid rgba(242, 201, 76, 0.3);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.55;
}
.scope-banner strong { color: var(--amber); }

/* ── Layout ──────────────────────────────────────────────── */
.drop-main {
  display: grid; gap: 26px;
  width: min(1160px, calc(100% - 48px));
  margin: 26px auto 60px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Masthead ────────────────────────────────────────────── */
.masthead {
  display: grid; gap: 26px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
  padding: 34px 0 8px;
}
.masthead h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(34px, 5.4vw, 56px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.015em;
}
.masthead h1 span { color: var(--green-bright); }
.masthead-summary {
  max-width: 56ch;
  margin: 0 0 20px;
  color: var(--muted-strong);
  font-size: 15.5px;
  line-height: 1.65;
}
.rail-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.rail-strip span {
  display: inline-flex; gap: 8px; align-items: baseline;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted-strong);
  white-space: nowrap;
}
.rail-strip i { color: var(--green); font-style: normal; font-family: var(--mono); font-size: 11px; }

.fairness-note {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.fairness-note h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
}
.fairness-note p { margin: 0 0 12px; color: var(--muted-strong); font-size: 13.5px; line-height: 1.6; }
.ok-text { color: var(--green-bright); }
.warn-text { color: var(--amber); }
.note-fineprint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.section-head {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  align-items: end; justify-content: space-between;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.section-note { max-width: 44ch; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.fictional-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  vertical-align: middle;
  color: var(--muted-strong);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Status grid ─────────────────────────────────────────── */
.status-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0;
}
.status-grid > div {
  padding: 14px 16px;
  background: var(--canvas-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.status-grid dt { color: var(--muted); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.status-grid dd { margin: 6px 0 0; font-family: var(--mono); font-size: 20px; font-weight: 600; }
.state-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.state-badge[data-tone="open"] { color: var(--green-pale); background: var(--green-dim); }
.state-badge[data-tone="done"] { color: var(--amber); background: var(--amber-dim); }

/* ── Forms ───────────────────────────────────────────────── */
.join-form, .resale-form {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: end;
}
.field { display: grid; gap: 6px; flex: 1 1 200px; min-width: 0; }
.field-qty { flex: 0 1 160px; }
.field-label { color: var(--muted-strong); font-size: 12.5px; font-weight: 600; }
.field input {
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--canvas-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.field input::placeholder { color: var(--muted); }
.field input:focus-visible { outline-offset: 0; }

.primary-button {
  display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  color: #061009;
  background: var(--green-bright);
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}
.primary-button:hover:not(:disabled) { background: var(--green-pale); }
.primary-button b { font-weight: 700; }
.ghost-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  color: var(--muted-strong);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-weight: 600;
}
.ghost-button:hover:not(:disabled) { color: var(--ink); border-color: var(--muted); }
.danger-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(255, 107, 114, 0.4);
  border-radius: 999px;
  font-weight: 600;
}
.danger-button:hover:not(:disabled) { background: var(--danger-dim); }

.inline-status { min-height: 1.2em; margin: 10px 0 0; font-size: 13px; line-height: 1.5; }
.inline-status[data-tone="ok"] { color: var(--green-bright); }
.inline-status[data-tone="bad"] { color: var(--danger); }
.inline-status[data-tone="info"] { color: var(--muted-strong); }

.queue-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ── Queue table ─────────────────────────────────────────── */
.table-wrap { margin-top: 16px; }
.queue-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.queue-table th {
  padding: 10px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.queue-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.queue-table td.num { font-family: var(--mono); color: var(--muted-strong); }
.queue-table .alias { font-weight: 600; overflow-wrap: anywhere; }
.queue-table .reason { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.source-tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.source-tag.is-you { color: var(--green-pale); border-color: rgba(114, 255, 120, 0.4); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-ok { color: var(--green-pale); background: var(--green-dim); }
.badge-wait { color: var(--amber); background: var(--amber-dim); }
.badge-bad { color: var(--danger); background: var(--danger-dim); }
.badge-queued { color: var(--muted-strong); background: rgba(196, 224, 200, 0.08); }

.empty-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.outcome-legend { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.outcome-legend summary { color: var(--muted-strong); font-size: 13px; font-weight: 600; cursor: pointer; }
.outcome-legend ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.outcome-legend li { color: var(--muted-strong); font-size: 13px; line-height: 1.55; }
.outcome-legend .badge { margin-right: 8px; }

/* ── Receipt ─────────────────────────────────────────────── */
.receipt-columns {
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: start;
}
.receipt-meta { display: grid; gap: 12px; margin: 0; }
.receipt-meta dt { color: var(--muted); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.receipt-meta dd { margin: 4px 0 0; font-size: 14px; }
.digest {
  display: block;
  padding: 10px 12px;
  background: var(--canvas-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.receipt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.receipt-json-wrap { margin-top: 16px; }
.receipt-json-wrap summary { color: var(--muted-strong); font-size: 13px; font-weight: 600; cursor: pointer; }
.receipt-json {
  max-height: 340px;
  margin: 10px 0 0;
  padding: 14px;
  overflow: auto;
  background: var(--canvas-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.checkin-card {
  padding: 18px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: center;
}
.checkin-card h3 { margin: 0 0 14px; font-family: var(--serif); font-size: 17px; font-weight: 500; }
.qr-frame {
  display: inline-block;
  padding: 10px;
  background: #f4f8f3;
  border-radius: var(--radius-sm);
  line-height: 0;
}
.qr-frame svg { width: min(180px, 60vw); height: auto; }
.checkin-code { margin: 12px 0 10px; }
.checkin-code code {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--green-pale);
}

/* ── Resale tester ───────────────────────────────────────── */
.resale-verdict {
  min-height: 1.2em;
  margin: 14px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}
.resale-verdict[data-tone] {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.resale-verdict[data-tone="ok"] { color: var(--green-pale); background: var(--green-dim); border-color: rgba(114, 255, 120, 0.3); }
.resale-verdict[data-tone="bad"] { color: var(--danger); background: var(--danger-dim); border-color: rgba(255, 107, 114, 0.3); }
.resale-verdict[data-tone="info"] { color: var(--muted-strong); }

/* ── Footer ──────────────────────────────────────────────── */
.page-foot {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.page-foot p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .masthead { grid-template-columns: 1fr; padding-top: 22px; }
  .receipt-columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .top-bar, .scope-banner, .drop-main, .page-foot { width: calc(100% - 32px); }
  .panel { padding: 18px 16px; }

  /* Stack the queue table into cards — no horizontal overflow at 390px. */
  .queue-table thead { display: none; }
  .queue-table, .queue-table tbody, .queue-table tr, .queue-table td { display: block; width: 100%; }
  .queue-table tr {
    margin-bottom: 10px;
    padding: 12px 14px;
    background: var(--canvas-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
  }
  .queue-table td { padding: 4px 0; border-bottom: 0; }
  .queue-table td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 76px;
    margin-right: 8px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .join-form .primary-button, .resale-form .primary-button { width: 100%; }
  .queue-toolbar button { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
