* {
  box-sizing: border-box;
}

:root {
  --bg: #16181b;
  --bg-soft: #1f2328;
  --panel: #23272d;
  --stroke: #3b424c;
  --text: #d5d9e0;
  --muted: #9aa2ad;
  --accent: #b0b6bf;
  --finale-progress: 0;
}

:root[data-theme="mono"] {
  --bg: #16181b;
  --bg-soft: #1f2328;
  --panel: #23272d;
  --stroke: #3b424c;
  --text: #d5d9e0;
  --muted: #9aa2ad;
  --accent: #b0b6bf;
}

:root[data-theme="neon"] {
  --bg: #111720;
  --bg-soft: #1a2330;
  --panel: #1c2532;
  --stroke: #3a4a63;
  --text: #e1ecff;
  --muted: #9fb1c7;
  --accent: #6ec1ff;
}

:root[data-theme="sunset"] {
  --bg: #201517;
  --bg-soft: #2a191c;
  --panel: #2d1b1f;
  --stroke: #4d2e35;
  --text: #f1e3de;
  --muted: #c8a9a1;
  --accent: #f0c068;
}

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg) 0%, #111214 100%);
  color: var(--text);
  font-family: "VT323", "Courier New", Courier, monospace;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  background: #ffffff;
  opacity: calc(var(--finale-progress) * 0.55);
}

#fxLayer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 30;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #2e323b;
  background: #1a1c20;
  position: relative;
  z-index: 10;
}

h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.8px;
}

.sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.themeRow {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--stroke);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 26, 34, 0.6);
}

.themeLabel {
  font-size: 11px;
  color: var(--muted);
}

.themeBtn {
  border: 1px solid #4a5664;
  background: transparent;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text);
}

.themeBtn.active {
  border-color: var(--accent);
  color: #f7fbff;
}

a {
  color: #b4c0d8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
  padding: 14px;
  position: relative;
  z-index: 10;
}

body.playtest-finale .top,
body.playtest-finale .panel,
body.playtest-finale #journal,
body.playtest-finale #board {
  filter: grayscale(calc(var(--finale-progress) * 100%))
    brightness(calc(1 + var(--finale-progress) * 0.8));
}

.left {
  min-width: 0;
}

.right {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

#board {
  width: 100%;
  height: auto;
  border: 4px solid var(--stroke);
  background: var(--bg-soft);
  image-rendering: pixelated;
  border-radius: 10px;
}

.hud {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #b9c0cc;
}

.panel {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px;
}

.title {
  font-size: 12px;
  color: #c5ccd8;
  margin-bottom: 8px;
}

label {
  font-size: 12px;
  color: #b3bbca;
}

.cmdRow {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #555b67;
  background: #1d1f24;
  color: #e6ebf5;
  border-radius: 8px;
}

button {
  border: 1px solid #5c6270;
  background: #2c3038;
  color: #d4dae5;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

button:hover {
  background: #363b46;
}

.controls button.active {
  border-color: var(--accent);
  color: #f7fbff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.controls {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.micIndicator {
  border: 1px solid #5c6270;
  background: #1d1f24;
  color: #d4dae5;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.2px;
  user-select: none;
}

.micIndicator.on {
  border-color: var(--accent);
  color: #f7fbff;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: #9ea7b5;
}

#journal {
  margin: 0;
  min-height: 280px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid #4e5460;
  border-radius: 4px;
  padding: 8px;
  background: #1a1c21;
  color: #c8d0de;
  font-size: 11px;
  line-height: 1.36;
  white-space: pre-wrap;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
