/* Wine's LGPL-2.1 Tahoma clone (public/fonts/README) where the system lacks Tahoma, the face the FONT glyphs were drawn from. */
@font-face {
  font-family: Tahoma;
  src: local('Tahoma'), url('fonts/tahoma.ttf') format('truetype');
}
@font-face {
  font-family: Tahoma;
  font-weight: bold;
  src: local('Tahoma Bold'), local('Tahoma-Bold'), url('fonts/tahomabd.ttf') format('truetype');
}
:root {
  color-scheme: dark;
  font:
    14px/1.5 Tahoma,
    Arial,
    sans-serif;
  color: #deded1;
  background: #080b09;
  --green: #a9ba78;
  --line: #4c5040;
  --gold: #d5c697;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: #dddccb;
  border: 1px solid #555a46;
  background: linear-gradient(#343b2d, #20261d);
  padding: 8px 13px;
  box-shadow: inset 0 1px #6b705039;
}
button:hover:not(:disabled) {
  color: #fff6d0;
  border-color: #adab71;
  background: linear-gradient(#49533a, #2d3525);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid #d8d287;
  outline-offset: 2px;
}
.hidden {
  display: none !important;
}
.screen {
  min-height: 100dvh;
}
.muted {
  color: #9caa92;
  font-size: 12px;
}
#menu {
  position: relative;
  overflow: hidden;
  background: #000;
}
#loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
}
/* The 640×480 screens scale to fit the window (--s, set by app.mjs). */
.loading-stage,
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--s, 1));
}
.loading-stage {
  width: 640px;
  height: 480px;
}
.loading-stage > * {
  position: absolute;
  margin: 0;
}
#loading-plate {
  left: 168px;
  top: 419px;
}
/* The bar runs under the plate, as wide as its inner panel. */
.loading-track {
  left: 172px;
  top: 456px;
  width: 296px;
  height: 3px;
  background: #0008;
}
#loading-bar {
  display: block;
  width: 0;
  height: 100%;
  background: #00c0c0;
  transition: width 0.15s linear;
}
#loading-message {
  left: 0;
  right: 0;
  top: 462px;
  text-align: center;
  font-size: 11px;
  color: #e0e0e0;
}
#stage {
  width: 640px;
  height: 480px;
  overflow: hidden;
  image-rendering: pixelated;
  /* FONT_MENU was drawn from Tahoma; these sizes match its advance widths (fonts 0–2). */
  --font-0: 9px / 11px Tahoma, sans-serif;
  --font-1: 11.75px / 13px Tahoma, sans-serif;
  --font-2: 14.8px / 18px Tahoma, sans-serif;
  /* The menu's RGB565 text colours. */
  --grey: #e0e0e0; /* 0xe71c */
  --cyan: #00a0a0; /* 0x514: button labels */
  --cyan-lit: #00e0e0; /* 0x71c */
  --cyan-mid: #00b8b8; /* 0x5d7: list row under the pointer */
  --cyan-dim: #008480; /* 0x430: list rows */
  --cyan-name: #00fcf8; /* 0x7ff: map name */
  --cyan-text: #00c0c0; /* 0x618: map description */
  --off: #808080; /* 0x8410: disabled labels */
  --off-box: #909490; /* 0x94b2: disabled box text */
  --atlas: url('/assets/interface/graph_menu-atlas.png');
  font: var(--font-2);
  color: var(--grey);
  /* Lays glyphs out unhinted, so small sizes keep even spacing when the stage is scaled up. */
  text-rendering: geometricPrecision;
}
/* The menu draws its own animated pointer (MOUSE_ANIM_MENU). */
#stage,
#stage * {
  cursor: none;
}
#menu-art,
#stage > section {
  position: absolute;
  inset: 0;
}
#stage > section {
  display: none;
}
#stage[data-screen='player'] > [data-screen='player'],
#stage[data-screen='main'] > [data-screen='main'],
#stage[data-screen='single'] > [data-screen='single'],
#stage[data-screen='custom'] > [data-screen='custom'],
#stage[data-screen='load'] > [data-screen='load'],
#stage[data-screen='config'] > [data-screen='config'] {
  display: block;
}
#stage [data-hot],
#stage .box,
.menu-title,
.map-info > *,
.team-label,
.menu-version,
#menu-cursor,
.drop {
  position: absolute;
  margin: 0;
}
/* An atlas sprite (ui/menu.mjs sets its size and position inline). */
.skin,
.sprite {
  position: absolute;
  left: 0;
  top: 0;
  background-image: var(--atlas);
  background-repeat: no-repeat;
  pointer-events: none;
}
/* A button's skin holds one sprite per state (s0 normal, s1 under the pointer, s2 pressed,
   s3 disabled); buttons blend at level 2 (0x495ba0 → 0x5344d0): 6/8 sprite, 2/8 background. */
.skin {
  background: none;
  opacity: 0.75;
}
.skin > .sprite {
  display: none;
}
#stage button:not(:hover, :disabled) > .skin > .s0,
#stage button:hover:not(:active, :disabled) > .skin > .s1,
#stage button:active:not(:disabled) > .skin > .s2,
#stage button:disabled > .skin > .s3 {
  display: block;
}
.menu-title {
  transform: translateX(-50%);
  white-space: nowrap;
  font: var(--font-2);
  font-weight: normal;
}
/* HOT buttons (0x495ba0): label centred in font 2; states normal, under the pointer, pressed
   (sprite 2, label shifted 2 px), disabled. */
#stage button {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font: var(--font-2);
  color: var(--cyan);
  text-align: center;
}
#stage button .label {
  position: relative;
  white-space: nowrap;
}
#stage button .key {
  color: var(--grey);
}
#stage button:hover:not(:disabled) {
  color: var(--cyan-lit);
}
#stage button:hover:not(:disabled) .key,
#stage button:active:not(:disabled) .key {
  color: #fff;
}
#stage button:active:not(:disabled) {
  color: var(--cyan-lit);
}
#stage button:active:not(:disabled) > .label {
  left: 2px;
  top: 2px;
}
#stage button:disabled {
  opacity: 1;
  color: var(--off);
}
#stage button:disabled .key {
  color: var(--off);
}
#stage button:focus-visible {
  outline: 1px dotted var(--cyan-lit);
  outline-offset: -3px;
}
/* Group boxes (0x4908f0 / 0x490a60): a dark outline, a grey one 1 px lower right, the top edge
   open under the title (font 2, 0xc618). */
#stage .box {
  border: 1px solid #282828;
  padding: 0;
  pointer-events: none;
}
#stage .box.shade {
  border-color: #848484;
}
#stage .box legend {
  margin: 0 auto;
  padding: 0 1px;
  line-height: 18px;
  font: var(--font-2);
  color: #c0c0c0;
}
#stage .box.shade legend {
  visibility: hidden;
}
/* The Custom Map list (0x48e690 / 0x48d550): 13 px rows, icon then name in font 0. */
.list {
  padding: 0;
  overflow: hidden scroll;
  scrollbar-width: none;
  list-style: none;
  font: var(--font-0);
  outline: none;
}
.list li {
  position: relative;
  height: 13px;
  padding-left: var(--indent);
  color: var(--cyan-dim);
  white-space: nowrap;
  overflow: hidden;
}
.list li:hover {
  color: var(--cyan-mid);
}
.list li[aria-selected='true'] {
  color: var(--cyan-lit);
}
.list li .label {
  position: relative;
  top: 1px;
}
.track .thumb {
  position: absolute;
  left: 0;
  opacity: 0.75;
}
/* The welcome screen's text, where Player ID lists profiles: rows of 13 px like the lists'. */
.about {
  box-sizing: border-box;
  padding: 0 4px;
  overflow: hidden scroll;
  scrollbar-width: none;
  font: var(--font-0);
  line-height: 13px;
  color: var(--cyan-text);
  outline: none;
}
/* Player ID outlines its list and scroll track 1 px outside their records. */
.about,
[data-screen='player'] .track {
  outline: 1px solid #9c9c9c;
}
.about h3 {
  margin: 0;
  font: var(--font-1);
  line-height: 13px;
  color: var(--cyan-name);
}
.about p {
  margin: 0 0 13px;
}
/* Map Description (0x4991a0 / 0x49a630). */
.map-info .name {
  transform: translateX(-50%);
  font: var(--font-1);
  color: var(--cyan-name);
  white-space: nowrap;
}
.map-info .kind {
  color: var(--cyan-lit);
}
.map-info .lines {
  transform: translateX(-50%);
  font: var(--font-0);
  color: var(--cyan-text);
  text-align: center;
  white-space: pre;
}
.map-info dl {
  display: grid;
  grid-template-columns: 200px auto;
  font: var(--font-1);
  line-height: 15px;
}
.map-info dt {
  text-align: right;
}
.map-info dd {
  margin: 0 0 0 4px;
  color: var(--cyan-lit);
}
/* Combo boxes (0x490360): the chosen item at x + 4 in font 0. */
#stage button.combo {
  font: var(--font-0);
  color: var(--grey);
  text-align: left;
}
#stage button.combo > .label {
  left: 4px;
  top: 1px;
}
#stage button.combo:active:not(:disabled) > .label {
  left: 4px;
  top: 1px;
}
#stage button.combo:disabled {
  color: var(--off-box);
}
/* The open list (0x490460): top piece, a piece per row, bottom piece; the row under the pointer
   on the highlight sprite in white. */
.drop {
  z-index: 2;
  padding: 0;
  list-style: none;
  font: var(--font-0);
}
.drop li {
  position: relative;
  height: 13px;
  color: var(--grey);
}
.drop li .label {
  position: relative;
  left: 4px;
  top: 1px;
}
.drop li:hover {
  color: #fff;
}
.drop li:not(:hover) > .lit {
  display: none;
}
.team-label {
  font: var(--font-2);
  color: var(--cyan-lit);
}
.menu-version {
  right: 2px;
  top: 469px;
  font: var(--font-0);
  color: #fff;
}
#menu-cursor {
  z-index: 3;
  pointer-events: none;
}
/* Browser-only extras, outside the original screens. */
.menu-corner {
  position: absolute;
  right: 6px;
  top: 6px;
  display: flex;
  gap: 4px;
  opacity: 0.75;
}
/* Explore map shows only on Game Configuration, once a map is chosen. */
#stage:not([data-screen='config']) ~ .menu-corner #explore {
  display: none;
}
.menu-corner button {
  padding: 2px 6px;
  font-size: 10px;
}
#loading-status {
  position: absolute;
  left: 6px;
  top: 6px;
  margin: 0;
  font-size: 11px;
  color: #cddc9e;
}
.art-credit {
  position: absolute;
  right: 22px;
  bottom: 20px;
  letter-spacing: 2px;
  font-size: 9px;
  color: #aaa891;
}
#battle {
  position: relative;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.toolbar {
  height: 42px;
  flex-shrink: 0;
  background: linear-gradient(#373c31, #1d251c);
  border-bottom: 2px solid #54583f;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
  font-size: 11px;
}
.toolbar button {
  padding: 4px 9px;
  font-size: 11px;
}
.toolbar strong {
  letter-spacing: 2px;
  font-size: 11px;
  white-space: nowrap;
}
.readouts {
  display: flex;
  gap: 24px;
  flex: 1;
  justify-content: center;
  color: #a6ae96;
}
.readouts b {
  color: #e4dda6;
  font-family: monospace;
  font-size: 14px;
  margin-left: 5px;
}
#viewport {
  flex: 1;
  min-height: 100px;
  position: relative;
  background: #000;
  overflow: hidden;
}
#world {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
  touch-action: none;
  cursor: none; /* the original MOUSE_ANIM cursor is drawn on the canvas */
  image-rendering: pixelated;
}
#notification {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#mode-label {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 11px;
  color: #d2db98;
  pointer-events: none;
  text-shadow: 1px 1px #000;
}
dialog {
  background: #172016;
  color: #d4d9c7;
  border: 1px solid #7a865d;
  max-width: 1000px;
  width: 90vw;
  max-height: 85vh;
  padding: 26px;
  box-shadow: 0 30px 100px #000b;
}
dialog::backdrop {
  background: #030702b8;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
h2 {
  font-weight: 400;
}
dialog h3 {
  font-size: 13px;
  color: #d4d99f;
}
dialog p {
  font-size: 13px;
  color: #bfc7b2;
}
.dialog-head h2 {
  font:
    24px Georgia,
    serif;
  color: #e6e1bc;
}
#unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 15px;
}
.unit-card {
  border: 1px solid #3f4c34;
  background: #10180f;
  padding: 14px;
  font-size: 11px;
}
.unit-card img,
.unit-card canvas {
  height: 80px;
  width: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  margin-bottom: 8px;
}
.unit-card h3 {
  margin: 4px 0;
}
.unit-card p {
  font-size: 11px;
  line-height: 1.5;
}
.unit-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 8px 0;
  color: #aeba96;
}
.unit-card dd {
  margin: 0;
  text-align: right;
  color: #e0dfb1;
}
@media (max-width: 900px) {
  .readouts {
    gap: 10px;
  }
  .toolbar strong {
    display: none;
  }
}
@media (max-width: 600px) {
  .menu-content {
    margin: 30px auto;
  }
  .setup {
    padding: 17px;
  }
  .subtitle {
    letter-spacing: 2px;
  }
  .toolbar {
    gap: 4px;
    height: 42px;
  }
  .toolbar button {
    font-size: 10px;
    padding: 4px;
  }
  .readouts {
    font-size: 9px;
    gap: 8px;
  }
  .readouts b {
    font-size: 11px;
    margin: 0;
  }
  .readouts > span:nth-child(3) {
    display: none;
  }
  .art-credit {
    display: none;
  }
  .options {
    gap: 8px;
    font-size: 10px;
  }
}
/* The original HUD is drawn on the canvas (hud.mjs); the toolbar is the Menu dropdown. */
#battle > .toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: none;
}
#battle.menu-open > .toolbar {
  display: flex;
}
.options-form {
  display: grid;
  gap: 10px;
  min-width: 340px;
}
.options-form label {
  display: grid;
  grid-template-columns: 120px 1fr 70px;
  align-items: center;
  gap: 8px;
}
