:root {
  --bg: #04070a;
  --panel: #060b08;
  --green: #3fe085;
  --green-dim: #1c5c3c;
  --green-glow: rgba(63, 224, 133, 0.35);
  --red: #e8615c;
  --red-dim: #7a2e2b;
  --yellow: #e8c547;
  --text-dim: #6f8f7f;
  --mono: "JetBrains Mono", "Fira Code", "Courier New", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--green);
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

#app {
  width: 1000px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

/* ---------- config panel ---------- */
#config-panel {
  width: 1000px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--green-dim);
  padding: 16px 20px;
  display: flex;
  gap: 28px;
}

.config-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-item label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

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

.config-row input[type="range"] {
  flex: 1;
  accent-color: var(--green);
  background: transparent;
  cursor: pointer;
}

.config-value {
  font-size: 12px;
  color: var(--green);
  min-width: 78px;
  text-align: right;
  white-space: nowrap;
}

.config-row input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#console {
  width: 1000px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--green-dim);
  padding: 18px 20px 0 20px;
  position: relative;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--green-dim);
  margin-bottom: 16px;
}

#game-name {
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--green);
}

#status-tag {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--yellow);
}

#status-tag.running { color: var(--yellow); }
#status-tag.failed { color: var(--red); }
#status-tag.cleared { color: var(--green); }

/* ---------- stat row ---------- */
#statrow {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

#uptime-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.label {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-dim);
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 12px;
  border: 1px solid var(--green-dim);
  background: #051309;
}

.bar-fill {
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
  width: 100%;
  transition: width 0.05s linear;
}

#strikes-tag {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--yellow);
  white-space: nowrap;
}

/* ---------- play field ---------- */
#field {
  position: relative;
  width: 100%;
  height: 420px;
  border: 1px solid var(--green-dim);
  overflow: hidden;
  background: #030503;
}

#field.hit-flash {
  box-shadow: inset 0 0 0 3px var(--red);
}

#lanes-bg {
  position: absolute;
  inset: 0;
  display: flex;
}

.lane-divider {
  flex: 1;
  border-right: 1px solid var(--green-dim);
}
.lane-divider:last-child { border-right: none; }

#lines-layer {
  position: absolute;
  inset: 0;
}

.fw-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 0;
  display: flex;
}

.fw-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fw-square {
  width: 40px;
  height: 40px;
  background: var(--red);
  border: 1px solid #ffb3ae;
  box-shadow: 0 0 8px rgba(232, 97, 92, 0.4);
  box-sizing: border-box;
}

#player {
  position: absolute;
  top: 82%;
  left: 50%; /* overwritten by JS per column; this is just an initial fallback */
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--green);
  box-shadow: 0 0 10px var(--green-glow);
  transition: left 0.08s ease-out;
  box-sizing: border-box;
}

#player span {
  width: 12px;
  height: 12px;
  background: var(--green);
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 3, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  gap: 10px;
}

.overlay.hidden { display: none; }

.overlay-eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin: 0;
}

.overlay h2 {
  font-size: 26px;
  letter-spacing: 1px;
  margin: 0 0 6px 0;
  color: var(--green);
}

#gameover-title.failed-color { color: var(--red); }

.overlay-body {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 380px;
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.overlay-controls {
  font-size: 13px;
  color: var(--green);
  margin: 0 0 14px 0;
}

.key {
  display: inline-block;
  border: 1px solid var(--green-dim);
  padding: 2px 8px;
  margin: 0 3px;
  color: var(--green);
}

.term-btn {
  font-family: var(--mono);
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
  padding: 10px 26px;
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
}

.term-btn:hover {
  background: var(--green);
  color: #04070a;
}

.overlay-shortcut {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 10px 0 0 0;
}

/* ---------- control hint ---------- */
#control-hint {
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 12px 0;
}

/* ---------- footer ---------- */
#footbar {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--green-dim);
  padding: 10px 0;
}

#ttl-tag { color: var(--yellow); }

#ttl-track {
  height: 6px;
  background: #1a1608;
  margin: 0 -20px;
}

#ttl-fill {
  height: 100%;
  width: 100%;
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(232, 197, 71, 0.5);
  transition: width 0.05s linear;
}

@media (max-width: 480px) {
  #console { padding: 14px 12px 0 12px; }
  #field { height: 360px; }
  #ttl-track { margin: 0 -12px; }
}
