:root {
  color-scheme: dark;
  --bg: #10141f;
  --accent: #5ee6ff;
  --text: #f4f1ea;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: relative;
  margin: 0 auto;
  width: 340px;
  height: 480px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  /* Positionierung/Skalierung auf die Viewport-Größe übernimmt main.js
     (position:fixed + left/top 50% + translate(-50%,-50%) scale(...)). */
}

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

.corner-btn {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 5;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.22); }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(16, 20, 31, 0.78);
  backdrop-filter: blur(2px);
  text-align: center;
  padding: 20px;
}

/* Autor-Stylesheets überschreiben sonst das UA-Default für [hidden],
   da beide dieselbe Spezifität haben. */
[hidden] {
  display: none !important;
}

.title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.title.small { font-size: 20px; }

.btn-primary {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #0b2e35;
  font-size: 30px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(94, 230, 255, 0.35);
}

.btn-primary:active { transform: scale(0.96); }

.hint {
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.5;
}

.best-score, .go-best {
  font-size: 13px;
  opacity: 0.8;
}

.go-score {
  font-size: 40px;
  font-weight: 800;
  color: var(--accent);
}

.row {
  display: flex;
  gap: 14px;
}

.sound-corner {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
}

/* ---------- Steuerung: drei Sticks + Kommando-Buttons ----------
   Bewusst AUSSERHALB von #stage, als eigene, nicht mit dem Canvas
   skalierte Overlay-Leiste am unteren Bildschirmrand – die Spec gibt
   feste px-Radien für echte Touch-Ziele vor (84px/58px), die auf einem
   kleinen Telefon durch die Canvas-Skalierung sonst zu klein würden. */
#controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
}

.command-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-btn {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 20, 31, 0.55);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, color 0.15s;
}

.cmd-btn.active {
  background: var(--accent);
  color: #0b2e35;
  border-color: transparent;
}

.cmd-btn:active {
  transform: scale(0.93);
}

.stick-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.stick {
  position: relative;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  touch-action: none;
  flex: 0 0 auto;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

/* Rein optisches Feedback während ein Finger den Stick hält (siehe
   input.js) – hilft besonders bei drei gleichzeitigen Sticks zu spüren,
   welcher gerade wirklich erfasst ist. */
.stick.stick-active {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 230, 255, 0.18);
}

.stick-move { width: 84px; height: 84px; }

.stick-cluster {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.stick-shoot, .stick-throw { width: 58px; height: 58px; }

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  height: 42%;
  margin-left: -21%;
  margin-top: -21%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  /* Kurze, kaum spürbare Glättung statt hartem Sprung bei jedem Move-Event
     UND ein sanftes Zurückschnappen zur Mitte beim Loslassen. */
  transition: transform 0.08s ease-out;
}
