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

:root {
  --bg: #000;
  --text: #fff;
  --header-bg: #f5f5f5;
  --header-border: #ccc;
  --header-text: #222;
  --stroke: #fff;
  --accent: #4a90d9;
  --overlay-bg: rgba(0,0,0,0.7);
}

[data-theme="dark"] {
  --bg: #050510;
  --header-bg: #16213e;
  --header-border: #0f3460;
  --header-text: #e0e0e0;
  --stroke: #aaccff;
  --overlay-bg: rgba(0,0,0,0.8);
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  color: var(--header-text);
}

.app-title { font-size: 1.15rem; font-weight: 700; }

.icon-btn {
  width: 36px; height: 36px; padding: 6px; border: none; border-radius: 8px;
  background: none; color: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(128,128,128,0.15); }

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  width: 100%;
}

.info-bar {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--header-text);
}
.info-bar b { font-weight: 700; color: var(--accent); }

[data-theme="dark"] .info-bar { color: var(--header-text); }

.canvas-wrap {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
}

canvas { display: block; background: #000; }

.overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay.hidden { display: none; }
.overlay-text {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
}

/* Touch controls */
.touch-controls {
  display: none;
  gap: 8px;
  justify-content: center;
}

@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: flex; }
}

.touch-btn {
  width: 64px; height: 52px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.touch-btn:active { background: rgba(255,255,255,0.25); }
.touch-btn.thrust {
  width: 110px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255,140,0,0.12);
  border-color: rgba(255,140,0,0.3);
}
.touch-btn.thrust:active { background: rgba(255,140,0,0.35); }
