:root {
  --bg: #0a0a0f;
  --surface: rgba(18, 18, 29, 0.78);
  --surface-soft: rgba(23, 24, 39, 0.64);
  --text: #edf2ff;
  --muted: #98a4c5;
  --accent: #6c63ff;
  --cyan: #00f5ff;
  --green: #00ff88;
  --border: rgba(122, 116, 255, 0.34);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 54px rgba(0, 0, 0, 0.48);
}

[data-theme="ember"] {
  --accent: #ff6b3d;
  --cyan: #ffc857;
}

[data-theme="aurora"] {
  --accent: #35b0ff;
  --cyan: #7effd7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, sans-serif;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.08;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 40% 20%, black 30%, transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1000px 520px at 8% -10%, rgba(108, 99, 255, 0.2), transparent 55%),
    radial-gradient(860px 420px at 94% 8%, rgba(0, 245, 255, 0.14), transparent 60%),
    linear-gradient(180deg, #0a0a0f 0%, #0b0d18 100%);
}

.container {
  width: min(1220px, 94vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(8, 9, 15, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner {
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}

.top-actions {
  display: inline-flex;
  gap: 8px;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 600 0.76rem "JetBrains Mono", monospace;
  text-transform: uppercase;
}

.crumb-home {
  display: inline-flex;
  align-items: center;
}

.crumb-home img {
  display: block;
  height: 40px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(0, 245, 255, 0.2));
}

.crumb strong {
  color: #fff;
  font-size: 0.95rem;
  text-transform: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 245, 255, 0.5);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(108, 99, 255, 0.42), rgba(0, 245, 255, 0.18));
  color: #fff;
  padding: 10px 12px;
  font: 600 0.76rem "JetBrains Mono", monospace;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 245, 255, 0.24);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(0, 245, 255, 0.72);
  outline-offset: 2px;
}

.player-wrap {
  margin-top: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: #020205;
  box-shadow: var(--shadow);
}

#game-frame {
  width: 100%;
  border: 0;
  height: 80vh;
  min-height: 560px;
}

.frame-status {
  position: absolute;
  z-index: 3;
  inset: 12px 12px auto 12px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 10px;
  background: rgba(7, 10, 20, 0.8);
  color: #d5ecff;
  padding: 9px 10px;
  font: 600 0.72rem "JetBrains Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.frame-status.hidden {
  display: none;
}

.frame-status.error {
  border-color: rgba(255, 86, 86, 0.52);
  color: #ffd4d4;
}

.shots-wrap {
  margin-top: 18px;
}

.shots-wrap h3 {
  margin: 0 0 10px;
}

.shot-stage {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(12, 14, 28, 0.84);
}

#active-shot {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.shot-strip {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.shot-thumb {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(10, 12, 24, 0.84);
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.shot-thumb:hover {
  transform: translateY(-1px);
}

.shot-thumb img {
  display: block;
  width: 100%;
  height: 74px;
  object-fit: cover;
}

.shot-thumb.active {
  border-color: rgba(0, 245, 255, 0.75);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.24);
}

.info-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin: 18px 0;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
  backdrop-filter: blur(12px);
}

.panel h2,
.panel h3 {
  margin: 0 0 8px;
}

.panel p,
.panel li {
  color: var(--muted);
  line-height: 1.55;
}

.panel ul {
  margin: 0;
  padding-left: 18px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  border: 1px solid rgba(0, 245, 255, 0.42);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--cyan);
  font: 600 0.7rem "JetBrains Mono", monospace;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
}

.meta-line span {
  color: var(--muted);
  font-size: 0.84rem;
}

.meta-line strong {
  color: var(--cyan);
  font-family: "JetBrains Mono", monospace;
}

.leaderboard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.board-tab.active {
  border-color: rgba(0, 245, 255, 0.58);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.2);
}

.leaderboard-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.leaderboard-list strong {
  color: var(--cyan);
}

.setting-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.setting-row label {
  color: var(--muted);
  font-size: 0.82rem;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.store-item {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.store-item:hover {
  transform: translateY(-1px);
}

.store-item small {
  display: block;
  color: var(--muted);
}

.store-item.owned {
  border-color: rgba(0, 255, 136, 0.44);
}

.store-item.equipped {
  border-color: rgba(0, 245, 255, 0.62);
}

#score-card {
  width: 100%;
  max-width: 380px;
  height: auto;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.related-card {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-soft);
  transition: border-color 0.2s, transform 0.2s;
}

.related-card:hover {
  border-color: rgba(0, 245, 255, 0.38);
  transform: translateY(-2px);
}

.related-logo {
  display: block;
  width: auto;
  height: 42px;
  max-width: 190px;
  margin-bottom: 8px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 245, 255, 0.18));
}

.related-card h4 {
  margin: 0 0 8px;
}

.related-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.related-card a {
  color: var(--cyan);
  font: 600 0.76rem "JetBrains Mono", monospace;
}

@media (max-width: 980px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    padding: 12px 0;
  }

  .top-actions {
    justify-content: flex-end;
    width: 100%;
  }

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

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

  #game-frame {
    min-height: 430px;
  }
}
