/* Look inspired by the game's menus, drawn in CSS. No game graphics. Font: VT323 (SIL Open Font License, vendor/fonts). */
@font-face { font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/vt323-latin-400-normal.woff2") format("woff2"); }
:root {
  --ink: #2b2b2b;
  --panel: #e9f6d9;
  --panel-hi: #f9fdf1;
  --line: #3b3b3b;
  --dim: #4a4a4a;
  --label: #5536c9;
  --ok: #1c6630;
  --bad: #9c2219;
  --shadow: rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: linear-gradient(180deg, #000000 0, #04201f 140px, #0b6f66 55%, #1fd8c8 100%) #0b6f66;
  color: var(--ink);
  font: 22px/1.15 "VT323", "Courier New", monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header, main, footer { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 24px; }
h1 { font-size: 36px; font-weight: 400; line-height: 1.05; margin: 0; letter-spacing: 1px; color: #f4fbe8; }
h1 span { color: #5ff0e0; }
#version-line { margin: 2px 0 0; color: #c9e9e4; }
h2 { font-size: 28px; font-weight: 400; margin: 0; }
main { flex: 1; padding-top: 34px; padding-bottom: 24px; }
.view { display: flex; flex-direction: column; gap: 32px; }
.panel {
  position: relative; background: var(--panel); color: var(--ink); border: 3px solid var(--line);
  box-shadow: inset 0 0 0 2px var(--panel-hi), 4px 4px 0 var(--shadow);
  padding: 22px 18px 16px; margin: 0;
}
.tab {
  position: absolute; top: -17px; left: 10px; display: flex; align-items: center; gap: 6px;
  padding: 0 8px; height: 28px; background: var(--panel); border: 3px solid var(--line); border-bottom: 0;
  font-size: 24px; font-weight: 400; line-height: 1; letter-spacing: 1px; color: var(--label); white-space: nowrap;
}
.tab::before { content: ""; width: 10px; height: 10px; background: var(--ink); }
.hint { color: var(--dim); font-size: 20px; margin: 0 0 8px; display: block; }
.note { margin: 0; }
input[type="text"], select {
  width: 100%; max-width: 300px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 0;
  background: var(--panel-hi); color: var(--ink); font: inherit; font-size: 24px;
}
input[type="file"] { width: 100%; color: var(--ink); font: inherit; }
input[type="file"]::file-selector-button {
  font: inherit; color: var(--ink); background: var(--panel-hi); border: 2px solid var(--line);
  padding: 6px 14px; margin-right: 12px; cursor: pointer;
}
#lang-row { margin-top: 10px; }
#lang-row label { display: block; color: var(--dim); font-size: 20px; }
.status { min-height: 1.15em; margin: 8px 0 0; color: var(--dim); overflow-wrap: anywhere; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: 14px; }
button {
  font: inherit; font-size: 24px; line-height: 1; color: var(--ink); background: var(--panel);
  border: 3px solid var(--line); border-radius: 0; padding: 8px 18px; min-height: 46px; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--panel-hi), 4px 4px 0 var(--shadow); touch-action: manipulation;
}
button:hover:not(:disabled) { background: var(--panel-hi); }
button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: inset 0 0 0 2px var(--panel-hi), 2px 2px 0 var(--shadow); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--ink); color: #f4fbe8; border-color: #111111; box-shadow: 4px 4px 0 var(--shadow); }
button.primary::before {
  content: ""; display: inline-block; width: 0; height: 0; margin-right: 10px;
  border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 12px solid #f4fbe8;
}
button.primary:hover:not(:disabled) { background: #444444; }
button.primary:active:not(:disabled) { box-shadow: 2px 2px 0 var(--shadow); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; box-shadow: 0 0 0 6px #111111; }

#rooms { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 10px; }
#rooms li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 10px;
  background: var(--panel-hi); border: 2px solid var(--line);
}
#rooms .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 26px; }
#rooms .meta, .state { color: var(--dim); font-size: 20px; }
#rooms button { box-shadow: none; }
#no-rooms { color: var(--dim); text-align: center; padding: 18px 0 6px; margin: 0; }
#players { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 32px 24px; }
#players li { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#players li span:nth-child(2) { font-size: 32px; line-height: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#players .state { font-size: 22px; min-height: 1.15em; }

#screen-wrap { position: relative; width: 100%; max-width: 480px; margin: 4px auto 0; aspect-ratio: 3 / 2; background: #000; border: 3px solid var(--line); overflow: hidden; }
#canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgba(0, 0, 0, 0.86); color: #f4fbe8; padding: 16px;
}
#overlay[hidden] { display: none; }
#link-status { text-align: center; }

#pad { user-select: none; -webkit-user-select: none; touch-action: none; }
#pad button { touch-action: none; -webkit-tap-highlight-color: transparent; }
#pad button.on { background: var(--ink); color: #f4fbe8; transform: translate(2px, 2px); }
.pad-row { display: flex; justify-content: space-between; align-items: center; }
.pad-row.top { margin-bottom: 8px; }
.pad-row.bottom { justify-content: center; gap: 14px; margin-top: 10px; }
.shoulder { width: 84px; padding: 8px 0; }
.pill { padding: 8px 16px; font-size: 22px; }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); }
.d { padding: 0; font: 16px/1 system-ui, sans-serif; box-shadow: inset 0 0 0 2px var(--panel-hi); }
.d.up { grid-area: 1 / 2; } .d.left { grid-area: 2 / 1; } .d.right { grid-area: 2 / 3; } .d.down { grid-area: 3 / 2; }
.ab { display: flex; gap: 14px; align-items: center; }
.round { width: 64px; height: 64px; border-radius: 50%; padding: 0; font-size: 28px; }
.round.a { margin-bottom: 26px; }

dialog { width: min(92vw, 400px); overflow: visible; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog .row { margin-top: 12px; }
#keys { width: 100%; border-collapse: collapse; }
#keys td { padding: 4px 0; }
#keys td:last-child { text-align: right; }
#keys button { min-width: 150px; box-shadow: none; min-height: 38px; padding: 4px 12px; }
#keys button.listening { background: var(--ink); color: #f4fbe8; }

footer { color: #052b28; font-size: 20px; padding-bottom: 16px; }
footer p { margin: 0; }
[hidden] { display: none !important; }
