/* Lobby page — builds on styles.css (cards, chips, segs, squad cards). */
.lobby-page .site-foot { padding-bottom: 28px !important; }
.lobby-mode-banner {
  max-width: 1240px; width: 100%; margin: 6px auto 0;
  padding: 9px 14px; border-radius: 8px;
  border: 1px dashed rgba(167, 139, 250, 0.6); background: rgba(167, 139, 250, 0.08);
  color: #c4b5fd; font-size: 13px;
}
.lobby-mode-banner code { color: var(--text); }

/* ---------- start ---------- */
.lobby-start { flex: 1; display: grid; place-items: start center; padding-top: 4vh; }
.lobby-hero { width: min(620px, 100%); padding: 30px 32px; }
.lobby-hero h1 { margin: 8px 0 10px; font: 700 clamp(34px, 6vw, 52px)/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.lobby-hero > p { margin: 0 0 22px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.lobby-field { display: grid; gap: 7px; margin-bottom: 16px; }
.lobby-field span { font: 600 10.5px/1 var(--display); letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim); }
.lobby-field input, .lobby-join input {
  padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35);
  color: var(--text); font: 500 15px/1.2 var(--body); outline: none;
}
.lobby-field input:focus, .lobby-join input:focus { border-color: var(--accent); }
.lobby-start-actions { display: grid; gap: 12px; }
.lobby-join { display: flex; gap: 8px; }
.lobby-join input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.18em; font-family: var(--display); font-weight: 600; }
.lobby-join .chip { color: var(--text); padding-inline: 20px; }
.lobby-error { margin: 14px 0 0; color: #fca5a5; font-size: 13.5px; }

/* ---------- room ---------- */
.lobby-room { flex: 1; width: 100%; max-width: 1240px; margin: 12px auto 24px; display: grid; gap: 14px; align-content: start; }
/* The bar (code, invite, roll) stays pinned while you scroll */
.lobby-bar {
  position: sticky; top: 10px; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 18px;
}
.lobby-bar.card { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.lobby-code-wrap { display: grid; gap: 3px; margin-right: auto; }
.lobby-label { font: 600 10px/1 var(--display); letter-spacing: 0.26em; text-transform: uppercase; color: var(--dim); }
.lobby-code { font: 700 30px/1 var(--display); letter-spacing: 0.18em; color: var(--accent); }
.lobby-bar .chip { color: var(--text); }
.lobby-status { display: inline-flex; align-items: center; gap: 7px; font: 600 11.5px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lobby-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #facc15; }
.lobby-status[data-state="live"]::before { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2); }
.lobby-status[data-state="reconnecting"]::before, .lobby-status[data-state="closed"]::before { background: #f87171; }
.lobby-leave:hover { color: #f87171; }

.lobby-grid { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 14px; align-items: start; }
.lobby-side { display: grid; gap: 14px; }
.lobby-main { display: grid; gap: 14px; }
.lobby-count { color: var(--muted); letter-spacing: 0.08em; }

.lobby-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lobby-member { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.lobby-avatar { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #0b0d12; font: 700 13px/1 var(--display); flex: none; }
.lobby-member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px/1.2 var(--display); }
.lobby-tag { padding: 3px 6px 2px; border-radius: 3px; border: 1px solid var(--line-2); font: 600 9.5px/1.2 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lobby-tag.host { color: #facc15; border-color: rgba(250, 204, 21, 0.5); }

.lobby-controls { display: grid; gap: 12px; }
.lobby-controls .card-head { margin-bottom: 0; }
.lobby-host-note { font-size: 12px; color: var(--dim); }
.lobby-ctrl { display: grid; gap: 7px; }
.lobby-ctrl .seg { justify-self: start; flex-wrap: wrap; }
.lobby-controls.readonly .seg button:disabled { opacity: 1; cursor: default; }
.lobby-controls.readonly .seg button:not([aria-checked="true"]):disabled { opacity: 0.45; }
/* Toggles: label on the left, switch on the right */
.lobby-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.lobby-check:has(input:checked) { color: var(--text); }
.lobby-check input { position: absolute; opacity: 0; pointer-events: none; }
.lobby-check .switch-track { flex: none; }
.lobby-check input:checked + .switch-track { background: var(--accent); }
.lobby-check input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.lobby-check input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.lobby-check:has(input:disabled) { cursor: default; }
.lobby-check:has(input:disabled) .switch-track { opacity: 0.6; }
.lobby-ch-left { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.lobby-dim { color: var(--dim); }

/* Advanced options: a collapsible box in the host controls */
.lobby-adv { border: 1px solid var(--line-2); border-radius: 8px; background: rgba(0, 0, 0, 0.18); }
.lobby-adv summary {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px; cursor: pointer; list-style: none;
  font: 600 11px/1 var(--display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--text);
}
.lobby-adv summary::-webkit-details-marker { display: none; }
.lobby-adv summary::after {
  content: ""; margin-left: auto; width: 7px; height: 7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg); transition: transform 0.2s;
}
.lobby-adv[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.lobby-adv-body { display: grid; gap: 12px; padding: 2px 12px 14px; }
.lobby-select {
  padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35);
  color: var(--text); font: 500 14px/1.2 var(--body);
}
.lobby-select option { background: #141822; }
.lobby-select:disabled { opacity: 0.7; }
.lobby-adv-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--dim); }
.lobby-deck-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: -4px; }
.lobby-deck-manage { flex: none; color: var(--text); padding: 6px 12px; font-size: 11px; }
.lobby-page .squad-ch span + strong { margin-top: 8px; }
.lobby-roll { justify-content: center; gap: 12px; padding: 12px 22px; }
.lobby-roll .roll-text { font-size: 18px; }
.lobby-roll kbd { margin-left: 0; }
@media (pointer: coarse) { .lobby-roll kbd { display: none; } }

.lobby-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--muted); font-size: 12.5px; }
.lobby-log li { padding-left: 12px; position: relative; }
.lobby-log li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }

/* Your roll: the big card */
.lobby-you { min-height: 220px; display: flex; align-items: stretch; overflow: hidden; position: relative; padding: 0; }
.lobby-wait { margin: auto; padding: 40px 24px; text-align: center; color: var(--muted); font: 600 16px/1.4 var(--display); letter-spacing: 0.04em; }
.lobby-you:not(.has-roll) { flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding-bottom: 24px; }
.lobby-you:not(.has-roll) .chip { color: var(--text); }
.lobby-you.has-roll {
  --c: var(--atk);
  border-color: color-mix(in srgb, var(--c) 40%, transparent);
  background: linear-gradient(120deg, color-mix(in srgb, var(--c) 14%, transparent), rgba(255, 255, 255, 0.02) 60%);
}
.lobby-you[data-role="defender"] { --c: var(--def); }
.lobby-you-portrait {
  width: 38%; min-width: 180px; max-height: 420px; object-fit: cover; align-self: flex-end;
  -webkit-mask-image: linear-gradient(180deg, #000 75%, transparent); mask-image: linear-gradient(180deg, #000 75%, transparent);
}
.lobby-you-info { flex: 1; min-width: 0; display: grid; gap: 12px; align-content: start; padding: 20px 22px 20px 6px; }
.lobby-you-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lobby-you-label { font: 600 11px/1.3 var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: var(--c); }
.lobby-you-name { display: flex; align-items: center; gap: 12px; }
.lobby-you-name img { width: 46px; height: 46px; }
.lobby-you-name strong { font: 700 clamp(30px, 4vw, 44px)/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.lobby-you-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.lobby-you-row { display: grid; gap: 3px; }
.lobby-you-val { font: 700 16px/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.lobby-you-att { font-size: 12px; color: var(--accent-2); }

@media (max-width: 900px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-main { order: -1; }
}
@media (max-width: 560px) {
  .lobby-hero { padding: 22px 18px; }
  .lobby-code { font-size: 24px; }
  .lobby-you { flex-direction: column; }
  .lobby-you-portrait { width: 100%; max-height: 240px; object-position: 50% 20% !important; }
  .lobby-you-info { padding: 4px 16px 18px; }
}
.lobby-ch-left .squad-team-tag { display: inline; margin: 0; }
/* Where a challenge came from (map, IRL, squad size, My deck): sized to sit beside the difficulty picker */
.lobby-src {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 4px;
  border: 1px solid rgba(167, 139, 250, 0.5); background: rgba(167, 139, 250, 0.12); color: #d8ccff;
  font: 600 10.5px/1.2 var(--display); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
}
.lobby-src svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Phones: the bar scrolls away and the host gets a roll button pinned to the bottom */
@media (max-width: 700px) {
  /* (no blur here: it would trap the fixed roll button inside the bar) */
  .lobby-bar, .lobby-bar.card { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .lobby-roll { position: fixed; z-index: 30; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); padding: 15px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55); }
  .lobby-is-host .lobby-room { padding-bottom: 80px; }
}

/* ---------- punishment wheel ---------- */
.lobby-pun-cats { display: grid; gap: 10px; }
.lobby-pun-cat { display: inline-flex; align-items: center; gap: 8px; }
.lobby-pun-cat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.lobby-card-tools { display: inline-flex; gap: 6px; }
.lobby-spin-for svg { stroke-width: 1.8; }
.lobby-spin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  border: 1px dashed rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.06); color: #fda4af;
  font: 600 11.5px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s;
}
.lobby-spin-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lobby-spin-btn:not(:disabled):hover { background: rgba(244, 63, 94, 0.14); border-color: rgba(244, 63, 94, 0.8); color: #fecdd3; }
.lobby-spin-btn:disabled { opacity: 0.5; cursor: default; }
.lobby-pun {
  --c: #f43f5e;
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, #f43f5e 55%, transparent); border-left: 3px solid #f43f5e;
  background: linear-gradient(100deg, rgba(244, 63, 94, 0.14), rgba(244, 63, 94, 0.04));
  animation: wheelPop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.lobby-you-info .lobby-pun, .lobby-you-info .lobby-spin-btn { margin-top: 0; }
.lobby-pun-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 5px; }
.lobby-pun-tag { font: 600 10.5px/1 var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: #fb7185; }
.lobby-pun-tag::before { content: "☠ "; letter-spacing: 0; }
.lobby-pun-time { font: 600 10px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: #fda4af; padding: 4px 8px; border-radius: 999px; background: rgba(244, 63, 94, 0.14); }
.lobby-pun-complete {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.1); color: #86efac;
  font: 600 10.5px/1.2 var(--display); letter-spacing: 0.12em; text-transform: uppercase;
  transition: background-color 0.18s, border-color 0.18s;
}
.lobby-pun-complete::before { content: ""; width: 8px; height: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-1px) rotate(-45deg); }
.lobby-pun-complete:hover { background: rgba(74, 222, 128, 0.2); border-color: #4ade80; }
.lobby-pun-until { display: inline-block; margin-top: 7px; font: 600 10.5px/1.2 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: #fb7185; }
.lobby-pun-spinning { margin-top: 10px; padding: 9px 12px; border-radius: 8px; border: 1px dashed rgba(244, 63, 94, 0.4); color: #fda4af; font-size: 12.5px; animation: punPulse 1.2s ease-in-out infinite; }
@keyframes punPulse { 50% { opacity: 0.55; } }
.lobby-spin-row { display: flex; gap: 8px; }
.lobby-spin-row .lobby-spin-btn { flex: 1; width: auto; }
.lobby-spin-instant {
  flex: none; width: 42px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  border: 1px dashed rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.06); color: #fda4af;
  transition: background-color 0.18s, border-color 0.18s;
}
.lobby-spin-instant svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.lobby-spin-instant:not(:disabled):hover { background: rgba(244, 63, 94, 0.14); border-color: rgba(244, 63, 94, 0.8); }
.lobby-spin-instant:disabled { opacity: 0.5; cursor: default; }
.lobby-pun strong { display: block; font: 700 15px/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.lobby-pun p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.spin-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: spinFade 0.2s ease-out;
}
.spin-overlay[hidden] { display: none; }
@keyframes spinFade { from { opacity: 0; } }
.spin-panel {
  width: min(420px, 100%); display: grid; justify-items: center; gap: 14px; padding: 22px 22px 18px;
  border-radius: 14px; border: 1px solid var(--line-2); background: #10141c; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: wheelPop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.spin-who { margin: 0; font: 700 18px/1.2 var(--display); letter-spacing: 0.1em; text-transform: uppercase; text-align: center; }
.spin-panel .wheel { width: min(300px, 78vw); }
.spin-close { color: var(--text); }
