/* Stille Sterne – Oberfläche. Dunkel, warm, weich. Farben aus tools/stille-sterne/mockup.html */
@font-face { font-family: "Recursive"; font-weight: 300 1000; font-display: swap; src: url(fonts/recursive.woff2) format("woff2"); }

:root {
  --ink: #E9E4FF; --title: #FFF1D2; --gold: #FFD98A; --gold-soft: #FFE7B0;
  --ring: rgba(255, 217, 138, .35); --panel: rgba(10, 14, 44, .92);
  --btn-bg: rgba(20, 26, 70, .35); --btn-ring: rgba(201, 210, 255, .12); --lav: #C9D2FF;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #070A24; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: "Recursive", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
  font-size: 15.5px; font-weight: 340; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  font-variation-settings: "CASL" .6;
}
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#bg, #fx { pointer-events: none; }
#play { touch-action: none; transition: opacity 3s ease; }
#play.gone { opacity: 0; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-appearance: none; appearance: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui button, #ui a, #ui input, #ui .sheet, #ui .skyview { pointer-events: auto; }

/* ---- Knöpfe ---- */
.ibtn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: var(--btn-bg); box-shadow: inset 0 0 0 1px var(--btn-ring); transition: background .4s, opacity .4s;
}
.ibtn:hover { background: rgba(30, 38, 96, .5); }
.ibtn svg, .item svg, .flybtn svg { width: 22px; height: 22px; stroke: var(--lav); opacity: .78; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ibtn.small { width: 44px; height: 44px; }

.hud { position: absolute; left: calc(14px + var(--safe-l)); right: calc(14px + var(--safe-r)); top: calc(14px + var(--safe-t)); display: flex; justify-content: space-between; align-items: flex-start; transition: opacity 1.2s; }
.dots { position: absolute; left: 50%; transform: translateX(-50%); top: 19px; display: flex; gap: 7px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: #FFD98A; box-shadow: 0 0 6px #FFD98A; animation: dotin 1.2s ease both; }
@keyframes dotin { from { opacity: 0; transform: scale(.3); } }

.flybtn {
  position: absolute; right: calc(14px + var(--safe-r)); width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; opacity: .5; transition: opacity 1s; animation: breathe 5s ease-in-out infinite;
}
.flybtn svg { stroke: #D6FF96; opacity: .9; }
.flybtn:hover { opacity: .9; }
@keyframes breathe { 50% { opacity: .3; } }

.hint {
  position: absolute; left: 0; right: 0; margin: 0; padding: 0 24px; text-align: center; font-size: 15px; font-weight: 380; letter-spacing: .01em;
  color: rgba(233, 228, 255, .62); opacity: 0; transition: opacity 1.2s ease; pointer-events: none;
}
.hint.on { opacity: 1; }

/* ---- Bildschirme ---- */
.screen { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility 0s .9s; pointer-events: none; }
.screen.on { opacity: 1; visibility: visible; transition: opacity .9s ease; }
.screen.on button, .screen.on a { pointer-events: auto; }
.screen:not(.on) button, .screen:not(.on) a { pointer-events: none; }

.start-inner {
  position: absolute; left: 0; right: 0; top: max(12%, calc(var(--safe-t) + 78px)); bottom: calc(26% + 8px); padding: 0 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 22px; overflow: visible;
}
.start-head { text-align: center; }
h1 { margin: 0; font-size: 28px; font-weight: 520; letter-spacing: .01em; color: var(--title); text-shadow: 0 0 18px rgba(255, 217, 138, .35); }
.tagline { margin: 10px auto 0; max-width: 32ch; font-size: 15.5px; line-height: 1.55; color: rgba(233, 228, 255, .78); }
.start-ctl { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 420px; }
.q { margin: 0; font-size: 14.5px; color: rgba(233, 228, 255, .7); text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 999px; border: 0; font-size: 14.5px; color: rgba(233, 228, 255, .8);
  background: rgba(20, 26, 70, .35); box-shadow: inset 0 0 0 1px var(--btn-ring); transition: background .4s, box-shadow .4s, color .4s;
}
.chip[aria-pressed="true"] { color: var(--gold-soft); background: rgba(255, 217, 138, .09); box-shadow: inset 0 0 0 1px var(--ring); }
.mainbtn {
  margin-top: 6px; min-height: 56px; padding: 0 38px; border-radius: 999px; border: 0; font-size: 17px; font-weight: 420; color: var(--gold-soft);
  background: rgba(255, 217, 138, .1); box-shadow: inset 0 0 0 1px var(--ring), 0 0 28px rgba(255, 217, 138, .12); transition: background .5s, box-shadow .5s;
}
.mainbtn:hover { background: rgba(255, 217, 138, .16); }
.start-row { display: flex; align-items: center; gap: 14px; }
.linkbtn { background: none; border: 0; min-height: 44px; padding: 0 12px; font-size: 14.5px; color: rgba(233, 228, 255, .7); text-decoration: none; display: inline-flex; align-items: center; }
.linkbtn:hover { color: var(--title); }
.only-browser { display: inline-flex; }
.standalone .only-browser { display: none !important; }
@media (display-mode: standalone) { .only-browser { display: none !important; } }

/* ---- Gelöst ---- */
.solved-text { position: absolute; left: 24px; right: 24px; top: max(13.5%, calc(var(--safe-t) + 74px)); text-align: center; pointer-events: none; }
.solved-text h2 { margin: 0; font-size: 28px; font-weight: 520; letter-spacing: .01em; color: var(--title); text-shadow: 0 0 18px rgba(255, 217, 138, .35); opacity: 0; transition: opacity .8s ease; }
.solved-text p { margin: 10px auto 0; max-width: 32ch; font-size: 15.5px; line-height: 1.55; color: rgba(233, 228, 255, .78); opacity: 0; transition: opacity .8s ease; text-wrap: pretty; }
.solved-text.show-name h2, .solved-text.show-story p { opacity: 1; }
.next-wrap { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0; transition: opacity .8s ease; }
.next-wrap.show { opacity: 1; }
.nextbtn { min-height: 46px; padding: 0 26px; border-radius: 999px; border: 0; font-size: 15px; color: var(--gold-soft); background: rgba(255, 217, 138, .08); box-shadow: inset 0 0 0 1px var(--ring); }
.nextbtn:hover { background: rgba(255, 217, 138, .15); }
.morebtn { background: none; border: 0; min-height: 44px; padding: 0 14px; font-size: 13.5px; color: rgba(233, 228, 255, .55); }
.next-wrap:not(.show) button { pointer-events: none !important; }

/* ---- Outro ---- */
.say, .breathe, .wake { position: absolute; left: 24px; right: 24px; margin: 0; text-align: center; pointer-events: none; opacity: 0; transition: opacity 1.4s ease; }
.say { top: 38%; font-size: 21px; font-weight: 360; line-height: 1.5; color: var(--title); text-shadow: 0 0 16px rgba(255, 217, 138, .25); }
.breathe { top: 50%; font-size: 16px; letter-spacing: .08em; color: var(--ink); transition: opacity 2s ease; }
.wake { position: fixed; z-index: 53; bottom: calc(10% + var(--safe-b)); font-size: 14px; color: rgba(233, 228, 255, .8); transition: opacity 3s ease; }
.say.on { opacity: 1; }
.breathe.on { opacity: .5; }
.wake.on { opacity: .35; }

/* ---- Blätter ---- */
.scrim { position: absolute; inset: 0; background: rgba(2, 3, 14, .32); opacity: 0; visibility: hidden; transition: opacity .5s, visibility 0s .5s; pointer-events: none; }
.scrim.on { opacity: 1; visibility: visible; transition: opacity .5s; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%; display: flex; flex-direction: column;
  background: var(--panel); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 22px 22px 0 0;
  box-shadow: inset 0 0 0 1px rgba(201, 210, 255, .1); transform: translateY(105%); visibility: hidden;
  transition: transform .55s cubic-bezier(.3, .7, .2, 1), visibility 0s .55s; padding-bottom: var(--safe-b);
}
.sheet.on { transform: none; visibility: visible; transition: transform .55s cubic-bezier(.3, .7, .2, 1); }
.sheet.dragging { transition: none; }
.grip { display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; flex: none; }
.grip i { width: 38px; height: 4px; border-radius: 2px; background: rgba(201, 210, 255, .25); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 4px 22px; flex: none; touch-action: none; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 480; color: var(--title); }
.sheet-body { overflow-y: auto; padding: 6px 12px 22px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.item {
  width: 100%; min-height: 50px; display: flex; align-items: center; gap: 14px; padding: 0 14px; border: 0; border-radius: 14px; background: none;
  text-align: left; font-size: 15.5px; color: var(--ink); transition: background .3s;
}
.item:hover:not(.static) { background: rgba(255, 255, 255, .05); }
.item.static { justify-content: space-between; cursor: default; }
.item.danger { color: #E7C9C9; }
.item.danger:hover { background: rgba(231, 201, 201, .08); }
.item[disabled] { opacity: .4; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 4px 14px; font-size: 15px; }
.row.col { flex-direction: column; align-items: stretch; justify-content: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.row label, .row > span { color: rgba(233, 228, 255, .88); }
.seg { display: inline-flex; border-radius: 999px; padding: 3px; background: rgba(20, 26, 70, .45); box-shadow: inset 0 0 0 1px var(--btn-ring); flex: none; }
.seg button { min-height: 38px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: none; font-size: 13.5px; color: rgba(233, 228, 255, .7); transition: background .3s, color .3s; }
.seg button[aria-pressed="true"] { background: rgba(255, 217, 138, .14); color: var(--gold-soft); }
.sw { width: 54px; height: 32px; border-radius: 16px; border: 0; position: relative; flex: none; padding: 0; background: rgba(20, 26, 70, .6); box-shadow: inset 0 0 0 1px var(--btn-ring); transition: background .4s; }
.sw::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(201, 210, 255, .7); transition: transform .4s, background .4s; }
.sw[aria-checked="true"] { background: rgba(255, 217, 138, .22); box-shadow: inset 0 0 0 1px var(--ring); }
.sw[aria-checked="true"]::after { transform: translateX(22px); background: var(--gold); }
input[type=range] { -webkit-appearance: none; appearance: none; width: min(46%, 220px); height: 44px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(201, 210, 255, .22); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(201, 210, 255, .22); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(255, 217, 138, .5); border: 0; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(255, 217, 138, .5); border: 0; }
.resetbox p { margin: 0 0 8px; color: #E7C9C9; font-size: 14.5px; }
.btnrow { display: flex; gap: 8px; }
.btnrow .item { justify-content: center; background: rgba(255, 255, 255, .04); }
.note { margin: 6px 14px 0; font-size: 13.5px; color: rgba(233, 228, 255, .7); line-height: 1.5; }
.small { margin: 12px 14px 0; font-size: 12.5px; line-height: 1.55; color: rgba(233, 228, 255, .5); }
.small a { color: inherit; }

/* ---- Dein Himmel ---- */
.skyview {
  position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility 0s .9s;
  background: radial-gradient(ellipse at 50% 40%, #121848 0%, #0A0E30 55%, #05071A 100%);
}
.skyview.on { opacity: 1; visibility: visible; transition: opacity .9s ease; }
#skyCanvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.sky-top { position: absolute; left: calc(14px + var(--safe-l)); right: calc(14px + var(--safe-r)); top: calc(14px + var(--safe-t)); display: flex; align-items: center; gap: 12px; pointer-events: none; }
.sky-top > * { pointer-events: auto; }
.sky-top h2 { margin: 0; flex: 1; text-align: center; font-size: 16px; font-weight: 420; color: var(--title); letter-spacing: .01em; }
.sky-top .spacer { width: 44px; }
.sky-empty { position: absolute; left: 32px; right: 32px; top: 40%; margin: 0; text-align: center; line-height: 1.6; color: rgba(233, 228, 255, .7); pointer-events: none; }
.sky-card {
  position: absolute; left: 16px; right: 16px; bottom: calc(18px + var(--safe-b)); max-width: 440px; margin: 0 auto; padding: 18px 20px 20px; border-radius: 20px; text-align: center;
  background: var(--panel); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(201, 210, 255, .1); animation: cardin .6s ease both;
}
.sky-card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 500; color: var(--title); }
.sky-card p { margin: 0; line-height: 1.55; color: rgba(233, 228, 255, .8); }
@keyframes cardin { from { opacity: 0; transform: translateY(10px); } }

/* ---- Filter und Sonstiges ---- */
#dim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 50; transition: opacity .8s linear; }
#warm { position: fixed; inset: 0; background: #FF9A3C; mix-blend-mode: multiply; opacity: 0; pointer-events: none; z-index: 51; transition: opacity .9s ease; }
#moonkeep { position: fixed; border-radius: 50%; pointer-events: none; z-index: 52; opacity: 0; transition: opacity 4s ease;
  background: radial-gradient(circle, rgba(255, 241, 210, .75) 0, rgba(255, 233, 184, .35) 18%, rgba(255, 233, 184, .1) 45%, rgba(255, 233, 184, 0) 70%); }
#moonkeep.on { opacity: .55; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.keys { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; }
.keys button { position: absolute; width: 1px; height: 1px; opacity: 0; }
.noscript { position: fixed; z-index: 99; top: 40%; left: 0; right: 0; text-align: center; color: #E9E4FF; padding: 0 24px; }

/* ---- Querformat ---- */
@media (orientation: landscape) {
  .sheet { left: auto; top: 0; bottom: 0; right: 0; width: min(420px, 60vw); max-height: none; border-radius: 22px 0 0 22px; transform: translateX(105%); padding-right: var(--safe-r); }
  .sheet.on { transform: none; }
  .solved-text { left: 3%; right: auto; width: max(190px, 24%); text-align: left; top: max(15%, calc(var(--safe-t) + 70px)); }
  .solved-text h2 { font-size: 24px; }
  .solved-text p { font-size: 14.5px; margin-left: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .start-inner {
    display: grid; grid-template-columns: minmax(0, 215px) minmax(0, 316px); grid-template-rows: auto 1fr; column-gap: 26px; row-gap: 4px;
    justify-content: start; align-items: start; padding-left: max(4vw, calc(22px + var(--safe-l))); padding-right: 0;
    top: max(10%, calc(var(--safe-t) + 40px)); bottom: auto;
  }
  .start-head { text-align: left; grid-column: 1; grid-row: 1; padding-top: 16px; }
  .tagline { margin-left: 0; }
  .start-ctl { gap: 8px; grid-column: 2; grid-row: 1 / span 2; }
  .chips { gap: 6px; }
  .mainbtn { min-height: 48px; margin-top: 2px; }
  .start-inner > .only-browser { grid-column: 1; grid-row: 2; justify-self: start; margin-left: -12px; }
  h1 { font-size: 26px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .start-inner { gap: 14px; }
  .solved-text h2 { font-size: 25px; }
  .solved-text p { font-size: 14.5px; line-height: 1.5; }
}
@media (min-width: 1500px) and (min-height: 850px) {
  body { font-size: 17.5px; }
  h1 { font-size: 36px; }
  .tagline, .solved-text p { font-size: 18px; }
  .solved-text h2 { font-size: 32px; }
  .q, .chip, .linkbtn, .hint { font-size: 16.5px; }
  .mainbtn { font-size: 19px; min-height: 60px; }
  .nextbtn { font-size: 17px; min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  .flybtn { animation: none; }
  .dots i { animation: none; }
  .sheet, .sheet.on { transition-duration: .01s; }
}
.reduce-motion .flybtn, .reduce-motion .dots i { animation: none; }
.reduce-motion .sheet, .reduce-motion .sheet.on { transition-duration: .01s; }
