/* Hush Protocol: one stylesheet for landing, lobby and game. */
:root {
  --bg: #070b16;
  --bg-2: #0c1324;
  --panel: rgba(16, 24, 46, 0.78);
  --panel-solid: #111a31;
  --panel-2: rgba(26, 37, 66, 0.7);
  --line: rgba(150, 175, 255, 0.12);
  --line-2: rgba(150, 175, 255, 0.22);
  --text: #e8edff;
  --muted: #8d99bd;
  --faint: #5b6688;
  --accent: #7d9bff;
  --accent-2: #a98bff;
  --good: #5dffa8;
  --warn: #ffb63d;
  --bad: #ff5470;
  --cyan: #35e0ff;
  --magenta: #ff4fd8;
  --lime: #9dff4a;
  --amber: #ffb63d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line);
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
svg { display: block; }
[hidden] { display: none !important; }
::selection { background: rgba(125, 155, 255, 0.35); }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- backdrop ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(125, 155, 255, 0.16), transparent 60%),
    radial-gradient(900px 600px at 110% 20%, rgba(255, 79, 216, 0.09), transparent 60%),
    radial-gradient(900px 700px at 50% 120%, rgba(53, 224, 255, 0.08), transparent 60%),
    var(--bg);
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(180, 200, 255, 0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel-2);
  font-weight: 600; letter-spacing: 0.01em;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none; white-space: nowrap; flex: none;
}
.btn:hover:not(:disabled) { border-color: rgba(150, 175, 255, 0.4); background: rgba(40, 54, 92, 0.8); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  border: 0; color: #0a0f1f;
  background: linear-gradient(135deg, #8fb0ff, #b393ff);
  box-shadow: 0 10px 30px -10px rgba(140, 160, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #a3beff, #c2a8ff); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line); }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.btn-lg { height: 54px; padding: 0 26px; font-size: 17px; border-radius: 14px; }

.input {
  height: 46px; width: 100%; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: rgba(6, 10, 22, 0.6);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(125, 155, 255, 0.18); }
.input-code { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 700; }

.card {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line);
}
.kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px; font: 700 11px var(--mono); color: var(--muted);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2); border-bottom-width: 2px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.logo { width: 34px; height: 34px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px; border-radius: 10px; background: #101830; box-shadow: 0 0 0 1px var(--line-2); flex: none; }
.logo i { border-radius: 50%; }
.logo i:nth-child(1) { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.logo i:nth-child(2) { background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }
.logo i:nth-child(3) { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.logo i:nth-child(4) { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.brand-name { font-weight: 700; letter-spacing: 0.02em; font-size: 17px; }

/* ---------- landing ---------- */
.center { text-align: center; }
.landing { max-width: 980px; margin: 0 auto; padding: 0 20px 64px; }
.hero { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 0 24px; }
.hero .brand { margin-bottom: 36px; }
.hero h1 { font-size: clamp(40px, 6.5vw, 68px); line-height: 1; margin: 0 0 16px; letter-spacing: -0.035em; }
.hero h1 .grad { background: linear-gradient(100deg, var(--cyan), var(--accent) 40%, var(--magenta) 80%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 460px; margin: 0 0 32px; }
.entry { width: min(400px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; margin: 4px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.join-row .btn { height: 46px; padding: 0 22px; }
.error-banner { padding: 12px 14px; border-radius: 12px; background: rgba(255, 84, 112, 0.12); border: 1px solid rgba(255, 84, 112, 0.35); color: #ffc2cd; font-size: 14px; }
.scroll-hint { margin-top: 40px; color: var(--muted); font-size: 14px; text-decoration: none; }
.scroll-hint:hover { color: var(--text); }

.section { margin-top: 48px; }
.section h2 { font-size: 24px; margin: 0 0 18px; letter-spacing: -0.02em; text-align: center; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.step { padding: 18px; }
.step .num { font: 700 12px var(--mono); color: var(--accent); }
.step h3 { margin: 8px 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 26px; margin-bottom: 22px; }
.legend-item { display: flex; gap: 10px; align-items: center; }
.legend-item canvas { flex: none; width: 40px; height: 40px; border-radius: 10px; background: #0e1630; }
.legend-item b { display: block; font-size: 14px; }
.legend-item span { color: var(--muted); font-size: 12px; }
.section .kbd { margin: 0 1px; }
.footer { margin-top: 64px; color: var(--faint); font-size: 13px; text-align: center; }

/* ---------- room shell ---------- */
.room { min-height: 100dvh; }
body.in-game { overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }

/* panel headers (in-game side panel) */
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel-head h2 svg { width: 16px; height: 16px; color: var(--muted); }

/* crew list (in-game panel) + avatars */
.crew { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.crew li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid transparent; }
.crew li.me { border-color: var(--line-2); background: rgba(125, 155, 255, 0.07); }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; color: #0a0f1f; position: relative; }
.avatar .status { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--faint); border: 2px solid var(--panel-solid); }
.avatar .status.on { background: var(--good); }
.crew .who { flex: 1; min-width: 0; }
.crew .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.crew .who small { color: var(--muted); font-size: 12px; }
.crew .roles { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.mini-role { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: rgba(125, 155, 255, 0.12); color: #c3d0ff; }
.mini-role svg { width: 14px; height: 14px; }
.mini-role.shared { background: rgba(255, 182, 61, 0.15); color: var(--warn); }

/* lobby */
.lobby { max-width: 1020px; margin: 0 auto; padding: 8px 20px 40px; }
.lobby-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 8px 0 28px; }
.room-code { font: 700 clamp(48px, 9vw, 72px)/1 var(--mono); letter-spacing: 0.18em; padding-left: 0.18em; background: linear-gradient(100deg, var(--cyan), var(--accent) 50%, var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 8px; }
.lobby-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.lobby-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lobby-block { padding: 18px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.block-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.block-head h2 svg { width: 16px; height: 16px; color: var(--muted); }
.block-head .muted { font-size: 13px; }

.crew-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.crew-chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 5px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.crew-chip.me { border-color: var(--line-2); background: rgba(125, 155, 255, 0.08); }
.crew-chip.away { opacity: 0.55; }
.crew-chip .avatar { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; }
.crew-chip .tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); border: 0; }
.crew-chip .tag svg { width: 12px; height: 12px; }
.crew-chip .tag.host { color: var(--warn); background: rgba(255, 182, 61, 0.12); }
.crew-chip button.tag:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.crew-chip.invite { padding: 0 16px; border-style: dashed; color: var(--muted); background: transparent; }
.crew-chip.invite:hover { color: var(--text); border-color: var(--accent); }

.mission-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.mission-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.025); transition: background 0.15s, border-color 0.15s; }
.mission-row:not(:disabled):hover { background: rgba(255, 255, 255, 0.05); }
.mission-row:disabled { cursor: default; }
.mission-row:disabled:not(.selected) { opacity: 0.55; }
.mission-row.selected { border-color: var(--accent); background: linear-gradient(160deg, rgba(125, 155, 255, 0.14), rgba(169, 139, 255, 0.05)); }
.mission-row .radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.mission-row.selected .radio { border-color: var(--accent); }
.mission-row.selected .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.mr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mr-title { display: flex; align-items: center; gap: 10px; }
.mr-title b { font-size: 15px; }
.mr-sub { font-size: 13px; color: var(--muted); }
.diff { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; color: #b9c8ff; background: rgba(125, 155, 255, 0.14); }
.diff.d1 { color: var(--good); background: rgba(93, 255, 168, 0.1); }
.diff.d3 { color: var(--warn); background: rgba(255, 182, 61, 0.12); }
.diff.d4 { color: var(--bad); background: rgba(255, 84, 112, 0.12); }
.mr-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.mr-meta .mono { font-size: 14px; font-weight: 700; }
.mr-meta small { font-size: 11px; color: var(--muted); }
.btn-block { width: 100%; }
.start-hint { margin: 10px 0 0; font-size: 13px; text-align: center; }
.lobby-chat { height: 460px; display: flex; flex-direction: column; position: sticky; top: 16px; }
.lobby-chat .block-head { padding: 18px 18px 0; margin-bottom: 4px; }

/* chat */
body > #chat { display: none; }
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 14px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.msg { font-size: 14px; word-wrap: break-word; }
.msg b { font-weight: 600; margin-right: 6px; }
.msg.sys { color: var(--faint); font-size: 12px; text-align: center; }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form .input { height: 40px; font-size: 14px; }
.chat-form .btn { height: 40px; width: 40px; padding: 0; flex: none; }
.chat-lock { display: flex; align-items: center; gap: 10px; margin: 10px 12px 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 84, 112, 0.08); border: 1px dashed rgba(255, 84, 112, 0.35); font-size: 13px; color: #ffb3c0; }
.chat-lock svg { width: 18px; height: 18px; flex: none; }
.chat-open-banner { margin: 10px 12px 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: rgba(93, 255, 168, 0.1); border: 1px solid rgba(93, 255, 168, 0.35); color: var(--good); display: flex; justify-content: space-between; align-items: center; }

/* ---------- game ---------- */
.game { position: fixed; inset: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#board.dragging { cursor: grabbing; }
#board.pointer { cursor: pointer; }

.hud-top {
  position: absolute; top: 12px; left: 12px; right: 12px; display: grid;
  grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.hud-left { display: flex; align-items: center; gap: 10px; }
.hud-pill { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; }
.hud-pill .title { font-weight: 700; font-size: 14px; }
.hud-pill .sub { font-size: 12px; color: var(--muted); }

.power { padding: 10px 18px 12px; min-width: 260px; text-align: center; }
.power-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.power-time { font: 700 34px/1 var(--mono); letter-spacing: 0.02em; }
.power-row svg { width: 20px; height: 20px; color: var(--warn); }
.power-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); margin-top: 8px; overflow: hidden; }
.power-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--good), var(--cyan)); transition: width 0.25s linear; }
.power.low .power-time { color: var(--bad); animation: pulse 1s infinite; }
.power.low .power-bar i { background: var(--bad); }
.power.mid .power-bar i { background: linear-gradient(90deg, var(--warn), #ffd27a); }
.comms { margin-top: 8px; font-size: 12px; display: flex; justify-content: center; align-items: center; gap: 6px; color: var(--muted); }
.comms svg { width: 14px; height: 14px; }
.comms.open { color: var(--good); }

.hud-right { display: flex; justify-content: flex-end; gap: 10px; align-items: start; }
.objective { padding: 10px 14px; }
.objective .label { font-size: 10px; margin-bottom: 6px; }
.obj-icons { display: flex; gap: 8px; }
.obj { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; border: 1.5px solid currentColor; opacity: 0.4; }
.obj.done { opacity: 1; background: color-mix(in srgb, currentColor 22%, transparent); box-shadow: 0 0 14px -2px currentColor; }
.obj svg { width: 16px; height: 16px; }
.alarm .objective { box-shadow: 0 0 0 1px rgba(255, 84, 112, 0.6), 0 0 30px -6px var(--bad); }
.alarm .objective .label { color: var(--bad); }

.dock {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
  max-width: calc(100vw - 24px);
}
.dock > * { pointer-events: auto; }
.drone-picker { display: flex; gap: 6px; padding: 6px; }
.drone-btn {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 8px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; font-weight: 600; font-size: 13px;
}
.drone-btn:hover { background: rgba(255, 255, 255, 0.05); }
.drone-btn .orb { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 10px currentColor; background: currentColor; position: relative; }
.drone-btn .orb.core::after { content: ""; position: absolute; inset: 5px; border-radius: 2px; background: #fff; transform: rotate(45deg); }
.drone-btn.selected { border-color: currentColor; background: color-mix(in srgb, currentColor 14%, transparent); }
.drone-btn.boarded { opacity: 0.35; }
.drone-btn .name { color: var(--text); }
.drone-btn .kbd { margin-left: 2px; }

.controls { display: flex; gap: 8px; padding: 8px; align-items: stretch; }
.controls .label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; text-align: center; padding: 0 2px; }
.act {
  width: 72px; height: 72px; border-radius: 14px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(60, 80, 140, 0.45), rgba(30, 42, 78, 0.55));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  position: relative; transition: transform 0.08s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.act svg { width: 28px; height: 28px; }
.act .act-name { font-size: 11px; font-weight: 600; color: var(--muted); }
.act .kbd { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; font-size: 9px; }
.act:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(125, 155, 255, 0.15); }
.act.flash { transform: scale(0.93); border-color: var(--accent); }
.act:disabled { opacity: 0.35; cursor: not-allowed; }
.act.shared { border-color: rgba(255, 182, 61, 0.5); }
.act.shared::after { content: "shared"; position: absolute; bottom: -7px; font-size: 9px; padding: 0 5px; border-radius: 4px; background: var(--warn); color: #1a1200; font-weight: 700; }
.act.shake { animation: shake 0.3s; }
.controls .none { padding: 18px; color: var(--muted); font-size: 14px; }

.side {
  position: absolute; top: 76px; right: 12px; bottom: 14px; width: 320px;
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s;
}
.side.collapsed { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.side-section { border-bottom: 1px solid var(--line); }
.side .crew { padding: 0 12px 12px; max-height: 34vh; overflow: auto; }
.side .crew li { padding: 7px 8px; }
.nudge { opacity: 0.55; }
.nudge:hover { opacity: 1; color: var(--warn); }
.nudge svg { width: 16px; height: 16px; }
.events { list-style: none; margin: 0; padding: 0 14px 8px; max-height: 18vh; overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.events li { display: flex; gap: 8px; align-items: baseline; color: var(--muted); }
.events li .dot { transform: translateY(-1px); }
.events li.alarm { color: var(--bad); font-weight: 600; }
.events li.won { color: var(--good); font-weight: 600; }

.float-btns { position: absolute; right: 12px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.float-btns .btn { background: var(--panel); box-shadow: var(--shadow); }
.side:not(.collapsed) ~ .float-btns { right: 344px; }

.toasts { position: fixed; top: 120px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 5; }
.toast {
  padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 500; display: flex; gap: 10px; align-items: center;
  animation: toast-in 0.25s ease-out, toast-out 0.4s ease-in 2.8s forwards;
}
.toast.error { color: #ffc2cd; box-shadow: 0 0 0 1px rgba(255, 84, 112, 0.5), var(--shadow); animation: toast-in 0.2s, toast-out 0.3s ease-in 1.6s forwards; }
.toast.alarm { background: #3a0e1a; color: #ffd0d8; font-weight: 700; font-size: 16px; box-shadow: 0 0 0 1px var(--bad), 0 0 40px -6px var(--bad); }
.toast.good { color: #c8ffe2; box-shadow: 0 0 0 1px rgba(93, 255, 168, 0.5), var(--shadow); }

.nudge-flash { position: fixed; inset: 0; pointer-events: none; z-index: 30; box-shadow: inset 0 0 0 4px var(--warn), inset 0 0 120px rgba(255, 182, 61, 0.35); animation: nudge 1.4s ease-out forwards; }
.nudge-flash span { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: 26px; font-weight: 700; color: var(--warn); text-shadow: 0 0 20px rgba(255, 182, 61, 0.7); white-space: nowrap; }

/* overlays */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(4, 7, 15, 0.7); backdrop-filter: blur(6px); z-index: 20; animation: fade 0.25s; }
.modal { width: min(520px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100dvh - 40px); overflow: auto; }
.modal h2 { margin: 0; font-size: 24px; }
.modal.wide { width: min(760px, 100%); }
.end-title { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; margin: 0; line-height: 1; }
.end-title.won { background: linear-gradient(100deg, var(--good), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-title.lost { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); text-align: center; }
.stat b { display: block; font: 700 22px var(--mono); }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; font-size: 14px; }
.help-grid div { display: flex; gap: 10px; align-items: center; }
.help-grid canvas { width: 36px; height: 36px; border-radius: 8px; background: #0e1630; flex: none; }

.connection { position: fixed; bottom: 16px; left: 16px; z-index: 40; padding: 8px 14px; border-radius: 10px; background: #3a0e1a; color: #ffd0d8; font-size: 13px; box-shadow: var(--shadow); display: flex; gap: 8px; align-items: center; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }

@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes nudge { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-chat { position: static; height: 360px; }
  .mr-meta small { display: none; }
  .hud-top { grid-template-columns: 1fr auto; }
  .hud-left .hud-pill .sub, .hud-left .brand-name { display: none; }
  .hud-top .power { grid-column: 1 / -1; grid-row: 2; justify-self: center; min-width: 200px; padding: 8px 14px; }
  .power-time { font-size: 26px; }
  .side { width: auto; left: 12px; top: auto; height: 55dvh; z-index: 10; }
  .side:not(.collapsed) ~ .float-btns { right: 12px; }
  .act { width: 56px; height: 56px; }
  .act .act-name { display: none; }
  .act svg { width: 24px; height: 24px; }
  .drone-btn .name, .drone-btn .kbd, .act .kbd { display: none; }
  .float-btns { bottom: auto; top: 128px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .legend { justify-content: flex-start; }
  .controls { flex-wrap: wrap; justify-content: center; }
  .controls .label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
