/* Blade Hymn — browser port shell */

@font-face {
  font-family: PixelifySans;
  src: url("data/ttf/PixelifySans.ttf");
  font-display: block;
}

:root {
  --bg: #0d0f14;
  --panel: #161a22;
  --line: #2a3040;
  --text: #e8e6df;
  --muted: #9aa0ae;
  --accent: #d8a24a;
  font-family: system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* display rules below must never resurrect a hidden element */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -10%, #1b2030 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
}

.stage {
  width: min(720px, 100vw);
  padding: 16px 12px 40px;
}

.masthead h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 2px;
  font-family: PixelifySans, "Courier New", monospace;
}

.byline { margin: 2px 0 14px; color: var(--muted); font-size: 14px; }
.byline a { color: var(--accent); }

.screen {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

#game-surface {
  display: block;
  width: 100%;
  aspect-ratio: 426 / 240;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  background: #000;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
}

.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }

button {
  font: inherit;
  color: var(--text);
  background: #1f2531;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #14100a; font-weight: 600; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 18px;
}

.toolbar-hint { margin-left: auto; color: var(--muted); font-size: 13px; }
kbd {
  background: #1f2531;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 12px;
}

.credits { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.credits a { color: var(--accent); }
.muted { color: var(--muted); }

/* submit modal */
.run-line { font-size: 16px; }
#submit-name {
  font: inherit;
  background: #0f131b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  width: 200px;
}
#submit-name-field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* leaderboard */
.lb-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.lb-tab.active { border-color: var(--accent); color: var(--accent); }
.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lb-table th, .lb-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.lb-table th { color: var(--muted); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.lb-table td:last-child { font-variant-numeric: tabular-nums; }
.lb-table tr.highlight td { color: var(--accent); font-weight: 700; }
.lb-loading { color: var(--muted); }

/* keybinds */
.bind-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.bind-key { min-width: 130px; text-align: center; font-variant-numeric: tabular-nums; }
.bind-key.capturing { border-color: var(--accent); color: var(--accent); }
