/* BMOBA menu system: the arena artwork and all menu screens share one visual language. */
:root {
  --menu-ink: #080d12;
  --menu-panel: #101820;
  --menu-panel-raised: #17222b;
  --menu-line: #46515a;
  --menu-gold: #d6b879;
  --menu-gold-light: #f0d79e;
  --menu-copy: #edf0eb;
  --menu-muted: #a9b3b9;
  --menu-blue: #80badc;
  --menu-red: #d99383;
}

body.menu-page {
  display: block;
  min-height: 100vh;
  background: var(--menu-ink);
  color: var(--menu-copy);
  font-family: 'Manrope', Arial, sans-serif;
  overflow-x: hidden;
}

.menu-page button,
.menu-page input,
.menu-page select { font: inherit; }
.menu-page button { cursor: pointer; }
.menu-page :focus-visible { outline: 2px solid var(--menu-gold-light); outline-offset: 3px; }

.arena-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('../assets/arena-hero-v2.webp') center center / cover no-repeat;
}
.arena-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 9, 13, .20), rgba(5, 9, 13, .32) 26%, rgba(5, 9, 13, .36) 74%, rgba(5, 9, 13, .22)),
    linear-gradient(180deg, rgba(4, 7, 10, .68), transparent 25%, transparent 63%, #080d12 100%);
}
.lobby-page .arena-backdrop::after,
.room-page .arena-backdrop::after,
.history-page-body .arena-backdrop::after {
  background: linear-gradient(180deg, rgba(4, 8, 12, .86), rgba(6, 11, 15, .72) 45%, #080d12);
}

.site-header {
  position: relative;
  z-index: 2;
  width: min(1460px, calc(100% - 72px));
  height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(214, 184, 121, .28);
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--menu-copy);
  font: 700 24px/1 'Cinzel', Georgia, serif;
  letter-spacing: .16em;
  text-decoration: none;
}
.site-brand small {
  display: block;
  margin-top: 7px;
  color: var(--menu-gold);
  font: 700 9px/1 'Manrope', Arial, sans-serif;
  letter-spacing: .34em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 1px solid var(--menu-gold);
  transform: rotate(45deg);
  color: var(--menu-gold-light);
  font: 700 27px/1 Georgia, serif;
  box-shadow: inset 0 0 0 4px rgba(214, 184, 121, .08);
}
.brand-mark span { transform: rotate(-45deg); }
.site-nav { display: flex; align-items: center; gap: 32px; }
.site-nav a, .site-nav button {
  color: #dbe0de;
  font: 700 11px/1 'Manrope', Arial, sans-serif;
  letter-spacing: .15em;
  text-transform: uppercase;
  text-decoration: none;
  background: none;
  border: 0;
}
.site-nav a:hover, .site-nav button:hover { color: var(--menu-gold-light); }
.build-label {
  padding: 9px 12px;
  border: 1px solid rgba(214, 184, 121, .45);
  color: var(--menu-gold-light);
  font: 700 10px/1 'Manrope', Arial, sans-serif;
  letter-spacing: .13em;
}

.home-shell {
  position: relative;
  z-index: 1;
  min-height: calc(100svh - 92px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 22px 36px;
}
.hero-copy { text-align: center; max-width: 760px; }
.overline, .page-overline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 13px;
  color: var(--menu-gold-light);
  font: 700 11px/1.4 'Manrope', Arial, sans-serif;
  letter-spacing: .33em;
}
.overline span { width: 34px; height: 1px; background: var(--menu-gold); opacity: .7; }
.hero-copy h1 {
  margin: 0 0 8px;
  color: #fff8e9;
  font: 600 clamp(70px, 8vw, 128px)/1 'Cinzel', Georgia, serif;
  letter-spacing: .08em;
  text-shadow: 0 4px 32px #000, 0 0 60px rgba(214, 184, 121, .20);
}
.hero-subtitle {
  color: #e1e5e1;
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: .03em;
  text-shadow: 0 2px 15px #000;
}
.play-panel {
  position: relative;
  width: min(440px, 100%);
  margin: 34px auto 24px;
  padding: 27px 30px 24px;
  background: linear-gradient(145deg, rgba(20, 29, 36, .96), rgba(8, 13, 18, .97));
  border: 1px solid rgba(214, 184, 121, .48);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .65), inset 0 0 0 4px rgba(214, 184, 121, .045);
}
.play-panel::before, .lobby-board::before, .team-column::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 98px;
  height: 2px;
  transform: translateX(-50%);
  background: var(--menu-gold);
  box-shadow: 0 0 20px rgba(214, 184, 121, .55);
}
.panel-topline {
  display: flex;
  justify-content: space-between;
  color: var(--menu-gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
}
.play-panel h2 {
  margin: 18px 0 5px;
  color: #f5eee0;
  font: 500 29px/1.2 'Cinzel', Georgia, serif;
}
.panel-intro { margin: 0 0 25px; color: var(--menu-muted); font-size: 13px; line-height: 1.6; }
.menu-page .input-group { margin: 0 0 17px; }
.menu-page .input-group label,
.menu-page .form-group label,
.menu-page .control-group label {
  display: block;
  margin-bottom: 9px;
  color: #d9d1bd;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
}
.menu-page input[type='text'],
.menu-page select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #5b666b;
  border-radius: 2px;
  background: #0d151c;
  color: var(--menu-copy);
  font-size: 14px;
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, .3);
}
.menu-page input::placeholder { color: #879298; }
.menu-page input:hover, .menu-page select:hover { border-color: #b6a27b; }
.menu-page input:focus, .menu-page select:focus { border-color: var(--menu-gold-light); background: #101b22; box-shadow: none; outline: none; }
.menu-page .btn-primary,
.menu-page .btn-secondary {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  width: auto;
  padding: 12px 19px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
  box-shadow: none;
  overflow: visible;
}
.menu-page .btn-primary {
  border: 1px solid #efdbac;
  background: linear-gradient(180deg, #e2c68c, #b9985c);
  color: #171510;
}
.menu-page .btn-primary:hover:not(:disabled) { background: #f0d79e; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(214, 184, 121, .2); }
.menu-page .btn-secondary {
  border: 1px solid rgba(214, 184, 121, .54);
  background: rgba(8, 14, 19, .68);
  color: #ede5d2;
}
.menu-page .btn-secondary:hover:not(:disabled) { border-color: var(--menu-gold-light); background: #293039; transform: translateY(-2px); }
.menu-page .btn-primary::before, .menu-page .btn-secondary::before { display: none; }
.menu-page button:disabled { opacity: .55; cursor: not-allowed; }
.menu-page .btn-glow { display: none; }
.menu-page .menu-action { width: 100%; justify-content: space-between; margin-top: 9px; }
.menu-action span:last-child { font-size: 19px; line-height: .8; }
.menu-page .status-message { min-height: 18px; margin-top: 15px; color: var(--menu-gold-light); font-size: 12px; text-align: center; text-shadow: none; animation: none; }
.hero-bottomline {
  display: flex;
  justify-content: space-between;
  width: min(440px, 100%);
  gap: 18px;
  color: #e5ded0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-shadow: 0 2px 12px #000;
}
.feature-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  padding: 28px max(35px, calc((100% - 1240px) / 2));
  gap: 38px;
  border-top: 1px solid rgba(214, 184, 121, .35);
  background: #0b1218;
}
.feature-strip > div { position: relative; padding-left: 43px; }
.feature-number { position: absolute; left: 0; top: 1px; color: var(--menu-gold); font: 600 22px/1 'Cinzel', Georgia, serif; }
.feature-strip strong { color: #ece2cd; font-size: 10px; letter-spacing: .17em; }
.feature-strip p { margin: 8px 0 0; color: #a5b0b5; font-size: 12px; line-height: 1.5; }

/* Lobby browser and lobby room */
.lobby-shell, .room-shell {
  position: relative;
  z-index: 1;
  width: min(1190px, calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0 80px;
}
.page-heading { text-align: center; margin-bottom: 31px; }
.page-heading h1 {
  margin: 0;
  color: #f5ead4;
  font: 500 clamp(33px, 5vw, 56px)/1.15 'Cinzel', Georgia, serif;
  letter-spacing: .03em;
  text-shadow: 0 4px 20px #000;
}
.page-heading p:last-child { margin-top: 12px; color: var(--menu-muted); font-size: 14px; }
.lobby-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.lobby-actions .btn-primary { min-width: 190px; }
.lobby-board, .controls-section, .team-column {
  position: relative;
  background: linear-gradient(140deg, rgba(19, 29, 37, .97), rgba(9, 15, 21, .97));
  border: 1px solid rgba(214, 184, 121, .34);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .43);
}
.lobby-board { min-height: 400px; padding: 28px; }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid rgba(214, 184, 121, .22); }
.board-heading h2, .controls-section h3 { margin: 0; color: #efe6d4; font: 500 23px/1.2 'Cinzel', Georgia, serif; }
.lobby-count { color: var(--menu-gold-light); font-size: 11px; font-weight: 700; letter-spacing: .11em; }
.lobby-list { display: grid; gap: 10px; margin-top: 18px; }
.lobby-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  background: #111b23;
  border: 1px solid #384750;
  border-left: 2px solid var(--menu-gold);
  transition: border-color .18s ease, background .18s ease;
}
.lobby-item:hover { border-color: var(--menu-gold); background: #1b2830; }
.lobby-info h3 { margin: 0 0 9px; color: #f0d79e; font: 500 19px/1.25 'Cinzel', Georgia, serif; }
.lobby-details { display: flex; flex-wrap: wrap; gap: 18px; }
.lobby-detail { color: var(--menu-muted); font-size: 12px; }
.lobby-detail-icon { margin-right: 6px; color: var(--menu-gold); }
.lobby-item .btn-primary { min-width: 100px; }
.empty-state { display: grid; place-items: center; align-content: center; min-height: 260px; text-align: center; color: var(--menu-muted); }
.empty-state-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 13px; border: 1px solid #6f674f; color: var(--menu-gold); font: 34px/1 Georgia, serif; transform: rotate(45deg); }
.empty-state p { margin: 3px 0; }
.empty-state-hint { font-size: 12px; }

.menu-page .modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 9, .83);
}
.menu-page .modal.active { display: flex; }
.modal-content { width: min(480px, 100%); padding: 29px; background: #121d26; border: 1px solid var(--menu-gold); box-shadow: 0 24px 90px #000; }
.modal-content h2 { margin: 0 0 9px; color: #f3e7ce; font: 500 28px/1.2 'Cinzel', Georgia, serif; }
.modal-content > p { margin: 0 0 25px; color: var(--menu-muted); font-size: 13px; }
.button-group { display: flex; gap: 10px; margin-top: 25px; }
.button-group button { flex: 1; }

.room-shell { width: min(1220px, calc(100% - 48px)); }
.room-heading { margin-bottom: 27px; }
.room-heading #lobby-mode { color: var(--menu-gold); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.teams-container { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; margin-bottom: 17px; }
.team-column { min-height: 275px; padding: 24px; }
.team-column.team1 { border-top-color: var(--menu-blue); }
.team-column.team2 { border-top-color: var(--menu-red); }
.team-column.team1::before { background: var(--menu-blue); }
.team-column.team2::before { background: var(--menu-red); }
.team-column h2 { margin: 0 0 18px; color: var(--menu-blue); font: 600 23px/1.2 'Cinzel', Georgia, serif; }
.team-column.team2 h2 { color: var(--menu-red); }
.player-card, .empty-slot { min-height: 55px; margin: 9px 0; padding: 12px 14px; border: 1px solid #394954; background: #101a22; }
.player-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.player-card.you { border-color: var(--menu-gold); }
.player-card .name { color: #f1ece2; font-weight: 700; font-size: 13px; }
.player-card .class { color: var(--menu-muted); font-size: 12px; }
.player-card .ready { color: #b8d5b1; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.you-badge { margin-left: 8px; color: var(--menu-gold); font-size: 10px; }
.ai-badge { margin-left: 8px; color: #a6d8e8; font-size: 10px; letter-spacing: .1em; }
.ai-remove { flex: none; border: 1px solid #6f5a52; color: #e6c9bd; background: #291e1c; padding: 7px 10px; cursor: pointer; font: 700 10px 'Manrope', sans-serif; text-transform: uppercase; }
.ai-remove:hover { border-color: #e1ad95; background: #49302a; }
.ai-section { margin-top: 18px; }
.ai-section[hidden] { display: none; }
.ai-intro { margin: -6px 0 17px; color: var(--menu-muted); font-size: 12px; }
.ai-control-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 16px; }
.ai-control-grid .btn-secondary { min-height: 46px; }
.ai-feedback { min-height: 18px; margin: 10px 0 0; color: #e7b3a0; font-size: 12px; }
.empty-slot { display: flex; align-items: center; justify-content: center; border-style: dashed; color: #84939d; font-size: 12px; }
.controls-section { padding: 24px; }
.controls-section h3 { margin-bottom: 19px; }
.control-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(170px, .7fr) auto; align-items: end; gap: 20px; }
.control-group #switch-team-btn { width: 100%; margin: 0 !important; }
.ready-container { display: flex; align-items: center; min-height: 48px; }
.ready-checkbox { display: flex; align-items: center; gap: 10px; color: var(--menu-copy); font-size: 12px; font-weight: 700; white-space: nowrap; }
.ready-checkbox input { width: 19px; height: 19px; accent-color: var(--menu-gold); }
.actions { display: flex; justify-content: space-between; gap: 16px; margin-top: 19px; }
.actions .btn-primary { min-width: 230px; }

/* Match history follows the same menu framing. */
.history-shell { position: relative; z-index: 1; width: min(1190px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0 80px; }
.history-header { margin-bottom: 28px; }
.history-header h1 { margin: 0; color: #f5ead4; font: 500 clamp(33px, 5vw, 56px)/1.15 'Cinzel', Georgia, serif; text-shadow: 0 4px 20px #000; }
.history-header p:last-child { margin: 12px 0 0; color: var(--menu-muted); font-size: 14px; }
#history-status { min-height: 22px; margin: 0 0 17px; color: var(--menu-gold-light); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
#match-list { display: grid; gap: 14px; }
.match-card { padding: 23px; background: linear-gradient(140deg, rgba(19, 29, 37, .97), rgba(9, 15, 21, .97)); border: 1px solid rgba(214, 184, 121, .34); box-shadow: 0 20px 55px #0006; }
.match-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.match-heading h2 { margin: 0; color: #f0d79e; font: 500 25px/1.2 'Cinzel', Georgia, serif; }
.match-heading p { margin: 0; color: var(--menu-muted); font-size: 12px; }
.team-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.team-panel { padding: 16px; background: #111b23; border: 1px solid #384750; border-left: 3px solid var(--menu-blue); }
.team-panel.red { border-left-color: var(--menu-red); }
.team-panel.winner { background: #1d2a30; }
.team-panel h3 { margin: 0 0 9px; color: #ece4d3; font: 600 18px/1.2 'Cinzel', Georgia, serif; }
.team-panel p { margin: 5px 0; color: #c2cbd0; font-size: 12px; overflow-wrap: anywhere; }
.match-details { margin-top: 16px; }
.match-details summary { cursor: pointer; color: var(--menu-gold-light); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stats-scroll { overflow-x: auto; margin-top: 13px; }
.stats-table { border-collapse: collapse; width: 100%; min-width: 1040px; }
.stats-table th, .stats-table td { padding: 10px; text-align: left; border-bottom: 1px solid #394852; font-size: 12px; }
.stats-table th { color: var(--menu-gold-light); white-space: nowrap; }
.stats-table td { color: #dae1e3; }
.stats-table td:first-child { font-weight: 700; overflow-wrap: anywhere; }
#load-more { display: none; margin: 22px auto 0; }

@media (max-height: 800px) and (min-width: 761px) {
  .site-header { height: 76px; }
  .home-shell { min-height: calc(100svh - 76px); padding: 20px 22px; }
  .hero-copy h1 { font-size: clamp(66px, 7vw, 95px); }
  .overline { margin-bottom: 7px; }
  .play-panel { margin: 21px auto 15px; padding: 20px 27px 16px; }
  .play-panel h2 { margin-top: 13px; font-size: 25px; }
  .panel-intro { margin-bottom: 16px; }
  .menu-page .input-group { margin-bottom: 9px; }
  .menu-page input[type='text'] { min-height: 43px; }
  .menu-page .menu-action { min-height: 43px; }
  .menu-page .status-message { min-height: 11px; margin-top: 9px; }
}
@media (max-width: 760px) {
  .site-header { width: calc(100% - 34px); height: 72px; }
  .site-brand { font-size: 17px; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; font-size: 20px; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: 10px; }
  .build-label { display: none; }
  .home-shell { min-height: calc(100svh - 72px); padding: 36px 18px; }
  .hero-copy h1 { font-size: clamp(57px, 14vw, 88px); }
  .arena-backdrop { background-position: 50% center; }
  .arena-backdrop::after { background: linear-gradient(90deg, rgba(5, 9, 13, .58), rgba(5, 9, 13, .68)), linear-gradient(180deg, rgba(5, 9, 13, .4), transparent 35%, #080d12); }
  .feature-strip { grid-template-columns: 1fr; gap: 23px; padding: 28px 24px; }
  .lobby-shell, .room-shell { width: calc(100% - 30px); padding-top: 32px; }
  .history-shell { width: calc(100% - 30px); padding-top: 32px; }
  .teams-container { grid-template-columns: 1fr; }
  .team-summary { grid-template-columns: 1fr; }
  .control-grid { grid-template-columns: 1fr 1fr; }
  .ai-control-grid { grid-template-columns: 1fr 1fr; }
  .ai-control-grid .btn-secondary { grid-column: 1 / -1; }
  .ready-container { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .site-nav { gap: 8px; }
  .site-nav a { font-size: 9px; letter-spacing: .04em; }
  .play-panel { padding: 24px 20px; }
  .hero-bottomline { flex-direction: column; align-items: center; gap: 7px; }
  .lobby-actions .btn-primary { width: 100%; }
  .lobby-board { padding: 20px 16px; }
  .lobby-item { align-items: stretch; flex-direction: column; }
  .lobby-item .btn-primary { width: 100%; }
  .control-grid { grid-template-columns: 1fr; }
  .ai-control-grid { grid-template-columns: 1fr; }
  .ai-control-grid .btn-secondary { grid-column: auto; }
  .ready-container { grid-column: auto; }
  .actions { flex-direction: column-reverse; }
  .actions > div, .actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-page *, .menu-page *::before, .menu-page *::after { animation: none !important; transition: none !important; }
}

/* Rejoin a running match after a crash (index.html). */
.menu-page .rejoin-matches { margin: 4px 0 14px; padding: 10px 12px 12px; border: 1px solid rgba(214, 184, 121, .55); border-radius: 6px; background: rgba(214, 184, 121, .08); }
.menu-page .rejoin-heading { margin: 0 0 2px; color: var(--menu-gold-light); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.menu-page .rejoin-button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

/* Practice options (index.html). */
.menu-page .practice-panel { margin-top: 9px; padding: 10px 12px 12px; border: 1px solid rgba(214, 184, 121, .35); border-radius: 6px; background: rgba(8, 15, 22, .6); }
.menu-page .practice-intro { margin: 0 0 8px; color: #b9c2c6; font-size: 12px; line-height: 1.4; }
.menu-page .practice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; }
.menu-page .practice-row label { color: var(--menu-gold-light); font-size: 11px; letter-spacing: .1em; }
.menu-page .practice-row select { flex: 0 0 60%; padding: 6px 8px; background: #0b141c; color: #f1ead8; border: 1px solid rgba(214, 184, 121, .45); border-radius: 4px; font: inherit; }
