/* M4-P2 host-lobby material slice (local; pending Codex review).
   Scoped to #screenHostLobby only. Art is three cropped WebP derivatives of the
   approved ui-kit-v2 masters (see evidence/m4-p2-host-lobby/derivatives.json),
   drawn as nine-slice border-images behind live HTML text and real controls.
   Every surface keeps a solid CSS fallback, so the lobby stays readable and usable
   if an image is slow or missing. arena-controls.css sets site-wide !important
   button colours; the !important declarations below override them only here.
   Its `border: ... !important` shorthand also resets border-image to none, so
   every button border-image here must be !important as well.
   Cream rows, fields, the room-code inset and destructive buttons are CSS
   constructions: their heights vary with content, and the row art's portrait
   socket would distort if stretched. */
#screenHostLobby.knightLobby {
  --lm-panel-art: url('ui-kit-navy-panel.webp');
  --lm-gold-art: url('ui-kit-gold-button.webp');
  --lm-navy-art: url('ui-kit-navy-button.webp');
  --lm-ink: #172a4f;
  --lm-pale: #fff7e5;
  --lm-soft: #dbe5f7;
  --lm-label: #f5dc9a;
  --lm-navy: #17418f;
  --lm-rim: #d9a441;
  --lm-rail: linear-gradient(145deg, #fff2bb 0%, #eac262 27%, #9c631b 58%, #f9d875 79%, #b17b2f 100%);
  --lm-cream: linear-gradient(170deg, #fffdf4, #f4e7cc);
  --lm-ledge: #8a5a14;
  --lm-focus-dark: #ffffff;
  --lm-focus-light: #1452c4;
  --lm-panel-rim: 36px;
}

/* ===== Navy/gold panels: header, welcome banner, both lobby panels ===== */
#screenHostLobby.knightLobby :is(header, .knightWelcome, .panel) {
  border: 12px solid var(--lm-rim);
  border-image: var(--lm-panel-art) 72 fill / var(--lm-panel-rim) stretch;
  background: var(--lm-navy) padding-box;
  border-radius: 21px;
  box-shadow: 0 5px 0 #6b4712, 0 14px 30px #0a1a3a59;
  color: var(--lm-pale);
}
#screenHostLobby.knightLobby header { padding: 10px 14px; }
#screenHostLobby.knightLobby .headerTitle { color: #fff3cf; }
#screenHostLobby.knightLobby :is(.sub, .hostEmail) { color: var(--lm-soft); }
#screenHostLobby.knightLobby .knightWelcome { padding: 10px 22px; margin: 18px 0; }
#screenHostLobby.knightLobby .knightWelcome h1 { color: #fff3cf; text-shadow: 0 2px 0 #0a1f4d; }
#screenHostLobby.knightLobby .knightWelcome p { color: var(--lm-soft); }
#screenHostLobby.knightLobby .lobbyGrid { gap: 20px; align-items: start; }
#screenHostLobby.knightLobby .panel h2 {
  position: relative;
  background: transparent;
  color: #ffe39b;
  border-bottom: 0;
  padding: 12px 14px 12px;
  font-size: 15px;
  letter-spacing: .12em;
}
#screenHostLobby.knightLobby .panel h2::after {
  content: "";
  position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #eac262, transparent);
  pointer-events: none;
}
#screenHostLobby.knightLobby .connectedCount { color: #a8f0c0; }
#screenHostLobby.knightLobby .controls { padding: 12px 12px 14px; }

/* ===== Settings groups and fields on navy ===== */
#screenHostLobby.knightLobby .box {
  background: #0b265c8c;
  border: 1px solid #e3b95a73;
  border-radius: 16px;
  color: var(--lm-pale);
  box-shadow: inset 0 1px 0 #ffffff14;
}
#screenHostLobby.knightLobby .label { color: var(--lm-label); }
#screenHostLobby.knightLobby select {
  border: 2px solid transparent;
  background: var(--lm-cream) padding-box, var(--lm-rail) border-box;
  color: var(--lm-ink);
  border-radius: 12px;
  min-height: 48px;
  box-shadow: inset 0 2px 4px #142c5526;
}
#screenHostLobby.knightLobby .themePreview { background: #0a1f4d; border: 1px solid #e3b95a; border-radius: 12px; }

/* Cream room-code inset: live text, tabular digits. */
#screenHostLobby.knightLobby .codeBig {
  border: 4px solid transparent;
  background: var(--lm-cream) padding-box, var(--lm-rail) border-box;
  color: var(--lm-ink);
  text-shadow: 0 1px 0 #fff;
  border-radius: 18px;
  box-shadow: inset 0 3px 6px #7a5a2a33, 0 3px 0 var(--lm-ledge), 0 8px 16px #07182d40;
  font-size: clamp(34px, 7vw, 52px);
  font-variant-numeric: tabular-nums;
  padding: 6px 0 6px .2em;
}

/* Cream status boxes (lobby status and the empty-roster notice). */
#screenHostLobby.knightLobby .status {
  background: #fff6de;
  color: var(--lm-ink);
  border: 2px solid #e3b95a;
  border-left-width: 6px;
  border-radius: 12px;
}

/* ===== Buttons ===== */
#screenHostLobby.knightLobby button { transition: transform .15s ease, filter .15s ease, box-shadow .15s ease; }
#screenHostLobby.knightLobby .row > button { flex: 1 1 160px; }
#screenHostLobby.knightLobby :is(.qrShowBtn, .tvShowBtn) { width: 100%; margin-top: 12px; }
#screenHostLobby.knightLobby #savedRecordStatus { margin-top: 10px; }

/* Gold primary: nine-slice of the approved gold button (slice 56/76 of 494x144). */
#screenHostLobby.knightLobby :is(button.ok, button.warn, .qrShowBtn, .tvShowBtn) {
  border: 4px solid #c08a2a !important;
  border-image: var(--lm-gold-art) 56 76 fill / 22px 30px stretch !important;
  background: #f8cf4f padding-box !important;
  color: var(--lm-ink) !important;
  text-shadow: 0 1px 0 #fff8 !important;
  border-radius: 999px;
  box-shadow: var(--lm-state-shadow, 0 4px 0 var(--lm-ledge), 0 9px 16px #07182d4d) !important;
  min-height: 48px;
  padding: 10px 26px;
}
#screenHostLobby.knightLobby #btnStartGame {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 16px;
  font-size: 20px;
  letter-spacing: .08em;
  border-image-width: 29px 40px !important;
}

/* Navy secondary: nine-slice of the approved navy button. */
#screenHostLobby.knightLobby :is(.mini:not(.danger):not(.logout), button[id="btnNewCode"]) {
  border: 4px solid #c08a2a !important;
  border-image: var(--lm-navy-art) 56 76 fill / 20px 27px stretch !important;
  background: #123c8a padding-box !important;
  color: var(--lm-pale) !important;
  border-radius: 999px;
  box-shadow: var(--lm-state-shadow, 0 3px 0 #6b4712, 0 7px 12px #07182d4d) !important;
  min-height: 44px;
  padding: 8px 20px;
}

/* Destructive: same gold rail, red face, text labels kept. */
#screenHostLobby.knightLobby :is(button.danger, button.logout) {
  border: 3px solid transparent !important;
  background: linear-gradient(160deg, #b8424b, #7a2230) padding-box, var(--lm-rail) border-box !important;
  color: #fff !important;
  border-radius: 999px;
  box-shadow: var(--lm-state-shadow, inset 0 2px 1px #ffffff40, inset 0 -3px 2px #3a0a1266, 0 3px 0 #6b4712, 0 7px 12px #07182d4d) !important;
  min-height: 44px;
  padding: 8px 18px;
}

/* Interaction states for every lobby button family. Families read their shadow
   through --lm-state-shadow so these lower-specificity state rules can change it. */
#screenHostLobby.knightLobby button:hover:not(:disabled):not([aria-busy="true"]) { filter: brightness(1.07) saturate(1.05); transform: translateY(-1px); }
#screenHostLobby.knightLobby button:active:not(:disabled):not([aria-busy="true"]) {
  filter: brightness(.95);
  transform: translateY(3px);
  --lm-state-shadow: 0 1px 0 #6b4712, 0 3px 6px #07182d40;
}
#screenHostLobby.knightLobby button:is(:disabled, [aria-busy="true"]) {
  filter: grayscale(.85) brightness(.92);
  opacity: .65;
  cursor: not-allowed;
  transform: none;
  --lm-state-shadow: none;
}
#screenHostLobby.knightLobby button[aria-busy="true"] { cursor: progress; }

/* ===== Roster ===== */
#screenHostLobby.knightLobby #playersList { padding: 4px 6px 10px 2px; }
#screenHostLobby.knightLobby .playerRow {
  position: relative;
  flex-shrink: 0; /* #playersList is a height-capped flex column; rows must grow, not squash. */
  min-height: 58px;
  padding: 6px 8px 6px 58px;
  border: 3px solid transparent;
  background: var(--lm-cream) padding-box, var(--lm-rail) border-box;
  color: var(--lm-ink);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #9c6b25, 0 6px 12px #07182d40;
}
/* Neutral decorative socket from the approved row art; not a player avatar. */
#screenHostLobby.knightLobby .playerRow::before {
  content: "";
  position: absolute; left: 9px; top: 50%;
  width: 36px; height: 36px; margin-top: -18px;
  border: 3px solid transparent;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5b8fdc 0, #1a4aa2 40%, #0b2a6b 100%) padding-box, var(--lm-rail) border-box;
  box-shadow: inset 0 2px 3px #ffffff55, 0 1px 2px #07182d66;
  pointer-events: none;
}
#screenHostLobby.knightLobby .playerInfo { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; gap: 4px 10px; }
#screenHostLobby.knightLobby .playerName { min-width: 0; overflow-wrap: anywhere; font-size: 17px; color: var(--lm-ink); }
#screenHostLobby.knightLobby .deletePlayerBtn {
  flex: 0 0 44px;
  width: 44px; min-width: 44px; height: 44px; min-height: 44px;
  padding: 0;
  border: 2px solid transparent !important;
  background: linear-gradient(160deg, #fff1ee, #f3cdc7) padding-box, var(--lm-rail) border-box !important;
  color: #7a1f2a !important;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: var(--lm-state-shadow, inset 0 0 0 2px #c0525a, 0 2px 0 #9c6b25, 0 4px 8px #07182d30) !important;
}

/* ===== Checklist on cream ===== */
#screenHostLobby.knightLobby .quickGuide {
  border: 3px solid transparent;
  background: var(--lm-cream) padding-box, var(--lm-rail) border-box;
  color: var(--lm-ink);
  border-radius: 16px;
  box-shadow: 0 3px 0 #9c6b25, 0 8px 16px #07182d33;
}

/* ===== Focus: white ring on navy, blue ring on cream; mouse clicks stay clean ===== */
#screenHostLobby.knightLobby :is(button, select, summary, a):focus:not(:focus-visible) { outline: none; }
#screenHostLobby.knightLobby :is(button, select, summary, a):focus-visible { outline: 3px solid var(--lm-focus-dark); outline-offset: 3px; }
#screenHostLobby.knightLobby :is(.quickGuide summary, .playerRow button, .status a):focus-visible { outline-color: var(--lm-focus-light); }

@media (max-width: 768px) {
  /* Keep Logout and Back side by side instead of a tall stack on phones. */
  #screenHostLobby.knightLobby .headerRight { flex-direction: row; align-items: center; }
}
@media (max-width: 600px) {
  #screenHostLobby.knightLobby { --lm-panel-rim: 28px; }
  #screenHostLobby.knightLobby :is(header, .knightWelcome, .panel) { border-width: 9px; border-radius: 16px; }
  #screenHostLobby.knightLobby .knightWelcome { padding: 8px 14px; }
  #screenHostLobby.knightLobby #btnStartGame { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #screenHostLobby.knightLobby button { transition: none !important; transform: none !important; }
}

/* ===== Integrated audit (Claude, Sep 24) ===== */
/* Theme preview name used the theme colour as text; Holiday red on navy measured 2.7:1.
   The theme colour stays as the accent edge; the name is readable pale gold. */
#screenHostLobby.knightLobby .themePreview { border-left: 6px solid var(--color-primary, #d6b25e); }
#screenHostLobby.knightLobby .themePreviewName { color: #ffe39b; }
