/* LUDO production experience shell.
 * Milestone M1: board composition, character/pedestal readability, production HUD,
 * legal-move feedback, and gameplay settings. Presentation only.
 */
html, body {
  width: 100%;
  min-height: 100%;
}

body::before {
  animation: none !important;
  filter: none !important;
}

/* ---------- Simple sign-in ---------- */
#screen-auth.active-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(6, 7, 29, .94) 0%, rgba(8, 8, 34, .74) 42%, rgba(8, 8, 34, .52) 100%),
    url('assets/backgrounds/ludo-sunset-arena.webp') center / cover no-repeat;
}

#screen-auth .auth-container {
  width: min(100%, 1180px);
  min-height: 100dvh;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(28px, 7vh, 90px) clamp(20px, 7vw, 88px);
}

#screen-auth .auth-brand {
  width: min(520px, 100%);
  margin: 0 0 22px;
  text-align: left;
}

#screen-auth .auth-brand h1 {
  color: #fff;
  font-size: clamp(2.8rem, 7vw, 5.7rem);
  font-weight: 950;
  line-height: .88;
  letter-spacing: -.045em;
  text-shadow: 0 8px 28px rgba(0,0,0,.45);
}

#screen-auth .auth-subtitle {
  max-width: 430px;
  margin-top: 14px;
  color: rgba(255,255,255,.76);
  font-size: clamp(.95rem, 1.8vw, 1.12rem);
  line-height: 1.5;
}

#screen-auth .auth-card {
  width: min(430px, 100%);
  max-width: none;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15,16,49,.92), rgba(8,9,30,.91));
  box-shadow: 0 30px 80px rgba(1,2,20,.48), inset 0 1px rgba(255,255,255,.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#screen-auth .auth-tabs { gap: 8px; margin-bottom: 14px; }
#screen-auth .auth-tab {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  color: rgba(255,255,255,.62);
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}
#screen-auth .auth-tab.active {
  color: #111326;
  background: #f4f7ff;
  border: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
#screen-auth .auth-card label { color: rgba(255,255,255,.7); font-weight: 700; }
#screen-auth .auth-card input[type="text"],
#screen-auth .auth-card input[type="password"] {
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.09);
  color: #fff;
}
#screen-auth .auth-card input:focus {
  border-color: rgba(255,255,255,.72);
  box-shadow: 0 0 0 3px rgba(255,255,255,.08);
}
#screen-auth .auth-submit {
  min-height: 54px;
  border-radius: 12px;
  background: #f3ff20;
  color: #101225;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: .045em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(243,255,32,.18);
}
#screen-auth .auth-submit:hover { background: #fbff69; transform: translateY(-1px); }
#screen-auth .auth-divider { margin: 16px 0; }
#screen-auth .auth-guest {
  min-height: 50px;
  border-radius: 12px;
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-weight: 850;
}
#screen-auth .auth-guest:hover {
  border-color: rgba(255,255,255,.62);
  background: rgba(255,255,255,.12);
  color: #fff;
}
#screen-auth .btn-google-login { display: none !important; }

/* ---------- MM-1: email, verification and password reset ---------- */
#screen-verify.active-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(6, 7, 29, .94) 0%, rgba(8, 8, 34, .74) 42%, rgba(8, 8, 34, .52) 100%),
    url('assets/backgrounds/ludo-sunset-arena.webp') center / cover no-repeat;
}
#screen-verify .auth-container {
  width: min(100%, 1180px);
  min-height: 100dvh;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(28px, 7vh, 90px) clamp(20px, 7vw, 88px);
}
#screen-verify .auth-brand { width: min(520px, 100%); margin: 0 0 22px; text-align: left; }
#screen-verify .auth-brand h1 {
  color: #fff;
  font-size: clamp(2.8rem, 7vw, 5.7rem);
  font-weight: 950;
  line-height: .88;
  letter-spacing: -.045em;
  text-shadow: 0 8px 28px rgba(0,0,0,.45);
}
#screen-verify .auth-subtitle { max-width: 430px; margin-top: 14px; color: rgba(255,255,255,.76); font-size: clamp(.95rem, 1.8vw, 1.12rem); line-height: 1.5; }
#screen-verify .auth-card {
  width: min(430px, 100%);
  max-width: none;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(29,27,69,.94), rgba(9,11,38,.95));
  box-shadow: 0 30px 80px rgba(1,2,20,.48), inset 0 1px rgba(255,255,255,.07);
}
#screen-verify .auth-card label { color: rgba(255,255,255,.7); font-weight: 700; }
#screen-verify .auth-account-hint { margin: 0 0 18px; color: rgba(255,255,255,.72); font-size: .78rem; line-height: 1.5; }
#screen-verify .auth-card input,
#screen-auth .auth-card input[type="email"] {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.09);
  color: #fff;
}
#screen-verify .auth-card input:focus { border-color: rgba(255,255,255,.72); box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
#screen-verify #verify-code,
#screen-auth #reset-code { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
#screen-verify .auth-submit {
  width: 100%;
  min-height: 54px;
  border-radius: 12px;
  background: #f3ff20;
  color: #101225;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: .045em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(243,255,32,.18);
}
#screen-verify .auth-submit:hover { background: #fbff69; }
#screen-verify .auth-divider { margin: 16px 0; }
#screen-verify .auth-guest {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-weight: 850;
}
#screen-verify .auth-error:not(:empty),
#screen-auth #forgot-error:not(:empty) { margin-top: 12px; }
.auth-field-hint { margin: 6px 0 12px; color: rgba(255,255,255,.62); font-size: .74rem; line-height: 1.45; }
.auth-link {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: #f3ff20;
  font-weight: 800;
  font-size: .82rem;
  cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid #f3ff20; outline-offset: 2px; }
.auth-link[disabled] { opacity: .5; cursor: default; text-decoration: none; }
/* QA-5 (7): lobby.js hides "Forgot password?" on Create Account; display:inline-block must not undo [hidden]. */
.auth-link[hidden] { display: none; }
.auth-link-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.auth-recovery-title { margin: 0 0 14px; color: #fff; font-size: 1.1rem; font-weight: 900; }
#screen-auth .auth-recovery[hidden],
#screen-verify form[hidden],
#screen-auth form[hidden] { display: none; }

/* ---------- Guest lobby state ---------- */
.home-profile.guest-profile { border-color: rgba(243,255,32,.35); }
.home-profile.guest-profile .home-profile-avatar { color: #101225; background: #f3ff20; }
.home-profile.guest-profile .home-profile-copy small { color: rgba(255,255,255,.72); }
.queue-choice.guest-locked { opacity: .68; }
.queue-choice.guest-locked::after {
  content: 'SIGN IN';
  margin-left: auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.82);
  font-size: .55rem;
  font-weight: 900;
  letter-spacing: .08em;
}
#screen-lobby.active-screen { display: block; }
.home-lobby { background-color: #120e35; }
.home-play-button { min-height: 70px; }

/* ---------- Lobby reachability ----------
   The play lobby used to be a fixed viewport with overflow hidden, so the
   mode panel and anything below it were clipped at phone size. The lobby
   screen is the scrollport; the hero stays cinematic and the rooms section
   follows in normal flow. */
#screen-lobby.active-screen {
  height: 100dvh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding-top: 84px;
}
.home-lobby {
  height: auto;
  min-height: 100%;
  overflow: visible;
}
#screen-lobby .home-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(6, 7, 28, .94), rgba(6, 7, 28, .78));
}
#screen-lobby .home-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}
#screen-lobby .home-tabs::-webkit-scrollbar { display: none; }
#screen-lobby .home-stage {
  position: relative;
  inset: auto;
  height: auto;
  min-height: 0;
}
.home-hero {
  position: relative;
  min-height: max(620px, calc(100dvh - 164px));
}
.lobby-status-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f3ff20;
  color: #151724;
  font-size: .55rem;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.35;
  text-transform: uppercase;
  vertical-align: 1px;
}
.home-tab.active .lobby-status-badge,
.queue-choice.active .lobby-status-badge {
  background: #15142f;
  color: #f4f7ff;
}
/* Queue tiles force every span to a block label. Keep this pill on the shared badge. */
.queue-choice .lobby-status-badge {
  display: inline-block;
  font-size: .55rem;
}
/* The extra Compete pill matches Pass, Quests, and Career. Slightly tighter
   lobby tabs keep Career fully in the strip at 1366 and 1440. */
#screen-lobby .home-tabs { gap: 2px; }
#screen-lobby .home-tab { padding-inline: 7px; }
.lobby-reach {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 42px);
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8px 0 48px;
}
.lobby-reach-copy span {
  color: #f3ff20;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.lobby-reach-copy h2 {
  margin: 6px 0 8px;
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 950;
  letter-spacing: -.03em;
  line-height: 1;
}
.lobby-reach-copy p {
  max-width: 36ch;
  color: rgba(255, 255, 255, .72);
  font-size: .9rem;
  line-height: 1.45;
}
.lobby-reach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.lobby-reach-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(31, 29, 72, .94), rgba(11, 12, 36, .92));
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(5, 5, 24, .28);
}
.lobby-reach-card span {
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -.02em;
}
.lobby-reach-card small {
  color: rgba(255, 255, 255, .66);
  font-size: .75rem;
  line-height: 1.4;
}
.lobby-reach-card:hover,
.lobby-reach-card:focus-visible {
  border-color: #f3ff20;
  outline: none;
}
.lobby-reach-card:focus-visible {
  outline: 3px solid #f3ff20;
  outline-offset: 3px;
}
.lobby-sheet {
  width: min(460px, calc(100vw - 28px));
  max-height: min(86dvh, 720px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(165deg, rgba(31, 29, 72, .98), rgba(9, 10, 32, .98));
  box-shadow: 0 30px 80px rgba(1, 2, 20, .55);
}
.lobby-sheet::backdrop {
  background: rgba(5, 6, 20, .72);
}
.lobby-sheet-kicker {
  margin: 0 0 8px;
  color: #f3ff20;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.lobby-sheet h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 1.7rem;
  font-weight: 950;
  letter-spacing: -.03em;
}
.lobby-sheet p {
  color: rgba(255, 255, 255, .76);
  font-size: .9rem;
  line-height: 1.45;
}
.lobby-sheet-guest {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(243, 255, 32, .12);
  color: #f3ff20;
}
.lobby-sheet-guest[hidden] { display: none; }
.lobby-code-field,
.lobby-team-picker {
  display: block;
  margin-top: 14px;
  color: rgba(255, 255, 255, .72);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.lobby-code-field input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.lobby-code-field input:focus {
  border-color: #f3ff20;
  outline: none;
}
.lobby-team-picker {
  border: 0;
  padding: 0;
}
.lobby-team-picker legend { margin-bottom: 8px; }
.lobby-team-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin: 0 8px 8px 0;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: .78rem;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.lobby-sheet-note:empty { display: none; }
.lobby-sheet-note {
  margin-top: 8px;
  color: #ffb4c0;
}
.lobby-rules {
  margin: 14px 0 0;
  padding-left: 18px;
  color: rgba(255, 255, 255, .84);
  font-size: .92rem;
  line-height: 1.45;
}
.lobby-rules li + li { margin-top: 8px; }
.lobby-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.lobby-sheet-cancel,
.lobby-sheet-go {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}
.lobby-sheet-cancel {
  border: 1px solid rgba(255, 255, 255, .24);
  background: transparent;
  color: #fff;
}
.lobby-sheet-go {
  border: 0;
  background: #f3ff20;
  color: #151724;
}
.lobby-sheet-go:disabled { opacity: .6; cursor: wait; }
.lobby-sheet button:focus-visible,
.lobby-code-field input:focus-visible,
.lobby-team-picker input:focus-visible {
  outline: 3px solid #f3ff20;
  outline-offset: 2px;
}
@media (max-width: 760px) {
  #screen-lobby .home-nav {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  #screen-lobby .home-account { margin-left: auto; }
  #screen-lobby .home-tabs {
    flex: 1 0 100%;
    order: 3;
  }
  #screen-lobby .home-tabs .home-tab:nth-child(n+5) { display: inline-block; }
  .home-hero {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .home-hero .home-party {
    position: relative;
    inset: auto;
    flex: 1 0 auto;
    min-height: clamp(300px, 52vh, 460px);
  }
  .home-hero .lobby-character { bottom: 18px; }
  .home-hero .home-mode-panel {
    position: relative;
    inset: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: auto;
    max-height: none;
    margin: 8px 10px 12px;
  }
  .lobby-reach {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 1120px);
    padding-bottom: 36px;
  }
  .lobby-reach-grid { grid-template-columns: 1fr; }
  .lobby-reach-card { min-height: 88px; }
}
@media (max-height: 660px) and (orientation: landscape) {
  .home-hero .home-mode-panel {
    position: relative;
    inset: auto;
    width: auto;
    max-height: none;
    margin: 12px;
  }
}

/* ==========================================================
   M1 GAMEPLAY FOUNDATION
   ========================================================== */
#screen-game {
  --active-team: #e53935;
  --game-topbar-height: 58px;
  --game-hud-height: 92px;
  --game-gap: 10px;
}

#screen-game.active-screen {
  position: relative;
  display: grid;
  grid-template-rows: var(--game-topbar-height) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--active-team) 12%, transparent), transparent 28%),
    radial-gradient(circle at 50% 46%, rgba(122, 97, 255, .18), transparent 48%),
    linear-gradient(155deg, #170c34 0%, #101538 46%, #07172d 100%);
}

#screen-game.active-screen::after {
  content: '';
  position: absolute;
  inset: var(--game-topbar-height) 0 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
  opacity: .35;
}

.game-topbar {
  position: relative;
  z-index: 120;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, auto) minmax(150px, 1fr);
  align-items: center;
  gap: 14px;
  min-height: var(--game-topbar-height);
  padding: 7px clamp(12px, 2vw, 26px);
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg, rgba(7,8,27,.94), rgba(9,11,32,.82));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
}

.game-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.game-brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  gap: 4px;
  place-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  transform: rotate(-3deg);
}
.game-brand-mark i { width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.game-brand-copy { min-width: 0; }
.game-brand-copy strong {
  display: block;
  color: #fff;
  font-size: .76rem;
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: .11em;
  text-transform: uppercase;
  white-space: nowrap;
}
.game-brand-copy small {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.46);
  font-size: .56rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.game-turn-center {
  display: grid;
  justify-items: center;
  gap: 0;
  text-align: center;
  line-height: 1;
}
.game-turn-kicker {
  color: rgba(255,255,255,.48);
  font-size: .54rem;
  font-weight: 850;
  letter-spacing: .14em;
}
.game-turn-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}
.game-turn-orb {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--active-team);
  color: #fff;
  box-shadow: 0 0 18px color-mix(in srgb, var(--active-team) 55%, transparent);
  font-size: .53rem;
}
.game-turn-title {
  color: #fff;
  font-size: clamp(.8rem, 1.15vw, 1.02rem);
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.game-turn-detail {
  max-width: 310px;
  margin-top: 2px;
  overflow: hidden;
  color: rgba(255,255,255,.55);
  font-size: .58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.game-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: #fff;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 800;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.game-icon-button:hover,
.game-icon-button:focus-visible {
  border-color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.11);
  outline: none;
}
.game-icon-button:active { transform: scale(.97); }
.game-icon-button svg { width: 17px; height: 17px; }

.legacy-state-bridge {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

#screen-game .winner-banner {
  position: absolute;
  top: calc(var(--game-topbar-height) + 10px);
  left: 50%;
  z-index: 130;
  width: min(520px, calc(100% - 28px));
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  transform: translateX(-50%);
  box-shadow: 0 16px 40px rgba(0,0,0,.3);
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: .08em;
}

#screen-game .game-dock {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--game-hud-height);
  gap: var(--game-gap);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: var(--game-gap) clamp(10px, 2vw, 24px) max(10px, env(safe-area-inset-bottom, 0px));
}

#screen-game .main-layout {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 0;
  overflow: visible;
}

#screen-game .board-panel {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.board-frame-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: min(
    calc(100vw - clamp(20px, 4vw, 56px)),
    calc(100dvh - var(--game-topbar-height) - var(--game-hud-height) - (var(--game-gap) * 3)),
    760px
  );
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  filter: drop-shadow(0 24px 44px rgba(0,0,0,.38));
}

.board-frame-shell::before {
  content: '';
  position: absolute;
  inset: -12px;
  z-index: -2;
  border-radius: 26px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--active-team) 18%, rgba(114,92,255,.2)), transparent 64%);
  filter: blur(14px);
  opacity: .9;
}

.board-frame-shell::after {
  content: '';
  position: absolute;
  inset: -4px;
  z-index: -1;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 21px;
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 0 0 1px rgba(0,0,0,.15);
  pointer-events: none;
}

#screen-game #board-svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: 1 / 1;
  overflow: visible;
}

/* ---------- Character scale + exact-position pedestal ---------- */
.game-token .token-pedestal {
  transform-origin: center;
  transform-box: fill-box;
  transition: opacity .18s ease, filter .18s ease;
}
.game-token .pedestal-rim,
.game-token .pedestal-face,
.game-token .pedestal-aura {
  vector-effect: non-scaling-stroke;
}

/* The source sprites are intentionally large. M1 makes the art subordinate to the board. */
.game-token .warrior-figure {
  transform-box: fill-box;
  transform-origin: 50% 88%;
  transform: translateY(2px) scale(.62) !important;
  animation: none !important;
  transition: transform .14s ease, opacity .18s ease, filter .18s ease !important;
}
.game-token.token-in-base .warrior-figure {
  transform: translateY(1px) scale(.38) !important;
}

/* M1 replaces the noisy infinite PICK ME bounce with a stable selectable pedestal. */
.pick-me-bounce .warrior-figure,
.idle-ready .warrior-figure,
.selectable-glow .warrior-figure { animation: none !important; }
.pick-me-bubble { display: none !important; }

.game-token.selectable .pedestal-aura {
  opacity: .95;
  stroke: #fff;
  stroke-dasharray: 2.2 1.8;
  filter: drop-shadow(0 0 4px var(--active-team));
  animation: m1-pedestal-pulse 1.25s ease-in-out infinite;
}
.game-token.selectable .pedestal-rim {
  stroke-width: 1.8;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.35));
}
.game-token.selectable .warrior-figure {
  transform: translateY(-2px) scale(.66) !important;
  filter: saturate(1.08) brightness(1.06);
}
.game-token.token-in-base.selectable .warrior-figure {
  transform: translateY(-1px) scale(.405) !important;
}
.game-token.selectable:focus-visible .pedestal-aura {
  opacity: 1;
  stroke-width: 2.8;
}

.board-has-selection .game-token:not(.selectable) .warrior-figure {
  opacity: .58;
  filter: saturate(.72) brightness(.82);
}
.board-has-selection .game-token:not(.selectable) .token-pedestal {
  opacity: .62;
}

.game-token .sel-ring {
  stroke-width: 1.2 !important;
  stroke-dasharray: 2 3 !important;
  opacity: .45 !important;
  animation-duration: 1.5s !important;
}

.legal-dest-highlight {
  stroke-width: 2.8 !important;
  stroke-dasharray: 3 2 !important;
  filter: drop-shadow(0 0 3px rgba(255,255,255,.62));
}
.capture-threat {
  stroke-width: 3 !important;
  stroke-dasharray: 1.5 2.5 !important;
  filter: drop-shadow(0 0 3px rgba(229,57,53,.65));
}

@keyframes m1-pedestal-pulse {
  0%, 100% { opacity: .7; }
  50% { opacity: 1; }
}

/* ---------- Production bottom HUD ---------- */
#screen-game .bottom-hud {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(200px, 1fr);
  align-items: center;
  gap: clamp(10px, 2vw, 24px);
  width: min(980px, 100%);
  max-width: none;
  height: var(--game-hud-height);
  margin: 0 auto;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(17,20,47,.94), rgba(8,11,30,.96));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 44px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.06);
  z-index: 100;
}

#screen-game .hud-left {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#screen-game .hud-player-chip {
  width: 42px;
  height: 42px;
  border: 3px solid currentColor;
  box-shadow: 0 0 18px rgba(255,255,255,.08);
}
#screen-game .hud-player-info { gap: 2px; }
.hud-section-label {
  color: rgba(255,255,255,.42);
  font-size: .52rem;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}
#screen-game .hud-player-name {
  color: #fff !important;
  font-size: clamp(.82rem, 1.2vw, .98rem);
  font-weight: 950;
  letter-spacing: .015em;
}
#screen-game .hud-turn-status {
  font-size: .67rem;
  color: rgba(255,255,255,.62);
}
#screen-game .hud-turn-status.your-turn { color: #f3ff20; font-weight: 800; }
#screen-game .hud-turn-status.ai-thinking { color: rgba(255,255,255,.58); font-style: normal; }

#screen-game .hud-center { align-self: center; }
#screen-game .hud-dice-btn {
  min-width: 82px;
  min-height: 76px;
  padding: 5px 9px 4px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 17px;
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--active-team) 14%, transparent), transparent 70%),
    rgba(255,255,255,.045);
  box-shadow: inset 0 1px rgba(255,255,255,.05);
}
#screen-game .hud-dice-btn:hover:not(:disabled),
#screen-game .hud-dice-btn:focus-visible:not(:disabled) {
  transform: translateY(-2px) scale(1.035);
  border-color: rgba(255,255,255,.38);
  box-shadow: 0 8px 26px color-mix(in srgb, var(--active-team) 20%, rgba(0,0,0,.35));
  outline: none;
}
#screen-game .hud-dice-btn:disabled { opacity: .52; }
#screen-game #hud-dice-canvas { width: 58px; height: 58px; }
#screen-game .hud-dice-label {
  margin-top: -2px;
  color: #fff;
  font-size: .55rem;
  font-weight: 950;
  letter-spacing: .17em;
}

#screen-game .hud-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.hud-event-block {
  display: grid;
  gap: 3px;
  min-width: 105px;
  max-width: 170px;
  padding-right: 6px;
}
.hud-event-label {
  color: rgba(255,255,255,.38);
  font-size: .5rem;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}
#screen-game .hud-last-roll {
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.68);
  font-size: .64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hud-action-button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.055);
  color: #fff;
  cursor: pointer;
  font-size: .66rem;
  font-weight: 850;
  white-space: nowrap;
}
.hud-action-button:hover,
.hud-action-button:focus-visible {
  border-color: rgba(255,255,255,.36);
  background: rgba(255,255,255,.1);
  outline: none;
}

/* ---------- Gameplay settings shell ---------- */
.game-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2,4,18,.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.game-settings-overlay[hidden] { display: none !important; }
.game-settings-panel {
  width: min(520px, 100%);
  max-height: min(960px, calc(100dvh - 36px));
  overflow: auto;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20,23,55,.985), rgba(8,11,31,.985));
  box-shadow: 0 30px 90px rgba(0,0,0,.52), inset 0 1px rgba(255,255,255,.06);
  color: #fff;
}
.game-settings-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 18px 14px;
  background: rgba(15,18,45,.96);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.game-settings-header h2 { font-size: 1.05rem; font-weight: 950; letter-spacing: .03em; }
.game-settings-header p { margin-top: 3px; color: rgba(255,255,255,.48); font-size: .68rem; }
.settings-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 11px;
  background: rgba(255,255,255,.06);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
}
.settings-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.settings-content { display: grid; gap: 20px; padding: 18px; }
.settings-group { display: grid; gap: 8px; }
.settings-group-title {
  color: rgba(255,255,255,.47);
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  cursor: pointer;
}
.settings-row:hover { background: rgba(255,255,255,.065); }
.settings-row strong { display: block; color: #fff; font-size: .78rem; }
.settings-row small { display: block; margin-top: 3px; color: rgba(255,255,255,.5); font-size: .64rem; line-height: 1.35; }
.settings-switch {
  width: 20px;
  height: 20px;
  accent-color: var(--active-team);
  cursor: pointer;
}
.settings-dev[hidden] { display: none; }
.settings-dev .seed-input { min-width: 120px; }

/* ---------- Resilient game boot ---------- */
.game-start-status {
  position: fixed;
  inset: 0;
  z-index: 680;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  background: rgba(5,7,24,.48);
  backdrop-filter: blur(8px);
}
.game-start-status[hidden] { display: none; }
.game-start-card {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  background: rgba(10,12,36,.97);
  box-shadow: 0 24px 70px rgba(0,0,0,.48);
  text-align: center;
  pointer-events: auto;
}
.game-start-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #f3ff20;
  border-radius: 50%;
  animation: ludo-spin .75s linear infinite;
}
.game-start-card strong { display: block; color: #fff; font-size: 1.05rem; }
.game-start-card p { margin-top: 7px; color: rgba(255,255,255,.66); font-size: .86rem; line-height: 1.45; }
.game-start-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.game-start-actions button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}
.game-start-actions .primary { border-color: transparent; background: #f3ff20; color: #101225; }
@keyframes ludo-spin { to { transform: rotate(360deg); } }

/* ---------- Performance / reduced motion ---------- */
body.performance-mode .game-topbar,
body.performance-mode #screen-game .bottom-hud,
body.performance-mode .game-settings-overlay,
body.performance-mode .game-start-status {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body.performance-mode .board-frame-shell { filter: drop-shadow(0 10px 20px rgba(0,0,0,.28)); }
body.performance-mode .board-frame-shell::before { display: none; }
body.calm .game-token .pedestal-aura { animation: none !important; }

/* ---------- Responsive layouts ---------- */
@media (max-width: 760px) {
  #screen-game {
    --game-topbar-height: 54px;
    --game-hud-height: 88px;
    --game-gap: 7px;
  }
  .game-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 6px 9px;
    gap: 7px;
  }
  .game-brand-copy small { display: none; }
  .game-brand-copy strong { font-size: .64rem; letter-spacing: .075em; }
  .game-brand-mark { width: 27px; height: 27px; }
  .game-icon-button { width: 38px; padding: 0; }
  .game-icon-button span { display: none; }
  .game-turn-kicker { font-size: .46rem; }
  .game-turn-title { font-size: .72rem; }
  .game-turn-detail { max-width: 170px; font-size: .5rem; }

  #screen-game .game-dock { padding-inline: 7px; }
  .board-frame-shell {
    width: min(
      calc(100vw - 14px),
      calc(100dvh - var(--game-topbar-height) - var(--game-hud-height) - (var(--game-gap) * 3))
    );
    border-radius: 13px;
  }
  .board-frame-shell::before { inset: -6px; filter: blur(10px); }
  .board-frame-shell::after { inset: -2px; border-radius: 15px; }

  #screen-game .bottom-hud {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 7px;
    width: 100%;
    height: var(--game-hud-height);
    padding: 8px 9px;
    border-radius: 16px;
  }
  #screen-game .hud-left { grid-template-columns: 32px minmax(0, 1fr); gap: 7px; }
  #screen-game .hud-player-chip { width: 32px; height: 32px; border-width: 2px; }
  .hud-section-label { display: none; }
  #screen-game .hud-player-name { font-size: .68rem; }
  #screen-game .hud-turn-status { max-width: 110px; font-size: .56rem; }

  #screen-game .hud-dice-btn { min-width: 68px; min-height: 70px; padding: 4px 7px 3px; }
  #screen-game #hud-dice-canvas { width: 50px; height: 50px; }
  #screen-game .hud-dice-label { font-size: .49rem; }

  .hud-event-block { display: none; }
  #screen-game .hud-right { gap: 5px; }
  .hud-action-button { min-height: 38px; min-width: 42px; padding: 0 8px; font-size: .56rem; }
  #btn-new-game-solo { display: none; }
}

@media (max-width: 460px) {
  .game-brand-copy { display: none; }
  .game-turn-detail { max-width: 145px; }
  #screen-game .hud-turn-status { max-width: 92px; }
  .hud-action-button { padding: 0 7px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  #screen-game {
    --game-topbar-height: 48px;
    --game-hud-height: 72px;
    --game-gap: 5px;
  }
  .game-topbar { padding-block: 4px; }
  .game-turn-detail { display: none; }
  #screen-game .bottom-hud { padding-block: 4px; border-radius: 14px; }
  #screen-game .hud-dice-btn { min-height: 62px; }
  #screen-game #hud-dice-canvas { width: 44px; height: 44px; }
  #screen-game .hud-player-chip { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .game-token .pedestal-aura { animation: none !important; }
  .game-start-spinner { animation-duration: 1.5s; }
}


/* ---------- SHOT-23: board-first match layout ---------- */
/* Presentation only. Keep the canonical board, hitboxes, token transforms and Classic rules untouched. */
#screen-game {
  --game-topbar-height: 52px;
  --game-hud-height: 76px;
  --game-gap: 8px;
}

#screen-game.active-screen {
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--active-team) 5%, transparent), transparent 34%),
    linear-gradient(180deg, #252a2f 0%, #191e22 58%, #15191d 100%);
}

#screen-game.active-screen::after {
  background:
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 74%);
  opacity: .22;
}

.game-topbar {
  padding: 5px clamp(10px, 1.6vw, 22px);
  border-bottom-color: rgba(255,255,255,.075);
  background: rgba(27,31,35,.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.game-brand-mark {
  width: 28px;
  height: 28px;
  border-color: rgba(255,255,255,.34);
  border-radius: 7px;
  background: rgba(255,255,255,.045);
}

.game-brand-copy strong { font-size: .7rem; letter-spacing: .085em; }
.game-brand-copy small { color: rgba(255,255,255,.38); }

.game-turn-kicker { color: rgba(255,255,255,.38); }
.game-turn-orb {
  width: 18px;
  height: 18px;
  box-shadow: 0 0 10px color-mix(in srgb, var(--active-team) 38%, transparent);
}
.game-turn-title { font-size: clamp(.78rem, 1vw, .94rem); }
.game-turn-detail { color: rgba(255,255,255,.48); }

.game-icon-button {
  min-height: 34px;
  border-color: rgba(255,255,255,.11);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}

#screen-game .game-dock {
  gap: var(--game-gap);
  padding: var(--game-gap) clamp(8px, 1.5vw, 18px) max(8px, env(safe-area-inset-bottom, 0px));
}

.board-frame-shell {
  width: min(
    calc(100vw - clamp(16px, 3vw, 40px)),
    calc(100dvh - var(--game-topbar-height) - var(--game-hud-height) - (var(--game-gap) * 2) - 8px),
    800px
  );
  border-radius: 14px;
  filter: drop-shadow(0 16px 30px rgba(0,0,0,.34));
}

.board-frame-shell::before {
  inset: -8px;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--active-team) 10%, rgba(255,255,255,.025)), transparent 67%);
  filter: blur(12px);
  opacity: .42;
}

.board-frame-shell::after {
  inset: -3px;
  border-color: rgba(255,255,255,.09);
  border-radius: 17px;
  box-shadow: inset 0 1px rgba(255,255,255,.06), 0 0 0 1px rgba(0,0,0,.12);
}

#screen-game .bottom-hud {
  grid-template-columns: minmax(130px, 1fr) auto minmax(150px, 1fr);
  gap: clamp(8px, 1.4vw, 18px);
  width: min(880px, 100%);
  height: var(--game-hud-height);
  padding: 7px 11px;
  border-color: rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(28,32,36,.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.045);
}

#screen-game .hud-left { grid-template-columns: 36px minmax(0, 1fr); gap: 8px; }
#screen-game .hud-player-chip {
  width: 36px;
  height: 36px;
  border-width: 2px;
  box-shadow: none;
}
.hud-section-label { display: none; }
#screen-game .hud-player-name { font-size: clamp(.76rem, 1vw, .9rem); }
#screen-game .hud-turn-status { display: none; }

#screen-game .hud-dice-btn {
  min-width: 70px;
  min-height: 62px;
  padding: 3px 7px 2px;
  border-color: rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  box-shadow: none;
}
#screen-game #hud-dice-canvas { width: 48px; height: 48px; }
#screen-game .hud-dice-label { font-size: .48rem; letter-spacing: .14em; }

.hud-event-label { display: none; }
.hud-event-block { min-width: 80px; max-width: 140px; }
.hud-action-button {
  min-height: 36px;
  padding: 0 10px;
  border-color: rgba(255,255,255,.11);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}

@media (max-width: 760px) {
  #screen-game {
    --game-topbar-height: 48px;
    --game-hud-height: 74px;
    --game-gap: 6px;
  }

  .game-topbar { padding: 4px 7px; }
  .game-brand-copy { display: none; }
  .game-turn-kicker,
  .game-turn-detail { display: none; }
  .game-turn-main { margin-top: 0; }
  .game-turn-title { font-size: .72rem; letter-spacing: .04em; }

  #screen-game .game-dock {
    grid-template-rows: auto minmax(0, 1fr);
    padding: var(--game-gap) 4px max(6px, env(safe-area-inset-bottom, 0px));
  }

  #screen-game .main-layout {
    height: auto;
    place-items: start center;
  }

  #screen-game .board-panel {
    height: auto;
    place-items: start center;
  }

  .board-frame-shell {
    width: min(
      calc(100vw - 8px),
      calc(100dvh - var(--game-topbar-height) - var(--game-hud-height) - (var(--game-gap) * 2))
    );
    border-radius: 10px;
  }
  .board-frame-shell::before { inset: -4px; opacity: .26; filter: blur(8px); }
  .board-frame-shell::after { inset: -1px; border-radius: 11px; }

  #screen-game .bottom-hud {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start;
    gap: 8px 6px;
    width: 100%;
    height: 100%;
    min-height: var(--game-hud-height);
    padding: 10px 10px max(10px, env(safe-area-inset-bottom, 0px));
    border-radius: 13px 13px 9px 9px;
    background:
      linear-gradient(180deg, rgba(32,37,41,.97), rgba(24,28,32,.97));
  }

  #screen-game .hud-left {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 7px;
    align-self: center;
  }
  #screen-game .hud-player-chip { width: 30px; height: 30px; }
  #screen-game .hud-player-name { font-size: .68rem; }

  #screen-game .hud-right {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  #screen-game .hud-center {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: center;
    justify-self: center;
  }

  #screen-game .hud-dice-btn {
    min-width: 88px;
    min-height: 94px;
    padding: 7px 9px 5px;
    border-radius: 16px;
    background:
      radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--active-team) 9%, transparent), transparent 68%),
      rgba(255,255,255,.035);
  }
  #screen-game #hud-dice-canvas { width: 70px; height: 70px; }
  #screen-game .hud-dice-label { font-size: .5rem; letter-spacing: .16em; }

  .hud-action-button { min-height: 34px; min-width: 42px; padding: 0 8px; font-size: .56rem; }
}

@media (max-width: 460px) {
  .game-brand-lockup { min-width: 28px; }
  .game-turn-center { justify-self: center; }
  .game-top-actions { min-width: 38px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  #screen-game {
    --game-topbar-height: 44px;
    --game-hud-height: 64px;
    --game-gap: 4px;
  }
  .board-frame-shell {
    width: min(
      calc(100vw - 12px),
      calc(100dvh - var(--game-topbar-height) - var(--game-hud-height) - (var(--game-gap) * 2))
    );
  }
  #screen-game .bottom-hud { padding-block: 3px; }
  #screen-game .hud-dice-btn { min-height: 52px; }
  #screen-game #hud-dice-canvas { width: 40px; height: 40px; }
}


/* ---------- SHOT-24: native piece presence ---------- */
/* Native-board presentation only. Custom renderers keep their own character-scale contracts. */
#board-svg .game-token .warrior-figure {
  transform: translateY(1px) scale(.68) !important;
  filter:
    drop-shadow(0 1.4px 1.5px rgba(0,0,0,.42))
    saturate(1.02);
}

#board-svg .game-token.token-in-base .warrior-figure {
  transform: translateY(.5px) scale(.68) !important;
}

#board-svg .game-token.selectable .warrior-figure {
  transform: translateY(-1.5px) scale(.72) !important;
  filter:
    drop-shadow(0 1.7px 1.8px rgba(0,0,0,.48))
    saturate(1.06)
    brightness(1.035);
}

#board-svg .game-token.token-in-base.selectable .warrior-figure {
  transform: translateY(-.75px) scale(.68) !important;
}

#board-svg .game-token .pedestal-aura {
  opacity: .08;
  animation: none !important;
  filter: none;
}

#board-svg .game-token .pedestal-rim {
  opacity: .78;
  stroke-width: .9 !important;
  filter: drop-shadow(0 1px 1.2px rgba(0,0,0,.28));
}

#board-svg .game-token .pedestal-face {
  opacity: .9;
}

#board-svg .game-token.selectable .pedestal-aura {
  opacity: .92;
  stroke-width: 1.8 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 3px var(--active-team));
}

#board-svg .game-token.selectable .pedestal-rim {
  opacity: 1;
  stroke-width: 1.2 !important;
}

#board-svg .game-token .sel-ring {
  animation: none !important;
}

#board-svg .game-token.selectable .sel-ring {
  opacity: .9 !important;
  stroke-width: 1.8 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 2.4px rgba(255,255,255,.76));
}

body.performance-mode #board-svg .game-token .warrior-figure {
  filter: none !important;
}


/* ---------- SHOT-32: native piece clarity at playing size ---------- */
/* Keep Shot 24 scale and canonical token/body transforms. Use one tight art
 * shadow rather than a broad halo around small silhouettes. */
#board-svg .game-token .warrior-figure {
  filter: drop-shadow(0 1px .6px rgba(10,16,22,.46));
}

#board-svg .game-token.selectable .warrior-figure {
  filter: drop-shadow(0 1.2px .7px rgba(10,16,22,.55)) brightness(1.035);
}

/* app.js already dims the token body during a choice. Preserve enough of the
 * original character to read an opponent/stack instead of dimming it twice
 * to roughly one third opacity. This rule must outrank native resting art. */
#board-svg.board-has-selection .game-token:not(.selectable) .warrior-figure {
  opacity: .82;
  filter: drop-shadow(0 1px .6px rgba(10,16,22,.38)) saturate(.8);
}

/* A solid light ring with a dark edge stays readable on both ivory and team
 * tiles. Focus adds a pattern, not a larger character or autonomous motion. */
#board-svg .game-token.selectable .sel-ring {
  filter: drop-shadow(0 1px .65px rgba(10,16,22,.85));
}

#board-svg .game-token:focus:not(:focus-visible) {
  outline: none;
}

#board-svg .game-token.selectable:focus-visible {
  outline: 2px solid #f7f3e8;
  outline-offset: 3px;
}

#board-svg .game-token.selectable:focus-visible .sel-ring {
  stroke-width: 2.4 !important;
  stroke-dasharray: 3 2 !important;
  opacity: 1 !important;
}


/* ---------- SHOT-25: purposeful native motion ---------- */
/* Continuous waiting-state motion is quiet on native boards.
   Dice, movement, capture/home/victory choreography stays event-driven in app.js. */
#board-svg:not([data-renderer-mode="custom"]) .legal-dest-highlight,
#board-svg:not([data-renderer-mode="custom"]) .capture-threat,
#board-svg:not([data-renderer-mode="custom"]) .gate-active,
#board-svg:not([data-renderer-mode="custom"]) .breathing-glow {
  animation: none !important;
}

#board-svg:not([data-renderer-mode="custom"]) .legal-dest-highlight {
  stroke-opacity: .94;
}

#board-svg:not([data-renderer-mode="custom"]) .capture-threat {
  stroke-opacity: .78;
}

#board-svg:not([data-renderer-mode="custom"]) .gate-active {
  opacity: .82;
}

#board-svg:not([data-renderer-mode="custom"]) .breathing-glow {
  opacity: 1;
}


/* ---------- SHOT-27: physical die + player identity ---------- */
#screen-game .hud-player-chip {
  overflow: hidden;
  border-width: 2px;
  border-radius: 50%;
  background-repeat: no-repeat;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}

#screen-game .hud-player-name {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-game .hud-dice-btn {
  border-color: rgba(255,255,255,.12);
  background:
    linear-gradient(180deg, rgba(49,54,60,.96), rgba(26,30,34,.98));
  box-shadow:
    inset 0 1px rgba(255,255,255,.055),
    inset 0 -1px rgba(0,0,0,.32),
    0 5px 14px rgba(0,0,0,.16);
}

#screen-game .hud-dice-btn:hover:not(:disabled),
#screen-game .hud-dice-btn:focus-visible:not(:disabled) {
  border-color: color-mix(in srgb, var(--active-team) 48%, rgba(255,255,255,.22));
  background:
    linear-gradient(180deg, rgba(57,62,68,.98), rgba(29,33,37,.98));
  box-shadow:
    inset 0 1px rgba(255,255,255,.07),
    0 7px 18px rgba(0,0,0,.25);
}

#screen-game #hud-dice-canvas {
  filter:
    drop-shadow(0 3px 0 rgba(105,111,118,.78))
    drop-shadow(0 6px 6px rgba(0,0,0,.28));
  transform-origin: 50% 50%;
}

#screen-game .hud-dice-label {
  color: rgba(255,255,255,.78);
  text-shadow: 0 1px 1px rgba(0,0,0,.55);
}

#screen-game .hud-dice-btn:not(:disabled) .hud-dice-label {
  color: rgba(255,255,255,.96);
}

#screen-game .hud-dice-btn:disabled {
  opacity: 1;
  border-color: rgba(255,255,255,.08);
  cursor: default;
}

#screen-game .hud-dice-btn:disabled .hud-dice-label {
  opacity: .46;
}

body.performance-mode #screen-game #hud-dice-canvas {
  filter: none;
}


/* ---------- SHOT-28: move/capture result clarity ---------- */
/* Completed move history should read as calm board notation, not debug rectangles. */
#board-svg .last-move-hl {
  animation: none !important;
  opacity: 1 !important;
  stroke-dasharray: none !important;
  stroke-width: 1.25px !important;
  stroke-opacity: .30 !important;
  fill: rgba(255,255,255,.025) !important;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.22));
  pointer-events: none !important;
}

/* updateHighlights appends the destination marker last; let it carry the stronger result cue. */
#board-svg .last-move-hl:last-child {
  stroke-width: 2px !important;
  stroke-opacity: .68 !important;
  fill: rgba(255,255,255,.055) !important;
  filter:
    drop-shadow(0 1px 1.5px rgba(0,0,0,.24))
    drop-shadow(0 0 2px rgba(255,255,255,.18));
}

/* Capture remains an event-owned animation; only its material treatment changes here. */
#board-svg .bonk-anim {
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.30));
}

#board-svg .bonk-anim > g:nth-of-type(2) > rect {
  fill: rgba(15,18,24,.94) !important;
  stroke: rgba(246,210,107,.92) !important;
  stroke-width: 1.25px !important;
}

#board-svg .bonk-anim > g:nth-of-type(2) > polygon {
  fill: rgba(15,18,24,.94) !important;
  stroke: rgba(246,210,107,.92) !important;
  stroke-width: 1px !important;
}

#board-svg .bonk-anim > g:nth-of-type(2) > text {
  fill: #f7f2df !important;
  font-size: 8.5px !important;
  font-weight: 850 !important;
  letter-spacing: .08em;
}

#board-svg .bonk-anim > text {
  fill: #f6d26b !important;
}

body.performance-mode #board-svg .last-move-hl,
body.performance-mode #board-svg .bonk-anim {
  filter: none;
}


/* ---------- SHOT-29: compact mobile control deck ---------- */
/* Stop SHOT-23's phone HUD from stretching through the full remaining viewport. */
@media (max-width: 760px) {
  #screen-game {
    --game-hud-height: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  #screen-game .game-dock {
    grid-template-rows: auto var(--game-hud-height);
    align-content: start;
    align-self: start;
    height: auto;
    padding: var(--game-gap) 4px 0;
    overflow: visible;
  }

  #screen-game .bottom-hud {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: var(--game-hud-height);
    min-height: var(--game-hud-height);
    padding: 5px 8px max(5px, env(safe-area-inset-bottom, 0px));
    border-radius: 13px;
  }

  #screen-game .hud-left {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    align-self: center;
    min-width: 0;
  }

  #screen-game .hud-player-chip {
    width: 28px;
    height: 28px;
  }

  #screen-game .hud-player-name {
    font-size: .64rem;
    max-width: none;
    letter-spacing: 0;
  }

  #screen-game .hud-center {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: center;
  }

  #screen-game .hud-dice-btn {
    min-width: 62px;
    min-height: 62px;
    padding: 3px 6px 2px;
    border-radius: 13px;
  }

  #screen-game #hud-dice-canvas {
    width: 48px;
    height: 48px;
  }

  #screen-game .hud-dice-label {
    font-size: .46rem;
    letter-spacing: .14em;
  }

  #screen-game .hud-right {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    min-width: 0;
  }

  #screen-game .hud-action-button {
    min-height: 36px;
    min-width: 44px;
  }
}

/* ---------- L6d: mobile-browser feel (board 0902; 0814 addendum) ---------- */
/* (a) Phone nav: all eight tabs sit on screen in a 4×2 grid — no sideways strip, no clipped
   "Coming soon" pill, nothing over PLAY. The pill drops under its label. */
@media (max-width: 760px) {
  #screen-lobby .home-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }
  #screen-lobby .home-tabs .home-tab,
  #screen-lobby .home-tabs .home-tab:nth-child(n+5) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 44px;
    padding: 5px 2px 7px;
    font-size: .62rem;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
  }
  #screen-lobby .home-tabs .lobby-status-badge {
    max-width: 100%;
    margin: 0;
    padding: 1px 4px;
    font-size: .46rem;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: 0;
  }
  #screen-lobby .home-tab.active::after { right: 18%; bottom: 3px; left: 18%; }
}

/* (b) Sticky headers in Locker and Shop are solid, so scrolled content never shows through. */
#screen-lobby .home-lobby:has(.hub-page:not([hidden])) .home-nav { background: #08091f; }
#screen-locker .locker-topbar { background: #07081e; }

/* (c) Settings: always fits the viewport (vh fallback for browsers without dvh), shows a
   scroll indicator while more controls sit below, and is compact on short screens. */
.game-settings-panel {
  max-height: calc(100vh - 36px);
  /* Play-test defect 6 (Vault board 1622): the old 720px cap left the UI, Dice and Game SFX sliders below the fold
     at 1000px height. The panel now fits whenever the screen has room (its content is about 900px tall) and scrolls,
     with the glow cue below, only on shorter screens. */
  max-height: min(960px, calc(100dvh - 36px));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.4) transparent;
  /* Scroll cue: a glow on the bottom edge that the end of the content covers once reached. */
  background:
    linear-gradient(rgba(8,11,31,0), rgb(8,11,31) 70%) center bottom / 100% 44px no-repeat local,
    radial-gradient(farthest-side at 50% 100%, rgba(243,255,32,.5), rgba(243,255,32,0)) center bottom / 100% 16px no-repeat scroll,
    linear-gradient(180deg, rgba(20,23,55,.985), rgba(8,11,31,.985));
}
/* QA-5 (4): like the wallet, the overlay scrolls and never centres the panel off-screen. */
.game-settings-overlay { overflow-y: auto; overscroll-behavior: contain; place-items: safe center; }
@media (max-height: 760px) {
  .game-settings-overlay { padding: 10px; }
  .game-settings-panel { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .game-settings-header { padding: 12px 14px 10px; }
  .settings-content { gap: 12px; padding: 12px 14px 22px; }
  .settings-group { gap: 6px; }
  .settings-row { min-height: 48px; padding: 8px 12px; }
}

/* ---------- L16 Match Setup ----------
   One screen between the lobby and the board. The commit row is the learned
   stake gesture: a pill, then minus / Play / plus. The panels are Ludo Arena's. */
#screen-match-setup.active-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  overflow: auto;
  color: #f4f7ff;
  background:
    linear-gradient(180deg, rgba(7, 8, 24, .42), rgba(7, 8, 24, .78)),
    url('assets/backgrounds/ludo-sunset-arena.webp') center / cover no-repeat,
    #090b22;
}
.match-setup {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 16px 28px;
}
.match-setup-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.match-setup-back,
.match-setup-step {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(9, 11, 34, .72);
  color: #fff;
  cursor: pointer;
}
.match-setup-back {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
}
.match-setup-back:hover,
.match-setup-step:hover { border-color: rgba(243,255,32,.7); }
.match-setup-kicker {
  margin: 0;
  color: #f3ff20;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.match-setup-heading h1 {
  margin: 2px 0 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 950;
  letter-spacing: -.03em;
  line-height: 1;
}
.match-setup-test {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(243,255,32,.55);
  border-radius: 999px;
  background: rgba(243,255,32,.12);
  color: #f3ff20;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.match-setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .8fr);
  gap: 16px;
  align-items: start;
}
.match-setup-look,
.match-setup-stake {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(12, 14, 40, .92), rgba(8, 10, 28, .9));
  box-shadow: 0 24px 60px rgba(1, 2, 16, .35);
}
.match-setup-look,
.match-setup-stake { min-width: 0; }
.match-setup-look { padding: 16px; }
.match-setup-stake { padding: 16px 16px 14px; }
.match-setup-look-head h2,
.match-setup-stake-head h2,
.match-setup-row h3 {
  margin: 0;
  font-weight: 950;
  letter-spacing: -.02em;
}
.match-setup-look-head p,
.match-setup-stake-head p,
.match-setup-empty {
  margin: 6px 0 0;
  color: rgba(244,247,255,.68);
  font-size: .86rem;
  line-height: 1.45;
}
.match-setup-matches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.match-setup-type {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.match-setup-type span { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 900; }
#match-setup-title:focus { outline: none; }
.match-setup-type small { color: rgba(244,247,255,.62); font-size: .75rem; }
.match-setup-type.is-selected {
  border-color: #f3ff20;
  background: rgba(243,255,32,.1);
}
.match-setup-type .lobby-status-badge { margin-left: 0; }
.match-setup-hero {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 14px 0;
  padding: 12px;
  border-radius: 18px;
  background: radial-gradient(120px 80px at 20% 70%, color-mix(in srgb, var(--seat, #E53935) 35%, transparent), transparent 70%), rgba(255,255,255,.03);
}
.match-setup-hero-art {
  position: relative;
  display: grid;
  place-items: end center;
  height: 148px;
}
.match-setup-hero-art svg {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 8px;
  width: calc(100% - 36px);
  height: 42px;
}
.match-setup-hero-art img {
  position: relative;
  z-index: 1;
  max-height: 132px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.35));
}
.match-setup-hero-copy p {
  margin: 0 0 4px;
  color: #f3ff20;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.match-setup-hero-copy h3 { margin: 0; font-size: 1.35rem; font-weight: 950; }
.match-setup-hero-copy span { color: var(--seat, #fff); font-weight: 800; }
.match-setup-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.match-setup-mini {
  margin: 0;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}
.match-setup-mini div {
  display: grid;
  place-items: center;
  height: 64px;
}
.match-setup-mini img { max-width: 100%; max-height: 58px; object-fit: contain; }
.match-setup-mini figcaption { font-size: .75rem; font-weight: 800; }
.match-setup-mini small {
  display: block;
  color: rgba(244,247,255,.5);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.match-setup-die,
.match-setup-pack {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}
.match-setup-die {
  background-color: #f4efe4;
  color: var(--seat, var(--red));
  box-shadow: inset 0 0 0 2px rgba(20,16,12,.16);
  background-image:
    radial-gradient(circle at 28% 28%, currentColor 2.3px, transparent 2.7px),
    radial-gradient(circle at 72% 28%, currentColor 2.3px, transparent 2.7px),
    radial-gradient(circle at 50% 50%, currentColor 2.3px, transparent 2.7px),
    radial-gradient(circle at 28% 72%, currentColor 2.3px, transparent 2.7px),
    radial-gradient(circle at 72% 72%, currentColor 2.3px, transparent 2.7px);
}
.match-setup-die[data-preview="dice-gold"] { background-color: #e4bc58; }
.match-setup-die[data-preview="dice-neon"] {
  background-color: #101a2e;
  box-shadow: inset 0 0 0 2px #62e8ff, 0 0 12px rgba(98,232,255,.35);
}
.match-setup-pack {
  background:
    radial-gradient(circle at 50% 50%, #f3ff20 0 3px, transparent 4px),
    conic-gradient(from 20deg, transparent 0 18deg, rgba(243,255,32,.85) 0 24deg, transparent 0 60deg, rgba(243,255,32,.55) 0 68deg, transparent 0 100%);
}
.match-setup-row { margin-top: 14px; }
.match-setup-row h3 { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(244,247,255,.72); }
.match-setup-chips,
.match-setup-colours {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}
.match-setup-chip,
.match-setup-colour {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  color: #fff;
  cursor: pointer;
}
.match-setup-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 132px;
  min-height: 58px;
  padding: 8px 12px;
  text-align: left;
}
.match-setup-chip span,
.match-setup-colour span:last-child { font-weight: 850; }
.match-setup-chip small { color: rgba(244,247,255,.6); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.match-setup-chip.is-selected,
.match-setup-colour.is-selected { border-color: #f3ff20; box-shadow: inset 0 0 0 1px #f3ff20; }
.match-setup-chip.is-locked { opacity: .55; }
.match-setup-colours { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
.match-setup-colour {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 96px;
  padding: 8px 6px;
}
.match-setup-swatch {
  position: relative;
  display: grid;
  place-items: end center;
  width: 100%;
  height: 58px;
}
.match-setup-swatch svg { width: 54px; height: 28px; }
.match-setup-swatch img {
  position: absolute;
  bottom: 8px;
  max-height: 52px;
  object-fit: contain;
}
.match-setup-colour.is-taken { opacity: .4; cursor: not-allowed; }
.match-setup-status:empty { display: none; }
.match-setup-status {
  margin: 12px 0 0;
  color: #f3ff20;
  font-size: .86rem;
  font-weight: 700;
}
.match-setup-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  margin: 14px auto 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #f4f7ff;
  color: #151724;
  font-size: 1.15rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.match-setup-stake { display: flex; flex-direction: column; align-items: center; }
.match-setup-stake-head,
.match-setup-prize,
.match-setup-custom,
.match-setup-cap,
.match-setup-commit { width: 100%; }
.match-setup-custom {
  display: grid;
  gap: 6px;
  margin: 4px 0 8px;
  color: rgba(244,247,255,.7);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.match-setup-custom input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
}
.match-setup-custom input:focus { outline: 2px solid #f3ff20; border-color: transparent; }
.match-setup-cap {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(243,255,32,.14);
  color: #f3ff20;
  font-size: .82rem;
  font-weight: 800;
}
.match-setup-cap[hidden] { display: none; }
.match-setup-prize {
  display: grid;
  gap: 6px;
  margin: 4px 0 12px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(0,0,0,.22);
}
.match-setup-prize-head,
.match-setup-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.match-setup-prize-head { color: rgba(244,247,255,.62); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.match-setup-line { padding-top: 6px; border-top: 1px solid rgba(255,255,255,.08); }
.match-setup-line span { display: flex; flex-direction: column; font-weight: 850; }
.match-setup-line small { color: rgba(244,247,255,.5); font-size: .68rem; font-weight: 700; }
.match-setup-line strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.match-setup-line[data-line="pot"] strong { color: #fff; }
.match-setup-line[data-line="house"] { color: rgba(244,247,255,.86); }
.match-setup-sum {
  margin: 2px 0 0;
  color: rgba(244,247,255,.55);
  font-size: .72rem;
}
.match-setup-commit {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: stretch;
}
.match-setup-step {
  min-height: 74px;
  border-radius: 16px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.match-setup-step[aria-disabled="true"] { opacity: .4; }
.match-setup-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 74px;
  border: 0;
  border-radius: 16px;
  background: #f3ff20;
  color: #151724;
  box-shadow: 0 7px 0 #8f9900;
  cursor: pointer;
}
.match-setup-play span { font-size: 1.2rem; font-weight: 950; letter-spacing: .04em; text-transform: uppercase; }
.match-setup-play small { font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.match-setup-play:disabled { cursor: not-allowed; opacity: .72; box-shadow: none; }
.match-setup-play:not(:disabled):hover { filter: brightness(1.05); }
.match-setup-back:focus-visible,
.match-setup-step:focus-visible,
.match-setup-play:focus-visible,
.match-setup-chip:focus-visible,
.match-setup-colour:focus-visible,
.match-setup-type:focus-visible { outline: 2px solid #f3ff20; outline-offset: 2px; }
@media (max-width: 860px) {
  #screen-match-setup.active-screen { overflow-x: hidden; overflow-y: auto; }
  .match-setup { width: 100%; max-width: 100%; min-width: 0; padding-bottom: 28px; }
  .match-setup-bar { grid-template-columns: auto minmax(0, 1fr); }
  .match-setup-heading { min-width: 0; }
  .match-setup-heading h1 { font-size: 1.7rem; white-space: normal; overflow-wrap: break-word; }
  .match-setup-test { grid-column: 1 / -1; justify-self: start; max-width: 100%; white-space: normal; }
  .match-setup-layout { grid-template-columns: minmax(0, 1fr); }
  .match-setup-look,
  .match-setup-stake,
  .match-setup-row,
  .match-setup-hero,
  .match-setup-hero-copy,
  .match-setup-prize,
  .match-setup-commit,
  .match-setup-custom,
  .match-setup-look-head,
  .match-setup-stake-head { min-width: 0; max-width: 100%; }
  .match-setup-look-head p,
  .match-setup-stake-head p,
  .match-setup-hero-copy h3,
  .match-setup-hero-copy span,
  .match-setup-type,
  .match-setup-type span,
  .match-setup-type small,
  .match-setup-line span,
  .match-setup-line small,
  .match-setup-mini figcaption,
  .match-setup-chip span,
  .match-setup-colour span {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: break-word;
  }
  .match-setup-line strong { flex-shrink: 0; }
  .match-setup-strip { grid-column: 1 / -1; }
  .match-setup-mini figcaption { text-align: center; }
  .match-setup-chips {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
  }
  .match-setup-chip {
    flex: 0 0 calc(50% - 4px);
    min-width: 0;
    max-width: calc(50% - 4px);
    scroll-snap-align: start;
  }
  .match-setup-colours {
    display: grid;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
  .match-setup-colour { min-width: 0; }
  .match-setup-matches { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .match-setup-play,
  .match-setup-step,
  .match-setup-chip { transition: none; }
}

/* ---------- QA-8: first viewport is the squad and Play ----------
   Unbuilt destinations stay in the markup so a shipped feature comes back
   by removing data-unbuilt. Display rules elsewhere force .home-tab to flex,
   so this selector has to outrank them. */
#screen-lobby .home-tabs button.home-tab[data-unbuilt],
#screen-lobby button.queue-choice[data-unbuilt] {
  display: none;
}
#screen-lobby .queue-picker {
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* The scenery used to cover the whole scrolling lobby, so the first screen
   was the dark top of that image and the squad sat low. Pin the art to the
   viewport and keep the hero (squad + Play) inside it. Rooms follow on scroll. */
#screen-lobby .home-lobby-art,
#screen-lobby .home-lobby-shade {
  bottom: auto;
  height: 100dvh;
}
#screen-lobby .home-lobby-art {
  background-position: 64% 72%;
}
#screen-lobby .home-lobby-shade {
  background:
    linear-gradient(90deg, rgba(7, 8, 30, .78) 0%, rgba(7, 8, 30, .34) 18%, transparent 38%),
    linear-gradient(180deg, rgba(7, 8, 30, .5) 0%, transparent 20%, transparent 70%, rgba(7, 8, 30, .28) 100%);
}
#screen-lobby .home-hero {
  height: calc(100dvh - 76px);
  min-height: 0;
  max-height: calc(100dvh - 76px);
}
#screen-lobby .home-hero .lobby-character {
  width: min(clamp(200px, 32vh, 380px), 22vw);
  bottom: clamp(108px, 18vh, 210px);
}
#screen-lobby .home-hero .lobby-character-yellow,
#screen-lobby .home-hero .lobby-character-green {
  width: min(clamp(188px, 30vh, 360px), 20vw);
}
#screen-lobby .home-hero .lobby-character-blue { --character-x: 46%; }
#screen-lobby .home-hero .lobby-character-yellow { --character-x: 60%; }
#screen-lobby .home-hero .lobby-character-red { --character-x: 74%; }
#screen-lobby .home-hero .lobby-character-green { --character-x: 86%; }
#screen-lobby .home-hero .party-status {
  top: clamp(12px, 2vh, 28px);
}

@media (max-width: 900px) {
  #screen-lobby .home-lobby-art {
    background-position: 58% 70%;
  }
  #screen-lobby .home-lobby-shade {
    background:
      linear-gradient(180deg, rgba(7, 8, 30, .55) 0%, transparent 16%, transparent 62%, rgba(7, 8, 30, .45) 100%);
  }
  #screen-lobby .home-hero {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 76px);
    min-height: 0;
    max-height: calc(100dvh - 76px);
  }
  #screen-lobby .home-hero .home-party {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    container-type: size;
  }
  #screen-lobby .home-hero .party-status {
    top: 8px;
    left: 50%;
  }
  #screen-lobby .home-hero .lobby-character,
  #screen-lobby .home-hero .lobby-character-yellow,
  #screen-lobby .home-hero .lobby-character-green {
    --character-x: 50%;
    top: auto;
    bottom: 0;
    width: min(calc(100cqh - 52px), 34cqw, 200px);
    height: auto;
  }
  #screen-lobby .home-hero .lobby-character-blue { --character-x: 22%; }
  #screen-lobby .home-hero .lobby-character-yellow { --character-x: 41%; }
  #screen-lobby .home-hero .lobby-character-red { --character-x: 60%; }
  #screen-lobby .home-hero .lobby-character-green { --character-x: 78%; }
  #screen-lobby .home-hero .home-mode-panel {
    position: relative;
    inset: auto;
    right: auto;
    bottom: auto;
    left: auto;
    flex: 0 0 auto;
    width: auto;
    max-height: none;
    margin: 0 10px 10px;
    padding: 14px;
  }
  #screen-lobby .home-hero .home-mode-panel h2 {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }
  #screen-lobby .home-play-button { min-height: 56px; }
  #screen-lobby .home-change-button { min-height: 40px; margin-top: 8px; }
  #screen-lobby .queue-choice { min-height: 46px; }
}
@media (max-width: 760px) {
  #screen-lobby .home-hero {
    height: calc(100dvh - 108px);
    max-height: calc(100dvh - 108px);
  }
}
@media (max-width: 760px) and (max-height: 700px) {
  #screen-lobby .home-hero .home-mode-panel { padding: 10px 12px; }
  #screen-lobby .home-hero .home-mode-panel > p { margin: 4px 0 8px; }
  #screen-lobby .home-play-button { min-height: 48px; }
  #screen-lobby .home-change-button { min-height: 36px; }
}
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  #screen-lobby .home-hero {
    display: block;
    height: calc(100dvh - 76px);
    max-height: calc(100dvh - 76px);
  }
  #screen-lobby .home-hero .home-party {
    position: absolute;
    inset: 0;
  }
  #screen-lobby .home-hero .lobby-character,
  #screen-lobby .home-hero .lobby-character-yellow,
  #screen-lobby .home-hero .lobby-character-green {
    width: min(28vh, 140px);
    bottom: 18px;
  }
  #screen-lobby .home-hero .lobby-character-blue { --character-x: 58%; }
  #screen-lobby .home-hero .lobby-character-yellow { --character-x: 70%; }
  #screen-lobby .home-hero .lobby-character-red { --character-x: 82%; }
  #screen-lobby .home-hero .lobby-character-green { --character-x: 92%; }
  #screen-lobby .home-hero .home-mode-panel {
    position: absolute;
    left: 12px;
    bottom: 8px;
    width: min(300px, 42vw);
    max-height: calc(100dvh - 88px);
    margin: 0;
    overflow: auto;
  }
  #screen-lobby .home-footer { display: none; }
}

/* MP-4 turn clock, away marker and resign (Vault board 1432). Online rooms only. */
.mp-turn-clock {
  align-self: center;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 14, 28, .72);
  color: #f4f6ff;
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.mp-turn-clock.mp-turn-clock-mine { box-shadow: 0 0 0 2px rgba(255, 214, 92, .85); }
.mp-turn-clock.mp-turn-clock-low { background: rgba(176, 32, 44, .9); }
.mp-away-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(10, 14, 28, .86);
  color: #f4f6ff;
  font-size: .78rem;
}
.mp-away-banner[hidden], .mp-turn-clock[hidden] { display: none; }
.mp-away-banner.mp-away-me { background: rgba(176, 112, 20, .95); }
/* MP-6 part B report dialog (Vault board 1447); reuses the match-confirm panel. */
.mp-report-form { display: grid; gap: 6px; margin-top: 10px; }
.mp-report-form label { color: #d6cbff; font-size: .72rem; font-weight: 700; }
.mp-report-form select, .mp-report-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 10px;
  background: rgba(10, 14, 28, .6);
  color: #f4f6ff;
  font: inherit;
  font-size: 16px;
}
.mp-report-form textarea { resize: vertical; min-height: 64px; }
.mp-report-status { min-height: 1.2em; margin: 2px 0 0; font-size: .78rem; }
@media (max-width: 520px) {
  .mp-turn-clock { min-width: 0; padding: 4px 8px; font-size: .6rem; }
  .mp-away-banner { font-size: .68rem; flex-wrap: wrap; justify-content: center; }
}
