* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; overflow: hidden; background: #0a1518; color: #eef1dc;
  font: 14px system-ui, sans-serif;
}
#game, #overlay { position: absolute; inset: 0; width: 100vw; height: 100vh; display: block; }
#game { cursor: crosshair; }
#overlay { pointer-events: none; }
header {
  position: absolute; top: 0; left: 0; right: 0; height: 32px; padding: 6px 14px;
  background: #091719e8; pointer-events: none;
}
header strong { font-size: 15px; letter-spacing: 2px; }
header span, em { color: #e5b966; font-style: normal; }
.tag { font-size: 10px; color: #0a1518; background: #e5b966; padding: 1px 5px; border-radius: 3px; margin-left: 4px; }
#teams { position: absolute; right: 14px; top: 8px; font-size: 11px; font-weight: 700; }
#hud {
  position: absolute; top: 34px; left: 12px; right: 12px; padding: 5px 10px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px;
  background: #091719dc; border: 1px solid #65776855; border-radius: 5px;
}
#stats { font-size: 12px; font-weight: 700; white-space: nowrap; }
#upgrades { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
#upgrades > div { display: flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; }
button {
  background: #e5b966; color: #19201a; border: 0; border-radius: 3px; padding: 13px 20px;
  font-weight: 800; cursor: pointer;
}
button:disabled { opacity: 0.35; cursor: default; }
button.ghost { background: transparent; color: #e5b966; border: 1px solid #e5b96688; }
#upgrades button { font-size: 16px; padding: 1px 8px; min-width: 27px; height: 26px; }
#controls {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0;
  font-size: 11px; line-height: 1.5; color: #c4d2c9;
}
#controls span { white-space: nowrap; }
kbd {
  font: 700 10px system-ui; color: #ffe4a5; background: #263b3c; border: 1px solid #73887866;
  border-radius: 3px; padding: 1px 5px;
}
.ready { color: #9ed6af; font-size: 10px; margin-left: 4px; }
.ready.wait { color: #e9a07a; }
#notice {
  position: absolute; top: 132px; width: 100%; text-align: center; font-size: 13px;
  color: #f6d17b; font-weight: 700; text-shadow: 0 1px 4px #000; pointer-events: none;
}
#notice.alert { color: #ff8f7a; }
#feed {
  position: absolute; right: 14px; top: 160px; text-align: right; font-size: 11px; line-height: 1.7;
  color: #e6ecdb; white-space: pre-line; text-shadow: 0 1px 3px #000; pointer-events: none;
}
footer {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; padding: 6px 12px; border-radius: 6px;
  background: #081416cc; font-size: 10px; letter-spacing: 1px; font-weight: 700; pointer-events: none;
}
footer span { white-space: nowrap; }
footer .red { color: #f58b7d; }
footer .blue { color: #8ccaf7; }
#minimap { width: 420px; height: 48px; border-radius: 3px; }
#modal {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #061112aa; backdrop-filter: blur(4px);
}
section {
  background: #101f22ed; border: 1px solid #80927955; padding: 36px 44px; width: min(450px, calc(100vw - 32px));
  box-shadow: 0 30px 100px #0008;
}
.eyebrow { font-size: 10px; letter-spacing: 3px; color: #e6bd77; }
h1 { font-size: 48px; letter-spacing: 4px; line-height: 1.05; margin: 20px 0; }
section p { line-height: 1.8; color: #afc0b8; }
input {
  width: 100%; padding: 14px; margin: 12px 0; background: #071416; color: white; border: 1px solid #52645b;
  font-size: 15px;
}
section button { width: 100%; margin: 6px 0; }
section small { display: block; margin-top: 14px; color: #91a59b; }
#scoreboard {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 140px); overflow: auto; padding: 16px 20px; border-radius: 8px;
  background: #0a1719f0; border: 1px solid #80927966; box-shadow: 0 20px 80px #000a; pointer-events: none;
}
.sb-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; letter-spacing: 2px; }
.sb-head span { color: #a8b6ac; font-size: 12px; }
.sb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sb-team h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: 1px; }
.sb-team.red h3 { color: #f58b7d; }
.sb-team.blue h3 { color: #8ccaf7; }
.sb-team small { color: #a8b6ac; font-weight: 400; margin-left: 6px; }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 12px; }
#scoreboard th { text-align: left; color: #8fa196; font-weight: 600; padding: 3px 4px; border-bottom: 1px solid #ffffff22; }
#scoreboard td { padding: 3px 4px; border-bottom: 1px solid #ffffff10; white-space: nowrap; }
#scoreboard td:nth-child(n+3), #scoreboard th:nth-child(n+3) { text-align: right; }
#scoreboard tr.me td { color: #ffe5a3; font-weight: 700; }
.sb-note { margin: 10px 0 0; font-size: 11px; color: #8fa196; }
@media (max-width: 1000px) {
  .sb-cols { grid-template-columns: 1fr; }
  #hud { grid-template-columns: 1fr; }
  #upgrades { justify-content: flex-start; }
  #notice { top: 158px; }
  #feed { top: 186px; }
  #minimap { width: 260px; height: 30px; }
}

/* Carved timber, aged brass and parchment — the jungle campaign interface. */
:root { --gold: #c5a05a; --cream: #f2dfaa; --wood: #181b12; --frame: #756039; }
body { color: var(--cream); background: #19291b; font-family: Georgia, 'Times New Roman', serif; }
header, #hud, footer, #modal section, #scoreboard {
  background-color: var(--wood);
  background-image: repeating-linear-gradient(2deg, transparent 0 5px, #dcc28b04 6px, #0003 8px, transparent 10px 15px), linear-gradient(100deg, #30302377, #100f0ce8 55%, #2a2a1b88);
  border: 3px double var(--gold);
  border-radius: 2px;
  box-shadow: inset 0 0 0 3px #0b0f09, inset 0 0 22px #000a, 0 4px 0 #090d08, 0 8px 24px #0008;
}
header { top: 10px; left: 12px; right: auto; width: 300px; height: 74px; padding: 11px 14px; }
header strong { display: block; font-size: 19px; letter-spacing: .7px; text-shadow: 0 2px #000; }
header strong span { color: var(--cream); }
header strong small { display: block; margin: 7px 0 0 46px; font: 9px Georgia, serif; letter-spacing: 2px; color: #baa67d; }
.crest { float: left; font-size: 37px; color: var(--gold); margin: -3px 11px 0 0; font-style: normal; }
#teams { position: fixed; top: 12px; left: 50%; right: auto; transform: translateX(-50%); padding: 14px 24px; background: #141c12ed; border: 3px double var(--gold); color: var(--cream); font: bold 12px Georgia, serif; box-shadow: 0 4px 16px #0007; white-space: nowrap; }
#teams:empty { display: none; }
#hud { top: auto; bottom: 12px; left: 12px; right: 306px; min-height: 178px; padding: 13px 16px 8px; grid-template-columns: minmax(230px, .85fr) minmax(360px, 1.4fr); gap: 9px 18px; }
h2 { margin: 0 0 9px; color: #f4d68b; font-size: 14px; font-weight: normal; letter-spacing: 1.5px; text-shadow: 0 2px #000; }
.soldier-panel { display: flex; align-items: center; gap: 14px; }
.portrait { width: 77px; height: 96px; flex-shrink: 0; border: 3px double #bc9c58; background: radial-gradient(ellipse at 50% 20%, #9a914e55, transparent 65%), linear-gradient(135deg, #43513b, #131d16); display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 38px; color: #d6b567; text-shadow: 0 2px 4px #000; box-shadow: inset 0 0 20px #000; }
.portrait span { font-size: 16px; letter-spacing: 5px; padding-left: 5px; }
#stats { font: 12px/1.8 Georgia, serif; white-space: normal; }
.soldier-info small { display: block; font-size: 8px; letter-spacing: 1px; color: #b4aa83; margin-top: 7px; }
meter { display: block; width: 100%; height: 13px; margin-top: 5px; }
meter::-webkit-meter-bar { background: #080d08; border: 1px solid #6d7041; border-radius: 0; }
meter::-webkit-meter-optimum-value { background: linear-gradient(#91c95b, #3f7929); }
.armory { border-left: 1px solid #79643b; padding-left: 18px; }
#upgrades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
#upgrades > div { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 7px 4px 5px; border: 2px ridge #b39b64; background: linear-gradient(#e0d09b, #b29b68 65%, #181b12 66%); color: #211e13; font-size: 10px; text-align: center; }
.upgrade-icon { font: normal 30px/32px Georgia, serif; color: #44482a; text-shadow: 0 1px #f9e9ba; }
#upgrades span { min-height: 25px; line-height: 1.3; color: var(--cream); margin-top: 5px; }
#upgrades button { position: absolute; right: 3px; top: 3px; height: 21px; min-width: 21px; padding: 0; font-size: 17px; }
button { border: 2px ridge #d4b565; border-radius: 1px; background: linear-gradient(#53603b, #27321f); color: #ffe6a0; font-family: Georgia, serif; letter-spacing: 1px; text-shadow: 0 1px #000; box-shadow: inset 0 0 0 1px #171d10, 0 2px 4px #0005; }
button:hover:not(:disabled) { filter: brightness(1.22); }
button:focus-visible, input:focus-visible { outline: 2px solid #f5d785; outline-offset: 3px; }
button:disabled { opacity: .45; }
#controls { border-top: 1px solid #77613b66; padding-top: 8px; gap: 4px 13px; color: #bbba9b; font-size: 10px; }
kbd { background: #11170e; border: 1px solid #71603e; border-radius: 1px; color: #dec58b; font-size: 9px; }
.ready { font-size: 9px; }
footer { bottom: 12px; left: auto; right: 12px; transform: none; width: 282px; height: 178px; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.map-title { grid-column: 1 / -1; text-align: center; font-size: 11px; letter-spacing: 1px; color: #ead293; }
#minimap { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 112px; border: 1px solid #847042; border-radius: 0; }
footer .blue { text-align: right; }
#notice { top: 96px; font-size: 14px; }
#feed { top: 130px; right: 20px; font-family: Georgia, serif; }
#modal { background: radial-gradient(ellipse at center, #16231955, #060e09bc); backdrop-filter: blur(2px); }
#modal section { position: relative; width: min(440px, calc(100vw - 32px)); padding: 28px 40px; text-align: center; border-width: 5px; }
#modal section::before, #modal section::after { content: '◆'; position: absolute; top: 8px; color: var(--gold); font-size: 16px; }
#modal section::before { left: 9px; } #modal section::after { right: 9px; }
.eyebrow { font-size: 9px; letter-spacing: 2px; color: #bda66e; }
.menu-crest { color: #d7b56d; font-size: 48px; margin-top: 15px; text-shadow: 0 3px #000; }
h1 { font-size: 42px; font-weight: normal; letter-spacing: 4px; margin: 6px 0 16px; text-shadow: 0 3px 2px #000; }
h1 em { color: #d9b66e; }
.menu-divider { color: #a98c4c; display: flex; align-items: center; gap: 12px; font-size: 9px; }
.menu-divider::before, .menu-divider::after { content: ''; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, #ab8d50, transparent); }
section p { color: #c5bca0; font-size: 14px; }
input { border: 1px solid #897343; background: #090f09aa; font-family: Georgia, serif; color: #f4dfb2; text-align: center; }
section small { color: #a6aa88; font-size: 11px; line-height: 1.6; }
#scoreboard { border-radius: 0; }
@media (max-width: 1150px) {
  header { width: 245px; } header strong { font-size: 15px; } header strong small { font-size: 7px; }
  #teams { left: auto; right: 12px; transform: none; font-size: 10px; padding: 12px; }
  #hud { right: 244px; grid-template-columns: 1fr 1.3fr; gap: 8px; padding: 10px; }
  footer { width: 220px; } .portrait { width: 50px; height: 78px; font-size: 27px; }
  .soldier-panel { gap: 8px; } .armory { padding-left: 10px; } #stats { font-size: 11px; }
  #upgrades { gap: 4px; } #upgrades > div { font-size: 9px; } #controls { gap: 3px 7px; }
}
@media (max-width: 760px) {
  header { top: 6px; left: 6px; width: 202px; height: 61px; padding: 9px; } header strong { font-size: 12px; } .crest { font-size: 28px; margin-right: 6px; } header strong small { margin-left: 33px; letter-spacing: .7px; }
  #teams { top: 72px; right: auto; left: 6px; font-size: 9px; padding: 7px; }
  #hud { left: 6px; right: 6px; bottom: 6px; min-height: 0; grid-template-columns: 1fr 1.2fr; padding: 8px; }
  .portrait, .soldier-info small { display: none; } h2 { font-size: 11px; letter-spacing: .5px; } #stats { font-size: 10px; }
  #controls { font-size: 9px; } .ready { font-size: 8px; } #controls span { white-space: normal; }
  footer { top: 6px; bottom: auto; right: 6px; width: 142px; height: 96px; padding: 4px; gap: 2px; } .map-title { font-size: 7px; letter-spacing: 0; } #minimap { height: 55px; } footer span { font-size: 8px; }
  #notice { top: 112px; padding: 0 10px; font-size: 11px; } #feed { top: 140px; font-size: 9px; }
  #modal section { padding: 20px 28px; max-height: calc(100dvh - 20px); overflow: auto; } h1 { font-size: 34px; } .menu-crest { font-size: 32px; margin-top: 8px; }
  #scoreboard { max-height: calc(100dvh - 30px); } .sb-cols { grid-template-columns: 1fr; }
}
@media (max-height: 600px) and (min-width: 761px) {
  #hud, footer { bottom: 6px; min-height: 0; } #hud { padding: 7px 10px; } footer { height: 151px; } #minimap { height: 90px; } .portrait { height: 70px; } #modal section { padding: 16px 32px; max-height: calc(100dvh - 16px); overflow: auto; } .menu-crest { display: none; } h1 { font-size: 34px; }
}
#upgrades > div { white-space: normal; }
#upgrades span { overflow-wrap: anywhere; width: 100%; }
@media (max-width: 760px) {
  #upgrades > div { padding-left: 2px; padding-right: 2px; }
  #upgrades span { font-size: 8px; min-height: 32px; }
  .upgrade-icon { font-size: 25px; }
  #upgrades button { right: 1px; top: 1px; min-width: 16px; height: 16px; font-size: 13px; }
}

/* Touch devices play in landscape. The prompt disappears as soon as they rotate. */
#rotate-screen { display: none; }
@media (hover: none) and (pointer: coarse) and (orientation: portrait) and (max-width: 1100px) {
  #rotate-screen {
    position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    background: #10180ff5; backdrop-filter: blur(8px); text-align: center;
    overflow: auto; touch-action: manipulation;
  }
  .rotate-card { width: min(360px, 100%); padding: 30px 20px; border: 3px double var(--gold); background: linear-gradient(135deg, #303023, #13170f); box-shadow: inset 0 0 30px #0008, 0 12px 40px #0008; }
  .rotate-device { font: 80px/1 Georgia, serif; color: #ead094; margin-bottom: 24px; }
  #rotate-title { font-size: 20px; line-height: 1.5; letter-spacing: 1px; }
  .rotate-card p { font-size: 14px; line-height: 1.8; color: #d2c6a7; }
  .rotate-card button { width: 100%; margin: 10px 0 16px; font-size: 11px; line-height: 1.6; }
  .rotate-card small { display: block; color: #b9b296; font-size: 12px; line-height: 1.7; }
}
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  header { top: 5px; left: max(6px, env(safe-area-inset-left)); height: 52px; width: 220px; padding: 6px 9px; }
  header strong { font-size: 13px; } header strong small { margin-top: 4px; font-size: 7px; } .crest { font-size: 28px; }
  #teams { top: 6px; right: max(6px, env(safe-area-inset-right)); padding: 8px; font-size: 9px; }
  #hud { left: max(6px, env(safe-area-inset-left)); right: max(6px, env(safe-area-inset-right)); bottom: max(5px, env(safe-area-inset-bottom)); min-height: 0; padding: 6px 8px; grid-template-columns: 1fr 1.6fr; }
  .portrait, .soldier-info small, #controls { display: none; }
  #upgrades > div { padding: 3px; gap: 2px; } .upgrade-icon { font-size: 21px; line-height: 23px; }
  #upgrades span { font-size: 9px; min-height: 20px; margin-top: 2px; }
  h2 { font-size: 11px; margin-bottom: 5px; }
  footer { top: 58px; right: max(6px, env(safe-area-inset-right)); bottom: auto; width: 144px; height: 88px; padding: 4px; gap: 2px; }
  .map-title { font-size: 7px; } #minimap { height: 48px; } footer span { font-size: 8px; }
  #notice { top: 62px; font-size: 11px; } #feed { top: 150px; font-size: 9px; }
}

#modal section { max-height: calc(100dvh - 20px); overflow-y: auto; }
#room-picker { margin: 20px 0 8px; padding: 13px 0 0; border: 0; border-top: 1px solid #89734388; }
#room-picker legend { padding: 0 10px; margin: auto; font-size: 11px; color: #ead094; letter-spacing: 1.5px; }
#room-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.room-option { position: relative; cursor: pointer; }
.room-option input { position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0; margin: 0; }
.room-option > span { display: block; padding: 10px 1px; border: 1px solid #79633e; background: #0d150f; transition: background .15s, border-color .15s; }
.room-option b { font-size: 23px; font-weight: normal; color: #c2b38a; }
#room-options small { margin-top: 4px; font-size: 7px; letter-spacing: 1px; color: #a99b7a; }
.room-option input:checked + span { border-color: #f1d184; background: linear-gradient(#59603b, #2c351f); box-shadow: inset 0 0 0 1px #ad8d4e; }
.room-option input:checked + span b { color: #ffe8ad; }
.room-option input:focus-visible + span { outline: 2px solid #ffe8ad; outline-offset: 3px; }
.room-option:hover > span { border-color: #d2b76e; }
#room-summary { color: #ead094; font-size: 12px; margin: 10px 0 0; }
#room-picker > small { margin-top: 5px; font-size: 10px; }
@media (max-height: 600px) and (orientation: landscape) {
  #modal section { width: min(590px, calc(100vw - 32px)); padding: 14px 26px; }
  #modal h1 { font-size: 25px; margin: 8px 0; } #modal h1 br { display: none; }
  #modal .menu-crest, #modal .menu-divider, #modal #message { display: none; }
  #room-picker { margin-top: 12px; padding-top: 8px; }
  .room-option > span { padding: 5px 1px; } .room-option b { font-size: 19px; }
  #modal input#name { padding: 8px; margin: 6px 0; } #modal section > button { padding: 8px; margin: 3px 0; }
  #modal #connection { margin-top: 6px; }
}
