:root {
  color-scheme: dark;
  --bg: #171b16;
  --surface: #20261e;
  --raised: #293125;
  --ink: #f0eee3;
  --muted: #a8b19e;
  --accent: #d7e980;
  --line: #3b4535;
  --orange: #e8b487;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
body.is-expanded { overflow: hidden; }
body.has-battle-dialog { overflow: hidden; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible,
a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button, a { touch-action: manipulation; }
.masthead, main, footer { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.masthead {
  min-height: 88px; display: flex; align-items: center;
  gap: 36px; border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 29px; font-weight: 850; letter-spacing: -.06em; text-decoration: none;
}
.brand-mark {
  display: grid; place-items: center; width: 35px; height: 35px;
  background: var(--accent); color: #28311e; border-radius: 9px; font-size: 29px;
}
.brand-dot { color: var(--accent); margin-left: -8px; }
.main-nav { display: flex; align-items: center; gap: 28px; margin-left: 18px; }
.main-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.main-nav a:hover { color: var(--ink); }
.header-presence {
  margin-left: auto; display: flex; align-items: center;
  gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap;
}
.live-dot, .status-pip {
  display: inline-block; flex-shrink: 0; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #d7e9800c;
}
main { padding-block: 40px 64px; }
.entry { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .9fr); gap: 20px; }
.cover {
  position: relative; display: flex; min-height: 526px; overflow: hidden; isolation: isolate;
  border: 1px solid #526141; border-radius: 22px; background: #303c29;
}
.cover-art { position: absolute; z-index: -1; inset: 0; color: #cfdbb4; }
.battle-map { position: absolute; width: 110%; min-width: 570px; height: 100%; right: -13%; bottom: -3%; opacity: .64; }
.cover::after {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(90deg, #293522dd, #29352255 62%, transparent);
}
.cover-copy { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: clamp(28px, 4.2vw, 52px); }
.eyebrow, .card-kicker, .screen-top, .screen-bottom, .panel-title > span, .pad-top > span {
  font: 700 10px/1.5 ui-monospace, SFMono-Regular, monospace; letter-spacing: .12em;
}
.eyebrow { display: flex; gap: 9px; align-items: center; margin: 0 0 18px; color: var(--accent); }
.eyebrow.muted { color: var(--muted); }
.cover h1 {
  margin: 10px 0 25px; font: 900 clamp(70px, 8vw, 112px)/.89 Impact, "Arial Black", sans-serif;
  letter-spacing: -.035em; color: #f3eedb;
}
.cover h1 em { color: var(--accent); font-style: normal; }
.lead { margin: 0 0 30px; max-width: 335px; color: #d6dccb; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.45; }
.hero-links { display: none; }
.cover-bottom { display: flex; flex-wrap: wrap; gap: 7px; max-width: 360px; margin-top: auto; }
.cover-bottom span {
  padding: 6px 9px; border: 1px solid #b9c5a338; border-radius: 5px;
  background: #25301f66; color: #cdd6bd; font-size: 10px; font-weight: 600;
}
.login { padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.card-kicker { display: flex; justify-content: space-between; margin-bottom: 22px; color: var(--muted); }
.card-kicker > span:last-child { font: 20px/1 sans-serif; color: var(--accent); }
.login h2 { margin: 0 0 9px; font-size: 29px; letter-spacing: -.055em; line-height: 1.1; }
.login > p:not(.footnote, .notice) { margin: 0 0 23px; color: var(--muted); font-size: 13px; line-height: 1.5; }
form, .launch-options { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #d1d8c9; font-size: 11px; font-weight: 650; }
input, select {
  width: 100%; min-width: 0; min-height: 43px; padding: 10px 12px;
  border: 1px solid #495540; border-radius: 7px; background: #171d15; color: var(--ink); font-size: 16px;
}
input::placeholder { color: #79856f; }
input[type=file] { padding: 8px; font-size: 12px; }
input::file-selector-button { padding: 5px; margin-right: 7px; border: 0; border-radius: 3px; background: #424f37; color: var(--ink); }
#room-password { font: 700 24px/1.2 ui-monospace, monospace; letter-spacing: .22em; }
#room-password::placeholder { font: 14px/1.2 -apple-system, BlinkMacSystemFont, sans-serif; letter-spacing: 0; }
.primary, .secondary, .tiny, .icon-button, .text-button { border: 1px solid transparent; border-radius: 7px; font-weight: 700; }
.primary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 45px;
  padding: 11px 14px; background: var(--accent); color: #26301b; text-align: left; font-size: 13px;
}
.primary:hover:enabled { background: #e5f4a1; }
.secondary, .tiny, .icon-button { padding: 9px 12px; background: #303a29; color: var(--ink); border-color: #4a573f; }
.secondary:hover:enabled, .tiny:hover:enabled, .icon-button:hover:enabled { background: #3d4a34; }
.text-button { padding: 6px; background: transparent; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--ink); }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; font-size: 21px; }
.tiny { font-size: 11px; white-space: nowrap; }
.footnote { margin: 15px 0 0; color: #929e87; font-size: 11px; line-height: 1.5; }
.notice { margin-block: 14px; padding: 12px; border: 1px solid #956d4f; border-radius: 8px; background: #3c2f23; color: #f6d7bb; font-size: 13px; line-height: 1.5; }
.result-note { margin: 0 0 15px; padding: 14px 16px; border: 1px solid #8b9958; border-radius: 9px; background: #323d24; color: #e2eeb8; font-size: 13px; line-height: 1.5; }
.battle-custom-wrap .secondary { display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 42px; font-size: 12px; }
.battle-custom-wrap .footnote { margin-top: 8px; }
.battle-room-summary { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.battle-room-setup > button { width: 100%; font-size: 11px; }
#stop-game { margin-top: 8px; background: #382e25; border-color: #69523c; color: #e8c3a0; }
.battle-launcher { width: min(1120px, calc(100% - 32px)); height: min(940px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow: hidden; border: 1px solid #626d4c; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px #0009; }
.battle-launcher::backdrop { background: #080d08d9; backdrop-filter: blur(5px); }
.battle-launcher form { display: flex; flex-direction: column; height: 100%; gap: 0; }
.battle-launcher select { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.battle-dialog-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 20px; border-bottom: 1px solid var(--line); background: #252d20; }
.battle-dialog-header .eyebrow { margin-bottom: 5px; font-size: 9px; }
.battle-dialog-header h2 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.04em; }
.battle-dialog-header .icon-button { flex: 0 0 auto; }
.battle-dialog-header .section-copy { margin: 8px 0 0; max-width: 600px; }
.battle-dialog-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 28px; scrollbar-color: #66734d #1b2218; }
.launcher-section { padding-block: 22px; border-top: 1px solid var(--line); }
.launcher-section:last-of-type { padding-bottom: 4px; }
.launcher-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 17px; }
.launcher-section-heading .eyebrow { margin-bottom: 5px; font-size: 9px; }
.launcher-section-heading h3 { margin: 0; font-size: 23px; letter-spacing: -.045em; }
.launcher-section-heading > label { width: min(210px, 45%); }
.launcher-section-heading .roster-size { width: 130px; }
.map-controls, .battle-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 15px; }
.map-browser { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr); gap: 15px; align-items: start; }
.map-hero { margin: 0; min-width: 0; overflow: hidden; border: 1px solid #526143; border-radius: 11px; background: #12190f; }
.map-hero figcaption { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px; padding: 13px; }
.map-hero figcaption strong { font-size: 16px; letter-spacing: -.025em; }
.map-hero figcaption span { color: var(--muted); font-size: 10px; }
.launcher-preview { display: block; position: relative; isolation: isolate; aspect-ratio: 4 / 3; min-width: 0; overflow: hidden; background: #11190e; }
.launcher-preview img { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: contain; }
.preview-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; border: 1px dashed #3a4830; background-image: linear-gradient(#87936a0b 1px, transparent 1px), linear-gradient(90deg, #87936a0b 1px, transparent 1px); background-size: 20px 20px; color: #879879; font-size: 10px; line-height: 1.4; text-align: center; }
.preview-placeholder-symbol { color: #6f8358; font-size: 25px; }
.map-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 9px; max-height: 330px; overflow-y: auto; padding: 2px 6px 5px 2px; overscroll-behavior: contain; }
.map-card, .model-card { min-width: 0; overflow: hidden; padding: 0; border: 1px solid #46553a; border-radius: 8px; background: #1a2216; color: var(--ink); text-align: left; }
.map-card:hover:enabled, .model-card:hover:enabled { border-color: #9aa96d; }
.map-card.selected, .model-card.selected { border-color: #c4d776; box-shadow: 0 0 0 1px #c4d776; background: #313d24; }
.map-card > strong, .model-card > strong { display: block; padding: 8px 9px 0; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.map-card > small, .model-card > small { display: block; min-height: 22px; padding: 4px 9px 8px; color: #9fae8e; font-size: 9px; }
.map-card:disabled, .model-card:disabled { opacity: 1; }
.battle-teams { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.battle-team { min-width: 0; margin: 0; padding: 17px; border: 1px solid #46523a; border-radius: 11px; background: #192016; }
.battle-team legend { padding: 0 7px; color: var(--accent); font: 700 10px ui-monospace, monospace; letter-spacing: .08em; }
.battle-team-head { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 13px; align-items: center; margin-bottom: 17px; }
.battle-team-head > .launcher-preview { aspect-ratio: 1; border: 1px solid #3c4a31; border-radius: 8px; }
.battle-team-identity { display: grid; gap: 11px; min-width: 0; }
.faction-current-name { display: none; }
.battle-team input { text-transform: uppercase; }
.battle-roster { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.roster-card { min-width: 0; padding: 12px; border: 1px solid #3d4b32; border-radius: 9px; background: #222c1c; }
.roster-card-heading { display: flex; align-items: center; gap: 7px; margin-bottom: 11px; }
.roster-card-heading span { display: grid; place-items: center; width: 26px; height: 24px; border-radius: 5px; background: #3a482d; color: #b6cb85; font: 10px ui-monospace, monospace; }
.roster-card-heading strong { color: #b7c6a7; font-size: 10px; font-weight: 600; }
.roster-card input { padding-inline: 8px; }
.roster-pig-identity { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 9px; }
.roster-pig-identity > label:only-child { grid-column: 1 / -1; }
.roster-pig-identity .launcher-preview { width: 42px; height: 56px; aspect-ratio: 3 / 4; border-radius: 5px; }
.roster-pig-identity .preview-placeholder { padding: 2px; font-size: 7px; }
.roster-pig-identity .preview-placeholder-symbol { font-size: 14px; }
.roster-class-info { display: block; margin-top: 9px; color: #91a47f; font-size: 9px; line-height: 1.4; }
.roster-attributes { display: grid; grid-template-columns: minmax(0, 1fr) 65px; gap: 8px; margin-top: 10px; }
.roster-attributes > label:only-child { grid-column: 1 / -1; }
.roster-attributes select { padding-inline: 7px; font-size: 12px; }
.battle-team-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; color: #9aac8a; font: 10px ui-monospace, monospace; }
.battle-team-bottom .text-button { padding: 2px; font: 10px -apple-system, BlinkMacSystemFont, sans-serif; }
.battle-name-hint { margin: 12px 0 0; color: #a3ae97; font-size: 11px; line-height: 1.5; }
.battle-rule-fields small { font-size: 10px; font-weight: 400; color: #9eae90; }
.battle-execution { min-width: 0; margin: 19px 0 0; padding: 0; border: 0; }
.battle-execution legend { margin-bottom: 9px; color: #d1d8c9; font-size: 11px; font-weight: 650; }
.execution-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 11px; }
.execution-option { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid #47533b; border-radius: 9px; background: #1a2117; cursor: pointer; }
.execution-option:has(input:checked) { border-color: #9dab60; background: #303b23; }
.execution-option input { flex: 0 0 auto; width: 16px; min-height: 16px; height: 16px; margin: 1px 0 0; padding: 0; accent-color: var(--accent); }
.execution-option strong { display: block; color: var(--ink); font-size: 12px; }
.execution-option small { display: block; margin-top: 5px; color: #a7b399; font-size: 10px; line-height: 1.5; }
.model-gallery { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 13px; max-width: 690px; }
.model-card .launcher-preview { aspect-ratio: 16 / 9; max-height: 145px; }
.model-card > strong { font-size: 13px; }
.launcher-presets { margin-bottom: 22px; padding: 15px 17px; border: 1px solid #4a573b; border-radius: 10px; background: #2a3422; }
.launcher-presets summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; cursor: pointer; color: #d6e3c5; font-size: 13px; font-weight: 700; }
.launcher-presets summary::after { content: '+'; margin-left: auto; color: var(--accent); font-size: 18px; }
.launcher-presets[open] summary::after { content: '−'; }
.launcher-presets summary > small { margin-left: auto; color: #a6b695; font-size: 10px; font-weight: 400; }
.launcher-presets .count-badge { display: inline-block; margin-left: 6px; }
.preset-controls { display: grid; gap: 12px; margin-top: 16px; }
.preset-row { display: flex; align-items: flex-end; gap: 9px; }
.preset-row > label { flex: 1; min-width: 0; }
.preset-row button { min-height: 43px; font-size: 11px; }
.preset-controls .battle-name-hint { margin: 0; }
.preset-controls .preset-error { color: #efbf9a; }
.battle-dialog-footer { display: flex; flex: 0 0 auto; width: 100%; margin: 0; padding: 16px 28px; border-top: 1px solid #4d5b3f; gap: 20px; background: #252e20; }
.battle-dialog-footer > div { flex: 1; min-width: 0; }
.battle-dialog-footer p { margin: 0; color: #9eab92; font-size: 9px; line-height: 1.45; }
.battle-dialog-footer .battle-draft-summary { margin-bottom: 6px; color: #dce9c9; font-size: 12px; font-weight: 650; line-height: 1.4; }
.battle-dialog-footer .notice { margin: 7px 0; padding: 8px 10px; color: #f6d7bb; font-size: 11px; }
.battle-dialog-footer button { flex: 0 0 auto; align-self: center; }
.battle-launcher input:disabled, .battle-launcher select:disabled { opacity: .8; color: var(--ink); -webkit-text-fill-color: var(--ink); }
.battle-launcher.read-only .execution-option { cursor: default; }

.lobby-grid, .community-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 20px; margin-top: 25px; }
.community-grid { grid-template-columns: 1fr 1fr; }
.surface { min-width: 0; padding: 27px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.section-heading .eyebrow { margin-bottom: 5px; font-size: 9px; }
.section-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 22px; letter-spacing: -.045em; }
.count-badge { min-width: 24px; padding: 2px 6px; border: 1px solid #4c5941; border-radius: 5px; background: #303a28; color: var(--accent); text-align: center; font: 600 11px/1.3 ui-monospace, monospace; }
.section-copy { margin: 12px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.section-symbol, .medal-symbol { color: var(--accent); font-size: 27px; font-weight: 400; }
.medal-symbol { color: var(--orange); }
.empty-state { margin: 0; padding: 27px 18px; border: 1px dashed #47523d; border-radius: 10px; color: #9ca88f; text-align: center; font-size: 12px; line-height: 1.6; }
.rooms-list, .online-list, .leaderboard-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.room-card { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 14px; border: 1px solid #3e4a34; border-radius: 11px; background: #1b2218; }
.room-card-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 10px; background: #344129; color: #b9d17e; font-size: 21px; }
.room-card.running .room-card-icon { background: #4a3b29; color: var(--orange); }
.room-card h3 { margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 700; letter-spacing: -.015em; }
.room-card-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 6px; color: #94a087; font-size: 10px; overflow-wrap: anywhere; }
.room-card-meta .room-status { color: #c3d89a; }
.room-card.running .room-status { color: #e0b385; }
.room-card-action { display: grid; gap: 6px; justify-items: end; }
.room-card-action small { color: var(--muted); font: 10px ui-monospace, monospace; }
.room-card-action button { min-height: 34px; padding: 7px 10px; font-size: 11px; }
.online-list { margin-top: 22px; gap: 14px; }
.online-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.online-person > div { min-width: 0; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; border: 1px solid #526044; border-radius: 10px; background: #33412a; color: #cddcb5; font: 700 12px ui-monospace, monospace; }
.online-person strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.online-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; color: #94a087; font-size: 10px; }
.online-person > .live-dot { margin-left: auto; width: 5px; height: 5px; box-shadow: none; }
.leaderboard-header, .leaderboard-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 49px 49px 49px; align-items: center; gap: 10px; }
.leaderboard-header { padding: 0 8px 8px; color: #8c9a81; font-size: 9px; }
.leaderboard-header span:nth-child(n+3) { text-align: right; }
.leaderboard-row { padding: 11px 8px; border-top: 1px solid #38422f; font-size: 12px; }
.rank-place { color: #8e9b82; font: 11px ui-monospace, monospace; }
.rank-player { display: flex; align-items: center; min-width: 0; gap: 9px; }
.rank-player .avatar { width: 30px; height: 30px; border-radius: 8px; font-size: 10px; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rank-stat { text-align: right; color: #bbc5ad; font: 11px ui-monospace, monospace; }
.rank-stat.wins { color: var(--accent); }
.achievements-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.achievements-list > .empty-state { grid-column: 1 / -1; }
.achievement-card { display: flex; gap: 11px; padding: 13px 11px; border: 1px solid #3d4635; border-radius: 10px; background: #1c2319; opacity: .6; }
.achievement-card.earned { border-color: #7d8653; background: #323a24; opacity: 1; }
.achievement-icon { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid #5b664a; border-radius: 50%; color: #8f9b7b; font-size: 18px; }
.achievement-card.earned .achievement-icon { border-color: #adba6a; color: var(--accent); }
.achievement-card strong { display: block; font-size: 11px; line-height: 1.35; }
.achievement-card p { margin: 4px 0 0; color: #a1ad94; font-size: 10px; line-height: 1.45; }
.achievement-card time { display: block; margin-top: 5px; color: #d1dca8; font-size: 9px; }
.in-room .main-nav { display: none; }
.in-room main { padding-top: 28px; }
.room-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.room-top .eyebrow { margin-bottom: 5px; font-size: 9px; }
.room h1 { margin: 0; font-size: clamp(23px, 3vw, 36px); letter-spacing: -.05em; }
#room-name-display { overflow-wrap: anywhere; }
#room-id { display: inline-block; margin-left: 8px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; color: #a9b99a; font: 10px/1.4 ui-monospace, monospace; vertical-align: middle; letter-spacing: .05em; }
.room-actions, .screen-bottom > div { display: flex; flex-wrap: wrap; gap: 7px; }
.room-actions button { min-height: 39px; font-size: 11px; }
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 285px); align-items: start; gap: 18px; }
.play-area { overflow: hidden; min-width: 0; border: 1px solid #4a573d; border-radius: 15px; background: var(--surface); }
.screen-top, .screen-bottom { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 10px 13px; color: var(--muted); font-size: 9px; letter-spacing: .055em; }
.screen-top > span:first-child { display: flex; gap: 6px; align-items: center; }
.screen-top i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.screen-bottom { min-height: 46px; }
.screen-bottom > span { font: 600 11px/1.4 -apple-system, BlinkMacSystemFont, sans-serif; letter-spacing: 0; }
.screen-bottom .tiny { min-height: 30px; padding: 6px 8px; font-size: 10px; }
#turn.active { color: var(--accent); }
.stage { position: relative; isolation: isolate; aspect-ratio: 4 / 3; overflow: hidden; background: #0b1009; }
#ps1, #remote-video, #server-screen, .standby { position: absolute; inset: 0; width: 100%; height: 100%; }
#remote-video, #server-screen { object-fit: contain; background: #080b07; }
.standby { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 13px; padding: 28px; background: radial-gradient(ellipse, #303c2480, transparent 70%); color: var(--muted); text-align: center; font-size: 12px; }
.standby strong { color: var(--ink); font-size: 25px; letter-spacing: -.04em; }
.standby > span { max-width: 340px; line-height: 1.5; }
.screen-icon { color: var(--accent); font-size: 38px; }
.sidebar { display: grid; gap: 13px; }
.panel { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 13px; }
.panel-title h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-title > span { color: var(--muted); font-size: 10px; }
.panel .footnote { font-size: 10px; }
.players { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.player { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 43px; padding: 7px 9px; border: 1px solid #3b4532; border-radius: 7px; background: #192016; }
.player.active { border-color: #8f9e5d; background: #303b25; }
.player.offline { opacity: .55; }
.player-info { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.player-info small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.player .tiny { padding: 6px; font-size: 9px; }
.access-panel { background: #293222; border-color: #5b6945; }
.access-code-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.access-code { color: var(--accent); font: 700 27px/1.2 ui-monospace, monospace; letter-spacing: .09em; }
.lock-symbol { color: var(--accent) !important; font-size: 21px !important; }
.guide summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.guide p { color: var(--muted); font-size: 11px; line-height: 1.8; }
kbd { padding: 2px 4px; border: 1px solid #4d5a3e; border-radius: 4px; background: #303a27; color: var(--ink); font: 10px ui-monospace, monospace; }
.invite-fallback { margin-bottom: 12px; }
.controller { padding: 11px 14px 13px; border-top: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad-top, .pad-main { display: flex; justify-content: space-between; align-items: center; gap: 7px; max-width: 520px; margin-inline: auto; }
.pad-top > div, .system-pad { display: flex; gap: 6px; }
.pad-top > span { color: #7e8c71; font-size: 8px; text-align: center; }
.controller button {
  min-width: 44px; min-height: 38px; padding: 0 6px; border: 1px solid #5d6b4b; border-bottom-width: 3px;
  border-radius: 8px; background: #303c27; color: var(--ink); font-weight: 750;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.controller button.pressed { border-color: #e4eea3; background: var(--accent); color: #25311b; transform: translateY(1px); }
.pad-top button, .system-pad button { font: 700 10px ui-monospace, monospace; }
.pad-main { margin-top: 7px; }
.cross-pad, .face-pad { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3px; }
.cross-pad button, .face-pad button { width: 44px; min-width: 0; height: 40px; min-height: 40px; }
.cross-pad button:nth-child(1), .face-pad button:nth-child(1) { grid-area: 1 / 2; }
.cross-pad button:nth-child(2), .face-pad button:nth-child(2) { grid-area: 2 / 1; }
.cross-pad button:nth-child(3), .face-pad button:nth-child(3) { grid-area: 2 / 3; }
.cross-pad button:nth-child(4), .face-pad button:nth-child(4) { grid-area: 3 / 2; }
.face-pad button { font-size: 23px; line-height: 1; }
.face-pad button:nth-child(1) { color: #9ed9b4; }
.face-pad button:nth-child(2) { color: #daa1d4; }
.face-pad button:nth-child(3) { color: #efb19c; }
.face-pad button:nth-child(4) { color: #a7c8ef; }
.face-pad button.pressed { color: #25311b; }
.play-area.expanded {
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 0; border-radius: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--bg);
}
.play-area.expanded .stage { aspect-ratio: auto; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-block: 26px; border-top: 1px solid var(--line); color: #85927b; font-size: 10px; }
.footer-brand { color: var(--ink); font-size: 16px; font-weight: 750; letter-spacing: -.035em; }
footer a { text-decoration: none; font-size: 20px; }
@media (max-width: 950px) {
  .masthead, main, footer { width: calc(100% - 40px); }
  .main-nav { margin-left: 0; gap: 20px; }
  .entry { grid-template-columns: minmax(0, 1fr) 340px; gap: 15px; }
  .cover-copy { padding: 30px; }
  .cover h1 { font-size: 78px; }
  .login { padding: 24px; }
  .lobby-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 15px; }
  .surface { padding: 23px; }
  .community-grid { gap: 15px; }
  .room-grid { grid-template-columns: minmax(0, 1fr) 245px; gap: 14px; }
  .room-actions { max-width: 270px; justify-content: flex-end; }
  .room-actions .primary { min-width: 180px; }
  .controller { padding-inline: 9px; }
  .cross-pad button, .face-pad button { width: 38px; }
  .system-pad { flex-direction: column; }
}
@media (max-width: 720px) {
  .masthead, main, footer { width: calc(100% - 28px); }
  .masthead { min-height: 74px; flex-wrap: wrap; gap: 12px; padding-block: 16px 0; }
  .wordmark { font-size: 25px; }
  .brand-mark { width: 31px; height: 31px; font-size: 25px; border-radius: 8px; }
  .header-presence { font-size: 10px; }
  .main-nav { order: 3; width: 100%; justify-content: space-around; gap: 15px; padding-block: 12px; border-top: 1px solid #394231; }
  .main-nav a { font-size: 12px; }
  main { padding-block: 22px 35px; }
  .entry, .lobby-grid, .community-grid, .room-grid { grid-template-columns: 1fr; }
  .entry { gap: 14px; }
  .cover { min-height: 354px; border-radius: 16px; }
  .cover-copy { padding: 28px; }
  .cover h1 { font-size: clamp(74px, 18vw, 94px); margin-block: 4px 20px; }
  .cover .eyebrow { font-size: 8px; margin-bottom: 15px; }
  .lead { font-size: 16px; margin-bottom: 22px; }
  .hero-links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
  .hero-links a { color: var(--accent); font-size: 12px; font-weight: 650; text-decoration: none; }
  .hero-links a:last-child { color: #c0ccb0; }
  .joining-room .cover { display: none; }
  .cover-bottom { max-width: none; gap: 5px; }
  .cover-bottom span { padding: 5px 7px; font-size: 8px; }
  .battle-map { right: -18%; opacity: .56; }
  .login { padding: 25px; border-radius: 16px; }
  .card-kicker { margin-bottom: 17px; }
  .login h2 { font-size: 27px; }
  .lobby-grid, .community-grid { margin-top: 14px; gap: 14px; }
  .surface { padding: 23px 20px; border-radius: 15px; }
  .section-heading h2 { font-size: 21px; }
  .section-copy { margin-block: 11px 19px; }
  .room-card { gap: 10px; padding: 12px; grid-template-columns: 36px minmax(0, 1fr) auto; }
  .room-card-icon { width: 36px; height: 40px; border-radius: 8px; font-size: 19px; }
  .room-card h3 { font-size: 13px; }
  .room-card-meta { gap: 4px 8px; font-size: 9px; }
  .room-card-action button { padding: 7px; }
  .online-list { grid-template-columns: 1fr 1fr; gap: 17px 13px; }
  .online-list .empty-state { grid-column: 1 / -1; }
  .online-person { gap: 8px; }
  .online-person > .live-dot { display: none; }
  .online-person strong { font-size: 11px; }
  .online-person small { font-size: 9px; }
  .avatar { width: 32px; height: 32px; font-size: 11px; }
  .leaderboard-header, .leaderboard-row { grid-template-columns: 18px minmax(0, 1fr) 40px 40px 40px; gap: 7px; }
  .achievements-list { gap: 8px; }
  .achievement-card { gap: 8px; padding: 12px 9px; }
  .achievement-icon { width: 28px; height: 28px; font-size: 16px; }
  .in-room .masthead { min-height: 59px; padding-block: 11px; }
  .in-room main { padding-top: 18px; }
  .room-top { align-items: flex-start; gap: 10px; margin-bottom: 13px; }
  .room h1 { font-size: 22px; }
  .room-top .eyebrow { font-size: 8px; }
  .room-actions { max-width: 135px; gap: 5px; }
  .room-actions .primary { min-width: 0; width: 100%; padding: 7px 9px; min-height: 34px; font-size: 9px; }
  .room-actions .secondary { min-height: 29px; padding: 5px 9px; font-size: 10px; }
  .room-grid { gap: 13px; }
  .play-area { border-radius: 11px; }
  .screen-top { padding: 9px; font-size: 8px; }
  .screen-bottom { padding: 8px 9px; gap: 6px; }
  .screen-bottom > span { font-size: 10px; }
  .screen-bottom .tiny { padding: 6px; font-size: 9px; }
  .controller { padding: 10px 9px 12px; }
  .cross-pad button, .face-pad button { width: clamp(36px, 10.5vw, 44px); min-height: 40px; }
  .pad-main { gap: 5px; }
  .pad-top > span { font-size: 7px; }
  .pad-top button { min-width: 45px; min-height: 36px; }
  .system-pad button { min-width: 43px; min-height: 30px; font-size: 8px; }
  .sidebar { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sidebar > .guide, .sidebar > .setup { grid-column: 1 / -1; }
  .sidebar > .battle-room-setup { grid-column: 1 / -1; }
  .panel { padding: 14px; }
  .panel-title h2 { font-size: 13px; }
  .access-code { font-size: 22px; }
  .access-code-row { flex-wrap: wrap; }
  .access-code-row .tiny { font-size: 9px; padding: 6px; }
  .player { padding: 6px; flex-wrap: wrap; }
  .player-info { font-size: 11px; }
  footer { flex-wrap: wrap; gap: 12px; padding-block: 22px; font-size: 9px; }
  footer > span:nth-child(2) { flex: 1; text-align: right; }
  footer > a { display: none; }
  .battle-launcher { width: calc(100% - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); padding: 0; border-radius: 13px; }
  .battle-dialog-header { padding: 17px; gap: 10px; }
  .battle-dialog-header h2 { font-size: 24px; }
  .battle-dialog-header .section-copy { font-size: 11px; margin-top: 6px; }
  .battle-dialog-body { padding: 17px; }
  .launcher-section { padding-block: 20px; }
  .launcher-section-heading { gap: 12px; align-items: flex-start; }
  .launcher-section-heading h3 { font-size: 21px; }
  .launcher-section-heading > label { width: 125px; flex: 0 0 auto; }
  .launcher-section-heading .roster-size { width: 104px; }
  .launcher-section-heading > .text-button { max-width: 110px; font-size: 10px; }
  .map-controls { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .map-browser { grid-template-columns: 1fr; gap: 12px; }
  .map-hero .launcher-preview { aspect-ratio: 16 / 9; }
  .map-hero figcaption { padding: 10px; }
  .map-hero figcaption strong { font-size: 15px; }
  .map-gallery { grid-auto-flow: column; grid-auto-columns: 142px; grid-template-columns: none; overflow-x: auto; overflow-y: hidden; max-height: none; gap: 8px; padding-bottom: 8px; }
  .battle-fields, .battle-teams, .execution-options { grid-template-columns: 1fr; gap: 13px; }
  .battle-team { padding: 14px 12px; }
  .battle-team-head { grid-template-columns: 74px minmax(0, 1fr); gap: 10px; }
  .battle-team-identity { display: contents; }
  .battle-team-identity > label:first-child { align-self: center; }
  .battle-team-name { grid-column: 1 / -1; }
  .faction-current-name { display: block; color: #adc591; font-size: 10px; font-weight: 400; overflow-wrap: anywhere; }
  .battle-team-head > .launcher-preview { aspect-ratio: 3 / 4; }
  .battle-roster { grid-template-columns: minmax(0, 1fr); }
  .roster-card { padding: 13px; }
  .roster-card-heading { margin-bottom: 9px; }
  .roster-attributes { grid-template-columns: minmax(0, 1fr) 72px; }
  .roster-attributes select { font-size: 16px; }
  .launcher-presets { padding: 13px; }
  .launcher-presets summary > small { width: 100%; margin: 0; font-size: 9px; }
  .preset-row { flex-wrap: wrap; }
  .preset-row > label { flex-basis: 100%; }
  .preset-row > button { flex: 1; min-height: 38px; }
  .model-gallery { gap: 9px; }
  .model-card > strong { font-size: 11px; }
  .model-card > small { font-size: 9px; }
  .model-card .launcher-preview { aspect-ratio: 4 / 3; }
  .battle-dialog-footer { flex-direction: column; align-items: stretch; gap: 12px; padding: 13px 17px; }
  .battle-dialog-footer .battle-draft-summary { font-size: 11px; }
  .battle-dialog-footer button { width: 100%; }

}
@media (max-width: 370px) {
  .masthead, main, footer { width: calc(100% - 20px); }
  .header-presence { font-size: 9px; }
  .cover-copy, .login { padding: 23px; }
  .surface { padding: 21px 16px; }
  .room-card { grid-template-columns: minmax(0, 1fr) auto; }
  .room-card-icon { display: none; }
  .sidebar { grid-template-columns: 1fr; }
  .sidebar > * { grid-column: auto; }
  .pad-main { gap: 4px; }
  .cross-pad button, .face-pad button { width: 35px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .play-area.expanded { grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr) 320px; }
  .play-area.expanded .screen-top, .play-area.expanded .screen-bottom { grid-column: 1 / -1; }
  .play-area.expanded .stage { grid-area: 2 / 1; }
  .play-area.expanded .controller { grid-area: 2 / 2; display: grid; align-content: center; padding-inline: 8px; border-top: 0; border-left: 1px solid var(--line); }
  .expanded .cross-pad button, .expanded .face-pad button { width: 38px; height: 40px; min-height: 40px; }
  .expanded .pad-main { gap: 5px; }
  .expanded .system-pad { flex-direction: column; }
  .expanded .pad-top button { min-width: 40px; min-height: 34px; }
  .expanded .pad-top > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
