/* ==========================================================================
   STICK ARENA RESKIN — FLOW SCREENS
   #screen-practice, #screen-host, #screen-lobby (room lobby), #screen-results.
   Loads after styles.css / prestige.css / sa-core.css: scoped ID selectors win
   over the legacy light theme by specificity, and over sa-core by cascade.
   Only tokens from sa-core.css are used; no :root redefinitions here.
   ========================================================================== */

/* --- Screen backdrops: dark SA steel inset inside the light plate --------- */
/* Light plate frame -> dark screen well -> medium steel panels -> deep wells,
   the same four-layer depth as the 2007 Flash lobby. */
#screen-practice,
#screen-host,
#screen-lobby,
#screen-results {
  width: calc(100% - 20px);
  min-height: 680px;
  margin: 10px;
  border: var(--sa-frame);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--sa-steel-700) 0%, var(--sa-steel-800) 58%, var(--sa-steel-900) 100%);
  box-shadow: var(--sa-bevel-well), 0 2px 10px rgba(0, 0, 0, 0.35);
  padding: 18px 20px 20px;
  color: #dce8f4;
}

/* --- Section headings: pixel gold eyebrow + chunky light title ------------ */
#screen-practice .section-heading,
#screen-host .section-heading,
#screen-lobby .section-heading {
  border-bottom: 2px solid rgba(13, 20, 29, 0.85);
  padding-bottom: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);
}
#screen-practice .eyebrow,
#screen-host .eyebrow,
#screen-lobby .eyebrow,
#screen-results .eyebrow {
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 210, 63, 0.25);
}
#screen-practice .section-heading h1,
#screen-host .section-heading h1,
#screen-lobby .section-heading h1,
#screen-results .results-heading h1 {
  color: #f2f7fc;
  font-family: var(--sa-chunky);
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 5px 12px rgba(0, 0, 0, 0.35);
}
#screen-practice .section-heading > div > p:last-child,
#screen-host .section-heading > div > p:last-child,
#screen-lobby .section-heading > div > p:last-child,
#screen-results .results-heading p:last-child {
  color: #9db4cc;
}
#screen-results .results-heading {
  border-bottom: 2px solid rgba(13, 20, 29, 0.85);
  padding-bottom: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Back / cancel: .button-ghost is already SA steel from sa-core (verified). */

/* --- Panel typography on dark steel --------------------------------------- */
#screen-practice .panel h2,
#screen-host .panel h2,
#screen-lobby .panel h2,
#screen-results .panel h2 {
  color: #f2f7fc;
  font-family: var(--sa-chunky);
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}
#screen-practice .field-label,
#screen-host .field-label,
#screen-lobby .field-label {
  color: #9db4cc;
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.14em;
}
#screen-practice .panel-title-row span,
#screen-host .panel-title-row span,
#screen-lobby .panel-title-row span,
#screen-results .panel-title-row span {
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: #8fb1d8;
}
#screen-lobby #roster-count { color: var(--sa-gold); }
#screen-lobby #lobby-ranked-label {
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
#screen-lobby .muted-copy {
  color: #8fb1d8;
  font-family: var(--sa-pixel);
  font-size: 8px;
  line-height: 1.6;
}

/* --- Map cards: chunky steel 3D cards -------------------------------------- */
#screen-practice .map-card,
#screen-host .map-card,
#screen-lobby .map-card {
  border: 2px solid var(--sa-btn-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--sa-steel-500) 0%, var(--sa-steel-600) 55%, var(--sa-steel-700) 100%);
  box-shadow: var(--sa-bevel-panel), 0 2px 0 rgba(0, 0, 0, 0.4);
  color: #eef4fa;
  transition: transform 80ms ease, box-shadow 80ms ease, border-color 80ms ease, filter 80ms ease;
}
#screen-practice .map-card canvas,
#screen-host .map-card canvas,
#screen-lobby .map-card canvas {
  background: var(--sa-well-deep);
  border-bottom: 2px solid #0d141d;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}
#screen-practice .map-card-copy strong,
#screen-host .map-card-copy strong,
#screen-lobby .map-card-copy strong {
  color: #f2f7fc;
  font-family: var(--sa-chunky);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}
#screen-practice .map-card-copy small,
#screen-host .map-card-copy small,
#screen-lobby .map-card-copy small {
  color: #9db4cc;
  font-family: var(--sa-pixel);
  font-size: 9px;
}
#screen-practice .map-card > i,
#screen-host .map-card > i,
#screen-lobby .map-card > i {
  border: 1px solid #000;
  background: rgba(11, 15, 22, 0.88);
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
#screen-practice .map-card:hover,
#screen-host .map-card:hover,
#screen-lobby .map-card:hover {
  border-color: var(--sa-bar-hi);
  filter: brightness(1.07);
  transform: translateY(-2px);
  box-shadow: var(--sa-bevel-panel), 0 5px 12px rgba(0, 0, 0, 0.5);
}
#screen-practice .map-card.selected,
#screen-host .map-card.selected,
#screen-lobby .map-card.selected {
  border-color: var(--sa-gold);
  box-shadow:
    0 0 0 2px rgba(255, 210, 63, 0.38),
    0 0 16px rgba(255, 210, 63, 0.2),
    var(--sa-bevel-panel),
    0 2px 0 rgba(0, 0, 0, 0.4);
}
#screen-practice .map-card.selected .map-card-copy strong,
#screen-host .map-card.selected .map-card-copy strong,
#screen-lobby .map-card.selected .map-card-copy strong {
  color: var(--sa-gold);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 210, 63, 0.3);
}

/* --- Choice cards (host radios/checkbox): steel buttons, pressed w/ gold --- */
#screen-host .choice-card {
  border: 2px solid var(--sa-btn-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--sa-steel-400) 0%, var(--sa-steel-500) 55%, var(--sa-steel-600) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -3px 0 rgba(0, 0, 0, 0.3),
    0 2px 0 rgba(0, 0, 0, 0.4);
  transition: filter 80ms ease, transform 60ms ease, box-shadow 60ms ease;
}
#screen-host .choice-card:hover { filter: brightness(1.08); }
#screen-host .choice-card:active { transform: translateY(1px); }
#screen-host .choice-card b {
  color: #f2f7fc;
  font-family: var(--sa-chunky);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
}
#screen-host .choice-card small {
  color: #b8cadd;
  font-family: var(--sa-pixel);
  font-size: 8px;
  line-height: 1.55;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
#screen-host .choice-card input { accent-color: var(--sa-gold-dark); }
#screen-host .choice-card:has(input:checked) {
  border-color: var(--sa-gold-dark);
  background: linear-gradient(180deg, var(--sa-btn-hi) 0%, var(--sa-btn-mid) 60%, var(--sa-btn-lo) 100%);
  box-shadow:
    inset 0 2px 5px rgba(30, 45, 62, 0.42),
    inset 0 -1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 2px rgba(255, 210, 63, 0.35),
    0 0 14px rgba(255, 210, 63, 0.18);
}
#screen-host .choice-card:has(input:checked) b {
  color: var(--sa-btn-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
#screen-host .choice-card:has(input:checked) small {
  color: #41576e;
  text-shadow: none;
}
#screen-host .choice-card:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }

/* Selected custom map chip (host sidebar) */
#screen-host .selected-custom-map-card {
  border: var(--sa-frame);
  border-radius: 8px;
  background: var(--sa-well);
  box-shadow: var(--sa-bevel-well);
  color: #dce8f4;
}
#screen-host .selected-custom-map-card strong {
  color: var(--sa-gold);
  font-family: var(--sa-chunky);
  font-weight: 800;
}
#screen-host .selected-custom-map-card small {
  color: #8fb1d8;
  font-family: var(--sa-pixel);
  font-size: 8px;
}

/* ==========================================================================
   ROOM LOBBY
   ========================================================================== */

/* --- Room code strip: dark well chip with big pixel gold code -------------- */
#screen-lobby .lobby-code-strip {
  border: var(--sa-frame);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--sa-steel-600) 0%, var(--sa-steel-700) 100%);
  box-shadow: var(--sa-bevel-panel), 0 2px 0 rgba(0, 0, 0, 0.35);
  color: #9db4cc;
  font-family: var(--sa-pixel);
  font-size: 9px;
  letter-spacing: 0.12em;
}
#screen-lobby .lobby-code-strip small {
  color: #7fa5c4;
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#screen-lobby .room-code {
  border: 2px solid var(--sa-well-line);
  border-radius: 6px;
  background: var(--sa-well-deep);
  box-shadow: var(--sa-bevel-well);
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.35), 0 1px 0 rgba(0, 0, 0, 0.8);
  transition: filter 80ms ease, transform 60ms ease;
}
#screen-lobby .room-code:hover { filter: brightness(1.25); }
#screen-lobby .room-code:active { transform: translateY(1px); }

/* --- Roster: pastel player rows like the SA players list -------------------- */
/* background-color only: prestige.css overlays --skin-tint as background-image. */
#screen-lobby .roster-list {
  border: var(--sa-frame);
  background: var(--sa-well-deep);
  box-shadow: var(--sa-bevel-well);
}
#screen-lobby .roster-row {
  border-bottom: 2px solid var(--sa-well-line);
  color: #16283c;
}
#screen-lobby .roster-row:nth-child(6n+1) { background-color: var(--sa-row-yellow); }
#screen-lobby .roster-row:nth-child(6n+2) { background-color: var(--sa-row-cream); }
#screen-lobby .roster-row:nth-child(6n+3) { background-color: var(--sa-row-salmon); }
#screen-lobby .roster-row:nth-child(6n+4) { background-color: var(--sa-row-cyan); }
#screen-lobby .roster-row:nth-child(6n+5) { background-color: var(--sa-row-blue); }
#screen-lobby .roster-row:nth-child(6n+6) { background-color: var(--sa-row-purple); }
#screen-lobby .roster-identity strong {
  color: #16283c;
  font-family: var(--sa-chunky);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
#screen-lobby .roster-identity small {
  color: #4a6076;
  font-family: var(--sa-pixel);
  font-size: 8px;
}
#screen-lobby .presence {
  color: #54687c;
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
}
#screen-lobby .presence.online { color: #237a1c; }
/* Hover: SA selected-row blue. Placed after the pastel cycle (equal specificity
   with the ID scope, cascade order decides). */
#screen-lobby .roster-row:hover {
  background-color: var(--sa-sel-bg);
  color: var(--sa-sel-ink);
}
#screen-lobby .roster-row:hover .roster-identity strong { color: var(--sa-sel-ink); }
#screen-lobby .roster-row:hover .roster-identity small { color: #33566f; }
#screen-lobby .roster-row:hover .presence { color: #3c5a74; }
#screen-lobby .roster-row:hover .presence.online { color: #2e7a2a; }
/* Local player: gold spine, keeps its pastel. */
#screen-lobby .roster-row.local { box-shadow: inset 4px 0 0 var(--sa-gold-dark); }

/* --- Map preview + compact grid + host controls ----------------------------- */
#screen-lobby .lobby-map-preview {
  padding: 8px;
  border: var(--sa-frame);
  border-radius: 8px;
  background: var(--sa-well);
  box-shadow: var(--sa-bevel-well);
}
#screen-lobby .lobby-controls label > span {
  color: #9db4cc;
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.12em;
}

/* --- Room chat: deep well with pixel lines ---------------------------------- */
#screen-lobby #room-chat-list {
  min-height: 380px;
  max-height: 470px;
  border: var(--sa-frame);
  border-radius: 6px;
  background: var(--sa-well);
  box-shadow: var(--sa-bevel-well);
  color-scheme: dark;
}
#screen-lobby #room-chat-list .chat-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--sa-pixel);
  font-size: 9px;
  line-height: 1.6;
}
#screen-lobby #room-chat-list .chat-name {
  font-family: var(--sa-pixel);
  font-size: 9px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
#screen-lobby #room-chat-list .chat-text {
  color: var(--sa-chat-text);
  font-family: var(--sa-pixel);
  font-size: 9px;
}
#screen-lobby .chat-form {
  border-top: 2px solid #0d141d;
  background: linear-gradient(180deg, var(--sa-steel-600) 0%, var(--sa-steel-700) 100%);
  border-radius: 0 0 8px 8px;
}

/* ==========================================================================
   RESULTS
   ========================================================================== */

/* --- Standings: SA leaderboard well ---------------------------------------- */
#screen-results .results-table-head {
  color: #8fb1d8;
  font-family: var(--sa-pixel);
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 4px 8px 8px;
}
#screen-results .results-list {
  border: var(--sa-frame);
  border-radius: 6px;
  background: var(--sa-well);
  box-shadow: var(--sa-bevel-well);
  overflow: hidden;
}
#screen-results .result-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #cfe1f2;
}
#screen-results .result-row:first-child { border-top: 0; }
#screen-results .result-identity strong {
  color: #f2f7fc;
  font-family: var(--sa-chunky);
  font-size: 13px;
  font-weight: 800;
}
#screen-results .result-identity small {
  color: #7fa5c4;
  font-family: var(--sa-pixel);
  font-size: 8px;
}
#screen-results .result-place {
  color: #8fb1d8;
  font-family: var(--sa-pixel);
  font-size: 12px;
}
#screen-results .result-row > b:not(.result-place),
#screen-results .result-row > span {
  font-family: var(--sa-pixel);
  font-size: 10px;
}
#screen-results .rating-change { font-family: var(--sa-pixel); font-size: 9px; }
#screen-results .rating-change.positive { color: var(--sa-chat-green); }
#screen-results .rating-change.negative { color: var(--sa-chat-red); }
/* Winner: gold wash + gold place. */
#screen-results .result-row.winner {
  background: linear-gradient(90deg, rgba(255, 210, 63, 0.16) 0%, rgba(255, 210, 63, 0.04) 70%, transparent 100%);
  color: var(--sa-gold);
}
#screen-results .result-row.winner .result-place {
  color: var(--sa-gold);
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.4), 0 1px 0 rgba(0, 0, 0, 0.7);
}
#screen-results .result-row.winner .result-identity strong { color: var(--sa-gold); }
/* Local row: selected blue, after .winner so local+winner still reads as you. */
#screen-results .result-row.local {
  background: var(--sa-sel-bg);
  box-shadow: inset 4px 0 0 var(--sa-gold-dark);
  color: var(--sa-sel-ink);
}
#screen-results .result-row.local .result-identity strong { color: var(--sa-sel-ink); }
#screen-results .result-row.local .result-identity small { color: #33566f; }
#screen-results .result-row.local .result-place { color: var(--sa-sel-ink); }
#screen-results .result-row.local > span { color: var(--sa-sel-ink); }

/* --- Reward card: gold career accents --------------------------------------- */
#screen-results .reward-card {
  border-color: var(--sa-gold-outline);
  box-shadow:
    var(--sa-bevel-panel),
    0 3px 8px rgba(0, 0, 0, 0.4),
    inset 0 3px 0 rgba(255, 210, 63, 0.5);
}
#screen-results .reward-title {
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 210, 63, 0.3);
}
#screen-results .reward-rating {
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow:
    1px 1px 0 var(--sa-gold-outline),
    -1px 1px 0 var(--sa-gold-outline),
    1px -1px 0 var(--sa-gold-outline),
    -1px -1px 0 var(--sa-gold-outline),
    0 3px 4px rgba(0, 0, 0, 0.6);
}
#screen-results .reward-card p {
  color: #9db4cc;
  font-family: var(--sa-pixel);
  font-size: 9px;
  line-height: 1.7;
}

/* --- Mobile (matches styles.css @900px: fixed bottom nav needs clearance) --- */
@media (max-width: 900px) {
  #screen-practice,
  #screen-host,
  #screen-lobby,
  #screen-results {
    min-height: 0;
    margin: 6px;
    width: calc(100% - 12px);
    padding: 14px 12px 70px;
  }
}

/* --- Reduced motion: no hover lifts ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #screen-practice .map-card,
  #screen-host .map-card,
  #screen-lobby .map-card,
  #screen-host .choice-card,
  #screen-lobby .room-code {
    transition: none;
  }
  #screen-practice .map-card:hover,
  #screen-host .map-card:hover,
  #screen-lobby .map-card:hover {
    transform: none;
  }
}

/* Integration: HOST badge chip in the room roster (orchestrator). */
#screen-lobby .roster-row .host-badge {
  margin-left: 6px;
  padding: 1px 5px 0;
  border: 1px solid var(--sa-gold-outline);
  border-radius: 3px;
  background: linear-gradient(180deg, var(--sa-gold-hi), var(--sa-gold-dark));
  color: #3a2c04;
  font-family: var(--sa-pixel);
  font-size: 7px;
  letter-spacing: .08em;
  vertical-align: 2px;
}
