/* escapebox lobby: "night-shift security console" (ADR-0028). Design owned by
   Claude; behaviour in lobby.js / game.js. No external requests. */
:root {
  --bg: #0a0d13;
  --bg-2: #0e121a;
  --panel: #121824;
  --panel-2: #161d2b;
  --line: #222b3b;
  --line-2: #2d384c;
  --text: #ece9e2;
  --muted: #8d96a8;
  --faint: #5d6678;
  --amber: #f3b54a;
  --amber-ink: #1b1305;
  --amber-glow: rgba(243, 181, 74, 0.18);
  --green: #4fd38a;
  --red: #f07070;
  --radius: 14px;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(243, 181, 74, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(79, 140, 211, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); background: rgba(10, 13, 19, 0.7); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: 0.16em; font-size: 14px; }
.brand-mark { width: 22px; height: 22px; border: 2px solid var(--text); border-radius: 4px; position: relative; }
.brand-mark::after { content: ""; position: absolute; right: 3px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font: 12px/1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; white-space: nowrap; }

.led { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.led.on { background: var(--green); box-shadow: 0 0 10px rgba(79, 211, 138, 0.7); }
.led.wait { background: var(--amber); box-shadow: 0 0 10px var(--amber-glow); animation: pulse 1.8s ease-in-out infinite; }
.led.off { background: var(--faint); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Type */
.eyebrow { font: 600 12px/1.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); margin: 0 0 12px; }
h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.04; letter-spacing: -0.025em; margin: 0; font-weight: 750; }
h1 .dim { color: var(--muted); }
h2 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.lede { color: var(--muted); font-size: 18px; max-width: 46ch; margin: 18px 0 0; }

/* Hero + access panel (lobby) */
.hero { padding: 64px 0 36px; }
.access {
  margin-top: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 820px;
}
.access > div, .access > form { padding: 18px 20px; }
.access > form { border-left: 1px solid var(--line); }
.field-label { display: block; font: 600 12px/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.input, select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font: 16px var(--sans);
}
.input::placeholder { color: var(--faint); }
.input:focus, select:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 3px var(--amber-glow); }
.input[aria-invalid="true"] { border-color: var(--red); }
.code-input { font: 600 18px var(--mono); letter-spacing: 0.32em; text-transform: uppercase; }
.row { display: flex; gap: 10px; }
.row .input { flex: 1; min-width: 0; }
.help { color: var(--faint); font-size: 13px; margin: 8px 0 0; }
.error { color: var(--red); font-size: 14px; margin: 8px 0 0; min-height: 0; }
.error:empty { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent;
  font: 650 15px var(--sans); letter-spacing: 0.01em; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { background: #ffc865; color: var(--amber-ink); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }
.btn:disabled, .btn-primary:disabled { background: var(--panel-2); color: var(--faint); border-color: var(--line-2); cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-big { height: 56px; font-size: 17px; }

/* Lobby layout: pitch on the left, rooms on the right (desktop) */
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; padding: 64px 0 70px; }
.lobby-grid .hero { padding: 0; }
.lobby-grid h1 { font-size: clamp(34px, 4.1vw, 54px); }
.lobby-grid .access { grid-template-columns: 1fr; max-width: none; }
.lobby-grid .access > form { border-left: 0; border-top: 1px solid var(--line); }
.rooms-col .rooms { grid-template-columns: 1fr; }
@media (max-width: 980px) {
  .lobby-grid { grid-template-columns: 1fr; gap: 40px; padding-top: 40px; }
}

/* Rooms */
.section { padding: 26px 0 70px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.section-head .count { font: 12px var(--mono); color: var(--faint); }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; list-style: none; padding: 0; margin: 0; }
.notice { color: var(--muted); }

.case {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.case-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px dashed var(--line-2); font: 12px/1 var(--mono); color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }
.case-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.case h3 { font-size: 26px; letter-spacing: -0.015em; margin: 0; }
.room-summary { margin: 0; color: #c9cbd1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.room-facts { margin: 0; font: 13px var(--mono); color: var(--muted); }
.badge { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font: 600 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--line-2); color: var(--muted); }
.badge-hacker { color: var(--amber); border-color: rgba(243, 181, 74, 0.45); background: rgba(243, 181, 74, 0.08); }
.hacker-note { margin: 0; font-size: 13px; color: var(--muted); border-left: 2px solid var(--amber); padding-left: 10px; }
.difficulty { display: grid; gap: 8px; }
.difficulty-description { margin: 0; color: var(--muted); font-size: 14px; min-height: 1.5em; }
.case-foot { padding: 0 20px 20px; }
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% - 20px) 20px, calc(100% - 15px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; cursor: pointer; }

.footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--faint); font-size: 13px; }

/* Game page */
.back { display: inline-block; margin: 26px 0 0; color: var(--muted); font-size: 14px; text-decoration: none; }
.back:hover { color: var(--amber); }
.game-head { padding: 22px 0 26px; }
.game-head .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.status-line { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; font: 600 15px var(--sans); }
.status-line.escaped { color: var(--green); }

.game-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; padding-bottom: 70px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 20px; }
.card h2 { margin-bottom: 4px; }
.card .sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

.code-display {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 6px 0 18px; max-width: 460px;
}
.code-display span {
  display: grid; place-items: center; aspect-ratio: 3 / 4;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px;
  font: 700 clamp(26px, 5vw, 44px)/1 var(--mono); color: var(--amber); text-shadow: 0 0 18px var(--amber-glow);
}
.invite-row { display: flex; gap: 10px; }
.invite-row .input { flex: 1; min-width: 0; font: 14px var(--mono); color: var(--muted); }
.copy-feedback { font-size: 13px; color: var(--green); margin: 8px 0 0; min-height: 1.4em; }

.enter-card { border-color: rgba(243, 181, 74, 0.35); box-shadow: 0 0 0 1px rgba(243, 181, 74, 0.08), 0 18px 50px rgba(0, 0, 0, 0.35); }
.enter-card form { display: grid; gap: 14px; margin-top: 12px; }
.play-hint { color: var(--muted); font-size: 14px; margin: 0; }

.roster-head { display: flex; justify-content: space-between; align-items: baseline; }
.roster-head .count { font: 13px var(--mono); color: var(--muted); }
.roster { list-style: none; margin: 14px 0 0; padding: 0; font-family: var(--mono); font-size: 14px; }
.roster li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.roster li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; box-shadow: 0 0 8px rgba(79, 211, 138, 0.6); }
.roster li::after { content: "badged in"; margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.roster-empty { color: var(--muted); margin: 14px 0 0; font-size: 14px; }

.message { color: var(--muted); }
.unknown { padding: 70px 0; max-width: 560px; }
.unknown p { color: var(--muted); }

/* Narrow screens */
@media (max-width: 860px) {
  .game-grid { grid-template-columns: 1fr; }
  .game-side { order: -1; }
}
@media (max-width: 640px) {
  .wrap { width: min(1120px, 100% - 32px); }
  .hero { padding: 40px 0 26px; }
  .lede { font-size: 16px; }
  .access { grid-template-columns: 1fr; }
  .access > form { border-left: 0; border-top: 1px solid var(--line); }
  .topbar .status-pill { display: none; }
  .invite-row { flex-direction: column; }
  .case-strip { padding: 12px 16px; }
  .case-body, .card { padding: 18px; }
  .case-foot { padding: 0 18px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
