:root {
  --bg: #0a0a12;
  --bg-elevated: rgba(12, 14, 28, 0.92);
  --surface: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f4f6ff;
  --muted: #9aa3c0;
  --cyan: #00f2fe;
  --pink: #ff007f;
  --glow-pink: rgba(255, 0, 127, 0.5);
  --radius-lg: 20px;
  --radius-md: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  font-family: "Noto Sans SC", system-ui, sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

body.play-mode {
  overflow: hidden;
  height: 100dvh;
}

html[lang="en"] body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 40px 40px;
  transform: perspective(520px) rotateX(62deg);
  mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, black, transparent);
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 40%, transparent 40%, rgba(10, 10, 18, 0.8) 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
}

.orb-1 {
  width: 280px;
  height: 280px;
  background: var(--pink);
  top: 10%;
  left: -5%;
}

.orb-2 {
  width: 220px;
  height: 220px;
  background: var(--cyan);
  bottom: 15%;
  right: -5%;
}

.arcadebox-top-bar {
  position: relative;
  z-index: 100;
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 14px 8px;
}

.back-link {
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.85rem;
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.8);
}

.lang-switch button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
}

.lang-switch button[aria-pressed="true"] {
  color: var(--cyan);
  border-color: rgba(0, 242, 254, 0.4);
}

.wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 10px max(10px, env(safe-area-inset-bottom));
}

.glass-panel {
  background: rgba(10, 10, 18, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.hud-shell {
  padding: 10px 14px;
  margin-bottom: 8px;
}

.hud-shell.hidden {
  display: none;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-row-primary {
  justify-content: space-between;
}

.hud-row-secondary {
  margin-top: 6px;
  justify-content: space-between;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-center {
  align-items: center;
  text-align: center;
}

.hud-right {
  align-items: flex-end;
}

.hud-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hud-value {
  font-family: Orbitron, sans-serif;
  font-size: 1.1rem;
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.8);
}

.hud-chip {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 0, 127, 0.35);
  color: var(--pink);
}

.hud-chip.hud-zoom {
  border-color: rgba(0, 242, 254, 0.45);
  color: var(--cyan);
}

.hud-power {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.hud-power.hidden {
  display: none;
}

.hud-power-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 8px var(--pink);
}

.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.arcade-frame {
  flex: 1;
  display: flex;
  min-height: 0;
  border-radius: var(--radius-lg);
  padding: 3px;
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.35), rgba(0, 242, 254, 0.25));
  box-shadow: 0 0 24px rgba(255, 0, 127, 0.15);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  border-radius: calc(var(--radius-lg) - 3px);
  background: #06060e;
  touch-action: none;
}

.game-toolbar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 4px;
}

.game-toolbar.hidden {
  display: none;
}

.ui-button,
.menu-button {
  border: 1px solid var(--pink);
  background: rgba(10, 10, 18, 0.85);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 0 10px var(--glow-pink);
  transition: transform 0.15s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.ui-button:hover,
.menu-button:hover {
  transform: scale(1.03);
}

.menu-button.primary {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.menu-button.secondary {
  border-color: var(--border);
  box-shadow: none;
  color: var(--muted);
}

.menu {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.menu.active {
  display: flex;
}

.menu-content {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  text-align: center;
}

.menu-hero-badge {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.menu-hero h1 {
  margin: 0;
  font-family: Orbitron, sans-serif;
  font-size: 1.5rem;
  text-shadow: 0 0 8px rgba(255, 0, 127, 0.6);
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

.mode-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 20px 0 8px;
  text-align: left;
}

.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.mode-card.active {
  border-color: var(--pink);
  box-shadow: 0 0 12px var(--glow-pink);
}

.mode-card-name {
  font-weight: 700;
}

.mode-card-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.leaderboard-mount {
  margin-top: 16px;
  text-align: left;
}

.leaderboard-mount .lb-group {
  gap: 0.5rem;
}

.leaderboard-mount .lb-panel summary {
  font-size: 0.8rem;
  color: var(--cyan);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.5);
}

.summary-best {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-best strong,
#goBest {
  color: var(--cyan);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.6);
}

.summary-line {
  margin: 8px 0;
  color: var(--muted);
}

.summary-line strong {
  color: var(--cyan);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.8);
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .hud-value {
    font-size: 0.95rem;
  }
}
