/* =========================================================
   GlideSweeper – Kawaii-Stil aus Thermikdoku
   Dicke Navy-Konturen + harte Sticker-Schatten wie bei den Figuren
   ========================================================= */
:root {
  --ink: #2b3a55;
  --ink-soft: #5d6b86;
  --line: 3px solid var(--ink);
  --pop: 0 5px 0 var(--ink);
  --pop-sm: 0 3px 0 var(--ink);
  --sky-top: #6cc3f7;
  --sky-mid: #a9dcfb;
  --sky-bot: #e4f6ff;
  --card: #ffffff;
  --red: #ff5a4e;
  --yellow: #ffd23f;
  /* Kit-Dialoge, Footer und Zahnrad im selben Look */
  --kit-ink: var(--ink);
  --kit-ink-soft: var(--ink-soft);
  --kit-accent: var(--red);
  --kit-card: #fff9ef;
  --kit-line: var(--line);
  --kit-pop: var(--pop);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--sky-mid); color: var(--ink);
  font-family: var(--kit-font); font-weight: 700;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: manipulation;
}
img { -webkit-user-drag: none; user-select: none; }
#stage { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; touch-action: none; }
#app { position: relative; z-index: 2; height: 100%; max-width: 520px; margin: 0 auto; pointer-events: none; }

/* ---------- Himmel (aus Thermikdoku) ---------- */
.sky {
  position: fixed; inset: 0; overflow: hidden; z-index: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 246, 200, .7), transparent 40%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-bot) 100%);
}
.sky-dots {
  position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .9) 1.2px, transparent 1.6px);
  background-size: 26px 26px;
  animation: dots 40s linear infinite;
}
@keyframes dots { to { background-position: 260px 520px; } }
.sun { position: absolute; top: calc(var(--safe-t) + 70px); right: 6%; width: 96px; height: 96px; }
.sun .rays { transform-origin: 50px 50px; animation: spin 24s linear infinite; }
.sun .face { animation: sunBob 4s ease-in-out infinite; transform-origin: 50px 50px; }
@keyframes sunBob { 50% { transform: translateY(2px) scale(1.04); } }
@keyframes spin { to { transform: rotate(360deg); } }
.cloud { position: absolute; left: -200px; width: 130px; animation: drift linear infinite; }
.cloud img { width: 100%; display: block; animation: cloudBob 5s ease-in-out infinite; }
.cloud.c1 { top: 13%; animation-duration: 75s; animation-delay: -12s; }
.cloud.c2 { top: 33%; width: 90px; animation-duration: 95s; animation-delay: -60s; opacity: .9; }
.cloud.c3 { top: 56%; width: 150px; animation-duration: 120s; animation-delay: -35s; opacity: .8; }
.cloud.c4 { top: 74%; width: 70px; animation-duration: 85s; animation-delay: -50s; opacity: .75; }
.cloud.c2 img { animation-delay: -1.5s; } .cloud.c3 img { animation-delay: -3s; }
@keyframes drift { from { left: -200px; } to { left: calc(100% + 200px); } }
@keyframes cloudBob { 50% { transform: translateY(-6px) scale(1.03, .97); } }
.sky-glider { position: absolute; top: 18%; left: -25%; width: 74px; animation: skyGlide 40s linear infinite; }
.sky-glider img { width: 100%; animation: skyBob 5s ease-in-out infinite; }
@keyframes skyGlide { 0% { left: -25%; top: 24%; } 50% { top: 10%; } 100% { left: 125%; top: 22%; } }
@keyframes skyBob { 50% { transform: translateY(-14px) rotate(8deg); } }
.hills { position: absolute; bottom: -2px; left: 0; width: 100%; height: 20vh; min-height: 110px; }
/* Im Spiel stört der Gleitschirm am Himmel nur */
.in-game .sky-glider { opacity: 0; transition: opacity .4s; }

/* ---------- Bildschirme mit federndem Übergang ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 6px);
  opacity: 0; visibility: hidden; transform: translateY(30px) scale(.97);
  transition: opacity .3s ease, transform .5s cubic-bezier(.2, 1.4, .4, 1), visibility 0s .3s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.screen.active > * { pointer-events: auto; }
#screen-game.active { pointer-events: none; }
#screen-game.active > .bottombar { pointer-events: none; }
.topbar { display: flex; align-items: center; gap: 8px; min-height: 52px; flex-shrink: 0; }
.spacer { flex: 1; min-width: 0; text-align: center; }

/* ---------- Sticker-Bausteine ---------- */
.icon-btn {
  width: 46px; height: 46px; border-radius: 16px; flex: none; position: relative; cursor: pointer;
  background: var(--card); color: var(--ink); border: var(--line); box-shadow: var(--pop-sm);
  transition: transform .12s, box-shadow .12s;
}
.icon-btn::before { content: ''; position: absolute; left: 18px; top: 15px; width: 11px; height: 11px; border-left: 4px solid currentColor; border-bottom: 4px solid currentColor; transform: rotate(45deg); border-radius: 2px; }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 58px; padding: 10px 20px;
  font: 900 21px/1.1 var(--kit-font); border-radius: 22px; cursor: pointer;
  background: var(--card); color: var(--ink); border: var(--line); box-shadow: var(--pop);
  transition: transform .1s, box-shadow .1s;
  animation: cardIn .6s 1.1s cubic-bezier(.2, 1.5, .4, 1) both;
}
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: linear-gradient(180deg, #ff7b6e, var(--red)); color: #fff; font-size: 24px; text-shadow: 0 2px 0 rgba(43, 58, 85, .35); }
.btn-play span { display: inline-block; animation: breathe 2s 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); } }

/* ---------- Start ---------- */
#screen-home { align-items: center; }
#screen-home > .topbar { width: 100%; }
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.logo-glider {
  width: min(40vw, 160px, 20vh); aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer;
  animation: logoIn 1.1s cubic-bezier(.2, 1.3, .4, 1) both;
}
.logo-glider img { width: 100%; height: 100%; animation: bob 3.6s ease-in-out infinite; }
.logo-glider.loop img { animation: loop 1s cubic-bezier(.4, 0, .2, 1); }
@keyframes loop {
  0% { transform: none; }
  30% { transform: translateY(-30px) rotate(-30deg) scale(1.1); }
  60% { transform: translateY(-10px) rotate(-330deg) scale(1.15); }
  100% { transform: rotate(-360deg); }
}
@keyframes logoIn {
  0% { transform: translate(-80vw, -30vh) rotate(-35deg) scale(.4); opacity: 0; }
  65% { transform: translate(3vw, 2vh) rotate(8deg) scale(1.05); opacity: 1; }
  100% { transform: none; }
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5%) rotate(3deg); } }
.title {
  margin: 4px 0 0; font-size: clamp(38px, 11.5vw, 60px); font-weight: 900; letter-spacing: -1px; line-height: 1;
  color: #fff; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  filter: drop-shadow(0 5px 0 var(--ink));
  display: flex;
}
.title span { display: inline-block; animation: letterIn .6s cubic-bezier(.2, 1.6, .4, 1) both, letterBob 3s ease-in-out infinite; }
.title span.y { color: var(--yellow); }
@keyframes letterIn { from { opacity: 0; transform: translateY(-40px) scale(.3) rotate(-20deg); } }
@keyframes letterBob { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(-7px) rotate(-4deg); } }
.subtitle {
  margin: 12px 0 0; max-width: 340px; font-size: 15px; font-weight: 800; line-height: 1.35; color: var(--ink);
  background: rgba(255, 255, 255, .88); border: 2.5px solid var(--ink); border-radius: 16px; padding: 6px 14px;
  animation: popIn .5s .9s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.5); } }

/* Strecken als Karten wie die Schwierigkeitsstufen in Thermikdoku */
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 440px); margin: 0 auto 14px; }
.level {
  --tone: #36c97a; --tone-soft: #dcf7e7;
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 92px; padding: 8px 4px 9px; cursor: pointer;
  font-family: var(--kit-font); color: var(--ink); border-radius: 22px;
  background: linear-gradient(170deg, #fff 45%, var(--tone-soft));
  border: var(--line); box-shadow: var(--pop);
  animation: cardIn .6s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(.8s + var(--k) * .09s);
  transition: transform .1s, box-shadow .1s;
}
.lv-valley { --tone: #3d8bff; --tone-soft: #dce9ff; }
.lv-alps { --tone: #ff8a1f; --tone-soft: #ffe8d1; }
.level:active { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }
.level.selected { background: linear-gradient(170deg, #fff8d6 40%, var(--yellow)); transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink); }
.level.bump { animation: wiggle .7s ease; }
.lv-icons { display: flex; height: 26px; }
.lv-icons img { width: 26px; height: 26px; margin: 0 -2px; }
.lv-icons img.off { filter: grayscale(1) brightness(1.15); opacity: .3; }
.level b { font-size: 17px; font-weight: 900; color: var(--tone); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; letter-spacing: .2px; }
.level small { font-size: 11.5px; font-weight: 800; color: var(--ink-soft); }
.level .lv-stars { color: #f2b705; font-size: 14px; letter-spacing: 1px; -webkit-text-stroke: 1px var(--ink); }
@keyframes cardIn { from { opacity: 0; transform: translateY(50px) scale(.7) rotate(-6deg); } }
@keyframes wiggle { 20% { transform: rotate(-4deg) scale(1.04); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(1deg); } }

.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin: 0 auto 8px; width: min(100%, 440px); }
.actions .btn-light { font-size: 16px; padding: 10px 8px; }

/* Footer wie bei Thermikdoku: weiße Schrift mit Navy-Kontur */
.kit-footer { color: #fff; font-weight: 800; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.kit-footer a, .kit-footer button { color: #fff; }

/* ---------- Spiel ---------- */
.hud { gap: 5px; }
.hud .pill { min-width: 56px; padding: 3px 8px; }
.hud .kit-gear { flex: none; }
.pill {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 62px; min-height: 46px; padding: 3px 10px;
  border-radius: 16px; background: var(--card); color: var(--ink); border: var(--line); box-shadow: var(--pop-sm);
}
.pill small { font-size: 10.5px; font-weight: 900; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.pill b { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.storm-icons { display: flex; gap: 3px; height: 22px; align-items: center; }
.ws { display: block; width: 8px; height: 16px; border-radius: 3px; border: 2px solid var(--ink-soft); opacity: .45; }
.ws.used { background: repeating-linear-gradient(180deg, var(--red) 0 4px, #fff 4px 8px); border-color: var(--ink); opacity: 1; }
.pill.bump { animation: jelly .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes jelly { 25% { transform: scale(1.12, .88); } 50% { transform: scale(.94, 1.06); } 75% { transform: scale(1.03, .97); } }
.level-name {
  display: inline-block; max-width: 100%; font-size: 14px; font-weight: 900; color: #fff;
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 2px; -webkit-text-stroke-width: 3.5px;
}

.bottombar { margin-top: auto; height: 4px; pointer-events: none; }
/* Regel-Chips aus Thermikdoku */
.rule-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 8px 0 0; flex-shrink: 0; }
.chip {
  display: flex; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 50px; padding: 4px 6px; border-radius: 16px;
  background: rgba(255, 255, 255, .94); border: 2.5px solid var(--ink); box-shadow: var(--pop-sm);
  font-size: 11.5px; font-weight: 800; line-height: 1.2; color: var(--ink);
  animation: cardIn .5s cubic-bezier(.2, 1.5, .4, 1) both;
}
.chip:nth-child(2) { animation-delay: .08s; } .chip:nth-child(3) { animation-delay: .16s; }
.chip canvas { width: 26px; height: 26px; flex: none; border: 2px solid var(--ink); border-radius: 8px; }
.chip b { font-weight: 900; }

/* ---------- Dialoge ---------- */
.over-card { text-align: center; }
.over-card p { margin: 0; }
.over-time { font-size: 52px; font-weight: 900; color: var(--yellow); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; font-variant-numeric: tabular-nums; }
.over-best { color: var(--ink-soft); min-height: 1.2em; }
.help-lead { margin: 0; text-align: center; font-size: 16px; font-weight: 800; }
/* Zwei Feldarten groß und klar wie die Regel-Chips in Thermikdoku */
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.legend figure {
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 8px 6px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: var(--pop-sm);
}
.legend canvas { width: 52px; height: 52px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; }
.legend figcaption { font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; color: var(--ink); }
.legend figcaption b { font-weight: 900; }
/* Gesten-Tabelle wie in der Thermikdoku-Anleitung */
.gestures { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; }
.gestures th, .gestures td { padding: 7px 10px; background: #fff; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); text-align: left; }
.gestures th { font-weight: 900; white-space: nowrap; border-left: 2px solid var(--ink); border-radius: 12px 0 0 12px; background: #fff3c4; }
.gestures td { font-weight: 700; border-right: 2px solid var(--ink); border-radius: 0 12px 12px 0; }
.help-small { margin: 0; font-size: 13px; color: var(--ink-soft); }

@media (max-height: 700px) {
  .subtitle { display: none; }
  .logo-glider { width: min(30vw, 110px, 16vh); }
  .level { min-height: 80px; padding: 6px 4px; }
  .lv-icons, .lv-icons img { height: 20px; width: auto; }
  .btn { min-height: 52px; }
}
@media (max-height: 620px) {
  .chip { min-height: 40px; font-size: 10.5px; }
  .chip canvas { display: none; }
}
