@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

a:link {
  color: white;
  background-color: transparent;
  text-decoration: none;
}

a:visited {
  color: white;
  background-color: transparent;
  text-decoration: none;
}

a:hover {
  color: lightgrey;
  background-color: transparent;
  text-decoration: none;
}

a:active {
  color: lightgrey;
  background-color: transparent;
  text-decoration: none;
}

:root {
  --bg: #101522;
  --panel: #171f30;
  --panel2: #202b40;
  --muted: #8793a8;
  --text: #f4f6fb;
  --accent: #8b7cff;
  --line: #2c3850;
}

/* Grundeinstellungen */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% -20%, #293657 0, transparent 55%), var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}

/* Hauptlayout und Kopfzeile */
.app {
  max-width: 1120px;
  margin: auto;
  padding: 0 28px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ffffff12;
}

.brand {
  font: 800 18px Outfit, sans-serif;
  letter-spacing: 2px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  color: #a99eff;
  font-size: 26px;
  vertical-align: -2px;
  margin-right: 8px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.icon-btn,
.back-btn {
  border: 1px solid var(--line);
  background: #ffffff08;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 19px;
}

/* Allgemeine Bildschirm- und Hilfsklassen */
.screen {
  flex: 1;
}

.hidden {
  display: none !important;
}

/* Startseite */
.hero {
  max-width: 650px;
  margin: 65px auto 70px;
  text-align: center;
}

.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: #a99eff;
}

.hero h1 {
  font: 800 clamp(44px, 7vw, 76px)/.98 Outfit, sans-serif;
  letter-spacing: -2px;
  margin: 18px 0;
}

.hero h1 span {
  color: #a99eff;
}

.hero p {
  color: #aab4c7;
  line-height: 1.7;
  max-width: 490px;
  margin: 20px auto 28px;
}

.primary-btn {
  border: 0;
  border-radius: 13px;
  background: linear-gradient(110deg, #897aff, #a18bff);
  padding: 16px 23px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  box-shadow: 0 9px 28px #7765ee44;
  min-width: 220px;
}

.primary-btn span {
  font-size: 18px;
  margin-left: 20px;
}

/* Fortschrittsanzeige */
.progress-wrap {
  max-width: 330px;
  margin: 38px auto 0;
  text-align: left;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
}

.progress-label strong {
  color: #fff;
}

.progress-track,
.mini-track {
  height: 6px;
  border-radius: 9px;
  background: #ffffff16;
  overflow: hidden;
}

.progress-track div,
.mini-track i {
  display: block;
  height: 100%;
  width: 0;
  background: #9c8cff;
  border-radius: 9px;
  transition: width .3s;
}

/* Weltenauswahl */
.worlds-panel {
  padding: 0 0 42px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-head h2 {
  font: 700 28px Outfit;
  margin: 7px 0 0;
}

.world-count {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.world-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #202b40, #171f30);
  border-radius: 16px;
  padding: 17px;
  text-align: left;
  min-height: 105px;
  transition: .2s;
}

.world-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: #897aff;
}

.world-card:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.world-card .world-num {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}

.world-card strong {
  display: block;
  font: 700 17px Outfit;
  margin: 8px 0 5px;
}

.world-card small {
  color: #aab4c7;
  font-size: 11px;
}

/* Kopfbereich im Spiel */
.game-head {
  height: 90px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #ffffff12;
}

.back-btn {
  width: auto;
  padding: 0 14px;
  font-size: 15px;
}

.back-btn span {
  font-size: 12px;
  margin-left: 5px;
}

.level-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.level-title small {
  font-size: 9px;
  letter-spacing: 1.8px;
  color: #a99eff;
  font-weight: 800;
}

.level-title strong {
  font: 700 19px Outfit;
}

.level-progress {
  margin-left: auto;
  width: 150px;
  text-align: right;
  font-size: 10px;
  color: var(--muted);
}

.mini-track {
  height: 4px;
  margin-top: 8px;
}

/* Spielinformationen */
.game-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.2px;
  padding: 22px 4px;
}

/* Spielfeld und Röhren */
.tube-area {
  min-height: 410px;
  display: flex;
  align-content: center;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 30px);
  padding: 25px 10px 40px;
}

.tube {
  width: clamp(48px, 7vw, 66px);
  height: clamp(185px, 28vw, 250px);
  border: 3px solid #8b9bb64d;
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background: linear-gradient(90deg, #ffffff08, #ffffff02 35%, #ffffff0d 75%, #ffffff04);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  padding: 5px 4px 8px;
  gap: 3px;
  position: relative;
  cursor: pointer;
  transition: .18s;
  box-shadow: inset 4px 0 9px #fff1, 0 12px 25px #0002;
}

.tube:before {
  content: "";
  position: absolute;
  top: -3px;
  left: -4px;
  right: -4px;
  height: 5px;
  border-radius: 6px;
  background: #a5b3cc8c;
}

.tube.selected {
  transform: translateY(-12px);
  border-color: #b3a8ff;
  box-shadow: 0 0 0 4px #9a8aff20, 0 12px 30px #0003;
}

/* Kugeln */
.ball {
  width: 100%;
  max-width: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  flex: 1 1 0;
  max-height: 47px;
  min-height: 12px;
  box-shadow: inset -5px -7px 9px #0003, inset 4px 5px 8px #ffffff50, 0 2px 4px #0004;
  position: relative;
  animation: drop .2s ease-out;
}

.ball:after {
  content: "";
  position: absolute;
  width: 27%;
  height: 18%;
  border-radius: 50%;
  background: #ffffff70;
  top: 15%;
  left: 18%;
  transform: rotate(-35deg);
}

@keyframes drop {
  from {
    transform: translateY(-10px) scale(.9);
    opacity: .5;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

/* Spielsteuerung */
.game-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 10px auto 26px;
}

.tool-btn {
  border: 1px solid var(--line);
  background: #1b2537;
  border-radius: 13px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c5ccda;
  font-size: 11px;
}

.tool-btn b {
  font-size: 20px;
  color: #a99eff;
}

.tool-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* Fußbereiche */
.game-footer {
  text-align: center;
  color: #69758a;
  font-size: 9px;
  letter-spacing: 1.5px;
  padding: 5px 0 20px;
}

footer {
  text-align: center;
  color: #657188;
  font-size: 9px;
  letter-spacing: 2px;
  padding: 24px 0 4px;
}

footer span {
  color: #a99eff;
  margin: 0 7px;
}

/* Modalfenster und Hilfe */
.game-modal {
  position: fixed;
  inset: 0;
  background: #080c16cc;
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
}

.modal-card {
  position: relative;
  background: linear-gradient(145deg, #222d44, #151d2d);
  border: 1px solid #ffffff20;
  border-radius: 24px;
  padding: 38px 32px;
  text-align: center;
  width: min(100%, 410px);
  box-shadow: 0 25px 80px #0008;
}

.win-icon {
  font-size: 44px;
  color: #b1a3ff;
  margin-bottom: 12px;
}

.modal-card h2 {
  font: 700 32px Outfit;
  margin: 10px 0;
}

.modal-card p {
  color: #aab4c7;
  line-height: 1.6;
  font-size: 13px;
  margin: 10px 0 25px;
}

.text-btn {
  border: 0;
  background: none;
  color: #aeb8ca;
  font-size: 12px;
  margin-top: 16px;
}

.close-btn {
  position: absolute;
  right: 17px;
  top: 13px;
  border: 0;
  background: none;
  font-size: 28px;
  color: #aab4c7;
}

.help-card {
  text-align: left;
}

.help-card h2 {
  margin-bottom: 14px;
}

.help-card ul {
  padding-left: 20px;
  color: #b9c3d4;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 25px;
}

.help-card .primary-btn {
  width: 100%;
}

/* Serverweite Bestenliste */
.leaderboard-panel {
  max-width: 760px;
  margin: 0 auto 54px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, #202b40aa, #171f30aa);
}

.highscore-list {
  display: grid;
  gap: 7px;
}

.score-row {
  display: grid;
  grid-template-columns: 42px minmax(90px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff08;
  font-size: 12px;
}

.score-row > b {
  color: #a99eff;
  font: 800 13px Outfit;
}

.score-row > span {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-row > small {
  color: #aab4c7;
  font-size: 10px;
  text-align: right;
}

.leaderboard-loading {
  color: #8793a8;
  font-size: 12px;
  margin: 8px 0;
}

.timer-count {
  font-variant-numeric: tabular-nums;
  color: #d9d2ff;
  font-weight: 800;
  letter-spacing: 1px;
}

/* Tipp-Funktion: Zielröhre hervorheben */
.tube.hint-destination {
  border-color: #ffe08a;
  box-shadow: 0 0 0 4px #ffe08a22, 0 0 22px #ffe08a88;
  transform: translateY(-5px);
}

/* Tablet und kleinere Bildschirme */
@media (max-width: 720px) {
  .app {
    padding: 0 16px 18px;
  }

  .topbar {
    height: 66px;
  }

  .hero {
    margin: 48px auto 58px;
  }

  .world-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .world-card {
    min-height: 95px;
  }

  .game-head {
    height: 78px;
    gap: 10px;
  }

  .level-progress {
    width: 90px;
  }

  .tube-area {
    min-height: 360px;
    gap: 13px;
    padding: 25px 0;
  }

  .tube {
    width: 48px;
    height: 190px;
  }

  .ball {
    max-height: 39px;
  }

  .tool-btn {
    padding: 11px 12px;
    gap: 6px;
  }

  .tool-btn span {
    font-size: 10px;
  }

  .game-meta {
    font-size: 9px;
  }

  .game-footer {
    font-size: 8px;
  }

  .leaderboard-panel {
    padding: 18px 14px;
    margin-bottom: 38px;
  }

  .score-row {
    grid-template-columns: 30px minmax(70px, 1fr);
    gap: 8px;
  }

  .score-row > small {
    grid-column: 2;
    text-align: left;
    margin-top: -5px;
  }

  .game-meta {
    gap: 8px;
  }

  .timer-count {
    white-space: nowrap;
  }
}

/* Sehr schmale Smartphones */
@media (max-width: 380px) {
  .tube-area {
    gap: 9px;
  }

  .tube {
    width: 43px;
    height: 175px;
  }

  .game-controls {
    gap: 6px;
  }

  .tool-btn {
    padding: 10px 8px;
  }

  .hero h1 {
    font-size: 43px;
  }
}

/* Bootstrap-Modals: optisch an Color Tubes angepasst */
#playerNameModal .modal-content,
#nameNoticeModal .modal-content {
  background: linear-gradient(145deg, #222d44, #151d2d) !important;
  color: var(--text) !important;
  border: 1px solid #ffffff20 !important;
}

#playerNameModal .modal-title,
#nameNoticeModal .modal-title {
  color: var(--text);
  font-family: Outfit, sans-serif;
  font-weight: 700;
}

#playerNameModal .form-control {
  color: var(--text);
  background: #101827;
  border-color: var(--line);
}

#playerNameModal .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .25rem #8b7cff33;
}

#playerNameModal .modal-header,
#playerNameModal .modal-footer,
#nameNoticeModal .modal-header,
#nameNoticeModal .modal-footer {
  border-color: var(--line) !important;
}
