/* External rather than inline because the page's CSP has no 'unsafe-inline'. */
:root {
  --bg: #11131a; --panel: #181d28; --fg: #e9e7e2; --dim: #8a92a0;
  --accent: #3f6fd8; --ok: #49c17a; --warn: #e0a33a;
}
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
/* Column layout, not an overlaid HUD: Fire Emblem puts its dialogue box and its
   terrain/unit panels along the bottom edge of the screen, which is exactly
   where a floating control bar would sit. */
body { display: flex; flex-direction: column; }
#wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px; }
/* Filling the box and letting object-fit letterbox is what actually scales the
   canvas up; width/height:auto leaves it at its intrinsic 240x160. */
canvas {
  display: block; background: #000; image-rendering: pixelated;
  width: 100%; height: 100%; object-fit: contain;
}
#overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; gap: 18px;
  align-items: center; justify-content: center; background: rgba(17, 19, 26, .97);
  padding: 24px; text-align: center;
}
#overlay.hidden { display: none; }
h1 { margin: 0; font-size: clamp(19px, 4.6vw, 29px); letter-spacing: .01em; }
.sub { margin: 0; color: var(--dim); max-width: 62ch; }
.sub a { color: #8ab4f8; }
#pick {
  background: var(--panel); border: 2px dashed #2c3545; border-radius: 14px;
  padding: 26px 34px; cursor: pointer; max-width: 62ch;
  transition: border-color .15s, background .15s;
}
#pick:hover, #pick.drag { border-color: var(--accent); background: #1d2433; }
#pick b { display: block; font-size: 16px; margin-bottom: 6px; }
#pick .hint { color: var(--dim); font-size: 12.5px; }
#rom-file { display: none; }
.note { color: var(--dim); font-size: 12.5px; max-width: 62ch; }
.note strong { color: var(--fg); font-weight: 600; }
#err { color: #ff7a6b; min-height: 1.4em; }
#hud {
  flex: 0 0 auto; display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; justify-content: center; padding: 7px 12px; background: #0d1016;
  border-top: 1px solid #1e2531; color: var(--dim); font-size: 12px;
}
#hud button {
  background: var(--panel); color: var(--fg); border: 1px solid #2c3545; border-radius: 7px;
  padding: 5px 11px; font: inherit; cursor: pointer;
}
#hud button:hover { border-color: var(--accent); }
#hud .sep { opacity: .4; }
#mutebtn.muted { color: var(--warn); }
#savedot { color: var(--ok); opacity: 0; transition: opacity .3s; }
#savedot.on { opacity: 1; }
kbd {
  border: 1px solid #3a4454; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px;
  font: 11.5px ui-monospace, monospace; color: var(--fg);
}
@media (max-width: 760px) { #hud .deskonly { display: none; } }
