:root {
  --bg: #05060f;
  --bg2: #0b1026;
  --panel: rgba(12, 16, 33, 0.82);
  --panel-strong: rgba(18, 24, 49, 0.92);
  --line: rgba(124, 242, 255, 0.2);
  --line-strong: rgba(124, 242, 255, 0.42);
  --text: #eef7ff;
  --muted: #a7bed0;
  --cyan: #67f7ff;
  --pink: #ff5bd6;
  --yellow: #ffe15f;
  --green: #69f0ae;
  --shadow: 0 0 30px rgba(103, 247, 255, 0.16), 0 0 100px rgba(255, 91, 214, 0.1);
  --radius: 24px;
  --pixel-size: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(5, 6, 15, 0.28), rgba(5, 6, 15, 0.64)),
    radial-gradient(circle at top, rgba(255, 91, 214, 0.12), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(103, 247, 255, 0.1), transparent 22%),
    url("./assets/arcade-background.jpg") center center / cover fixed no-repeat;
  font-family: "Rajdhani", system-ui, sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 225, 95, 0.05) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255, 225, 95, 0.05) 25%, transparent 25%);
  background-size: 100% 28px, 28px 100%, 64px 64px, 64px 64px;
  background-position: 0 0, 0 0, 0 0, 32px 32px;
  opacity: 0.45;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2), transparent 20%, transparent 84%, rgba(0, 0, 0, 0.28));
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.12;
  mix-blend-mode: screen;
}

.glow {
  position: fixed;
  width: 38vw;
  height: 38vw;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.26;
}

.glow-left {
  top: -10vw;
  left: -10vw;
  background: rgba(103, 247, 255, 0.35);
}

.glow-right {
  right: -8vw;
  top: 16vw;
  background: rgba(255, 91, 214, 0.28);
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  gap: 18px;
  padding: 20px 0 28px;
}

.panel-kicker,
.pillar-tag {
  margin: 0;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  line-height: 1.35;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  color: #fff8bf;
  text-shadow:
    0 0 0 var(--cyan),
    4px 4px 0 rgba(255, 91, 214, 0.22),
    0 0 18px rgba(103, 247, 255, 0.28),
    0 0 40px rgba(255, 91, 214, 0.12);
}

.lede {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
}

.hero-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 18px;
  border: 3px solid rgba(103, 247, 255, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 91, 214, 0.1), transparent 35%),
    linear-gradient(225deg, rgba(103, 247, 255, 0.12), transparent 40%),
    rgba(8, 10, 20, 0.82);
  box-shadow:
    inset 0 0 0 2px rgba(255, 225, 95, 0.08),
    0 14px 50px rgba(0, 0, 0, 0.4);
}

.open-score-dialog,
.dialog-close {
  border: none;
  border-radius: 999px;
  min-height: 52px;
  padding: 0 20px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  color: #060816;
  background: linear-gradient(90deg, var(--yellow), var(--cyan));
  box-shadow: 0 0 18px rgba(103, 247, 255, 0.18);
}

.dialog-close {
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 14px;
  font: 700 1rem/1 "Press Start 2P", monospace;
}

.open-score-dialog:hover,
.dialog-close:hover {
  filter: brightness(1.08);
}

.score-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.score-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-shell {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 24px));
  padding: 22px;
  border: 1px solid rgba(103, 247, 255, 0.22);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(11, 15, 31, 0.98), rgba(5, 6, 15, 0.99));
  color: var(--text);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), var(--shadow);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.dialog-header > div {
  padding-right: 12px;
}

.dialog-header h2 {
  margin-top: 8px;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
}

.dialog-copy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.score-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.score-form label {
  display: grid;
  gap: 7px;
  font-weight: 600;
  color: var(--muted);
}

.score-form input,
.score-form select,
.score-form button {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(103, 247, 255, 0.28);
  background: rgba(5, 6, 15, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  padding: 0 14px;
}

.score-form input::placeholder {
  color: rgba(238, 247, 255, 0.34);
}

.score-form input:focus,
.score-form select:focus {
  outline: 2px solid rgba(103, 247, 255, 0.55);
  outline-offset: 2px;
}

.score-form button {
  cursor: pointer;
  border: none;
  font-family: "Press Start 2P", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  color: #060816;
  box-shadow: 0 0 18px rgba(103, 247, 255, 0.22);
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.score-form button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.form-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--yellow);
}

.scoreboard {
  margin-top: 28px;
  padding: 20px;
  border: 4px solid rgba(103, 247, 255, 0.28);
  border-radius: 26px;
  background:
    radial-gradient(circle at top, rgba(255, 225, 95, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(13, 18, 38, 0.78), rgba(5, 6, 15, 0.86));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 18px 60px rgba(0, 0, 0, 0.45);
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(103, 247, 255, 0.18);
}

.board-header h2 {
  font-size: clamp(0.95rem, 1.5vw, 1.2rem);
}

.board-header p {
  margin: 0;
  color: var(--muted);
}

.pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.pillar {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 2px,
      transparent 2px,
      transparent calc(var(--pixel-size) * 2)
    ),
    linear-gradient(180deg, rgba(10, 15, 33, 0.88), rgba(6, 8, 18, 0.94));
  border: 4px solid rgba(103, 247, 255, 0.26);
  box-shadow:
    inset 0 0 0 1px rgba(255, 225, 95, 0.06),
    0 0 30px rgba(103, 247, 255, 0.12),
    0 0 100px rgba(255, 91, 214, 0.06);
  overflow: hidden;
  min-height: 600px;
}

.pillar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(103, 247, 255, 0.08), transparent 18%),
    linear-gradient(90deg, rgba(255, 91, 214, 0.06), transparent 32%, transparent 68%, rgba(103, 247, 255, 0.06)),
    linear-gradient(90deg, transparent 0, transparent 91%, rgba(255, 225, 95, 0.32) 91%, rgba(255, 225, 95, 0.32) 93%, transparent 93%);
  pointer-events: none;
}

.pillar-top {
  position: relative;
  z-index: 1;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(103, 247, 255, 0.18);
}

.pillar-title {
  margin-top: 10px;
  font-size: clamp(0.95rem, 1.15vw, 1.05rem);
}

.champion {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(103, 247, 255, 0.2), transparent 65%),
    rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(103, 247, 255, 0.2);
}

.champion-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.champion-score {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  color: var(--yellow);
  text-shadow: 0 0 14px rgba(255, 225, 95, 0.28);
}

.champion-name {
  color: var(--text);
  font-size: 1.08rem;
}

.leaderboard {
  position: relative;
  z-index: 1;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.leaderboard li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(103, 247, 255, 0.14);
}

.leaderboard li .rank {
  width: 2ch;
  color: var(--cyan);
  font-family: "Press Start 2P", monospace;
  font-size: 0.75rem;
}

.leaderboard li .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard li .score {
  color: var(--yellow);
  font-weight: 700;
}

.leaderboard li.top {
  border-color: rgba(255, 225, 95, 0.32);
  background: linear-gradient(90deg, rgba(255, 225, 95, 0.1), rgba(103, 247, 255, 0.08));
}

.leaderboard li.empty {
  grid-template-columns: 1fr;
  color: var(--muted);
}

.empty-state {
  position: relative;
  z-index: 1;
  padding: 12px;
  border: 1px dashed rgba(103, 247, 255, 0.28);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .pillars {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1400px);
    padding-top: 18px;
  }

  .pillars {
    grid-template-columns: 1fr;
  }

  .hero-bar {
    align-items: start;
    flex-direction: column;
  }

  .board-header {
    align-items: start;
    flex-direction: column;
  }

  .pillar {
    min-height: auto;
  }
}
