:root {
  color-scheme: dark;
  --ui-bg: rgba(19, 20, 20, 0.88);
  --ui-border: rgba(236, 180, 93, 0.28);
  --ui-text: #f3eee5;
  --ui-muted: #b4aaa0;
  --accent: #e2a145;
  --accent-2: #c84a3b;
  --danger: #ff664f;
}

/* v27 command-center presentation pass */
.splash.splash {
  --splash-red: #d8533f;
  --splash-gold: #f0bb65;
  place-content: center;
  min-height: 100%;
  padding: max(28px, env(safe-area-inset-top)) 24px max(22px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 38%, rgba(205, 75, 50, 0.2), transparent 27%),
    linear-gradient(90deg, transparent 49.85%, rgba(240, 187, 101, 0.16) 50%, transparent 50.15%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 32px),
    linear-gradient(135deg, rgba(46, 22, 20, 0.985), rgba(5, 8, 9, 0.985));
}

.splash::before,
.splash::after {
  content: "";
  position: fixed;
  z-index: 0;
  left: 50%;
  top: 42%;
  width: min(68vw, 760px);
  aspect-ratio: 1;
  border: 1px solid rgba(240, 187, 101, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: radar-breathe 4s ease-in-out infinite;
}

.splash::after {
  width: min(42vw, 460px);
  border-style: dashed;
  animation: radar-spin 28s linear infinite;
}

@keyframes radar-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes radar-breathe { 50% { opacity: 0.42; transform: translate(-50%, -50%) scale(1.035); } }

.splash-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--splash-gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.splash-eyebrow span {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
}

.splash-eyebrow span:last-child { transform: scaleX(-1); }

.splash.splash h1 {
  font-size: clamp(52px, 9vw, 94px);
  letter-spacing: -0.055em;
  text-transform: uppercase;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.4));
  animation: title-deploy 650ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes title-deploy {
  from { opacity: 0; transform: translateY(-18px) scale(1.08); letter-spacing: 0.03em; }
}

.splash .splash-subtitle {
  margin: -3px 0 4px;
  color: #cbbba7;
  font-size: 15px;
  letter-spacing: 0.24em;
}

.battle-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 7px;
  color: #978c80;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.battle-readout i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--splash-red);
  box-shadow: 0 0 9px var(--splash-red);
}

.splash .mode-actions { width: min(520px, calc(100vw - 32px)); margin-inline: auto; }

.splash.splash button {
  position: relative;
  height: 62px;
  overflow: hidden;
  border: 1px solid rgba(255, 223, 166, 0.35);
  border-radius: 4px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 12px 30px rgba(0, 0, 0, 0.24);
  transition: transform 140ms ease, filter 140ms ease, border-color 140ms ease;
}

.splash.splash button small {
  display: block;
  margin-bottom: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  opacity: 0.68;
}

.splash.splash button:hover { transform: translateY(-2px); filter: brightness(1.1); border-color: rgba(255, 226, 169, 0.8); }
.splash.splash button:active { transform: translateY(1px) scale(0.985); }
.splash.splash button:focus-visible { outline: 2px solid #fff1c8; outline-offset: 3px; }
.splash.splash .secondary-button { height: 62px; background: linear-gradient(180deg, rgba(83, 55, 48, 0.86), rgba(34, 24, 23, 0.94)); }

.splash .multiplayer-panel {
  width: min(520px, calc(100vw - 32px));
  max-height: min(62vh, 620px);
  overflow-y: auto;
  margin-inline: auto;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
  transition: max-height 280ms ease, opacity 180ms ease, transform 280ms ease, padding 280ms ease, margin 280ms ease, border-width 280ms ease;
}

.splash .multiplayer-panel.collapsed {
  max-height: 0;
  margin-top: -4px;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  border-width: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.icon-button,
.build-button,
.command-button { transition: transform 110ms ease, filter 110ms ease, border-color 110ms ease; }
.icon-button:active,
.build-button:not(:disabled):active,
.command-button:active { transform: scale(0.94); filter: brightness(1.2); }
.build-button:not(:disabled):hover,
.command-button:hover { border-color: rgba(240, 187, 101, 0.62); }

.notice { animation: notice-drop 220ms cubic-bezier(.2,.8,.2,1) both; box-shadow: 0 12px 36px rgba(0,0,0,.36), 0 0 20px rgba(226,161,69,.12); }
@keyframes notice-drop { from { opacity: 0; transform: translate(-50%, -10px) scale(.96); } }

.modal-screen:not(.hidden) .modal-panel {
  animation: modal-deploy 300ms cubic-bezier(.16,.84,.28,1) both;
  border-radius: 4px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.62), inset 0 1px rgba(255, 235, 196, 0.08);
}

.modal-panel h2 {
  color: #f5dfbc;
  letter-spacing: 0.04em;
  text-shadow: 0 3px 0 rgba(125, 44, 34, 0.52);
}

@keyframes modal-deploy {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
}

@media (max-width: 680px) {
  .splash.splash { place-content: center; padding-inline: 16px; }
  .splash.splash h1 { font-size: clamp(45px, 15vw, 70px); }
  .splash .splash-subtitle { font-size: 12px; letter-spacing: 0.14em; }
  .battle-readout { font-size: 9px; }
  .splash .mode-actions { grid-template-columns: 1fr; }
  .splash.splash button, .splash.splash .secondary-button { height: 54px; }
  .splash .multiplayer-panel:not(.collapsed) { max-height: 58vh; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .splash.splash { place-content: start center; padding-top: max(14px, env(safe-area-inset-top)); }
  .splash.splash h1 { font-size: 48px; }
  .splash .splash-subtitle { margin-bottom: 0; }
  .battle-readout { margin-bottom: 2px; }
  .splash.splash button, .splash.splash .secondary-button { height: 48px; }
  .splash .multiplayer-panel:not(.collapsed) { max-height: 48vh; }
}

.showcase-badge {
  position: absolute !important;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 2 !important;
  padding: 5px 8px;
  border: 1px solid rgba(240, 187, 101, 0.32);
  border-radius: 3px;
  background: rgba(7, 10, 11, 0.58);
  color: rgba(240, 215, 170, 0.76);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  pointer-events: none;
}

.splash .demo-tip {
  margin: -2px auto 0;
  color: #a99e90;
  font-size: 10px;
  letter-spacing: 0.04em;
}

@media (max-width: 680px) {
  .showcase-badge { right: 12px; font-size: 7px; }
  .splash .demo-tip { max-width: 330px; font-size: 9px; line-height: 1.4; }
}

@media (prefers-reduced-motion: reduce) {
  .splash::before, .splash::after, .splash h1, .notice { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0b0d0e;
  color: var(--ui-text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  touch-action: none;
  user-select: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

#game-shell {
  position: fixed;
  inset: 0;
  min-width: 320px;
  min-height: 240px;
  background: #0b0d0e;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud-panel {
  position: absolute;
  z-index: 10;
  border: 1px solid var(--ui-border);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, rgba(45, 44, 42, 0.96), rgba(13, 14, 15, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 223, 169, 0.12),
    inset 0 -2px 0 rgba(0, 0, 0, 0.56),
    inset 4px 0 0 rgba(200, 74, 59, 0.28),
    0 10px 26px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

#topbar {
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: calc(max(10px, env(safe-area-inset-right)) + 86px);
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
}

.stat {
  min-width: 70px;
  padding: 3px 8px;
  border-left: 2px solid rgba(226, 161, 69, 0.88);
  background: rgba(0, 0, 0, 0.18);
}

.stat-label {
  display: block;
  color: var(--ui-muted);
  font-size: 11px;
  line-height: 1.1;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(93, 92, 86, 0.72), rgba(28, 29, 30, 0.88));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.32);
  cursor: pointer;
}

#pause-button {
  margin-left: auto;
}

#build-panel {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 74px;
  display: grid;
  gap: 7px;
  padding: 7px;
  border-radius: 8px;
}

#objective-panel {
  top: calc(max(10px, env(safe-area-inset-top)) + 58px);
  left: max(10px, env(safe-area-inset-left));
  width: 248px;
  padding: 9px 10px;
  border-radius: 8px;
  pointer-events: none;
}

#objective-panel strong,
#production-panel strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  line-height: 1;
}

#objective-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#objective-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.2;
}

#objective-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

#objective-list li.complete {
  color: #d8f4c5;
}

#objective-list li.complete::before {
  background: #74d37f;
  box-shadow: 0 0 8px rgba(116, 211, 127, 0.6);
}

.build-button {
  min-height: 55px;
  padding: 5px 4px;
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 1px solid rgba(226, 161, 69, 0.2);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255, 220, 150, 0.1), transparent 48%),
    linear-gradient(180deg, rgba(66, 65, 62, 0.82), rgba(19, 20, 22, 0.9));
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.18),
    inset 3px 0 0 rgba(200, 74, 59, 0.18);
  cursor: pointer;
}

.build-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.build-button.active {
  border-color: rgba(226, 161, 69, 0.95);
  background:
    linear-gradient(135deg, rgba(255, 225, 155, 0.28), transparent 48%),
    linear-gradient(180deg, rgba(104, 55, 43, 0.9), rgba(32, 24, 22, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(255, 231, 173, 0.18),
    0 0 14px rgba(213, 162, 83, 0.18);
}

.build-button span:not(.build-icon) {
  font-size: 12px;
  line-height: 1;
}

.build-button small {
  color: var(--ui-muted);
  font-size: 10px;
  line-height: 1;
}

.build-icon {
  width: 26px;
  height: 22px;
  position: relative;
  display: block;
}

.build-icon.power {
  clip-path: polygon(43% 0, 83% 0, 61% 39%, 92% 39%, 29% 100%, 45% 54%, 11% 54%);
  background: #f3cf65;
}

.build-icon.barracks {
  background: #a7473c;
  clip-path: polygon(9% 42%, 50% 6%, 91% 42%, 91% 100%, 9% 100%);
}

.build-icon.factory {
  background: #7b7d77;
  clip-path: polygon(0 42%, 24% 42%, 24% 14%, 42% 14%, 42% 42%, 100% 42%, 100% 100%, 0 100%);
}

.build-icon.sentry {
  margin-top: 3px;
  border-radius: 50%;
  background: #994239;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.24);
}

.build-icon.sentry::before {
  content: "";
  position: absolute;
  width: 25px;
  height: 5px;
  left: 11px;
  top: 7px;
  border-radius: 8px;
  background: #b8c39c;
}

.build-icon.sentry::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: -4px;
  height: 7px;
  border-radius: 5px 5px 2px 2px;
  background: #3b433c;
}

.build-icon.soldier::before {
  content: "";
  position: absolute;
  inset: 2px 8px 0;
  border-radius: 50% 50% 38% 38%;
  background: #d06650;
}

.build-icon.soldier::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 0;
  height: 10px;
  border-radius: 6px 6px 2px 2px;
  background: #7e2c29;
}

.build-icon.rocket::before {
  content: "";
  position: absolute;
  inset: 3px 8px 0;
  border-radius: 50% 50% 38% 38%;
  background: #d06650;
}

.build-icon.rocket::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 6px;
  left: 8px;
  top: 6px;
  border-radius: 8px;
  background: #f3cf65;
  box-shadow: -8px 9px 0 #7e2c29;
  transform: rotate(-14deg);
}

.build-icon.tank {
  margin-top: 4px;
  border-radius: 6px;
  background: #a7473c;
}

.build-icon.tank::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 5px;
  right: -10px;
  top: 4px;
  border-radius: 8px;
  background: #e08a64;
}

.build-icon.harvester {
  margin-top: 3px;
  border-radius: 5px;
  background: #8a8466;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22);
}

.build-icon.harvester::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  right: -3px;
  top: 5px;
  border-radius: 3px;
  background: #d8b55e;
  transform: rotate(45deg);
}

.build-icon.harvester::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 4px;
  bottom: -4px;
  height: 5px;
  border-radius: 5px;
  background: #2f3633;
}

#command-bar {
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  padding: 7px;
  border-radius: 8px;
  max-width: calc(100vw - 20px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
}

#command-bar::-webkit-scrollbar {
  display: none;
}

.command-button {
  flex: 0 0 auto;
  min-width: 58px;
  height: 38px;
  padding: 0 10px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(65, 64, 61, 0.82), rgba(18, 19, 20, 0.9));
  border: 1px solid rgba(226, 161, 69, 0.18);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.command-button.active {
  background: linear-gradient(180deg, rgba(162, 59, 48, 0.74), rgba(71, 28, 25, 0.92));
  outline: 1px solid rgba(255, 196, 104, 0.76);
}

#minimap-panel {
  left: max(10px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: 174px;
  height: 120px;
  padding: 6px;
  border-radius: 8px;
}

#minimap {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 5px;
  background: #151615;
  cursor: crosshair;
  touch-action: none;
}

#selection-panel {
  left: max(10px, env(safe-area-inset-left));
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 128px);
  width: 174px;
  min-height: 48px;
  display: grid;
  gap: 2px;
  align-content: center;
  padding: 7px 10px;
  border-radius: 8px;
  pointer-events: none;
}

#production-panel {
  right: calc(max(10px, env(safe-area-inset-right)) + 84px);
  top: max(10px, env(safe-area-inset-top));
  width: 210px;
  padding: 8px 10px;
  border-radius: 8px;
}

#production-panel.hidden {
  display: none;
}

#match-panel {
  right: calc(max(10px, env(safe-area-inset-right)) + 84px);
  top: calc(max(10px, env(safe-area-inset-top)) + 82px);
  width: 210px;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  pointer-events: none;
}

#match-panel.hidden {
  display: none;
}

#match-title {
  font-size: 13px;
  line-height: 1.1;
}

#match-meta {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.25;
}

#production-list {
  display: grid;
  gap: 6px;
}

.production-item {
  display: grid;
  gap: 4px;
}

.production-item span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1;
}

.production-item b,
.production-item em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-item b {
  color: var(--ui-text);
}

.production-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.production-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

#selection-title {
  font-size: 14px;
  line-height: 1.1;
}

#selection-meta {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.2;
}

.notice {
  position: absolute;
  z-index: 20;
  top: 68px;
  left: 50%;
  max-width: min(520px, calc(100vw - 120px));
  transform: translateX(-50%);
  padding: 9px 13px;
  border-radius: 8px;
  background: rgba(13, 14, 15, 0.9);
  border: 1px solid rgba(226, 161, 69, 0.62);
  color: #fff4c8;
  text-align: center;
  font-size: 14px;
  pointer-events: none;
}

.notice.hidden {
  display: none;
}

.splash {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, rgba(50, 28, 25, 0.96), rgba(7, 9, 10, 0.96));
}

.splash.hidden {
  display: none;
}

.splash h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 84px);
  line-height: 0.9;
  letter-spacing: 0;
  color: #f4e5c9;
  text-shadow: 0 5px 0 rgba(116, 38, 31, 0.7), 0 0 22px rgba(226, 161, 69, 0.3);
}

.splash p {
  margin: 0 0 12px;
  color: var(--ui-muted);
  font-size: 16px;
}

.mode-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.splash button {
  height: 48px;
  min-width: 160px;
  padding: 0 22px;
  border-radius: 8px;
  background: linear-gradient(180deg, #efb35e, #a33d32);
  color: #14110c;
  font-weight: 700;
  cursor: pointer;
}

.multiplayer-panel {
  width: min(390px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid rgba(226, 161, 69, 0.22);
  border-radius: 8px;
  background: rgba(9, 12, 13, 0.5);
}

.multiplayer-panel header {
  display: grid;
  gap: 3px;
  text-align: left;
}

.multiplayer-panel header strong {
  font-size: 16px;
}

.multiplayer-panel header span {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.35;
}

.multiplayer-panel label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  text-align: left;
}

.multiplayer-panel span {
  color: var(--ui-muted);
  font-size: 13px;
}

.multiplayer-panel input,
.multiplayer-panel select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ui-text);
  font: 13px "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.multiplayer-panel select {
  cursor: pointer;
}

.multiplayer-panel select:disabled {
  opacity: 0.68;
  cursor: default;
}

.room-config {
  margin-top: -1px;
}

.room-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.room-summary {
  display: grid;
  grid-template-columns: 1.05fr 0.85fr 1fr 0.7fr 0.7fr;
  gap: 6px;
}

.room-summary div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
}

.room-summary span,
.slot-body span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-summary strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #f4e5c9;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-list {
  display: grid;
  gap: 6px;
}

.slot-card {
  min-height: 42px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(4, 7, 8, 0.48);
}

.slot-card.occupied {
  border-color: rgba(226, 161, 69, 0.3);
  background: rgba(178, 67, 51, 0.16);
}

.slot-card.own {
  border-color: rgba(95, 228, 198, 0.58);
  box-shadow: inset 0 0 0 1px rgba(95, 228, 198, 0.18);
}

.slot-card.ready {
  background: rgba(80, 132, 85, 0.18);
}

.slot-card.ai {
  border-color: rgba(146, 185, 209, 0.32);
  background: rgba(72, 111, 143, 0.16);
}

.slot-card.closed {
  opacity: 0.62;
  background: rgba(255, 255, 255, 0.035);
}

.slot-color {
  width: 9px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
}

.slot-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.slot-body strong {
  overflow: hidden;
  color: var(--ui-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-badge {
  min-width: 54px;
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #dfe8d9;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.slot-card.ready .slot-badge {
  background: rgba(139, 187, 95, 0.22);
  color: #d8ffc0;
}

.slot-card.own .slot-badge {
  background: rgba(95, 228, 198, 0.18);
  color: #bffbed;
}

.slot-card.ai .slot-badge {
  background: rgba(154, 185, 209, 0.18);
  color: #cfeeff;
}

.slot-card.closed .slot-badge {
  background: rgba(255, 255, 255, 0.06);
  color: #9fa7a3;
}

.tool-button {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ui-text);
  cursor: pointer;
}

.multiplayer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.splash .secondary-button {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background: rgba(200, 74, 59, 0.24);
  border: 1px solid rgba(226, 161, 69, 0.44);
  color: var(--ui-text);
}

.splash .ready-button.ready {
  background: rgba(213, 162, 83, 0.24);
  border-color: rgba(227, 182, 96, 0.74);
  color: #ffe7ad;
}

.multiplayer-actions button:disabled,
.room-tools button:disabled {
  opacity: 0.46;
  cursor: default;
}

#multiplayer-status {
  min-height: 15px;
  color: #cfddcf;
  font-size: 12px;
  line-height: 1.25;
}

#multiplayer-status.waiting {
  color: #ffe1a0;
}

#multiplayer-status.ready {
  color: #c8f3c0;
}

#multiplayer-status.error {
  color: #ffb0a3;
}

.server-settings {
  display: grid;
  gap: 7px;
  color: var(--ui-muted);
  font-size: 12px;
  text-align: left;
}

.server-settings summary {
  cursor: pointer;
}

.server-settings label {
  margin-top: 7px;
}

.modal-screen {
  position: absolute;
  z-index: 28;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 20px;
  background: rgba(5, 7, 8, 0.58);
  backdrop-filter: blur(5px);
}

.modal-screen.hidden {
  display: none;
}

.modal-panel {
  width: min(360px, calc(100vw - 40px));
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid rgba(213, 162, 83, 0.45);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(25, 31, 31, 0.96), rgba(10, 13, 14, 0.96));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
}

.modal-panel h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.modal-panel p {
  margin: 0 0 6px;
  color: var(--ui-muted);
}

.modal-panel button {
  height: 42px;
  border-radius: 8px;
  background: rgba(84, 182, 166, 0.22);
  border: 1px solid rgba(84, 182, 166, 0.52);
  cursor: pointer;
}

.modal-panel button + button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.privacy-link {
  color: rgba(238, 245, 238, 0.72);
  font-size: 12px;
  text-decoration: none;
}

.privacy-link:focus-visible,
.privacy-link:hover {
  color: #ffffff;
}

@media (max-width: 680px) {
  #topbar {
    right: calc(max(8px, env(safe-area-inset-right)) + 74px);
    min-height: 43px;
    gap: 4px;
    padding: 5px;
  }

  .stat {
    min-width: 54px;
    padding: 2px 5px;
  }

  .stat strong {
    font-size: 13px;
  }

  #build-panel {
    width: 64px;
    gap: 5px;
    padding: 5px;
  }

  #objective-panel {
    top: calc(max(8px, env(safe-area-inset-top)) + 52px);
    width: min(218px, calc(100vw - 92px));
    padding: 7px 8px;
  }

  #objective-list li {
    font-size: 10px;
  }

  #production-panel {
    top: calc(max(8px, env(safe-area-inset-top)) + 52px);
    right: max(8px, env(safe-area-inset-right));
    width: 64px;
    padding: 6px;
  }

  #production-panel strong {
    font-size: 10px;
  }

  .production-item span {
    display: block;
    font-size: 9px;
  }

  #match-panel {
    top: calc(max(8px, env(safe-area-inset-top)) + 134px);
    right: max(8px, env(safe-area-inset-right));
    width: 132px;
    padding: 6px 7px;
  }

  #match-title {
    font-size: 11px;
  }

  #match-meta {
    font-size: 10px;
  }

  .build-button {
    min-height: 48px;
  }

  .build-button span:not(.build-icon) {
    font-size: 11px;
  }

  .command-button {
    min-width: 46px;
    height: 34px;
    padding: 0 6px;
    font-size: 12px;
  }

  #command-bar {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 154px);
  }

  #minimap-panel {
    width: 132px;
    height: 92px;
    padding: 5px;
  }

  #selection-panel {
    left: max(10px, env(safe-area-inset-left));
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 98px);
    width: 132px;
    min-height: 42px;
    padding: 6px 8px;
  }

  #selection-title {
    font-size: 12px;
  }

  #selection-meta {
    font-size: 10px;
  }

  .splash {
    place-content: start center;
    gap: 6px;
    padding: 16px;
    overflow-y: auto;
  }

  .multiplayer-panel {
    gap: 6px;
    padding: 9px;
  }

  .mode-actions {
    grid-template-columns: 1fr 1fr;
  }

  .splash button {
    height: 42px;
  }

  .multiplayer-panel header span {
    font-size: 11px;
  }

  .multiplayer-panel label {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .room-summary {
    grid-template-columns: 1fr 1fr;
  }

  .room-summary div {
    padding: 6px;
  }

  .room-summary strong {
    font-size: 12px;
  }

  .slot-card {
    grid-template-columns: 8px minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 36px;
    padding: 5px 6px;
  }

  .slot-color {
    height: 24px;
  }

  .slot-body strong {
    font-size: 11px;
  }

  .slot-badge {
    min-width: 48px;
    padding: 3px 6px;
  }

  .multiplayer-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  #command-bar {
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  #build-panel {
    width: 122px;
    grid-template-columns: repeat(2, 56px);
    gap: 5px;
    padding: 5px;
  }

  .build-button {
    min-height: 45px;
    padding: 4px 3px;
  }

  .build-icon {
    width: 24px;
    height: 19px;
  }

  .build-button span:not(.build-icon) {
    font-size: 10px;
  }

  .build-button small {
    font-size: 9px;
  }
}

/* v28 skirmish nations and simplified lobby */
.splash.splash { isolation: isolate; transform: translateZ(0); }
.splash.splash::before,
.splash.splash::after { z-index: 0; }
.splash.splash > * { position: relative; z-index: 1; }
.splash.splash h1 { filter: none; }

.skirmish-panel {
  width: min(620px, calc(100vw - 32px));
  display: grid;
  gap: 9px;
  margin: 2px auto 4px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(240, 187, 101, 0.24);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(18, 20, 20, 0.76), rgba(8, 11, 12, 0.72));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 16px 40px rgba(0, 0, 0, 0.22);
  transition: max-height 240ms ease, opacity 160ms ease, transform 240ms ease, padding 240ms ease, margin 240ms ease;
}

.skirmish-panel.collapsed {
  max-height: 0;
  margin-block: -5px;
  padding-block: 0;
  border-width: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.skirmish-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
}

.skirmish-panel header strong {
  flex: 0 0 auto;
  color: #f4e5c9;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.skirmish-panel header span {
  overflow: hidden;
  color: #b8ac9d;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faction-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.splash.splash .faction-card {
  min-width: 0;
  height: 68px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 0 7px;
  padding: 8px;
  border-color: rgba(255, 255, 255, 0.11);
  background: linear-gradient(145deg, rgba(72, 70, 65, 0.48), rgba(17, 19, 20, 0.86));
  color: #e8dfd1;
  text-align: left;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.splash.splash .faction-card b {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: #d6ba79;
  font-size: 15px;
}

.splash.splash .faction-card span,
.splash.splash .faction-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.splash.splash .faction-card span { align-self: end; font-size: 11px; font-weight: 700; }
.splash.splash .faction-card small { align-self: start; margin: 2px 0 0; color: #9d968b; font-size: 9px; letter-spacing: 0.06em; }
.splash.splash .faction-card.active {
  border-color: rgba(240, 187, 101, 0.84);
  background: linear-gradient(145deg, rgba(160, 62, 45, 0.72), rgba(45, 25, 23, 0.94));
  box-shadow: inset 3px 0 #e8b35e, 0 0 18px rgba(204, 82, 55, 0.2);
}

.skirmish-options {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.9fr;
  gap: 7px;
}

.skirmish-options label {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  color: #a9a094;
  font-size: 10px;
  text-align: left;
}

.skirmish-options select {
  min-width: 0;
  height: 32px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: #eee7dd;
  font: 11px "Segoe UI", "Microsoft YaHei", sans-serif;
}

.room-advanced {
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.035);
  color: #b8afa2;
  text-align: left;
}

.room-advanced summary { cursor: pointer; font-size: 12px; }
.room-advanced-body { display: grid; gap: 7px; margin-top: 9px; }

.modal-panel .return-button,
.modal-panel button.return-button {
  background: rgba(184, 67, 52, 0.18);
  border-color: rgba(232, 133, 93, 0.42);
  color: #f3d9c7;
}

@media (max-width: 680px) {
  .skirmish-panel { gap: 7px; padding: 9px; }
  .skirmish-panel header { display: grid; gap: 2px; }
  .skirmish-panel header span { font-size: 9px; }
  .faction-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .splash.splash .faction-card { height: 50px; grid-template-columns: 24px minmax(0, 1fr); padding: 5px 7px; }
  .splash.splash .faction-card b { width: 22px; height: 22px; font-size: 11px; }
  .skirmish-options { grid-template-columns: 1fr; }
  .skirmish-options label { grid-template-columns: 64px minmax(0, 1fr); }
}

@media (max-height: 620px) and (orientation: landscape) {
  .skirmish-panel { width: min(760px, calc(100vw - 24px)); grid-template-columns: 1.35fr 1fr; padding: 8px; }
  .skirmish-panel header { grid-column: 1 / 3; }
  .splash.splash .faction-card { height: 50px; grid-template-columns: 22px minmax(0, 1fr); padding: 5px; }
  .splash.splash .faction-card b { width: 20px; height: 20px; font-size: 10px; }
  .skirmish-options { grid-template-columns: 1fr; }
}
