:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f3ead7;
  background: #171917;
  --faint: #c9c2b0;
  --line: #4a4f44;
  --soil: #3c3328;
  --gold: #ffcf84;
  --blue: #9edbe9;
}

* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100% - 24px, 880px); margin: 0 auto; }
header { padding: clamp(12px, 3vw, 28px) 0 14px; }
.demo-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 5px; }
.demo-language:not([hidden]) { display: flex; align-items: center; justify-content: end; gap: 5px; }
.demo-language { color: var(--faint); font-size: .75rem; }
.demo-language select {
  max-width: 53vw;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px;
  color: #f3ead7;
  background: #30342c;
  font: inherit;
}
.demo-language select:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.brand { color: var(--gold); letter-spacing: .14em; font-size: .73rem; font-weight: 800; text-underline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 5vw, 3.4rem); letter-spacing: -.056em; line-height: 1.06; }
header p { margin-top: 5px; color: var(--faint); }
.game { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #252821; }
.readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.readouts div { display: flex; align-items: baseline; justify-content: center; gap: .35rem .65rem; padding: .55rem .25rem; flex-wrap: wrap; }
.readouts div + div { border-inline-start: 1px solid var(--line); }
.readouts dt { color: var(--faint); font-size: .78rem; }
.readouts dd { margin: 0; font-size: .9rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.map { position: relative; aspect-ratio: 16 / 9; isolation: isolate; background: var(--soil) url('./terrain.jpg') center / 100% 100%; }
.map::before { position: absolute; inset: 0; content: ''; background: #291b0e45; z-index: -1; }
canvas { display: block; width: 100%; height: 100%; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.position {
  position: absolute;
  z-index: 1;
  width: clamp(36px, 5.5vw, 50px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0;
  border-radius: 50%;
  border: 2px solid #ffe2b4;
  background: #263026;
  color: #fff3d9;
  box-shadow: 0 2px 7px #19120d;
  font-size: .82rem;
  font-weight: 800;
}
.position:disabled { opacity: .42; }
.position[data-occupied] { opacity: 1; background: #f5c779; color: #171917; border-color: #121610; }
.position[data-occupied="skyguard"] { background: var(--blue); }
.position-a { left: 21.75%; top: 47.55%; }
.position-b { left: 36.875%; top: 26.67%; }
.position-c { left: 42.94%; top: 55.56%; }
.position-d { left: 68.125%; top: 44.44%; }
.position-e { left: 78.125%; top: 60%; }
.position-f { left: 57.375%; top: 79.56%; }
.orders { display: grid; gap: 10px; padding: 10px clamp(8px, 2vw, 16px) 12px; }
#message { min-height: 2.5em; color: #fff1d6; font-size: .88rem; line-height: 1.3; }
.roster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.roster button, .controls button, footer a {
  display: grid;
  align-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #30342c;
  color: inherit;
  padding: 6px 8px;
  line-height: 1.2;
}
.roster button span { color: var(--faint); font-size: .75rem; }
.roster button { overflow-wrap: anywhere; }
.roster [aria-pressed="true"] { border-color: var(--gold); background: #423829; }
.roster button:disabled { opacity: .55; }
.controls { display: flex; gap: 6px; }
.controls button { min-width: 82px; font-weight: 750; }
#start { flex: 1; border-color: var(--gold); background: var(--gold); color: #201c13; }
#start:disabled { opacity: .55; }
.result-sharing { border-top: 1px solid var(--line); padding-top: 8px; }
.orders [hidden] { display: none; }
#result-store footer { padding: 0 0 10px; }
.result-sharing button { border-color: #7c6a4c; color: var(--gold); }
#share-status { color: var(--faint); font-size: .82rem; }
#share-status:not(:empty), #manual-invitation:not([hidden]) { display: block; margin-top: 6px; }
#manual-invitation { color: var(--faint); font-size: .82rem; }
#invitation {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #20231e;
  color: inherit;
  font: inherit;
  resize: vertical;
}
#invitation:focus-visible { outline: 2px solid white; outline-offset: 2px; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding: 18px 0 24px; }
footer div { flex: 1 1 360px; }
footer h2 { font-size: 1rem; }
footer p { margin-top: 4px; color: var(--faint); font-size: .85rem; line-height: 1.4; }
footer nav { display: flex; align-items: center; gap: 8px; }
footer a { color: var(--gold); text-decoration: none; font-size: .86rem; font-weight: 750; padding-inline: 12px; }

.partner-demo header { padding: 8px 0 10px; }
.partner-demo h1 { font-size: clamp(1.45rem, 3vw, 2.2rem); }
.partner-demo header p { font-size: .9rem; }
.partner-demo footer { padding-block: 10px; }
@media (min-width: 660px) and (max-height: 650px) {
  .partner-demo .game {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 34%);
    align-items: start;
  }
  .partner-demo .readouts { grid-column: 1 / -1; }
}

@media (max-width: 360px) {
  .readouts div { gap: 4px; }
  .roster button { font-size: .89rem; padding-inline: 2px; }
  .roster button span { font-size: .71rem; }
}
