/* Rootfall: Gears & Glyphs — pre-game UI (Character Create / Select / Lobby).
 * Re-uses the mossy + brass visual language from auth.css. The shell sits
 * in the same centered slot the login card occupies on login.html. */

#pregame-shell[hidden] { display: none; }

#pregame-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 24px 64px;
  box-sizing: border-box;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(2, 7, 5, 0.26), rgba(2, 7, 5, 0.72)),
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.68) 100%),
    url('../assets/ui/rootfall-login-bg.jpg') center center / cover no-repeat,
    radial-gradient(ellipse 1100px 700px at 50% 70%, rgba(40, 80, 50, 0.45), transparent 70%),
    linear-gradient(180deg, #0d1d18 0%, #07120e 60%, #050a08 100%);
  color: #f4f4ee;
  font: 14px/1.5 'EB Garamond', Georgia, 'Times New Roman', serif;
}

.pregame-panel {
  position: relative;
  width: min(720px, 100%);
  /* border-box so the 56px horizontal padding + 1px border are
   * subtracted from 100% — without this, a narrow viewport overflows
   * horizontally (border-content fall over the right edge of the
   * shell) and the @media (max-width: 520px) rules look like they
   * never fire because the actual page width sits above the threshold. */
  box-sizing: border-box;
  background: rgba(8, 16, 12, 0.94);
  border: 1px solid rgba(180, 140, 80, 0.45);
  border-radius: 10px;
  padding: 28px 28px 24px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 220, 150, 0.05);
}

.pregame-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(180, 140, 80, 0.30);
}

.pregame-title {
  margin: 0 0 4px;
  font: 700 26px/1.1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  letter-spacing: 0.10em;
  color: #ffd866;
  text-shadow:
    0 0 14px rgba(255, 200, 80, 0.30),
    0 2px 6px rgba(0, 0, 0, 0.85);
}

.pregame-subtitle {
  font: italic 400 13px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(244, 244, 238, 0.65);
}

.pregame-error {
  margin: 0 0 14px;
  padding: 8px 10px;
  background: rgba(178, 36, 36, 0.18);
  border: 1px solid rgba(255, 100, 100, 0.45);
  border-radius: 4px;
  color: #ffcaca;
  font: 600 12px/1.4 system-ui, sans-serif;
  display: none;
}
.pregame-error.show { display: block; }

.pregame-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 10px 16px;
  background: rgba(8, 16, 12, 0.94);
  border: 1px solid rgba(180, 140, 80, 0.55);
  border-radius: 4px;
  color: #ffd866;
  font: 600 13px/1.3 system-ui, sans-serif;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}
.pregame-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(4px);
}

/* ---- Form: Character Create ---- */
.pregame-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}
.pregame-field label {
  font: 600 10px/1 system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.6);
}
.pregame-field input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f4ee;
  padding: 10px 12px;
  border-radius: 4px;
  font: 500 14px/1 system-ui, sans-serif;
  outline: none;
  transition: border-color 160ms, background 160ms;
}
.pregame-field input:focus {
  border-color: rgba(180, 220, 200, 0.65);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 3px rgba(120, 200, 180, 0.12);
}
.pregame-field .pregame-hint {
  font-size: 10px;
  color: rgba(244, 244, 238, 0.4);
  letter-spacing: 0.04em;
}

/* ---- Class picker ---- */
.pregame-section-title {
  font: 700 10px/1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd866;
  margin: 4px 0 10px;
}
.pregame-class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 600px) {
  .pregame-class-grid { grid-template-columns: 1fr; }
}

.pregame-class-card {
  position: relative;
  padding: 14px 12px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 140ms ease-out, border-color 140ms ease-out, background 140ms ease-out;
  text-align: left;
  color: inherit;
  font: inherit;
}
.pregame-class-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255, 216, 102, 0.6);
  background: rgba(255, 216, 102, 0.06);
}
.pregame-class-card.is-selected {
  border-color: #ffd866;
  background: rgba(255, 216, 102, 0.10);
  box-shadow: 0 0 18px rgba(255, 200, 90, 0.20);
}
.pregame-class-card:disabled,
.pregame-class-card.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pregame-class-name {
  font: 700 16px/1.1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  color: #ffd866;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.pregame-class-blurb {
  font: 400 12px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.78);
}
.pregame-coming-soon {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  background: rgba(60, 70, 64, 0.85);
  border: 1px solid rgba(180, 180, 180, 0.40);
  border-radius: 3px;
  font: 700 9px/1 system-ui, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.78);
}

/* ---- Buttons (brass-on-mossy pill, matches .roadmap-open-btn / .auth-submit) ---- */
.pregame-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #d8a060 0%, #8b5a30 100%);
  color: #1a0d04;
  border: none;
  border-radius: 4px;
  font: 700 13px/1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(180, 120, 60, 0.35),
    inset 0 1px 0 rgba(255, 220, 150, 0.45);
  transition: transform 100ms, box-shadow 160ms, filter 160ms;
}
.pregame-btn:hover:not(:disabled) {
  box-shadow:
    0 6px 20px rgba(220, 160, 90, 0.55),
    0 0 24px rgba(150, 220, 200, 0.25),
    inset 0 1px 0 rgba(255, 220, 150, 0.55);
  filter: brightness(1.05);
}
.pregame-btn:active:not(:disabled) { transform: translateY(1px); }
.pregame-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.4);
}

.pregame-btn-ghost {
  background: transparent;
  color: #ffd866;
  border: 1px solid rgba(180, 140, 80, 0.45);
  box-shadow: none;
}
.pregame-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 216, 102, 0.10);
  border-color: rgba(255, 216, 102, 0.6);
  box-shadow: none;
  filter: none;
}

.pregame-btn-danger {
  background: linear-gradient(180deg, #c83030 0%, #6e1010 100%);
  color: #ffe0c0;
  box-shadow:
    0 4px 14px rgba(140, 20, 20, 0.45),
    inset 0 1px 0 rgba(255, 200, 140, 0.35);
}
.pregame-btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow:
    0 6px 20px rgba(200, 60, 60, 0.55),
    inset 0 1px 0 rgba(255, 200, 140, 0.45);
}

.pregame-btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pregame-run-length-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pregame-run-length-label {
  font: 700 9px/1 system-ui, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.78);
  flex-shrink: 0;
}
.pregame-segmented {
  display: inline-flex;
  border: 1px solid rgba(180, 140, 80, 0.45);
  border-radius: 4px;
  overflow: hidden;
}
.pregame-segmented button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  background: transparent;
  color: #ffd866;
  border: none;
  border-right: 1px solid rgba(180, 140, 80, 0.45);
  font: 700 12px/1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, sans-serif;
  letter-spacing: 0.10em;
  cursor: pointer;
  transition: background 120ms;
}
.pregame-segmented button:last-child { border-right: none; }
.pregame-segmented button:hover { background: rgba(255, 216, 102, 0.10); }
.pregame-segmented button.active {
  background: rgba(180, 120, 60, 0.45);
  color: #ffe9a8;
}
.pregame-segmented-est {
  font: 500 9px/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  color: rgba(244, 244, 238, 0.5);
}
.pregame-segmented button.active .pregame-segmented-est {
  color: rgba(255, 233, 168, 0.7);
}

.pregame-back {
  display: inline-block;
  margin-top: 14px;
  font: 600 12px/1 system-ui, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.6);
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}
.pregame-back:hover { color: #ffd866; }
.pregame-back:disabled { opacity: 0.5; cursor: default; }

/* Lobby footer — Switch character (left) + Log out (right) on one row. */
.pregame-lobby-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pregame-lobby-footer .pregame-back { margin-top: 14px; }

/* ---- Character Select: choose-hero layout ----
 * Two-column staging panel. Roster list on the left, single shared
 * live hero preview on the right. The preview's WebGL renderer is
 * created once and re-targeted on focus (see hero-preview.js). Mobile
 * stacks the preview ABOVE the roster so the visual still leads. */

.pregame-panel-wide {
  width: min(1280px, 100%);
}

.pregame-choose-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.pregame-character-panel {
  width: min(1280px, 100%);
  padding: 12px 18px 18px;
  background:
    linear-gradient(180deg, rgba(8, 16, 12, 0.78), rgba(5, 10, 8, 0.70));
  backdrop-filter: blur(3px);
}

.pregame-roster-col {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(180, 140, 80, 0.30);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(15, 28, 22, 0.72), rgba(5, 10, 8, 0.58));
  backdrop-filter: blur(2px);
}

.pregame-roster-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  outline: none;
}
/* Brass focus halo when the list itself is keyboard-focused — gives
 * arrow-key users a clear "you are here" target. */
.pregame-roster-list:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 216, 102, 0.35);
  border-radius: 4px;
}

.pregame-roster-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 10px 10px 10px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.12));
  border: 1px solid rgba(180, 140, 80, 0.18);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 140ms ease-out, border-color 140ms ease-out;
}
.pregame-roster-row:hover {
  background: rgba(255, 216, 102, 0.04);
  border-color: rgba(255, 216, 102, 0.35);
}
/* Focused (= currently previewed) row gets a brass left bar and a
 * subtle elevated background — selected/focused readable at a glance
 * without nesting a card-in-card visual. */
.pregame-roster-row.is-focused {
  background:
    linear-gradient(180deg, rgba(255, 216, 102, 0.09), rgba(0, 0, 0, 0.14));
  border-color: rgba(255, 216, 102, 0.45);
}
.pregame-roster-row.is-focused::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, #ffd866 0%, #b48c50 100%);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 216, 102, 0.55);
}

.pregame-roster-row-text {
  flex: 1 1 auto;
  min-width: 0;
}
.pregame-roster-name {
  font: 700 17px/1.1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  color: #ffd866;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  word-break: break-word;
}
.pregame-roster-meta {
  font: 400 12px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.80);
  margin-bottom: 2px;
}
.pregame-roster-meta strong {
  color: #ffd866;
  font-weight: 700;
}
.pregame-roster-age {
  font: italic 400 11px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(244, 244, 238, 0.50);
}
.pregame-roster-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-shrink: 0;
}
.pregame-roster-actions .pregame-btn {
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.10em;
}

/* ---- Hero stage (preview pedestal + meta) ---- */
.pregame-hero-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pregame-hero-preview-stage {
  position: relative;
  width: 100%;
  height: clamp(260px, 38vw, 340px);
  border: 1px solid rgba(180, 140, 80, 0.45);
  border-radius: 6px;
  overflow: hidden;
  /* Dark inset pedestal — radial green-black gradient with a soft brass
   * inner rim. Reads as "small staging pad" rather than "blank tile." */
  background:
    linear-gradient(180deg, rgba(2, 7, 5, 0.24), rgba(2, 7, 5, 0.60)),
    radial-gradient(ellipse at 50% 72%, rgba(40, 90, 70, 0.22), rgba(0, 0, 0, 0.54) 76%),
    url('../assets/ui/rootfall-login-bg.jpg') center 30% / cover no-repeat,
    radial-gradient(ellipse at 50% 78%, rgba(80, 130, 90, 0.22) 0%, rgba(8, 14, 11, 0.0) 60%),
    radial-gradient(circle at 50% 55%, rgba(14, 26, 20, 0.84) 0%, rgba(5, 10, 8, 0.88) 70%);
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.65),
    inset 0 0 1px rgba(255, 216, 102, 0.35);
}
.pregame-character-panel .pregame-hero-preview-stage {
  /* Height-aware so the preview shrinks with the window (not just width),
   * keeping Character Select above the fold on laptop heights without
   * relying solely on the short-viewport breakpoint below. */
  height: clamp(300px, 46vh, 560px);
}

.pregame-character-panel .pregame-hero-meta {
  padding: 10px 12px;
  border: 1px solid rgba(180, 140, 80, 0.22);
  border-radius: 0 0 6px 6px;
  background: rgba(0, 0, 0, 0.24);
}
.pregame-hero-preview-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.pregame-hero-meta {
  text-align: center;
  padding: 6px 4px 2px;
}
.pregame-hero-meta-name {
  font: 700 22px/1.15 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  color: #ffd866;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  word-break: break-word;
}
.pregame-hero-meta-line {
  font: 400 13px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.85);
  margin-bottom: 2px;
}
.pregame-hero-meta-line strong {
  color: #ffd866;
  font-weight: 700;
}
.pregame-hero-meta-age {
  font: italic 400 11px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(244, 244, 238, 0.55);
}

/* Mobile: stack preview ABOVE the roster so the visual still leads.
 * Below ~520px we also wrap each roster row so Select/Delete sit
 * beneath the text — keeps the actions reachable without horizontal
 * overflow when the column is narrow. */
@media (max-width: 760px) {
  .pregame-choose-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .pregame-hero-stage {
    order: -1;
  }
  .pregame-hero-preview-stage {
    height: clamp(240px, 60vw, 300px);
  }
}
@media (max-width: 520px) {
  .pregame-roster-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .pregame-roster-row-text {
    flex-basis: 100%;
  }
  .pregame-roster-actions {
    flex-direction: row;
    flex-basis: 100%;
    justify-content: flex-end;
  }
}

/* ---- Lobby ---- */
.pregame-lobby-hero {
  padding: 14px 16px;
  background: rgba(255, 216, 102, 0.06);
  border: 1px solid rgba(180, 140, 80, 0.45);
  border-radius: 6px;
  margin-bottom: 18px;
}
.pregame-lobby-hero-name {
  font: 700 22px/1.1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  color: #ffd866;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.pregame-lobby-hero-meta {
  font: 400 12px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.85);
}
.pregame-lobby-hero-meta strong {
  color: #ffd866;
  font-weight: 700;
}

/* Lobby live preview: a stage box (reuses the Character Select pedestal
 * styling) with a label row beneath it. Solo shows one centered label;
 * a party shows one equal-width column per member, in lineup order. */
.pregame-lobby-stage {
  margin-bottom: 18px;
}
.pregame-lobby-stage .pregame-hero-preview-stage {
  height: clamp(240px, 34vw, 320px);
}
.pregame-lobby-labels {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.pregame-lobby-label {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}
.pregame-lobby-label-name {
  font: 700 15px/1.15 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  color: #ffd866;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pregame-lobby-label-sub {
  font: 400 12px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.85);
}
.pregame-lobby-label-sub strong {
  color: #ffd866;
  font-weight: 700;
}
.pregame-lobby-label-badge {
  margin-top: 2px;
  font: 700 9px/1 system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffd866;
}

.pregame-party {
  margin-top: 16px;
  padding: 14px 14px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(180, 140, 80, 0.30);
  border-radius: 6px;
}
.pregame-party-title {
  font: 700 11px/1 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd866;
  margin-bottom: 10px;
}
.pregame-party-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pregame-party-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}
.pregame-party-member-name {
  font: 600 13px/1 system-ui, sans-serif;
  color: #f4f4ee;
}
.pregame-party-member-detail {
  margin-right: auto;
  padding-left: 10px;
  font: 400 12px/1 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.7);
}
.pregame-party-member-role {
  font: 700 10px/1 system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.55);
}
.pregame-party-member-role.is-leader { color: #ffd866; }
.pregame-party-member-reconnecting {
  font: 700 10px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0c674;
  opacity: 0.85;
}
.pregame-party-member.is-reconnecting { opacity: 0.6; }
.pregame-party-member-kick {
  margin-left: 10px;
  padding: 3px 9px;
  background: rgba(180, 60, 60, 0.18);
  border: 1px solid rgba(220, 90, 90, 0.45);
  border-radius: 4px;
  color: #f0b4b4;
  font: 700 10px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.pregame-party-member-kick:hover:not(:disabled) {
  background: rgba(200, 70, 70, 0.32);
  color: #ffe0e0;
}
.pregame-party-member-kick:disabled { opacity: 0.5; cursor: default; }

/* ---- Lobby: Solo / Group sections ---- */
.pregame-section {
  margin-bottom: 18px;
}
/* Stacked label + control used by the Group create/visibility fields.
   Distinct from the Character-Create `.pregame-field label` selector so
   the lobby can use a <span> or <label> interchangeably. */
.pregame-field-label {
  display: block;
  font: 600 10px/1 system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.6);
  margin-bottom: 5px;
}
.pregame-field-value {
  font: 600 13px/1 system-ui, sans-serif;
  color: #f4f4ee;
}
.pregame-input,
.pregame-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f4ee;
  padding: 10px 12px;
  border-radius: 4px;
  font: 500 14px/1 system-ui, sans-serif;
  outline: none;
  transition: border-color 160ms, background 160ms;
}
.pregame-input:focus,
.pregame-select:focus {
  border-color: rgba(180, 220, 200, 0.65);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 3px rgba(120, 200, 180, 0.12);
}
.pregame-select { width: 100%; }
.pregame-group-join {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pregame-join-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pregame-join-row .pregame-input { flex: 1 1 auto; }
.pregame-code-chip {
  flex: 1 1 auto;
  font: 700 15px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: 0.22em;
  color: #ffd866;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(180, 140, 80, 0.55);
  border-radius: 4px;
  padding: 9px 12px;
  text-align: center;
}
.pregame-hint {
  margin-top: 8px;
  font: italic 400 11px/1.4 'EB Garamond', Georgia, serif;
  color: rgba(244, 244, 238, 0.45);
}

/* ---- Confirm dialog ---- */
.pregame-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
}
.pregame-confirm-panel {
  width: min(420px, 92vw);
  padding: 22px 22px 18px;
  background: rgba(8, 16, 12, 0.96);
  border: 1px solid rgba(180, 140, 80, 0.55);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
}
.pregame-confirm-title {
  margin: 0 0 8px;
  font: 700 16px/1.2 'IM Fell English', 'EB Garamond', 'Cinzel', system-ui, serif;
  color: #ffd866;
  letter-spacing: 0.04em;
}
.pregame-confirm-body {
  margin: 0 0 16px;
  font: 400 13px/1.5 'EB Garamond', Georgia, serif;
  color: rgba(244, 244, 238, 0.85);
}
.pregame-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Lobby inventory + gear modal ---- */
/* Sits above the pre-game shell (z-index 60) but below the pregame toast
 * (z-index 80) so equip/destroy feedback toasts stay visible over it. */
.pregame-inv-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.65);
}
.pregame-inv-modal {
  width: min(680px, 94vw);
  max-height: min(82vh, calc(100vh - 60px));
  display: flex;
}
/* The modal reuses the in-game inventory markup (id="inventory"), whose
 * own rule is position:fixed/inset:0/display:none and shown via
 * body.inv-open. Neutralise that here so the backdrop owns the
 * centered/dimmed layout while all the #inventory .inv-* and
 * .equipment-slots styling still applies. */
.pregame-inv-backdrop #inventory {
  position: static;
  inset: auto;
  display: flex;
  width: 100%;
  min-height: 0;
  pointer-events: auto;
}
.pregame-inv-backdrop #inventory .inv-shell {
  width: 100%;
  max-height: min(82vh, calc(100vh - 60px));
}

/* ---- Loading state ---- */
.pregame-loading {
  display: inline-block;
  margin-left: 8px;
  font: italic 400 12px/1 'EB Garamond', Georgia, serif;
  color: rgba(244, 244, 238, 0.55);
}

/* ---- Lobby: componentized command surface ---- */
.pregame-lobby-panel {
  width: min(1280px, 100%);
  padding: 12px 18px 18px;
  background:
    linear-gradient(180deg, rgba(8, 16, 12, 0.78), rgba(5, 10, 8, 0.70));
  backdrop-filter: blur(3px);
}

.pregame-lobby-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 8px 10px;
  border: 1px solid rgba(180, 140, 80, 0.24);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(12, 24, 19, 0.72), rgba(4, 8, 7, 0.62));
  box-shadow: inset 0 1px 0 rgba(255, 216, 102, 0.04);
}
.pregame-lobby-player {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pregame-lobby-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 216, 102, 0.42);
  border-radius: 50%;
  color: #ffd866;
  background: rgba(255, 216, 102, 0.08);
}
.pregame-lobby-player-name,
.pregame-lobby-player-sub {
  display: block;
}
.pregame-lobby-player-name {
  color: #f4f4ee;
  font: 700 13px/1.15 system-ui, sans-serif;
}
.pregame-lobby-player-sub {
  color: rgba(214, 214, 207, 0.70);
  font: 500 11px/1.2 'EB Garamond', Georgia, serif;
}
.pregame-lobby-currencies {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: rgba(244, 244, 238, 0.78);
  font: 700 11px/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pregame-lobby-currencies span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pregame-lobby-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
}
.pregame-lobby-title-block { min-width: 0; }
.pregame-lobby-header .pregame-lobby-status-chip {
  position: absolute;
  right: 0;
  top: 0;
}

.pregame-lobby-status-chip,
.pregame-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(180, 140, 80, 0.48);
  border-radius: 4px;
  background: rgba(255, 216, 102, 0.08);
  color: #ffd866;
  font: 700 10px/1 system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pregame-chip-blue {
  border-color: rgba(130, 190, 200, 0.42);
  background: rgba(72, 150, 150, 0.12);
  color: #b8e8de;
}

.pregame-ico {
  display: inline-grid;
  place-items: center;
  width: 1.25em;
  min-width: 1.25em;
  height: 1.25em;
  color: currentColor;
  font-family: system-ui, sans-serif;
  font-weight: 800;
  line-height: 1;
  text-transform: none;
  filter: drop-shadow(0 0 5px rgba(255, 216, 102, 0.18));
}

.pregame-icon-btn {
  gap: 8px;
}

.pregame-icon-btn .pregame-ico {
  width: 22px;
  min-width: 22px;
  height: 22px;
  margin-left: -4px;
  border: 1px solid rgba(255, 216, 102, 0.28);
  border-radius: 4px;
  background: rgba(255, 216, 102, 0.08);
  color: #ffd866;
  font-size: 12px;
}

.pregame-btn:not(.pregame-btn-ghost) .pregame-ico {
  border-color: rgba(40, 20, 6, 0.20);
  background: rgba(40, 20, 6, 0.14);
  color: #2a1608;
}

.pregame-lobby-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.pregame-lobby-stage {
  grid-column: auto;
  grid-row: auto;
  margin-bottom: 0;
  min-width: 0;
}

.pregame-lobby-stage .pregame-hero-preview-stage {
  /* Height-aware (vh) so the lobby preview scales down on short windows
   * and the Loadout/Status row + Start Run stay above the fold. */
  height: clamp(260px, 40vh, 500px);
  border-color: rgba(210, 160, 88, 0.58);
  background:
    linear-gradient(180deg, rgba(2, 7, 5, 0.22), rgba(2, 7, 5, 0.58)),
    radial-gradient(ellipse at 50% 72%, rgba(40, 90, 70, 0.22), rgba(0, 0, 0, 0.54) 76%),
    url('../assets/ui/rootfall-login-bg.jpg') center 30% / cover no-repeat,
    linear-gradient(180deg, rgba(255, 216, 102, 0.045), rgba(255, 216, 102, 0.00) 24%),
    radial-gradient(ellipse at 50% 82%, rgba(126, 180, 118, 0.18) 0%, rgba(8, 14, 11, 0.0) 64%),
    radial-gradient(circle at 50% 52%, rgba(16, 30, 24, 0.80) 0%, rgba(5, 10, 8, 0.82) 72%);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.28),
    inset 0 0 34px rgba(0, 0, 0, 0.70),
    inset 0 0 1px rgba(255, 216, 102, 0.42);
}

.pregame-lobby-stage .pregame-hero-preview-stage::after {
  content: '';
  position: absolute;
  inset: 5% 18% 16%;
  z-index: 2;
  background: url('../assets/ui/rootfall-tree-emblem.jpg') center center / contain no-repeat;
  opacity: 0.11;
  mix-blend-mode: screen;
  filter: saturate(0.82) contrast(0.85);
  pointer-events: none;
}

.pregame-lobby-stage .pregame-hero-preview-stage canvas {
  z-index: 1;
}

.pregame-lobby-labels {
  padding: 8px;
  background: rgba(0, 0, 0, 0.20);
  border: 1px solid rgba(180, 140, 80, 0.22);
  border-top: 0;
  border-radius: 0 0 6px 6px;
}

.pregame-lobby-label {
  padding: 3px 6px;
  border-right: 1px solid rgba(180, 140, 80, 0.18);
}
.pregame-lobby-label:last-child { border-right: none; }

.pregame-lobby-side {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.75fr);
  gap: 12px;
}

.pregame-quick-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(180, 140, 80, 0.30);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(15, 28, 22, 0.72), rgba(5, 10, 8, 0.58));
  backdrop-filter: blur(2px);
}

.pregame-quick-panel-muted {
  background:
    linear-gradient(180deg, rgba(40, 76, 62, 0.16), rgba(255, 255, 255, 0.02));
}

.pregame-lobby-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pregame-lobby-tools .pregame-btn {
  width: 100%;
  justify-content: center;
  padding: 10px 12px;
  letter-spacing: 0.09em;
}

.pregame-tutorial-panel {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(255, 216, 102, 0.42);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(24, 38, 30, 0.88), rgba(8, 16, 13, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 232, 170, 0.10);
}
.pregame-tutorial-panel.is-hidden {
  display: none;
}
.pregame-tutorial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.pregame-tutorial-close {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid rgba(180, 140, 80, 0.45);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(244, 244, 238, 0.72);
  cursor: pointer;
  font: 700 18px/1 system-ui, sans-serif;
}
.pregame-tutorial-close:hover {
  color: #ffd866;
  border-color: rgba(255, 216, 102, 0.62);
}
.pregame-tutorial-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.pregame-tutorial-steps li {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(180, 140, 80, 0.28);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.18);
}
.pregame-tutorial-steps b,
.pregame-tutorial-steps span {
  display: block;
}
.pregame-tutorial-steps b {
  margin-bottom: 5px;
  color: #ffd866;
  font: 700 12px/1.2 system-ui, sans-serif;
}
.pregame-tutorial-steps span {
  color: rgba(244, 244, 238, 0.76);
  font: 500 11px/1.35 system-ui, sans-serif;
}

.pregame-lobby-mini-copy,
.pregame-section-subtitle {
  font: 400 12px/1.45 'EB Garamond', Georgia, serif;
  color: rgba(214, 214, 207, 0.76);
}

.pregame-lobby-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(380px, 1.08fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.pregame-command-card {
  min-width: 0;
  margin-bottom: 0;
  padding: 14px;
  border: 1px solid rgba(180, 140, 80, 0.30);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(15, 28, 22, 0.72), rgba(5, 10, 8, 0.58));
  backdrop-filter: blur(2px);
}

.pregame-command-card-group {
  background:
    linear-gradient(180deg, rgba(20, 42, 34, 0.72), rgba(5, 10, 8, 0.58));
}

.pregame-section-head,
.pregame-party-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pregame-section-head .pregame-section-title,
.pregame-quick-panel .pregame-section-title {
  margin-top: 0;
}

.pregame-group-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.pregame-group-create .pregame-field { margin-bottom: 0; }

.pregame-divider-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  color: rgba(244, 244, 238, 0.44);
  font: 700 9px/1 system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.pregame-divider-label::before,
.pregame-divider-label::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: rgba(180, 140, 80, 0.20);
}

.pregame-party {
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.pregame-party-title {
  margin-bottom: 0;
  font-size: 12px;
}

.pregame-party-capacity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(180, 140, 80, 0.35);
  border-radius: 4px;
  color: #ffd866;
  background: rgba(0, 0, 0, 0.24);
  font: 700 11px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
}

.pregame-party-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.pregame-party-member {
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.18));
  border-color: rgba(180, 140, 80, 0.20);
}

.pregame-party-member-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pregame-party-member-detail {
  margin-right: 0;
  padding-left: 0;
}
.pregame-party-member-side {
  margin-left: auto;
  flex: 0 0 auto;
}

.pregame-party-member-role,
.pregame-party-member-reconnecting {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
}
.pregame-party-member-role.is-leader {
  border-color: rgba(255, 216, 102, 0.40);
  background: rgba(255, 216, 102, 0.08);
}

.pregame-party-controls {
  display: grid;
  grid-template-columns: minmax(250px, 1.5fr) minmax(150px, 0.8fr);
  gap: 12px;
  align-items: end;
}
.pregame-party-controls .pregame-field { margin-bottom: 0; }
.pregame-field-levels {
  grid-column: 1 / -1;
}

.pregame-code-chip {
  min-width: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 216, 102, 0.055) 0 1px, transparent 1px 10px),
    rgba(0, 0, 0, 0.35);
}

.pregame-command-card .pregame-btn-row {
  margin-top: 12px;
}

.pregame-command-card .pregame-btn-row .pregame-btn {
  min-height: 38px;
}

.pregame-command-card .pregame-btn:not(.pregame-btn-ghost) {
  min-width: 148px;
}

.pregame-lobby-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(180, 140, 80, 0.20);
}

@media (max-width: 900px) {
  .pregame-lobby-command {
    grid-template-columns: minmax(0, 1fr);
  }
  .pregame-lobby-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .pregame-lobby-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pregame-lobby-tools {
    grid-template-columns: minmax(0, 1fr);
  }
  .pregame-tutorial-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .pregame-lobby-panel {
    padding: 22px 18px 18px;
  }
  .pregame-lobby-header,
  .pregame-section-head,
  .pregame-party-head {
    align-items: stretch;
  }
  .pregame-lobby-side,
  .pregame-group-create,
  .pregame-party-controls {
    grid-template-columns: minmax(0, 1fr);
  }
  .pregame-lobby-stage .pregame-hero-preview-stage {
    height: clamp(280px, 68vw, 360px);
  }
  .pregame-join-row {
    align-items: stretch;
    flex-direction: column;
  }
  .pregame-join-row .pregame-btn,
  .pregame-group-create .pregame-btn,
  .pregame-command-card .pregame-btn {
    width: 100%;
  }
  .pregame-party-member {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .pregame-party-member-side {
    margin-left: 0;
  }
}

/* Laptop windows (~768-940px tall): compress the panel chrome so Character
 * Select / Run Lobby render without internal scroll on common screens.
 * The height-aware preview clamps above cover taller windows; this tier
 * adds the extra squeeze for shorter ones. The shell keeps overflow-y:auto
 * as a fallback; this just makes scrolling unnecessary at the default sizes. */
@media (max-height: 1080px) {
  #pregame-shell {
    padding: 14px 18px 16px;
  }
  .pregame-panel {
    padding: 14px 20px 12px;
  }
  .pregame-character-panel {
    padding: 8px 16px 12px;
  }
  .pregame-header,
  .pregame-lobby-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  .pregame-title {
    font-size: 22px;
  }
  .pregame-subtitle {
    font-size: 12px;
  }
  .pregame-choose-hero {
    gap: 12px;
    margin-bottom: 10px;
  }
  .pregame-roster-col {
    padding: 10px;
  }

  /* Lobby — keep the "one big featured preview" design intent, but at
   * short viewports it has to share a row with the Loadout/Status side
   * panel or the panel runs ~1200px tall and pushes Start Run below
   * the fold. The two-column flip + a smaller preview lets the whole
   * panel land in 720-768px. */
  .pregame-lobby-command {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
    gap: 10px;
    margin-bottom: 8px;
  }
  .pregame-lobby-stage .pregame-hero-preview-stage {
    height: clamp(220px, 30vh, 320px);
  }
  .pregame-character-panel .pregame-hero-preview-stage {
    height: clamp(280px, 56vh, 460px);
  }
  .pregame-lobby-side {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .pregame-quick-panel {
    padding: 8px 10px;
    gap: 8px;
  }
  .pregame-lobby-tools .pregame-btn {
    padding: 8px 10px;
  }
  .pregame-tutorial-panel {
    padding: 10px 12px;
    margin: 10px 0;
  }
  .pregame-tutorial-steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .pregame-lobby-grid {
    gap: 10px;
    margin-bottom: 6px;
  }
  .pregame-command-card {
    padding: 10px 12px;
  }
  .pregame-section-head,
  .pregame-party-head {
    margin-bottom: 8px;
  }
  .pregame-lobby-footer {
    padding-top: 8px;
  }
  .pregame-lobby-footer .pregame-back {
    margin-top: 6px;
  }
}

/* ============================================================
 * FORGED-HUD REDESIGN — Character Select + Run Lobby
 * Sharper "forged" chrome over the existing command-screen layout:
 * tighter corner radii, a gold top-accent bar on the wide panel,
 * L-bracket corners + a glowing pedestal on the preview stage, a
 * gold tick before each section label, brass button plates, a gear
 * crest, and engraved (Cinzel) micro-labels. CSS-only over the
 * existing markup + IDs — the builders/handlers are untouched.
 * ============================================================ */
:root {
  --rf-gold: #ffd866;
  --rf-gold-bright: #ffe08a;
  --rf-copper-deep: #b8842f;
  --rf-teal: #b8e8de;
  --rf-line: rgba(180, 140, 80, 0.30);
  --rf-line-strong: rgba(180, 140, 80, 0.45);
  --rf-caps: 'Cinzel', 'IM Fell English', Georgia, serif;
  --rf-serif-display: 'IM Fell English', 'EB Garamond', Georgia, serif;
}

/* ---- forged radii ---- */
.pregame-panel { border-radius: 3px; }
.pregame-roster-col,
.pregame-quick-panel,
.pregame-command-card,
.pregame-hero-preview-stage,
.pregame-tutorial-panel,
.pregame-roster-row,
.pregame-party-member,
.pregame-lobby-topbar { border-radius: 3px; }
.pregame-btn,
.pregame-input,
.pregame-select,
.pregame-segmented,
.pregame-code-chip { border-radius: 2px; }

/* ---- gold top-accent bar on the wide screen panel ---- */
.pregame-character-panel,
.pregame-lobby-panel { position: relative; }
.pregame-character-panel::before,
.pregame-lobby-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, transparent, var(--rf-gold) 28%, var(--rf-gold) 72%, transparent);
  box-shadow: 0 0 12px rgba(255, 216, 102, 0.4);
  opacity: 0.9;
  pointer-events: none;
  z-index: 1;
}

/* ---- page-head title: larger forged display ---- */
.pregame-title {
  font-size: clamp(32px, 3.6vw, 50px);
  line-height: 1.02;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 16px rgba(255, 216, 102, 0.30),
    0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ---- gold tick before each section label ---- */
.pregame-section-title {
  position: relative;
  padding-left: 16px;
  font-family: var(--rf-caps);
  letter-spacing: 0.24em;
}
.pregame-section-title::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 14px;
  background: var(--rf-gold);
  box-shadow: 0 0 8px rgba(255, 216, 102, 0.6);
}

/* ---- topbar: gear crest + engraved nav ---- */
.pregame-lobby-avatar {
  color: transparent;
  border: 1.5px solid var(--rf-gold);
  background:
    radial-gradient(circle, rgba(46, 32, 12, 0.92) 0 40%, transparent 42%),
    repeating-conic-gradient(from 0deg, var(--rf-gold) 0 18deg, transparent 18deg 36deg);
  box-shadow:
    0 0 18px rgba(255, 216, 102, 0.30),
    inset 0 0 12px rgba(10, 8, 4, 0.6);
}
.pregame-lobby-currencies {
  font-family: var(--rf-caps);
  letter-spacing: 0.18em;
  color: var(--rf-gold);
}
.pregame-lobby-currencies span:last-child { color: rgba(244, 244, 238, 0.55); }

/* ---- chips / status pills ---- */
.pregame-chip,
.pregame-lobby-status-chip {
  border-radius: 2px;
  font-family: var(--rf-caps);
  letter-spacing: 0.16em;
}

/* ---- brass plate buttons ---- */
.pregame-btn {
  font-family: var(--rf-caps);
  letter-spacing: 0.18em;
}
.pregame-btn:not(.pregame-btn-ghost):not(.pregame-btn-danger) {
  color: #3a2a10;
  border: 1px solid var(--rf-copper-deep);
  background: linear-gradient(180deg, var(--rf-gold-bright), var(--rf-gold) 45%, var(--rf-copper-deep));
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 220, 0.7),
    inset 0 -2px 4px rgba(120, 80, 40, 0.5),
    0 6px 16px -8px #000;
}
.pregame-btn:not(.pregame-btn-ghost):not(.pregame-btn-danger):hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 220, 0.8),
    inset 0 -2px 4px rgba(120, 80, 40, 0.5),
    0 0 22px rgba(255, 216, 102, 0.45),
    0 6px 16px -8px #000;
}
.pregame-btn-ghost {
  font-family: var(--rf-caps);
  letter-spacing: 0.16em;
}

/* segmented active -> gold plate */
.pregame-segmented button {
  font-family: var(--rf-caps);
  letter-spacing: 0.14em;
}
.pregame-segmented button.active {
  color: #3a2a10;
  background: linear-gradient(180deg, var(--rf-gold-bright), var(--rf-copper-deep));
}
.pregame-segmented button.active .pregame-segmented-est { color: rgba(58, 42, 16, 0.72); }

/* ---- preview stage: L-bracket corners ---- */
.pregame-cornered { position: relative; }
.pregame-corner {
  position: absolute;
  width: 18px; height: 18px;
  z-index: 3;
  pointer-events: none;
}
.pregame-corner::before {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid var(--rf-gold);
  filter: drop-shadow(0 0 6px rgba(255, 216, 102, 0.5));
}
.pregame-corner.tl { top: 9px; left: 9px; }
.pregame-corner.tl::before { border-right: none; border-bottom: none; }
.pregame-corner.tr { top: 9px; right: 9px; }
.pregame-corner.tr::before { border-left: none; border-bottom: none; }
.pregame-corner.bl { bottom: 9px; left: 9px; }
.pregame-corner.bl::before { border-right: none; border-top: none; }
.pregame-corner.br { bottom: 9px; right: 9px; }
.pregame-corner.br::before { border-left: none; border-top: none; }

/* ---- footer links: engraved tracked caps ---- */
.pregame-lobby-footer .pregame-back,
.pregame-back {
  font-family: var(--rf-caps);
  letter-spacing: 0.22em;
}

/* ---- divider label: engraved ---- */
.pregame-divider-label { font-family: var(--rf-caps); letter-spacing: 0.2em; }

/* Genuinely short windows (~768px): a last squeeze so the Run Lobby
 * (preview + Loadout/Status + Start Run) clears the fold. Placed at the
 * end of the file so it wins the cascade over the forged-chrome rules
 * above. Shrink-only — nothing is hidden. */
@media (max-height: 800px) {
  .pregame-lobby-stage .pregame-hero-preview-stage {
    height: clamp(176px, 23vh, 260px);
  }
  .pregame-character-panel .pregame-hero-preview-stage {
    height: clamp(240px, 50vh, 420px);
  }
  .pregame-lobby-header { margin-bottom: 6px; padding-bottom: 4px; }
  .pregame-lobby-topbar { margin-bottom: 8px; }
  .pregame-lobby-labels { padding: 5px; }
  .pregame-lobby-command { margin-bottom: 4px; }
  /* The command row is bounded by the side panel and the grid by the
   * group card, not by the preview — trim those so Start Run clears the
   * fold. Nothing is hidden; only padding/gaps tighten. */
  .pregame-lobby-side { gap: 6px; }
  .pregame-quick-panel { padding: 8px 9px; gap: 7px; }
  .pregame-lobby-tools { gap: 6px; }
  .pregame-lobby-tools .pregame-btn { padding: 7px 9px; }
  .pregame-lobby-grid { gap: 8px; margin-bottom: 4px; }
  .pregame-command-card { padding: 8px 11px; }
  .pregame-section-head,
  .pregame-party-head { margin-bottom: 6px; }
  .pregame-run-length-row { margin-bottom: 6px; }
  .pregame-lobby-topbar { padding: 5px 10px; }
  .pregame-input,
  .pregame-select { padding: 7px 12px; }
  .pregame-group-join { margin-top: 8px; padding-top: 8px; }
  .pregame-divider-label { margin-top: 8px; }
  .pregame-lobby-footer { padding-top: 6px; }
}
