:root {
  --bg: #07090e;
  --panel: rgba(12, 16, 24, 0.86);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eef8;
  --muted: #8b97ab;
  --accent: #3ee0ff;
  --mint: #5cffd4;
  --gold: #ffc14a;
  --danger: #ff4455;
  --pink: #ff7ab0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --font-d: 'Orbitron', sans-serif;
  --font-b: 'Outfit', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  overflow: hidden;
}

button,
input,
select {
  font-family: inherit;
}

#fx-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
}

#app {
  position: relative;
  z-index: 2;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  animation: fadeIn 0.45s ease;
}

.screen[hidden] {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  letter-spacing: 0.42em;
  font-size: 11px;
  color: var(--mint);
  margin: 0 0 10px;
  font-weight: 600;
}

.logo {
  font-family: var(--font-d);
  font-weight: 900;
  font-size: clamp(48px, 10vw, 96px);
  margin: 0;
  letter-spacing: 0.04em;
  line-height: 0.9;
  text-shadow: 0 0 40px rgba(62, 224, 255, 0.35);
}

.logo span {
  color: var(--accent);
}

.tag {
  color: var(--muted);
  margin: 14px 0 28px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 640px;
}

.hint-keys {
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.title-deco {
  width: min(420px, 80vw);
  margin-bottom: 8px;
  opacity: 0.9;
}

.title-pipes {
  width: 100%;
  filter: drop-shadow(0 0 12px rgba(62, 224, 255, 0.45));
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  background: rgba(62, 224, 255, 0.1);
  border-color: rgba(62, 224, 255, 0.4);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, #2ad6ff, #14a0c8);
  color: #041018;
  border-color: transparent;
  font-weight: 700;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #7aefff, #19b4dc);
}

.btn.glow {
  box-shadow: 0 0 0 1px rgba(62, 224, 255, 0.25), 0 10px 40px rgba(62, 224, 255, 0.25);
}

.btn.slim {
  padding: 8px 10px;
  font-size: 12px;
  width: 100%;
}

.btn.slim kbd {
  font-size: 10px;
  opacity: 0.7;
}

.panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel.wide {
  width: min(720px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
}

.panel h2 {
  font-family: var(--font-d);
  margin: 0 0 6px;
  letter-spacing: 0.08em;
}

.howto {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.howto strong {
  color: var(--text);
}

kbd {
  font-family: var(--font-d);
  font-size: 11px;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.muted {
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select {
  background: #0b0f16;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}

.field.range input {
  padding: 0;
  accent-color: var(--accent);
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  color: var(--text);
}

.check input {
  accent-color: var(--accent);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scores {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.scores th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}

.scores td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.level-card {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
  min-width: min(440px, 92vw);
}

.level-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  text-align: left;
  margin: 8px 0 22px;
  color: var(--muted);
}

.level-meta div em {
  display: block;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.level-meta div b {
  color: var(--text);
  font-size: 16px;
}

.screen.game {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.hud {
  display: grid;
  grid-template-columns: 200px minmax(240px, 1fr) 280px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.92), rgba(8, 10, 16, 0.55));
  border-bottom: 1px solid var(--line);
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud-right {
  justify-content: flex-end;
}

.hud-brand {
  font-family: var(--font-d);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--accent);
}

.hud-level {
  font-weight: 700;
  color: var(--gold);
}

.hud-center {
  min-width: 0;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 4px;
}

.meter {
  position: relative;
  height: 10px;
  background: #10141c;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--line);
}

#meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--mint));
  box-shadow: 0 0 12px var(--mint);
  transition: width 0.12s linear;
}

#meter-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gold);
  left: 0;
  opacity: 0.85;
}

.stat {
  white-space: nowrap;
  min-width: 88px;
}

.stat em {
  display: block;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.stat strong {
  font-family: var(--font-d);
  font-size: 18px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 150px 1fr 210px;
  min-height: 0;
  height: calc(100% - 62px);
}

.rail {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(6, 8, 12, 0.55);
  border-right: 1px solid var(--line);
}

.right-rail {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.rail-title {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--muted);
  text-align: center;
}

#queue-canvas {
  width: 100%;
  flex: 1;
  min-height: 200px;
}

.board-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  position: relative;
}

#board-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.tip {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(8, 12, 18, 0.88);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  letter-spacing: 0.04em;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.tip[hidden] {
  display: none !important;
}

.card-mini {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
}

.card-mini em {
  display: block;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-mini p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-mini.nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-mini.nums b {
  font-family: var(--font-d);
  font-size: 16px;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(4, 6, 10, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.overlay[hidden] {
  display: none !important;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  color: var(--muted);
}

.result-stats b {
  color: var(--text);
}

.medal {
  height: 28px;
  font-family: var(--font-d);
  letter-spacing: 0.2em;
  color: var(--gold);
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
  }
  .left-rail,
  .right-rail {
    border: 0;
    border-top: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  #queue-canvas {
    height: 110px;
    width: 100%;
    flex: 1 1 100%;
    min-height: 110px;
  }
  .hud {
    grid-template-columns: 1fr;
  }
}
