/* Pony Adventure – Styles für Seite und Overlays (Titel, Game Over, Shop) */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1d2b53;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #333;
  overflow: hidden;

  /* Auf Tablet und Handy: beim Tippen zum Springen soll nichts blau
     aufleuchten. Der Browser markiert sonst die angetippte Stelle
     (tap-highlight) bzw. wählt beim Wischen Text aus (user-select). */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spielfeld: immer 16:9, so groß wie das Fenster erlaubt */
#game {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: inline-size;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  touch-action: none;   /* kein Scrollen/Zoomen beim Tippen auf Touch-Geräten */
  cursor: pointer;
}

/* Pause-Knopf: klebt oben rechts auf dem Spielfeld (die Overlays liegen
   im HTML dahinter und decken ihn dadurch ab, wenn ein Fenster offen ist) */
#btn-pause {
  position: absolute;
  top: 10%;
  right: 2.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 8cqw;
  height: 8cqw;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  font-size: clamp(20px, 4.4cqw, 50px);
  line-height: 1;
  background: rgba(255, 255, 255, .9);
  color: #555;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}

/* Overlays liegen über dem Canvas */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 30, 60, .35);
  border-radius: 12px;
  font-size: 16px;
  font-size: clamp(11px, 2cqw, 22px);   /* Text skaliert mit dem Spielfeld */
}

.screen.hidden { display: none; }

.panel {
  background: rgba(255, 255, 255, .93);
  border-radius: 1.2em;
  padding: 1.2em 2em;
  text-align: center;
  max-width: 85%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}

h1 { margin: 0 0 .3em; font-size: 2.4em; color: #d64f8e; }
h2 { margin: 0 0 .3em; font-size: 1.9em; color: #d64f8e; }
p  { margin: .4em 0; }

button {
  font: inherit;
  touch-action: manipulation;   /* kein Doppeltipp-Zoom, keine 300ms Verzögerung */
  -webkit-tap-highlight-color: transparent;
  font-weight: bold;
  border: 0;
  border-radius: 999px;
  padding: .5em 1.3em;
  margin: .3em;
  cursor: pointer;
  background: #ffd166;
  color: #5a3d00;
  box-shadow: 0 4px 0 #d9a93d;
}
button.big {
  font-size: 1.25em;
  padding: .55em 1.8em;
  background: #6fcf6f;
  color: #14421a;
  box-shadow: 0 5px 0 #4a9a4a;
}
button:active { transform: translateY(3px); box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.tiny {
  font-size: .7em;
  font-weight: normal;
  background: #eee;
  color: #777;
  box-shadow: none;
  padding: .3em .8em;
}

.hint  { color: #666; font-size: .85em; }
.stats { color: #888; font-size: .85em; }

kbd {
  background: #f3f3f3;
  border: 1px solid #bbb;
  border-bottom-width: 3px;
  border-radius: .4em;
  padding: 0 .4em;
  font-family: inherit;
}

.shop-list {
  list-style: none;
  padding: 0;
  margin: .6em 0;
  text-align: left;
}
.shop-list li {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: .3em 0;
  border-bottom: 1px dashed #ddd;
}
.shop-list li span:first-child { flex: 1; }
.shop-list li button { padding: .2em .8em; margin: 0; font-size: .8em; }

/* ---------- Levelübersicht (Weg mit Level-Stationen) ------------------ */

.panel.wide { max-width: 96%; padding: .9em 1.2em; }

.stars-big { font-size: 2.2em; color: #f2b705; letter-spacing: .1em; margin: .1em 0; }

/* Der Weg: ein SVG im Hintergrund, die Stationen liegen als Knöpfe darauf */
.level-map {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 260;
  margin: .2em 0 .4em;
}

.map-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.map-path path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.path-back { stroke: #e3cdb4; stroke-width: 22; }
.path-dash { stroke: #fff; stroke-width: 3; stroke-dasharray: 10 14; opacity: .8; }
.path-done { stroke: #8fd48a; stroke-width: 22; }

/* Eine Station auf dem Weg */
.level-node {
  position: absolute;
  width: 12%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
/* Stationen oben auf der Welle bekommen ihre Beschriftung nach oben */
.level-node.label-up { flex-direction: column-reverse; }
.level-node.label-up .node-label { margin: 0 0 .35em; }

.node-dot {
  position: relative;
  width: 2.6em;
  height: 2.6em;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  font-size: 1.15em;
  background: #ffd166;
  box-shadow: 0 4px 0 #d9a93d, 0 0 0 .22em #fff;
}
.level-node.done .node-dot   { background: #7ed37a; box-shadow: 0 4px 0 #4a9a4a, 0 0 0 .22em #fff; }
.level-node.locked .node-dot { background: #d8d8d8; box-shadow: 0 0 0 .22em #fff; color: #999; }
.level-node.next .node-dot   { animation: hop 1.1s ease-in-out infinite; }

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-.22em); }
}

.node-nr {
  position: absolute;
  top: -.35em;
  left: -.35em;
  min-width: 1.35em;
  padding: 0 .15em;
  border-radius: 999px;
  background: #fff;
  color: #d64f8e;
  font-size: .55em;
  line-height: 1.35em;
}
.level-node.locked .node-nr { color: #aaa; }

/* Beschriftung unter der Station */
.node-label {
  margin-top: .3em;
  padding: .12em .35em;
  border-radius: .5em;
  background: rgba(255, 255, 255, .82);
  text-align: center;
  font-size: .72em;
}
.node-name  { display: block; font-weight: bold; }
.node-meta  { display: block; color: #777; font-size: .85em; white-space: nowrap; }
.node-stars { display: block; color: #d9d9d9; letter-spacing: .05em; }
.node-stars b { color: #f2b705; font-weight: normal; }

/* Tempo-Balken: je voller, desto schneller ist das Level */
.tempo { display: inline-flex; gap: .12em; vertical-align: middle; }
.tempo i {
  width: .3em;
  height: .62em;
  border-radius: .1em;
  background: #ddd;
}
.tempo i.on { background: #d64f8e; }
.level-node.locked .tempo i.on { background: #bbb; }
.level-node.locked .node-name,
.level-node.locked .node-meta { color: #aaa; }
.level-node.locked .node-stars { color: #d5d5d5; }

/* einzelne Elemente ausblenden (z.B. der "Nächstes Level"-Knopf).
   !important, weil #btn-pause per id-Regel ein display bekommt und id-Regeln
   sonst stärker sind als diese Klasse. */
.hidden { display: none !important; }
