/* The Halo CE menu look (layouts/halo: the server browser, create server, the play page's overlays): navy space,
   cyan-blue outlined panels with cut corners, blocky caps headers, a button legend. From docs/user-servers/mockup. */
:root {
  --bg0: #020814; --bg1: #06142b; --panel: rgba(6, 26, 58, .78); --panel-hi: rgba(18, 60, 120, .85);
  --line: #2f8cff; --line-soft: rgba(47, 140, 255, .45); --text: #cfe6ff; --muted: #7fa3cc; --head: #6fc3ff;
  --glow: 0 0 6px rgba(80, 170, 255, .75), 0 0 18px rgba(40, 120, 255, .35);
  --red: #ff4b4b; --blue: #3f8dff; --gold: #ffcf4a; --green: #5dff8f;
  --cut: 14px;
  font-family: "Eurostile", "Bank Gothic", "Microgramma", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--text); background: var(--bg0); }
html { background: var(--bg0); }
body.space { background:
  radial-gradient(1200px 600px at 75% -10%, rgba(40, 90, 200, .35), transparent 60%),
  radial-gradient(900px 500px at -10% 110%, rgba(20, 60, 140, .35), transparent 60%),
  radial-gradient(2px 2px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 60% 70%, #fff6, transparent),
  radial-gradient(1px 1px at 80% 20%, #fff7, transparent), radial-gradient(1.5px 1.5px at 35% 85%, #fff5, transparent),
  linear-gradient(180deg, var(--bg1), var(--bg0)); background-attachment: fixed; }
h1, h2, h3, .caps { text-transform: uppercase; letter-spacing: .06em; margin: 0; }
h1 { font: 900 34px/1 "Arial Black", Impact, sans-serif; color: var(--head); text-shadow: var(--glow); letter-spacing: .04em; }
h2 { font: 800 15px/1.2 "Arial Black", sans-serif; color: var(--head); }
h3 { font: 700 12px/1.2 Arial, sans-serif; color: var(--muted); letter-spacing: .12em; }
.muted { color: var(--muted); }
/* the angled panel: cut top-left and bottom-right corners, a 1px blue outline drawn by a pseudo-element */
.panel { position: relative; background: var(--panel); padding: 14px 16px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--line); z-index: 2;
  clip-path: polygon(evenodd,
    var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut), var(--cut) 0,
    calc(var(--cut) + .41px) 1px, calc(100% - 1px) 1px, calc(100% - 1px) calc(100% - var(--cut) - .41px), calc(100% - var(--cut) - .41px) calc(100% - 1px), 1px calc(100% - 1px), 1px calc(var(--cut) + .41px), calc(var(--cut) + .41px) 1px); }
.topbar { display: flex; align-items: center; gap: 18px; padding: 16px 22px 12px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(10, 40, 90, .6), transparent); }
.topbar .sub { color: var(--muted); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.topbar .spacer { flex: 1; }
.player-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line-soft); border-radius: 18px; font-size: 13px; background: rgba(0,0,0,.25); }
.player-chip .swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--red); box-shadow: 0 0 6px var(--red); }
.btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border: 1px solid var(--line); color: var(--text); background: rgba(20, 70, 140, .45);
  padding: 9px 16px; font: 700 13px/1 Arial, sans-serif; text-transform: uppercase; letter-spacing: .08em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.btn:hover, .btn.hi { background: rgba(50, 130, 255, .55); box-shadow: var(--glow); }
.btn.primary { background: linear-gradient(180deg, #2f8cff, #1455b8); border-color: #8cc8ff; color: #fff; }
.btn.ghost { background: transparent; }
.xb { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 900 11px Arial; color: #fff; }
.xb.a { background: #2fa84f; } .xb.b { background: #d8322b; } .xb.x { background: #2a6fdb; } .xb.y { background: #e0b020; }
.kbd { display: inline-block; min-width: 22px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 4px; font: 700 12px/1.2 Arial; color: #fff; background: rgba(10,40,90,.8); text-align: center; }
.legend { display: flex; gap: 22px; justify-content: center; padding: 10px; border-top: 1px solid var(--line-soft); font: 800 13px Arial; color: var(--head); text-transform: uppercase; letter-spacing: .06em; background: rgba(0, 0, 0, .35); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- server browser */
.browser { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; padding: 18px 22px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tab { padding: 7px 14px; border: 1px solid var(--line-soft); font: 700 12px Arial; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); cursor: pointer; background: rgba(0,0,0,.25); }
.tab.on { color: #fff; border-color: var(--line); background: rgba(47, 140, 255, .3); box-shadow: var(--glow); }
.toolbar .count { margin-left: auto; font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.meter { display: inline-block; width: 90px; height: 6px; background: rgba(255,255,255,.1); vertical-align: middle; margin: 0 6px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--line), #8cc8ff); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { padding: 0; cursor: pointer; --cut: 12px; transition: transform .08s; }
.card:hover { transform: translateY(-2px); }
.card.sel { background: var(--panel-hi); box-shadow: var(--glow); }
.card.sel::before { background: #9fd4ff; }
.card .pic { position: relative; aspect-ratio: 140 / 80; background: #0b1d3a center / cover no-repeat; border-bottom: 1px solid var(--line-soft); }
.card .pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(2, 8, 20, .9)); }
.card .gt { position: absolute; right: 8px; top: 8px; width: 44px; height: 36px; background: center / cover; border: 1px solid var(--line); z-index: 1; }
.badge { font: 800 10px Arial; letter-spacing: .1em; padding: 3px 7px; text-transform: uppercase; }
.card .badge { position: absolute; left: 8px; top: 8px; z-index: 1; }
.badge.official { background: var(--gold); color: #1a1200; }
.badge.community { background: rgba(0,0,0,.6); color: var(--text); border: 1px solid var(--line-soft); }
.badge.yours { background: var(--green); color: #002010; }
.card .mapname { position: absolute; left: 10px; bottom: 6px; z-index: 1; font: 900 18px "Arial Black", sans-serif; text-transform: uppercase; color: #fff; text-shadow: 0 1px 3px #000; }
.card .body { padding: 9px 12px 12px; }
.card .name { font: 700 15px Arial; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .line { display: flex; gap: 10px; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { font: 700 10px Arial; letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border: 1px solid var(--line-soft); color: var(--text); background: rgba(47, 140, 255, .12); }
.chip.warn { border-color: #ff8a3d; color: #ffc59e; }
.players b { color: #fff; }
.state { display: inline-flex; align-items: center; gap: 5px; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.state.lobby::before { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.state.full::before { background: var(--red); box-shadow: 0 0 6px var(--red); }
.bar { height: 4px; background: rgba(255,255,255,.08); margin-top: 7px; }
.bar i { display: block; height: 100%; background: var(--line); }

/* the rule details panel */
.details { position: sticky; top: 18px; align-self: start; padding: 0; --cut: 18px; }
.details .pic { aspect-ratio: 140 / 70; background: center / cover; position: relative; }
.details .pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(6, 26, 58, 1)); }
.details .head { padding: 0 18px; margin-top: -40px; position: relative; z-index: 1; }
.details .head h2 { font-size: 20px; color: #fff; }
.details .head .muted { font-size: 13px; margin-top: 4px; }
.details .sect { padding: 10px 18px; border-top: 1px solid rgba(47, 140, 255, .2); }
.rules { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin-top: 7px; font-size: 13px; }
.rules dt { color: var(--muted); } .rules dd { margin: 0; color: #fff; font-weight: 700; text-align: right; }
.rules dd.off { color: var(--muted); font-weight: 400; }
.roster { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 7px; font-size: 13px; max-height: 22em; overflow-y: auto; }
.roster .r { color: #ffb0b0; } .roster .b { color: #a9ccff; }
.details .actions { display: flex; gap: 8px; padding: 14px 18px 18px; }
.details .actions .btn { flex: 1; justify-content: center; }
.foot { font-size: 11px; color: var(--muted); padding: 0 18px 14px; }

/* ---------- create */
.create { max-width: 1180px; margin: 0 auto; padding: 18px 22px 30px; }
.steps { display: flex; gap: 6px; margin: 4px 0 16px; }
.step { flex: 1; padding: 8px 12px; font: 800 12px Arial; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-soft); background: rgba(0,0,0,.25);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); padding-left: 20px; }
.step.done { color: var(--text); } .step.on { color: #fff; background: rgba(47, 140, 255, .35); border-color: var(--line); }
.create-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 10px; }
.maptile { position: relative; aspect-ratio: 140 / 116; background: center / cover; border: 1px solid var(--line-soft); cursor: pointer; }
.maptile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 5px; font: 800 10px Arial; text-transform: uppercase; letter-spacing: .06em; background: rgba(0,0,0,.7); }
.maptile.on { border: 2px solid #9fd4ff; box-shadow: var(--glow); }
.maptile.on::after { content: "✓"; position: absolute; top: 4px; right: 6px; font: 900 16px Arial; color: #9fd4ff; text-shadow: 0 0 6px #000; }
.gametypes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.gtile { border: 1px solid var(--line-soft); padding: 0 0 6px; text-align: center; font: 800 11px Arial; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; background: rgba(0,0,0,.25); }
.gtile i { display: block; aspect-ratio: 140/100; background: center / cover; margin-bottom: 5px; }
.gtile.on { border-color: #9fd4ff; box-shadow: var(--glow); background: rgba(47,140,255,.25); }
.opt-group { margin-top: 12px; }
.opt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(47, 140, 255, .15); font-size: 13px; }
.spin { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line-soft); }
.spin button { width: 26px; height: 26px; border: 0; background: rgba(47,140,255,.2); color: var(--text); font: 900 14px Arial; cursor: pointer; }
.spin output { min-width: 96px; text-align: center; font: 700 13px Arial; color: #fff; }
.toggle { width: 42px; height: 22px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.35); position: relative; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); }
.toggle.on { background: rgba(47,140,255,.5); } .toggle.on::after { left: 22px; background: #fff; box-shadow: var(--glow); }
.field { display: grid; gap: 5px; margin-top: 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field input { font: 700 15px Arial; color: #fff; background: rgba(0,0,0,.35); border: 1px solid var(--line); padding: 9px 10px; }
.notice { margin-top: 12px; font-size: 12px; color: var(--muted); border-left: 3px solid var(--line); padding: 6px 10px; background: rgba(47,140,255,.08); }

/* ---------- slim play page */
body.play { overflow: hidden; background: #000; }
.game-view { position: fixed; inset: 0; background: #000 center / contain no-repeat; image-rendering: auto; }
.hud-btns { position: fixed; top: 12px; left: 12px; display: flex; gap: 8px; z-index: 5; opacity: .9; }
.hud-btns .btn { padding: 7px 11px; font-size: 12px; background: rgba(6, 26, 58, .72); backdrop-filter: blur(3px); }
.hud-btns .btn .kbd { font-size: 10px; min-width: 18px; padding: 1px 4px; }
.conn { position: fixed; top: 14px; right: 14px; z-index: 5; font: 700 11px Arial; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; align-items: center; background: rgba(0,0,0,.45); padding: 5px 9px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.chat { position: fixed; left: 14px; bottom: 150px; width: min(430px, calc(100vw - 28px)); z-index: 4; font-size: 13px; }
.chat ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.chat li { text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.chat li b.r { color: #ff9b9b; } .chat li b.b { color: #9cc4ff; } .chat li.sys { color: var(--muted); font-style: italic; }
.chat .hint { margin-top: 8px; display: inline-flex; gap: 6px; align-items: center; font: 700 11px Arial; color: var(--muted); background: rgba(0,0,0,.5); padding: 4px 8px; letter-spacing: .04em; }
.chat .compose { margin-top: 8px; padding: 8px 10px; --cut: 8px; }
.chat .compose .row { display: flex; gap: 8px; align-items: center; }
.chat .compose .to { font: 800 11px Arial; color: var(--head); text-transform: uppercase; letter-spacing: .08em; }
.chat .compose input { flex: 1; font: 14px Arial; color: #fff; background: rgba(0,0,0,.4); border: 1px solid var(--line); padding: 7px 8px; outline: none; box-shadow: var(--glow); }
.chat .compose .keys { display: flex; gap: 14px; margin-top: 7px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.chat.faded ol { opacity: .75; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(2, 8, 20, .55); z-index: 8; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(1100px, 94vw); z-index: 9; background: linear-gradient(180deg, rgba(8, 26, 56, .97), rgba(2, 8, 20, .97)); border-right: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: 10px 0 40px rgba(0,0,0,.6); }
.drawer .browser { overflow: auto; flex: 1; grid-template-columns: minmax(0, 1fr) 330px; }
.drawer .topbar h1 { font-size: 24px; }
.drawer .tabs2 { display: flex; gap: 6px; }
.here { outline: 2px solid var(--green); }

/* ---------- phone */
@media (max-width: 760px) {
  .browser, .drawer .browser { grid-template-columns: 1fr; padding: 12px; }
  .details { position: static; }
  .cards { grid-template-columns: 1fr; }
  .card .pic { aspect-ratio: 140 / 52; background-position: center 40%; }
  h1 { font-size: 24px; }
  .topbar { flex-wrap: wrap; padding: 12px; gap: 10px; }
  .topbar .sub { display: none; }
  .create-grid { grid-template-columns: 1fr; }
  .steps .step { font-size: 10px; padding: 7px 6px 7px 14px; }
  .legend { gap: 12px; font-size: 11px; flex-wrap: wrap; }
  .drawer { width: 100vw; }
  .chat { bottom: 120px; }
}

/* ---------- site pieces in the Halo look */
a { color: #8cc8ff; }
body.space { font-size: 14px; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
.maptile, .gtile { font-family: inherit; color: var(--text); padding: 0; }
body.space > main { flex: 1; }
.topbar .banner img { display: block; height: 52px; width: auto; }
.topbar .titles { display: grid; gap: 4px; }
.player-chip .swatch { background: var(--swatch, var(--red)); box-shadow: 0 0 6px var(--swatch, var(--red)); }
.player-chip img { width: 22px; height: 22px; object-fit: cover; object-position: top; border-radius: 50%; background: rgba(0,0,0,.4); }
a.btn { text-decoration: none; }
.btn[disabled], .btn.disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.danger { border-color: #ff6b6b; background: rgba(160, 30, 30, .35); }
.btn:focus-visible, .tab:focus-visible, .card:focus-visible, .maptile:focus-visible, .gtile:focus-visible { outline: 2px solid #9fd4ff; outline-offset: 2px; }
button.tab { font-family: inherit; }
.flash { margin: 12px 22px 0; padding: 8px 12px; border-left: 3px solid var(--line); background: rgba(47,140,255,.1); font-size: 13px; }
.flash.warning { border-color: var(--gold); background: rgba(255, 207, 74, .08); }
.flash.error { border-color: var(--red); background: rgba(255, 75, 75, .08); }
.site-footer { margin: 28px auto 0; padding: 14px 22px 18px; border-top: 1px solid var(--line-soft); text-align: center; font-size: 12px; color: var(--muted); max-width: 1100px; }
.site-footer p { margin: 3px 0; } .site-footer .fine { font-size: 11px; opacity: .8; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.card .pic.plain { background-image: linear-gradient(135deg, #0f2a55, #06142b); }
.card .gt.plain { display: none; }
.badge.starting { background: rgba(255, 207, 74, .2); color: var(--gold); border: 1px solid var(--gold); }
.state.starting::before, .state.offline::before { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.state.offline::before, .state.failed::before { background: var(--red); box-shadow: 0 0 6px var(--red); }
.state.postgame::before { background: #b58cff; box-shadow: 0 0 6px #b58cff; }
.details .pic.plain { background-image: linear-gradient(135deg, #0f2a55, #06142b); }
.details .notice { margin: 0 18px 12px; }
.rules dd.changed { color: var(--gold); }
.rules dd.changed::after { content: " *"; color: var(--gold); }
.notice.warn { border-color: var(--gold); background: rgba(255, 207, 74, .08); color: #ffe7a6; }
.notice.bad { border-color: var(--red); background: rgba(255, 75, 75, .08); color: #ffc9c9; }
.error-text { color: #ff9b9b; font-size: 12px; margin-top: 4px; }
.opt select, .field select { font: 700 13px Arial; color: #fff; background: rgba(0,0,0,.45); border: 1px solid var(--line-soft); padding: 4px 6px; }
.toggle { cursor: pointer; padding: 0; appearance: none; }
.spin button:disabled { opacity: .35; cursor: default; }
.create .summary { font-size: 12px; color: var(--muted); margin-top: 6px; }
.maptile { background-color: #0b1d3a; }
.maptile.plain { background-image: linear-gradient(135deg, #0f2a55, #06142b); }
.gtile i.plain { background-image: linear-gradient(135deg, #0f2a55, #06142b); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.live-dot { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.live-dot[data-live="true"]::before { content: "● "; color: var(--green); }
.legend kbd, .kbd { font-family: Arial, sans-serif; }

/* ---------- the play page (play/index) */
[hidden] { display: none !important; }
.game-view iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.game-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(ellipse at 50% 40%, rgba(10, 40, 90, .85), rgba(2, 6, 16, .96)); z-index: 2; overflow: auto; }
.game-overlay.rejoin { background: rgba(2, 8, 20, .82); z-index: 3; }
.pick-panel { max-width: 520px; padding: 22px 26px; text-align: center; }
.pick-panel h2 { margin: 0 0 10px; font: 900 22px Arial; color: var(--head); text-transform: uppercase; letter-spacing: .06em; }
.pick-panel p { margin: 8px 0; }
.game-stats { position: absolute; top: 48px; right: 14px; z-index: 2; pointer-events: none; padding: 5px 8px; background: rgba(0, 0, 0, .6); color: #e6edf3; font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: right; }
.game-stats strong { font-size: 14px; }
.game-stats[data-grade="good"] strong { color: #56d364; } .game-stats[data-grade="fair"] strong { color: #e3b341; } .game-stats[data-grade="poor"] strong { color: #f85149; }
.game-stats [data-bad="true"] { color: #e3b341; } .game-stats .stats-warn { color: #f85149; font-weight: 600; }
.hud-btns .btn.hi { border-color: #9fd4ff; box-shadow: var(--glow); }
.conn[data-state="loading"]::before, .conn[data-state="ready"]::before, .conn[data-state="idle"]::before { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.conn[data-state="error"]::before, .conn[data-state="disconnected"]::before { background: var(--red); box-shadow: 0 0 6px var(--red); }
.conn .conn-server { color: var(--text); }
.game-status { position: fixed; top: 44px; right: 14px; z-index: 4; font-size: 11px; color: var(--muted); text-shadow: 0 1px 2px #000; max-width: 40vw; text-align: right; }
.game-status:empty { display: none; }
/* The chat sits in the bottom-right corner of the game picture: the game's
   motion tracker (radar) is in the bottom-left corner, and the first-person
   weapon takes the lower middle-right (about 57-90% across, from 62% down).
   The web build always draws 640x480 and the frame letterboxes it (object-fit:
   contain), so the picture is the 4:3 box that fits the window, with black
   bands beside it (wide windows) or under it (narrow ones). The chat keeps to
   the picture's right edge and is narrow (about a third of the picture), so it
   covers only the weapon's outer edge and never the radar; the log grows up
   from the input but stops well under the connection pill and statistics in
   the top-right corner. (100dvh where supported: the frame fills the window as
   it is, phone address bar included.) */
.chat {
  --vh: 100vh;
  --game-w: min(100vw, var(--vh) * 4 / 3);
  --game-h: min(var(--vh), 75vw);
  --band-x: max(0px, (100vw - var(--game-w)) / 2);
  --band-y: max(0px, (var(--vh) - var(--game-h)) / 2);
  --chat-bottom: calc(var(--band-y) + 12px);
  left: auto; right: calc(var(--band-x) + 12px); bottom: var(--chat-bottom);
  width: min(380px, max(250px, var(--game-w) * .32), var(--game-w) * .7 - 24px);
  pointer-events: none;
}
@supports (height: 100dvh) {
  .chat { --vh: 100dvh; }
}
.chat > * { pointer-events: auto; }
/* the log grows up from the input: under a third of the window, a few lines on
   a landscape phone, and never up into the connection pill and statistics
   (top right) */
.chat .chat-log { max-height: max(1.6em, min(30vh, calc(var(--game-h) * .5 - 110px), calc(var(--vh) - var(--chat-bottom) - 290px))); overflow: hidden auto; scrollbar-width: none; }
/* the panel is a column pinned to the right: the key hint stays on one line
   under the input, reaching left past the panel when it is wider, but no
   further than the radar's side of the picture leaves (then it wraps) */
.chat { display: flex; flex-direction: column; align-items: stretch; }
.chat .hint { align-self: flex-end; width: max-content; flex-wrap: wrap; justify-content: flex-end; max-width: max(100%, var(--game-w) * .7 - 24px); }
.chat .compose .to { white-space: nowrap; }
.chat .compose input { min-width: 0; }
/* portrait windows (phones): the picture leaves a tall black band under it,
   and the chat stays there, below the picture (its radar and weapon), full
   width, with the log no taller than the band leaves above the input */
@media (max-aspect-ratio: 3/4) {
  .chat { --chat-bottom: 10px; right: 12px; width: min(430px, calc(100vw - 24px)); }
  .chat .hint { max-width: 100%; }
  .chat .chat-log { max-height: max(1.6em, calc(var(--band-y) - 150px)); }
}
.chat .chat-name { font-weight: 800; color: #9cc4ff; margin-right: 2px; }
.chat .chat-mine .chat-name { color: #ffe08a; }
.chat .chat-system, .chat .sys { color: var(--muted); font-style: italic; }
/* the input shows while the chat is open (joined): T in the game focuses it,
   and a display:none input cannot take the focus (the chat looked absent and
   T, a message and Enter went to the game) */
.chat .compose { display: none; }
.chat[data-state="joined"] .compose, .chat:focus-within .compose { display: block; }
.chat:focus-within .hint { display: none; }
.chat .compose .btn { padding: 6px 10px; font-size: 11px; }
.chat .chat-members { margin-left: auto; }
.chat[data-state="unavailable"] .hint { opacity: .6; }
.drawer .topbar { flex-wrap: wrap; }
.player-drawer { width: min(760px, 96vw); }
.player-body { overflow: auto; padding: 18px 22px; display: grid; gap: 16px; align-content: start; }
.player-form fieldset { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.player-form legend { padding: 0; }
.player-form legend h3 { margin: 0; }
.player-form .small, .controls .muted { font-size: 12px; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.swatch-pick { position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--swatch); border: 2px solid transparent; cursor: pointer; overflow: hidden; }
.swatch-pick.with-image { width: 52px; height: 72px; border-radius: 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--swatch) 35%, #06142b), #06142b); }
.swatch-pick img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.swatch-pick input, .team-row input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-pick:has(input:checked) { border-color: #fff; box-shadow: 0 0 10px #fff; }
.swatch-pick:has(input:focus-visible), .team-row .tab:has(input:focus-visible) { outline: 2px solid #9fd4ff; outline-offset: 2px; }
.team-row { margin: 8px 0 0; }
.team-row .tab { position: relative; cursor: pointer; }
.team-row .tab:has(input:checked) { border-color: #9fd4ff; background: rgba(47, 140, 255, .3); color: #fff; }
.team-row .team-red:has(input:checked) { border-color: #ff8a8a; background: rgba(200, 40, 40, .35); }
.player-actions { display: flex; gap: 8px; margin-top: 14px; }
.player-actions .btn.primary { flex: 1; justify-content: center; }
.controls { padding: 14px 18px; }
.controls h3 { margin: 0 0 8px; }
.controls table { width: 100%; border-collapse: collapse; font-size: 13px; }
.controls td { padding: 4px 6px; border-bottom: 1px solid rgba(47, 140, 255, .15); vertical-align: top; }
.controls kbd { display: inline-block; margin: 0 3px 2px 0; padding: 1px 6px; border: 1px solid var(--line-soft); border-bottom-width: 2px; border-radius: 3px; font: 700 11px Arial; background: rgba(10, 40, 90, .8); color: #fff; }
.fine-print { font-size: 12px; text-align: center; }

/* ---------- player setup (play/setup, partials/player-settings): the game's
   player profile screen, a large Master Chief in the picked colour beside the form */
.setup { max-width: 1040px; }
.setup-intro { margin: 0 0 14px; font-size: 13px; }
.setup-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.setup-preview { --cut: 18px; padding: 0; display: grid; grid-template-rows: auto auto; overflow: hidden;
  background: radial-gradient(120% 70% at 50% 35%, color-mix(in srgb, var(--swatch) 32%, transparent), transparent 70%), var(--panel); }
.setup-preview .player-preview { margin: 0; display: grid; place-items: center; min-height: 380px; padding: 18px 0 6px; }
.setup-preview .player-preview img { width: auto; height: 360px; image-rendering: auto; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--swatch) 55%, transparent)); }
.setup-preview-empty { min-height: 380px; margin: 0; display: grid; place-items: center; font: 800 13px Arial; text-transform: uppercase; letter-spacing: .12em; }
.setup-preview-swatch { margin: 40px auto 20px; width: 160px; height: 160px; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 30px var(--swatch); }
.setup-nameplate { display: grid; gap: 2px; padding: 10px 18px 16px; border-top: 1px solid var(--line-soft); background: rgba(0, 0, 0, .25); }
.setup-nameplate b { font: 900 20px "Arial Black", sans-serif; color: #fff; text-transform: uppercase; letter-spacing: .04em; overflow-wrap: anywhere; }
.setup-nameplate .muted { font: 700 11px Arial; text-transform: uppercase; letter-spacing: .12em; }
.setup-form { padding: 16px 20px 20px; }
.setup-form .field { margin-top: 0; }
.setup-form .field input:focus { outline: none; box-shadow: var(--glow); }
.setup-form .field input[aria-invalid="true"] { border-color: var(--red); }
.setup-form .small { margin: 5px 0 0; }
.setup-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.setup-swatches .swatch-pick.with-image { width: auto; height: 84px; }
.setup-swatches .swatch-pick:not(.with-image) { width: 44px; height: 44px; }
.setup-swatches .swatch-pick::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--swatch); }
.setup-swatches .swatch-pick:hover { border-color: var(--line); }
.setup-form .color-current { margin-left: 6px; color: var(--text); letter-spacing: .08em; }
.setup-form .team-row .tab span { pointer-events: none; }
.setup-form .team-row .team-blue:has(input:checked) { border-color: #8cb8ff; background: rgba(40, 90, 220, .4); }
.setup-form .player-actions { margin-top: 18px; }
@media (max-width: 760px) {
  .setup-grid { grid-template-columns: 1fr; }
  .setup-preview { grid-template-columns: 110px 1fr; grid-template-rows: auto; align-items: center; }
  .setup-preview .player-preview, .setup-preview-empty { min-height: 0; padding: 8px 0; }
  .setup-preview .player-preview img { height: 150px; }
  .setup-preview-empty { height: 150px; font-size: 10px; }
  .setup-preview-swatch { width: 70px; height: 70px; margin: 12px auto; }
  .setup-nameplate { border-top: 0; background: none; }
  .setup-swatches { grid-template-columns: repeat(6, 1fr); }
  .setup-swatches .swatch-pick.with-image { height: 70px; }
}

/* ---------- input settings (play/input-settings: the setup page and the Player overlay) */
.input-settings .opt { cursor: pointer; }
.input-settings .opt .small { display: block; margin: 2px 0 0; font-size: 11px; letter-spacing: .02em; }
.input-settings .range { display: inline-flex; align-items: center; gap: 10px; }
.input-settings input[type=range] { width: min(180px, 34vw); accent-color: var(--line); cursor: pointer; }
.input-settings output { min-width: 46px; text-align: right; font: 700 13px Arial; color: #fff; }
.input-settings input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--line); cursor: pointer; }
.input-settings input:focus-visible { outline: 2px solid #9fd4ff; outline-offset: 2px; }
.gamepad-status { display: flex; gap: 8px; align-items: baseline; margin: 8px 0 4px; padding: 7px 10px; font-size: 13px;
  border-left: 3px solid var(--line-soft); background: rgba(47, 140, 255, .08); }
.gamepad-status b { color: #fff; }
.gamepad-status[data-state="ok"] { border-left-color: var(--green); color: #fff; }
.gamepad-status[data-state="warn"] { border-left-color: var(--gold); color: #fff; }
.controls .controls-sub { margin: 14px 0 6px; }

/* ---------- touchscreens (body.touch: a phone or tablet; the game's touch
   controls, game/port/web/shell/halo-touch.js, are in the frame). The game
   takes every finger: no pinch, scroll or double-tap zoom over it (the
   drawers still scroll). The compose box shows only while typing (the Chat
   button focuses it), the keyboard hints go, and in portrait the frame's
   "rotate your phone" screen is not covered by the chat and pills. */
body.touch .game-view, body.touch .game-view iframe { touch-action: none; overscroll-behavior: none; }
body.touch { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.touch .hud-btns .kbd, body.touch .chat .hint, body.touch .chat .compose .keys { display: none; }
body.touch .chat:not(.typing) .compose { display: none; }
body.touch .chat:not(.typing) { pointer-events: none; }
body.touch .chat:not(.typing) > * { pointer-events: none; }
@media (orientation: portrait) {
  body.touch .chat, body.touch .conn, body.touch .game-stats, body.touch .game-status { display: none; }
}
