:root {
  --bg: #0a0f0a;
  --panel: #0e1a0e;
  --green: #35ff6d;
  --green-dim: #1b8f3c;
  --amber: #ffd166;
  --grid: rgba(53, 255, 109, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at 50% 0%, #12240f 0%, var(--bg) 70%);
  color: var(--green);
  font-family: "Courier New", Courier, monospace;
  letter-spacing: 0.06em;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0.28) 4px
  );
  z-index: 50;
  mix-blend-mode: multiply;
}

.cabinet {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

h1 {
  text-align: center;
  font-size: clamp(28px, 6vw, 52px);
  margin: 0 0 22px;
  letter-spacing: 0.35em;
  text-shadow: 0 0 6px var(--green), 0 0 22px var(--green-dim);
}

.layout {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.screen-wrap { flex: 0 1 auto; }

.hud {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 0 4px 8px;
  color: var(--green-dim);
  text-transform: uppercase;
}
.hud b { color: var(--green); font-weight: bold; }

.screen {
  position: relative;
  border: 3px solid var(--green-dim);
  border-radius: 10px;
  background: #050a05;
  box-shadow: 0 0 0 6px #071007, 0 0 34px rgba(53, 255, 109, 0.22), inset 0 0 40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  line-height: 0;
}

canvas {
  display: block;
  width: min(480px, 82vw);
  height: min(480px, 82vw);
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 3, 0.86);
  text-align: center;
  line-height: 1.5;
  z-index: 5;
}
.overlay.hidden, .hidden { display: none; }

.overlay-inner { padding: 16px; }
.overlay h2 {
  margin: 0 0 10px;
  font-size: 26px;
  letter-spacing: 0.2em;
  text-shadow: 0 0 10px var(--green);
}
.overlay p { margin: 0 0 16px; font-size: 13px; color: var(--green-dim); }

button, input {
  font-family: inherit;
  letter-spacing: inherit;
  background: #071307;
  color: var(--green);
  border: 2px solid var(--green-dim);
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 14px;
  text-transform: uppercase;
}
button { cursor: pointer; }
button:hover, button:focus { background: var(--green-dim); color: #041004; outline: none; }
button.big { font-size: 15px; animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

#name-form { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-bottom: 14px; }
#name-form label { font-size: 12px; color: var(--green-dim); }
#name { width: 160px; text-align: center; }

.hint {
  text-align: center;
  font-size: 11px;
  color: var(--green-dim);
  margin: 10px 0 0;
}

.board {
  flex: 0 0 260px;
  background: var(--panel);
  border: 2px solid var(--green-dim);
  border-radius: 10px;
  padding: 14px 16px 18px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
}
.board h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.22em;
  border-bottom: 1px dashed var(--green-dim);
  padding-bottom: 8px;
}
#scores { list-style: none; counter-reset: rank; margin: 0; padding: 0; font-size: 13px; }
#scores li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dotted rgba(27, 143, 60, 0.4);
}
#scores li::before { content: counter(rank, decimal-leading-zero) "."; color: var(--green-dim); }
#scores li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
#scores li .sc { color: var(--amber); }
#scores li.me { text-shadow: 0 0 8px var(--green); }
#scores li.empty { justify-content: center; color: var(--green-dim); }
#scores li.empty::before { content: ""; }

@media (max-width: 780px) {
  .board { flex: 1 1 100%; max-width: 480px; }
}
