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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: 'Sora', system-ui, sans-serif;
  background: radial-gradient(ellipse at 50% 0%, #0c2848 0%, #061428 55%, #030a14 100%);
  color: #e8f4ff;
}

#game-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.65rem;
  gap: 0.5rem;
}

.game-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  width: min(900px, 100%);
  padding: 0.55rem 0.85rem;
  background: linear-gradient(180deg, rgba(20, 80, 140, 0.55) 0%, rgba(8, 35, 70, 0.75) 100%);
  border: 2px solid rgba(80, 180, 255, 0.35);
  border-radius: 0.5rem;
  box-shadow: 0 4px 24px rgba(0, 120, 220, 0.15);
}

.game-header h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #ffe600, #ff9922, #4ade80);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  flex: 1;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 4.5rem;
}

.stat-label {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.stat-value.lives {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #ff6b8a;
}

.stat-value.accent {
  color: #ffe600;
}

.header-actions {
  display: flex;
  gap: 0.45rem;
  margin-left: auto;
}

.btn {
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #e8f4ff;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-primary {
  background: linear-gradient(90deg, #ffe600, #ff9922);
  border-color: transparent;
  color: #1a0a00;
  font-weight: 700;
}

.btn-primary:hover {
  transform: scale(1.02);
}

#canvas-wrap {
  position: relative;
  border: 3px solid rgba(80, 200, 255, 0.45);
  border-radius: 0.45rem;
  box-shadow: 0 0 36px rgba(40, 160, 255, 0.2), inset 0 0 20px rgba(0, 40, 80, 0.4);
  line-height: 0;
  max-width: 100%;
  overflow: hidden;
}

#board {
  display: block;
  width: 900px;
  height: 500px;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  background: #2a8fd4;
  outline: none;
}

.controls-hint {
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  max-width: 900px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(4, 20, 40, 0.82);
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  font-size: 1.45rem;
  color: #ffe600;
  text-align: center;
}

.overlay h2.win {
  color: #4ade80;
}

.overlay h2.lose {
  color: #ff6b8a;
}

.overlay p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  max-width: 85%;
  line-height: 1.45;
}

body.is-mobile .game-header h1 {
  display: none;
}

body.is-mobile .stats-row {
  justify-content: center;
}

body.is-mobile .header-actions {
  margin-left: 0;
  width: 100%;
  justify-content: center;
}

body.is-mobile #board {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 900 / 500;
}