/* Orbit — game page styles */

@import url("../../css/theme.css");

:root {
  --hud-height: 72px;
  --topbar-height: 44px;
  --game-accent: var(--color-primary);
  --game-danger: var(--color-danger);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body.game-page {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background: var(--color-bg);
}

.game-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 var(--space-4);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.game-topbar a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.game-topbar a:hover {
  color: var(--color-primary);
}

.game-topbar__title {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
}

.game-topbar__spacer {
  width: 4.5rem;
}

.game-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--color-bg);
}

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

.game-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(var(--color-bg-rgb), 0.82);
  backdrop-filter: blur(4px);
  z-index: 10;
}

.game-overlay.is-visible {
  display: flex;
}

.overlay-panel {
  width: 100%;
  max-width: 440px;
  max-height: 90%;
  overflow-y: auto;
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}

.overlay-panel h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.overlay-panel h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-4);
}

.overlay-panel p {
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-4);
}

.overlay-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle) !important;
}

.overlay-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  text-align: left;
}

.overlay-stat {
  padding: var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.overlay-stat__label {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.overlay-stat__value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-6);
}

.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.game-btn:hover {
  background: var(--color-primary-hover);
}

.game-btn--secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.game-btn--secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

.game-hud {
  flex-shrink: 0;
  height: var(--hud-height);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(180deg, var(--color-bg-elevated) 0%, var(--color-bg) 100%);
  border-top: 2px solid var(--color-border-strong);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.game-hud__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.hud-stat__label {
  font-size: var(--font-size-xs);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud-stat__value {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
}

.hud-hp {
  flex: 1;
  min-width: 120px;
  max-width: 240px;
}

.hud-bar {
  height: 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.hud-bar__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--game-danger), #ff8fa0);
  transition: width 0.15s ease;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.hud-icon-btn {
  width: 44px;
  height: 44px;
  font-size: var(--font-size-lg);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.hud-icon-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.game-hud.is-hidden {
  display: none;
}

@media (max-width: 768px) {
  :root {
    --hud-height: auto;
  }

  .game-hud {
    padding: var(--space-3);
  }

  .game-hud__inner {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .hud-hp {
    flex: 1 1 100%;
    max-width: none;
  }

  .hud-controls {
    margin-left: auto;
  }

  .overlay-panel {
    padding: var(--space-5);
  }
}
