* {
  box-sizing: border-box;
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #11181c;
  color: white;

  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}


/* =========================================================
   SPIEL
   ========================================================= */

.game {
  width: 100vw;
  height: 100dvh;

  display: grid;
  grid-template-rows: auto 1fr;

  overflow: hidden;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  position: relative;
  z-index: 100;

  min-height: 68px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 9px 16px;

  background: #151c20;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.kicker {
  display: block;

  color: #f3cd43;

  font-size: .68rem;
  font-weight: 900;

  letter-spacing: .12em;
}

.topbar h1 {
  margin: 2px 0 0;

  font-size: clamp(1rem, 2vw, 1.25rem);
}

.close-btn {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;

  background: rgba(255,255,255,.08);
  color: white;

  text-decoration: none;

  font-size: 1.6rem;
  font-weight: 400;
}


/* =========================================================
   SPIELFLÄCHE
   ========================================================= */

.game-area {
  position: relative;

  min-height: 0;

  overflow: hidden;

  background: #89aa70;

  touch-action: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  display: block;
}


/* =========================================================
   TUTORIAL
   ========================================================= */

.tutorial-progress {
  position: absolute;
  z-index: 30;

  top: 12px;
  left: 12px;

  display: flex;
  gap: 6px;

  padding: 8px 10px;

  border-radius: 999px;

  background: rgba(23,63,89,.92);

  box-shadow: 0 5px 16px rgba(0,0,0,.25);
}

.tutorial-progress i {
  display: block;

  width: 11px;
  height: 11px;

  border-radius: 50%;

  background: rgba(255,255,255,.32);
}

.tutorial-progress i.current {
  background: white;

  box-shadow:
    0 0 0 3px rgba(116,216,143,.55);
}

.tutorial-progress i.done {
  background: #74d88f;
}


/* Erklärung */

.tutorial-box {
  position: absolute;
  z-index: 31;

  top: 56px;
  left: 50%;

  width: min(620px, calc(100% - 28px));

  transform: translateX(-50%);

  padding: 14px 18px;

  border-radius: 17px;

  background: rgba(18,43,57,.94);

  color: white;

  text-align: center;

  font-size: .95rem;
  font-weight: 800;
  line-height: 1.4;

  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.tutorial-box strong {
  display: block;

  margin-bottom: 4px;

  font-size: 1.12rem;
}

.tutorial-button {
  width: 100%;

  margin-top: 11px;
  padding: 11px 14px;

  border: 0;
  border-radius: 11px;

  background: #ffffff;
  color: #17384e;

  font-weight: 900;

  cursor: pointer;
}

.tutorial-button.secondary {
  margin-top: 7px;

  background: #dce8ee;
}


/* =========================================================
   FAHRSTEUERUNG
   ========================================================= */

.drive-controls {
  position: absolute;
  z-index: 40;

  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));

  transform: translateX(-50%);

  width: min(96vw, 520px);

  display: grid;
  grid-template-columns: 96px 1fr;

  align-items: end;
  justify-items: center;

  gap: 18px;

  pointer-events: none;
}

.drive-controls > * {
  pointer-events: auto;
}


/* Pedale */

.pedals {
  display: grid;
  gap: 9px;
}

.pedal {
  width: 88px;
  height: 72px;

  border: 0;
  border-radius: 17px;

  background:
    linear-gradient(
      #4f88aa,
      #234f6c
    );

  color: white;

  font-weight: 950;

  box-shadow: 0 7px 20px rgba(0,0,0,.30);

  touch-action: none;

  cursor: pointer;
}

.pedal span {
  display: block;

  font-size: 1.65rem;
  line-height: 1;
}

.pedal small {
  display: block;

  margin-top: 3px;

  font-size: .7rem;
}

.pedal.active {
  filter: brightness(1.22);

  transform: translateY(2px);
}


/* Lenkrad */

.steering {
  position: relative;

  width: min(52vw, 220px);
  height: min(52vw, 220px);

  min-width: 165px;
  min-height: 165px;

  touch-action: none;
}

.wheel {
  position: absolute;

  inset: 10%;

  border: 15px solid rgba(23,63,89,.78);
  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(23,63,89,.78) 0 17%,
      transparent 18%
    );

  box-shadow: 0 7px 20px rgba(0,0,0,.20);

  pointer-events: none;

  transition: transform .08s linear;
}

.wheel::before,
.wheel::after {
  content: "";

  position: absolute;

  left: 50%;
  top: 50%;

  width: 45%;
  height: 12px;

  background: rgba(23,63,89,.78);

  border-radius: 20px;

  transform-origin: 0 50%;
}

.wheel::before {
  transform: rotate(25deg);
}

.wheel::after {
  transform: rotate(155deg);
}


/* Lenkbuttons */

.steer-btn {
  position: absolute;
  z-index: 2;

  top: 50%;

  width: 74px;
  height: 74px;

  transform: translateY(-50%);

  border: 3px solid white;
  border-radius: 50%;

  background: rgba(23,63,89,.91);

  color: white;

  font-size: 2.2rem;
  font-weight: 950;

  box-shadow: 0 5px 15px rgba(0,0,0,.33);

  touch-action: none;

  cursor: pointer;
}

.steer-btn.left {
  left: 0;
}

.steer-btn.right {
  right: 0;
}

.steer-btn.active {
  background: #2e789e;

  transform:
    translateY(-50%)
    scale(.96);
}


/* =========================================================
   AKTUELLES BEDIENELEMENT MARKIEREN
   ========================================================= */

.tutorial-focus {
  animation: tutorialPulse 1s ease-in-out infinite;
}

@keyframes tutorialPulse {

  50% {

    filter: brightness(1.35);

    box-shadow:
      0 0 0 12px rgba(243,205,67,.27),
      0 8px 24px rgba(0,0,0,.45);
  }
}


/* =========================================================
   MOBIL
   ========================================================= */

@media (max-width: 520px) {

  .topbar {
    min-height: 58px;

    padding: 7px 10px;
  }

  .topbar h1 {
    font-size: .98rem;
  }

  .close-btn {
    width: 38px;
    height: 38px;
  }

  .tutorial-box {
    top: 52px;

    padding: 11px 12px;

    font-size: .82rem;
  }

  .tutorial-box strong {
    font-size: .98rem;
  }

  .drive-controls {
    grid-template-columns: 82px 1fr;

    gap: 9px;

    bottom: max(6px, env(safe-area-inset-bottom));
  }

  .pedal {
    width: 78px;
    height: 65px;
  }

  .steering {
    width: min(55vw, 200px);
    height: min(55vw, 200px);
  }

  .steer-btn {
    width: 64px;
    height: 64px;

    font-size: 1.9rem;
  }
}