:root {
  --base-green: #123826;
  --deep-green: #0b1a14;
  --graphite: #3c4650;
  --text-gray: #9fa6aa;
  --glow-violet: #6e4bd8;
  --bio-blue: #4ac0ff;
  --spore-green: #c0e94d;
  --copper: #b66a3c;
  --warn-orange: #e87b2a;
  --radius: 14px;
  --font-display: "Saira", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Work Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background: radial-gradient(circle at 20% 20%, rgba(74, 192, 255, 0.08), transparent 40%),
              radial-gradient(circle at 80% 30%, rgba(110, 75, 216, 0.12), transparent 45%),
              linear-gradient(160deg, #07110c, #0f2016 60%, #0b1a14);
  color: var(--text-gray);
  font-family: var(--font-body);
  overflow: auto;
  min-height: 100vh;
}

canvas#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

.joystick {
  position: fixed;
  width: 170px;
  height: 170px;
  z-index: 4;
  touch-action: none;
  user-select: none;
  display: none;
}

@media (pointer: coarse) {
  .joystick {
    display: block;
  }
}

.joystick__base {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(74, 192, 255, 0.12), rgba(11, 26, 20, 0.9));
  border: 1px solid rgba(110, 75, 216, 0.4);
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(74, 192, 255, 0.18), inset 0 0 18px rgba(11, 26, 20, 0.8);
}

.joystick__thumb {
  position: absolute;
  width: 72px;
  height: 72px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192, 233, 77, 0.9), rgba(110, 75, 216, 0.6));
  box-shadow: 0 0 18px rgba(110, 75, 216, 0.6);
  border: 2px solid rgba(74, 192, 255, 0.5);
}

.joystick__label {
  position: absolute;
  bottom: -4px;
  right: 12px;
  font-size: 12px;
  color: var(--bio-blue);
  text-shadow: 0 0 10px rgba(74, 192, 255, 0.5);
  pointer-events: none;
}

.joystick--aim {
  right: 18px;
  bottom: 18px;
}

.joystick--move {
  left: 18px;
  bottom: 18px;
}

.fire-btn {
  position: fixed;
  right: 28px;
  bottom: 210px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1px solid rgba(74, 192, 255, 0.4);
  background: radial-gradient(circle, rgba(232, 123, 42, 0.85), rgba(182, 106, 60, 0.8));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35), 0 0 20px rgba(232,123,42,0.5);
  z-index: 4;
  display: none;
}

@media (pointer: coarse) {
  .fire-btn {
    display: block;
  }
}

.nitro-btn {
  position: fixed;
  left: 28px;
  bottom: 210px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1px solid rgba(74, 192, 255, 0.4);
  background: radial-gradient(circle, rgba(74, 192, 255, 0.85), rgba(110, 75, 216, 0.8));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35), 0 0 20px rgba(74,192,255,0.5);
  z-index: 4;
  display: none;
}

@media (pointer: coarse) {
  .nitro-btn {
    display: block;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(10, 20, 15, 0.72);
  backdrop-filter: blur(6px);
  z-index: 3;
  overflow-y: auto;
  padding: 32px 12px;
}

.overlay.hidden {
  display: none;
}

.overlay__card {
  background: rgba(12, 26, 19, 0.9);
  border: 1px solid rgba(110, 75, 216, 0.35);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 30px rgba(74, 192, 255, 0.2);
  border-radius: 18px;
  padding: 28px;
  width: min(620px, 90vw);
  margin: 0 auto 28px;
}

.logo {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--spore-green);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo__pill {
  padding: 6px 10px;
  background: linear-gradient(120deg, rgba(74,192,255,0.25), rgba(110,75,216,0.35));
  border: 1px solid rgba(74,192,255,0.4);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #dff4ff;
}

.logo__img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(74, 192, 255, 0.3);
  box-shadow: 0 0 10px rgba(74, 192, 255, 0.25);
}

.subtitle {
  font-size: 15px;
  color: #dbe6ea;
  margin-bottom: 16px;
  line-height: 1.4;
}

.overlay__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.feature-card {
  padding: 12px;
  border: 1px solid rgba(74, 192, 255, 0.25);
  border-radius: 12px;
  background: rgba(14, 30, 22, 0.8);
  box-shadow: inset 0 0 0 rgba(0,0,0,0.3), 0 0 20px rgba(74,192,255,0.08);
}

.feature-card h3 {
  margin-bottom: 8px;
  color: var(--bio-blue);
  font-size: 15px;
  letter-spacing: 0.03em;
}

.bullet-list {
  list-style: none;
  margin: 0 0 6px;
  display: grid;
  gap: 6px;
}

.bullet-list li {
  font-size: 14px;
  color: #e0ebef;
}

.preview-card {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid rgba(74, 192, 255, 0.3);
  border-radius: 14px;
  background: rgba(10, 22, 17, 0.8);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.preview-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e0ebef;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.preview-note {
  font-size: 12px;
  color: var(--text-gray);
}

.preview-frame {
  position: relative;
  border: 1px solid rgba(74, 192, 255, 0.25);
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 30%, rgba(74, 192, 255, 0.1), transparent 45%), rgba(12, 24, 18, 0.8);
  aspect-ratio: 16 / 9;
}

.preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-embed {
  width: 100%;
  height: 100%;
  border: none;
}

.preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cfd9dd;
  font-size: 13px;
  backdrop-filter: blur(2px);
  background: rgba(10, 20, 15, 0.45);
  text-align: center;
  padding: 10px;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(62, 70, 80, 0.8);
  border-radius: 10px;
  border: 1px solid rgba(74, 192, 255, 0.4);
  color: var(--bio-blue);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.btn {
  background: var(--deep-green);
  color: var(--text-gray);
  border: 1px solid rgba(110, 75, 216, 0.6);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  width: 100%;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 18px rgba(110, 75, 216, 0.3), inset 0 0 0 rgba(0, 0, 0, 0);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(74, 192, 255, 0.4), 0 12px 24px rgba(0, 0, 0, 0.35);
}

.btn:active {
  transform: translateY(0);
  box-shadow: inset 0 0 10px rgba(182, 106, 60, 0.4);
}

.btn--ghost {
  background: rgba(12, 26, 19, 0.5);
  color: var(--bio-blue);
  border: 1px solid rgba(74, 192, 255, 0.5);
}

.share-block {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.share-row {
  display: flex;
  gap: 8px;
}

.share-row .btn {
  flex: 1;
}

.leaderboard {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(74, 192, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(15,32,24,0.7), rgba(18,40,30,0.9));
}

.leaderboard__title {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--bio-blue);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.leaderboard__status {
  font-size: 13px;
  color: #d5dee3;
  margin-bottom: 6px;
}

.leaderboard__list {
  list-style: decimal;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  max-height: 140px; /* ca. 4 Eintraege sichtbar */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 8px;
  color: #dce4e7;
  font-size: 14px;
}

@media (pointer: coarse) {
  .leaderboard__list {
    max-height: 180px;
  }
}

.leaderboard__list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed rgba(74, 192, 255, 0.2);
  padding-bottom: 3px;
}

.leaderboard__list .name {
  font-weight: 700;
}

.leaderboard__list .score {
  color: var(--spore-green);
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.hud__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-gray);
  font-size: 13px;
}

.nitro-meter-wrapper {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 1; /* unter Overlay/Start-Button halten */
}

.hud-leave {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(232, 123, 42, 0.5);
  background: rgba(30, 20, 20, 0.8);
  color: #ffe4c4;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(0,0,0,0.35);
  height: 34px;
  align-self: center;
}

.fire-ring-meter {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.fire-ring-label {
  color: #ff8a50;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.fire-ring-bar {
  width: 14px;
  height: 140px;
  border-radius: 10px;
  background: rgba(60, 30, 20, 0.7);
  border: 1px solid rgba(232, 123, 42, 0.5);
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 12px rgba(232, 123, 42, 0.4);
}

.fire-ring-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, rgba(255, 120, 60, 0.95), rgba(255, 60, 40, 0.95));
  transition: height 0.1s ease, opacity 0.1s ease;
}

.fire-ring-status {
  color: #ffd6c2;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-align: center;
}

.bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
}

.bar {
  height: 14px;
  background: rgba(60, 70, 80, 0.5);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.5);
  position: relative;
}

.bar .fill {
  height: 100%;
  width: 100%;
  transition: width 0.12s ease;
}

.bar--health .fill {
  background: linear-gradient(90deg, #5fcf3e, var(--spore-green));
  box-shadow: 0 0 12px rgba(192, 233, 77, 0.4);
}

.bar--shield .fill {
  background: linear-gradient(90deg, rgba(110, 75, 216, 0.8), rgba(74, 192, 255, 0.9));
  box-shadow: 0 0 12px rgba(110, 75, 216, 0.4);
}

.label {
  font-size: 13px;
  color: #d5dee3;
}

.objective {
  justify-self: center;
  padding: 10px 16px;
  background: rgba(11, 26, 20, 0.85);
  border-radius: 999px;
  border: 1px solid rgba(74, 192, 255, 0.3);
  color: var(--bio-blue);
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 0 18px rgba(74, 192, 255, 0.2);
}

.scoreboard {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.score, .wave {
  background: rgba(60, 70, 80, 0.35);
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(182, 106, 60, 0.35);
  font-weight: 700;
  font-size: 13px;
  color: #e8eff2;
}

.wave {
  border-color: rgba(110, 75, 216, 0.4);
}

.hint {
  opacity: 0.8;
}

.cooldown {
  background: rgba(15, 32, 22, 0.8);
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid rgba(74, 192, 255, 0.3);
  color: var(--glow-violet);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nitro-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(11, 26, 20, 0.75);
  border: 1px solid rgba(74, 192, 255, 0.3);
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(74, 192, 255, 0.2);
  min-width: 220px;
}

.nitro-bar {
  width: 140px;
  height: 12px;
  border-radius: 999px;
  background: rgba(90, 20, 20, 0.6);
  border: 1px solid rgba(232, 123, 42, 0.4);
  overflow: hidden;
}

.nitro-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 80, 80, 0.95), rgba(232, 123, 42, 0.95));
  box-shadow: 0 0 12px rgba(232, 80, 80, 0.6);
}

.nitro-text {
  color: #ff5a5a;
  font-weight: 700;
  font-size: 13px;
}

@media (max-width: 640px) {
  .nitro-meter {
    min-width: 180px;
  }
}

@media (max-width: 640px) {
  .hud__top {
    grid-template-columns: 1fr;
    justify-items: flex-start;
  }

  .objective {
    justify-self: flex-start;
  }

  .scoreboard {
    justify-self: flex-start;
  }

  .hud__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
