/* SPDX-License-Identifier: GPL-3.0-or-later */
:root {
  --bg: #12141c;
  --panel: #1c1f2b;
  --line: #333849;
  --text: #eceef4;
  --muted: #9aa0b4;
  --accent: #e63b3b;
  --accent-text: #fff;
  --token: #ffd34d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; }

.screen { padding: 20px 16px; max-width: 1180px; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.top-actions { display: flex; gap: 8px; }
.remember { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 13px; cursor: pointer; }
.remember input { margin: 2px 0 0; }
#disc-continue { display: block; margin-top: 12px; overflow-wrap: anywhere; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.narrow { max-width: 480px; margin: 12vh auto 0; }
.narrow h1 { margin-bottom: 8px; }
.status { color: var(--muted); min-height: 1.45em; margin: 10px 0 0; }
.hint { color: var(--muted); margin: 0 0 12px; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 6px; padding: 8px 14px; border: 1px solid var(--line); background: transparent; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--token); outline-offset: 1px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; padding: 10px 28px; }

.file-button { display: inline-block; cursor: pointer; background: var(--accent); color: var(--accent-text); font-weight: 600; border-radius: 6px; padding: 10px 18px; margin-top: 8px; }
.file-button input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-button:focus-within { outline: 2px solid var(--token); outline-offset: 2px; }

.select-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 760px) { .select-layout { grid-template-columns: minmax(0, 1fr); } }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.fighter { position: relative; aspect-ratio: 64 / 56; padding: 0; overflow: hidden; background: #262a39; display: flex; align-items: flex-end; }
.fighter img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fighter span { position: relative; width: 100%; padding: 2px 6px; font-size: 12px; text-align: left; background: rgba(10, 12, 18, .72); }
/* The icons have the name printed on them, except that Sheik's is Zelda's. */
.fighter img ~ span:not(.always) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.fighter[aria-checked="true"] { border-color: var(--token); }
.fighter[aria-checked="true"]::after {
  content: "P1";
  position: absolute; top: 4px; right: 4px;
  width: 30px; height: 30px; line-height: 30px;
  border-radius: 50%;
  background: var(--token); color: #2a2100;
  font-weight: 800; font-size: 13px; text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .55);
}

.join { display: flex; flex-direction: column; gap: 12px; }
.join label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.join .status { margin: 0; }
.costume-picker { display: flex; align-items: center; justify-content: center; gap: 4px; }
.costumes { display: flex; align-items: center; justify-content: center; gap: 4px; flex: 1; min-width: 0; min-height: 200px; }
.costume { padding: 0; flex: none; width: 44px; aspect-ratio: 136 / 188; overflow: hidden; opacity: .6; background: #262a39; }
.costume:hover:not(:disabled) { opacity: 1; }
.costume.selected { width: 136px; opacity: 1; border-color: var(--token); }
.costume img { display: block; width: 100%; height: 100%; object-fit: cover; }
.arrow { flex: none; padding: 8px 6px; font-size: 22px; line-height: 1; }
.costume-label { margin: 0; text-align: center; color: var(--muted); font-size: 13px; min-height: 1.45em; }
.join input { background: #12141c; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; color: var(--text); }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.wide { grid-column: 1 / -1; }
.device-bar { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.device-bar .arrow { align-self: center; }
.devices { min-width: 0; display: flex; justify-content: safe center; gap: 12px; padding: 3px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.device { flex: 0 0 216px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.device-face { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px; font-size: inherit; text-align: center; background: #12141c; border: 1px solid var(--line); border-radius: 8px; }
button.device-face:hover { border-color: var(--muted); }
.device-icon { display: block; width: 152px; }
.device-icon svg { display: block; width: 100%; height: auto; }
.device b { font-weight: 500; overflow-wrap: anywhere; }
.device small { color: var(--muted); line-height: 1.3; }
.device a { color: var(--token); }
.device.active .device-face { border-color: var(--token); }
.device.help .device-face { background: transparent; border-style: dashed; }
.device .badge { margin-top: auto; font-size: 12px; color: var(--muted); }
.device.active .badge { color: var(--token); font-weight: 600; }
.small { padding: 3px 10px; font-size: 13px; }
.device .primary.small { padding: 4px 16px; margin-top: auto; }
/* Opacity rather than hidden: it keeps its space, so nothing moves under the
   pointer, and the keyboard can still reach it. */
.device-controls { opacity: 0; transition: opacity .12s; }
.device:hover .device-controls, .device:focus-within .device-controls { opacity: 1; }
@media (hover: none) { .device-controls { opacity: 1; } }
.device-controls.spacer { visibility: hidden; }
.view-layout { margin-top: 12px; }

.viewer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.stick { position: relative; width: 88px; height: 88px; border-radius: 50%; border: 2px solid var(--line); background: #12141c; }
.stick span { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: var(--text); }
.cstick span { background: var(--token); }
.triggers { display: flex; gap: 8px; }
.trigger { position: relative; width: 26px; height: 88px; background: #12141c; border: 2px solid var(--line); border-radius: 4px; overflow: hidden; text-align: center; }
.trigger span { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--muted); }
.trigger b { position: relative; font-size: 12px; }
.buttons { display: flex; flex-wrap: wrap; gap: 4px; max-width: 200px; }
.buttons i { font-style: normal; min-width: 32px; padding: 3px 6px; text-align: center; font-size: 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.buttons i.on { background: var(--token); border-color: var(--token); color: #2a2100; }

.bindings { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-bottom: 12px; }
.binding { display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.binding code { color: var(--muted); font-family: inherit; }
.binding.listening { border-color: var(--token); }
.binding.listening code { color: var(--token); }

.game { max-width: none; padding: 0; height: 100vh; display: flex; align-items: center; justify-content: center; background: #000; }
#stage { position: relative; width: min(100vw, 133.33vh); aspect-ratio: 4 / 3; }
#canvas { display: block; width: 100%; height: 100%; outline: none; }
#tags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tag {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: baseline; gap: 6px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
  will-change: transform;
}
.tag .pct { font-variant-numeric: tabular-nums; }
.tag.you .name { color: var(--token); }
#leaderboard {
  position: absolute; right: 8px; top: 8px; margin: 0; padding: 6px 8px;
  max-width: 45%;
  display: grid; grid-template-columns: auto 18px minmax(0, 1fr) auto; column-gap: 6px; align-items: center;
  list-style: none; pointer-events: none;
  background: rgba(0, 0, 0, 0.45); border-radius: 6px;
  font-size: 13px; line-height: 1.35; font-variant-numeric: tabular-nums;
  color: #fff; text-shadow: 0 1px 2px #000;
}
#leaderboard li { display: contents; }
#leaderboard .rank { color: #c5c9d6; text-align: right; }
#leaderboard .stock { width: 18px; height: 18px; }
#leaderboard .stock img { display: block; width: 100%; height: 100%; }
#leaderboard .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#leaderboard .score { font-weight: 700; text-align: right; }
#leaderboard li.you span { color: var(--token); font-weight: 700; }
#leaderboard:empty { display: none; }
.overlay-status { position: absolute; left: 50%; top: 45%; transform: translateX(-50%); color: #fff; text-shadow: 0 1px 3px #000; text-align: center; }
