/* style.css — Void Salvage */

:root {
  --bg: #080820;
  --bg-surface: rgba(12, 12, 30, 0.85);
  --bg-surface-solid: #0c0c1e;
  --text: #e8e8f0;
  --text-dim: #8888aa;
  --text-dimmer: #555577;
  --accent: #4488cc;
  --accent-glow: #44aaff;
  --accent-deep: #2266aa;
  --danger: #ff4444;
  --danger-glow: #ff6666;
  --heat: #ff6622;
  --salvage: #44ffaa;
  --gold: #ffcc44;
  --border: rgba(68, 170, 255, 0.12);
  --border-strong: rgba(68, 170, 255, 0.25);
  --shadow: rgba(0, 0, 0, 0.6);
  --font-stack: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[data-theme="light"] {
  --bg: #e0e0ec;
  --bg-surface: rgba(255, 255, 255, 0.9);
  --bg-surface-solid: #ffffff;
  --text: #1a1a2e;
  --text-dim: #666688;
  --text-dimmer: #9999bb;
  --accent: #3366aa;
  --accent-glow: #2277cc;
  --accent-deep: #225588;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  --shadow: rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-stack);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
}

#app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#app > * {
  pointer-events: auto;
}

/* ── Shared button styles ── */
.btn-start, .btn-retry, .btn-menu {
  position: relative;
  display: block;
  width: 100%;
  font-family: var(--font-stack);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.btn-start {
  max-width: 240px;
  margin: 0 auto 24px;
  padding: 16px 32px;
  font-size: 18px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  box-shadow: 0 4px 24px rgba(34, 102, 170, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(34, 102, 170, 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-start:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(34, 102, 170, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-retry {
  max-width: 280px;
  margin: 0 auto 10px;
  padding: 15px 24px;
  font-size: 15px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  box-shadow: 0 4px 20px rgba(34, 102, 170, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-retry:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(34, 102, 170, 0.45), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-retry:active {
  transform: translateY(0);
}

.btn-menu {
  max-width: 280px;
  margin: 0 auto;
  padding: 13px 24px;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn-menu:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(68, 170, 255, 0.05);
}

.btn-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}

.btn-start:hover .btn-glow,
.btn-retry:hover .btn-glow {
  left: 100%;
}

/* ── Menu Screen ── */
.screen-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  animation: fadeInUp 0.5s ease;
}

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

.title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.title-bracket {
  width: 3px;
  height: 50px;
  background: linear-gradient(to bottom, transparent, var(--accent-glow), transparent);
  border-radius: 2px;
  animation: bracketPulse 2s ease-in-out infinite;
}

.title-bracket.left {
  height: 60px;
}

.title-bracket.right {
  height: 60px;
  animation-delay: 0.3s;
}

@keyframes bracketPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(0.8); }
  50% { opacity: 1; transform: scaleY(1); }
}

.game-title {
  font-size: clamp(34px, 9vw, 56px);
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 0.95;
  color: var(--accent-glow);
  text-shadow:
    0 0 20px rgba(68, 170, 255, 0.5),
    0 0 40px rgba(68, 170, 255, 0.25),
    0 2px 0 rgba(0, 0, 0, 0.3);
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(68, 170, 255, 0.5), 0 0 40px rgba(68, 170, 255, 0.25), 0 2px 0 rgba(0,0,0,0.3); }
  50% { text-shadow: 0 0 28px rgba(68, 170, 255, 0.7), 0 0 56px rgba(68, 170, 255, 0.35), 0 2px 0 rgba(0,0,0,0.3); }
}

.game-subtitle {
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 28px;
  line-height: 1.6;
}

.high-score-display {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 22px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px var(--shadow);
}

.hs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.hs-row:first-child {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 2px;
}

.hs-label {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.hs-value {
  color: var(--gold);
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 0 12px rgba(255, 204, 68, 0.3);
}

.controls-info {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
}

.ctrl-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-dimmer);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 12px;
}

.ctrl-key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  min-width: 56px;
  text-align: center;
  padding: 3px 8px;
  color: var(--accent-glow);
  background: rgba(68, 170, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.ctrl-desc {
  color: var(--text-dim);
  font-size: 11px;
}

.mechanics-info {
  text-align: left;
  padding: 0 4px;
}

.mech-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  padding: 3px 0;
  line-height: 1.5;
}

.mech-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mech-dot.heat {
  background: var(--heat);
  box-shadow: 0 0 8px rgba(255, 102, 34, 0.5);
}

.mech-dot.salvage {
  background: var(--salvage);
  box-shadow: 0 0 8px rgba(68, 255, 170, 0.5);
}

.mech-dot.split {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255, 204, 68, 0.5);
}

/* ── Game Over Screen ── */
.screen-gameover {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  animation: fadeInUp 0.4s ease;
}

.go-content {
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.go-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 2px solid var(--danger);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 24px rgba(255, 68, 68, 0.3);
  animation: goIconPulse 1.5s ease-in-out infinite;
}

.go-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 4px;
  background: var(--danger);
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
}

@keyframes goIconPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255, 68, 68, 0.3); }
  50% { box-shadow: 0 0 36px rgba(255, 68, 68, 0.5); }
}

.go-title {
  font-size: clamp(26px, 7vw, 42px);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--danger);
  text-shadow: 0 0 24px rgba(255, 68, 68, 0.4);
  margin-bottom: 20px;
}

.go-stats {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px var(--shadow);
}

.go-stat {
  margin-bottom: 14px;
}

.go-stat:nth-child(2) {
  margin-bottom: 0;
}

.go-label {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.go-value {
  display: block;
  font-size: 30px;
  font-weight: 900;
  color: var(--accent-glow);
  text-shadow: 0 0 16px rgba(68, 170, 255, 0.3);
}

.go-new-best {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin: 14px 0 0;
  padding: 8px;
  text-shadow: 0 0 16px rgba(255, 204, 68, 0.5);
  animation: newBestPulse 1.2s ease-in-out infinite;
}

@keyframes newBestPulse {
  0%, 100% { text-shadow: 0 0 16px rgba(255, 204, 68, 0.5); }
  50% { text-shadow: 0 0 28px rgba(255, 204, 68, 0.8); }
}

.go-high {
  font-size: 11px;
  color: var(--text-dim);
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  letter-spacing: 0.05em;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ── */
@media (max-width: 360px) {
  .menu-content {
    padding: 0 4px;
  }
  .high-score-display, .controls-info {
    padding: 12px 16px;
  }
  .go-stats {
    padding: 16px;
  }
  .ctrl-key {
    min-width: 48px;
    font-size: 9px;
  }
}

@media (min-width: 768px) {
  .game-title {
    letter-spacing: 0.2em;
  }
  .menu-content {
    max-width: 440px;
  }
  .go-content {
    max-width: 400px;
  }
}
