:root {
  --bg: #04070D;
  --grid: 111, 249, 255;
  --primary: #6FF9FF;
  --secondary: #1FB6FF;
  --heat: #FF9E64;
  --text: #D7F7FF;
  --muted: #6C8A96;
  --tile: rgba(111, 249, 255, 0.045);
  --deck-h: 118px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Rajdhani", "Orbitron", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(var(--deck-h) + 24px); }

.mono {
  font-family: "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------- scenery */
.grid-floor {
  position: fixed;
  inset: 0 0 auto 0;
  height: 62vh;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(to right, rgba(var(--grid), 0.10) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(to bottom, rgba(var(--grid), 0.07) 0 1px, transparent 1px 64px);
  transform: perspective(420px) rotateX(62deg) scale(1.6);
  transform-origin: top center;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 78%);
  animation: drift 18s linear infinite;
}

@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 64px, 0 64px; }
}

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

/* ------------------------------------------------------------------- hero */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 56px 20px 28px;
}

.kick {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.marquee {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 9vw, 76px);
  letter-spacing: 0.12em;
  color: var(--primary);
  text-shadow:
    0 0 6px rgba(111, 249, 255, 0.9),
    0 0 22px rgba(31, 182, 255, 0.55),
    0 0 60px rgba(31, 182, 255, 0.35);
}

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

/* ------------------------------------------------------------------ tiles */
.tiles {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 1180px;
  margin: 8px auto 40px;
  padding: 0 20px;
  list-style: none;
}

@media (min-width: 780px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
}

.tile {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(var(--grid), 0.28);
  background: var(--tile);
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: border-color 300ms ease, box-shadow 300ms ease, transform 200ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 168px;
  text-align: left;
}

.tile:hover, .tile:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(111, 249, 255, 0.25), 0 0 28px rgba(111, 249, 255, 0.18);
}

.tile:hover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(111, 249, 255, 0.16), transparent);
  animation: sweep 420ms ease-out 1;
  pointer-events: none;
}

@keyframes sweep {
  from { transform: translateY(-100%); }
  to   { transform: translateY(100%); }
}

.tile[data-state="playing"] {
  border-color: var(--heat);
  box-shadow: 0 0 0 1px rgba(255, 158, 100, 0.35), 0 0 26px rgba(255, 158, 100, 0.18);
}

.tile.inserting { animation: insert 400ms ease-out 1; }

@keyframes insert {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(6px) scale(0.985); }
  100% { transform: translateY(0) scale(1); }
}

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

.tile-title {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1.25;
}

.tile-sub {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.tile-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sizes {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}

button, .dl {
  font-family: inherit;
  cursor: pointer;
}

.primary {
  border: 1px solid rgba(255, 158, 100, 0.6);
  background: rgba(255, 158, 100, 0.10);
  color: var(--heat);
  padding: 8px 12px;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.ghost {
  border: 1px solid rgba(var(--grid), 0.35);
  background: transparent;
  color: var(--primary);
  padding: 6px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.ghost:hover, .primary:hover { filter: brightness(1.25); }

.dl {
  display: block;
  text-align: center;
  text-decoration: none;
  border: 1px solid rgba(255, 158, 100, 0.45);
  color: var(--heat);
  padding: 7px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.dl:hover { background: rgba(255, 158, 100, 0.12); }

/* ------------------------------------------------------------- scoreboard */
.board {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto 64px;
  padding: 0 20px;
}

.board-title {
  margin: 0 0 4px;
  font-size: 14px;
  letter-spacing: 0.24em;
  color: var(--primary);
}

.board-note {
  margin: 0 0 16px;
  font-size: 11px;
  color: var(--muted);
}

.board-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 11px;
  color: var(--muted);
}

#tagInput {
  width: 74px;
  background: transparent;
  border: 1px solid rgba(var(--grid), 0.35);
  color: var(--primary);
  font-family: "Share Tech Mono", monospace;
  font-size: 14px;
  letter-spacing: 0.24em;
  padding: 6px 8px;
  text-transform: uppercase;
}

.scores {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(var(--grid), 0.2);
}

.score {
  display: grid;
  grid-template-columns: 42px 58px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(var(--grid), 0.12);
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  color: var(--text);
}

.score[data-rank="1"] {
  color: var(--heat);
  text-shadow: 0 0 10px rgba(255, 158, 100, 0.45);
}

.score-empty {
  padding: 14px 4px;
  color: var(--muted);
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
}

/* ------------------------------------------------------------------- deck */
.deck {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: linear-gradient(to top, #03060B 60%, rgba(3, 6, 11, 0.92));
  border-top: 1px solid rgba(var(--grid), 0.4);
  box-shadow: 0 -8px 40px rgba(31, 182, 255, 0.18);
  padding: 12px 16px 14px;
  transform: translateY(100%);
  transition: transform 260ms ease;
}

.deck[hidden] { display: none; }
.deck.open { transform: translateY(0); }

.deck-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
}

.deck-meta { min-width: 0; flex: 1; }

.deck-title {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.viz { width: 200px; height: 40px; flex: 0 0 auto; opacity: 0.9; }

@media (max-width: 620px) { .viz { display: none; } }

.deck-controls { display: flex; gap: 8px; flex: 0 0 auto; }

.seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1180px;
  margin: 10px auto 0;
}

.time { font-size: 11px; color: var(--muted); min-width: 40px; }

.seek {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 2px;
  background: rgba(var(--grid), 0.35);
  outline: none;
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(111, 249, 255, 0.8);
  cursor: pointer;
}

.seek::-moz-range-thumb {
  width: 10px; height: 10px; border: 0;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(111, 249, 255, 0.8);
  cursor: pointer;
}

.vol { width: 84px; accent-color: var(--secondary); }

/* ------------------------------------------------------------------ misc */
.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 20px 28px;
  font-size: 10px;
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .grid-floor { animation: none; }
  .scanlines { opacity: 0.3; }
  .tile, .deck { transition: none; }
  .tile:hover::after, .tile.inserting { animation: none; }
}

/* ------------------------------------------------------------------ notes */
.notes {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto 96px;
  padding: 0 20px;
}

.note-form {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(var(--grid), 0.22);
  background: var(--tile);
  padding: 18px;
}

.note-row { display: grid; gap: 6px; }

.note-row label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.opt { color: rgba(108, 138, 150, 0.75); font-size: 10px; letter-spacing: 0.06em; }

.note-row input,
.note-row textarea {
  background: rgba(4, 7, 13, 0.7);
  border: 1px solid rgba(var(--grid), 0.3);
  color: var(--text);
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  padding: 9px 10px;
  width: 100%;
  resize: vertical;
}

.note-row input:focus, .note-row textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 1px rgba(111, 249, 255, 0.35);
}

.note-form .primary { justify-self: start; padding: 10px 18px; }

.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
