:root {
  --bg: #0a0a0a;
  --bg-2: #121212;
  --elev: #1a1a1a;
  --inset: #141414;
  --line: rgba(180, 180, 180, 0.16);
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --accent: #f0c014;
  --accent-2: #c8c8c8;
  --accent-dim: rgba(240, 192, 20, 0.14);
  --warn: #d6d6d6;
  --danger: #ff7b7b;
  --paper: #ffffff;
  --ink: #1c1c1c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --radius: 22px;
  --sans: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(240, 192, 20, 0.12), transparent 55%),
    radial-gradient(720px 420px at 100% 0%, rgba(120, 120, 120, 0.16), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 22px 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(240, 192, 20, 0.35);
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(240, 192, 20, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(240, 192, 20, 0); }
}

.grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  align-items: start;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.qr-card {
  padding: 20px;
  position: sticky;
  top: 18px;
}

.qr-frame {
  background: var(--paper);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  place-items: center;
  min-height: 280px;
  box-shadow: inset 0 0 0 1px rgba(11, 26, 36, 0.06);
}

.qr-frame img {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
}

.qr-placeholder { color: #7a7a7a; font-size: 14px; }

.ip-pick { display: block; margin-top: 14px; }
.ip-pick span,
.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.ip-pick select,
.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--inset);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.field input,
.field select { font-size: 16px; }

.field select,
.ip-pick select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field input:focus,
.field select:focus,
.ip-pick select:focus {
  outline: none;
  border-color: rgba(240, 192, 20, 0.55);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.url-box {
  margin-top: 12px;
  padding: 11px 12px;
  background: var(--inset);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
  color: var(--muted);
}

.copy-btn { width: 100%; margin-top: 0; }

.qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.help-box {
  margin-top: 14px;
  border-radius: 14px;
  background: var(--inset);
  color: var(--muted);
  font-size: 13px;
}

.help-box summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}

.help-box summary::-webkit-details-marker { display: none; }
.help-box ol { margin: 0; padding: 0 16px 14px 32px; }
.help-box li { margin-bottom: 6px; }
.help-box code { font-family: var(--mono); font-size: 12px; color: var(--accent); }

.hint { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.log-card { overflow: hidden; min-height: 420px; }

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.log-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--inset);
  border: 1px solid var(--line);
}

.log-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.log-tab:hover { color: var(--text); }

.log-tab.is-on {
  background: var(--elev);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.log-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.count-wait {
  background: rgba(180, 180, 180, 0.16);
  color: var(--muted);
}

.ghost {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.22); }

.signup-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.signup-item {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--inset);
  border: 1px solid var(--line);
}

.signup-item.is-wait {
  border-color: rgba(160, 160, 160, 0.28);
  background: linear-gradient(180deg, rgba(160, 160, 160, 0.08), var(--inset));
}

.signup-item.is-done {
  border-color: rgba(240, 192, 20, 0.28);
}

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.item-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.item-name .sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill-wait { background: rgba(180, 180, 180, 0.16); color: var(--muted); }
.pill-done { background: var(--accent-dim); color: var(--accent); }

.wait-timer {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.pill .wait-timer {
  margin-left: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.meta .wait-timer {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.wait-timer.is-low,
.meta .wait-timer.is-low {
  color: var(--danger);
}

.signup-item.is-expiring {
  border-color: rgba(255, 123, 123, 0.35);
  background: linear-gradient(180deg, rgba(255, 123, 123, 0.1), var(--inset));
}

.pill-wait:has(.wait-timer.is-low) {
  background: rgba(255, 123, 123, 0.16);
  color: var(--danger);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.meta {
  min-width: 0;
}

.meta b {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.meta span, .meta a {
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  word-break: break-word;
}

.meta a { color: var(--accent-2); }
.waiting { color: var(--accent); font-weight: 700; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}

.checkin-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.checkin-card {
  width: min(440px, 100%);
  padding: 28px 24px 24px;
  text-align: center;
}

.terms-box {
  max-height: min(42vh, 360px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px;
  margin: 16px 0 8px;
  border-radius: 14px;
  background: var(--inset);
  border: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.terms-box h3 {
  margin: 16px 0 6px;
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.terms-box p { margin: 0 0 10px; }
.terms-box p:last-child { margin-bottom: 0; }

.terms-accept {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.terms-accept input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.signup-card { text-align: left; }
.signup-card h1,
.signup-card .hint,
.signup-card .eyebrow,
.signup-card .logo-mark { text-align: center; }

.signup-form { margin-top: 18px; }
.field { display: block; margin-bottom: 14px; }

.step { display: none; }
.step.show { display: block; animation: fadein 0.28s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.signup-progress {
  display: flex;
  gap: 6px;
  margin: 18px 0 6px;
}

.signup-progress i {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--line);
}

.signup-progress i.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.lib-body .wrap { max-width: 980px; }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.lib-card {
  display: block;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  min-height: 160px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.lib-card:hover {
  transform: translateY(-3px);
  border-color: rgba(240, 192, 20, 0.4);
}

.lib-card .lib-index {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 14px;
}

.lib-card h2 { margin: 0 0 8px; font-size: 16px; letter-spacing: -0.03em; }
.lib-card p { margin: 0; color: var(--muted); font-size: 13px; }

.file-list { list-style: none; margin: 0; padding: 8px; }
.file-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  border-radius: 14px;
}
.file-list a:hover { background: var(--inset); }

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.logo-mark {
  width: auto;
  height: 88px;
  max-width: 220px;
  margin: 0 auto 14px;
  border-radius: 0;
  object-fit: contain;
  display: block;
  background: transparent;
}

.logo-mark.small {
  height: 64px;
  max-width: 180px;
  margin: 0;
}

.status {
  margin: 14px 0 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--inset);
  font-size: 14px;
  color: var(--muted);
}

.status.warn { color: var(--accent); }

.primary {
  appearance: none;
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), #ffe36b);
  color: #111111;
  cursor: pointer;
}

.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .qr-card { position: static; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .meta-grid { grid-template-columns: 1fr; }
  .log-head { flex-wrap: wrap; }
}
