/* ------------------------------------------------------------------ *
 * Selenophile — Stylesheet
 * Keine externen Abhängigkeiten, damit die App auch offline lädt.
 * ------------------------------------------------------------------ */

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: local("Open Sans"), local("OpenSans");
}

:root {
  --bg: #0c0f18;
  --surface: rgba(20, 25, 38, 0.80);
  --surface-hi: rgba(27, 33, 48, 0.86);
  --header-bg: rgba(12, 15, 24, 0.86);
  --nav-bg: rgba(20, 25, 38, 0.92);
  --line: #252c3e;
  --text: #e9ecf4;
  --muted: #828ca6;
  --accent: #e6c88e;
  --accent-soft: rgba(230, 200, 142, 0.12);
  --warn: #d98a6b;
  --moon-filter: drop-shadow(0 0 24px rgba(220, 225, 240, 0.1));
  --logo-filter: none;
  --logo-opacity: 1;
}

body.night {
  --bg: #0a0304;
  --surface: #170608;
  --surface-hi: #20090c;
  --header-bg: #0a0304;
  --nav-bg: #170608;
  --line: #3a1014;
  --text: #f0a8a8;
  --muted: #8e4c4c;
  --accent: #ff6b6b;
  --accent-soft: rgba(255, 107, 107, 0.1);
  --warn: #ff8a5c;
  --moon-filter: brightness(0.5) sepia(1) saturate(5) hue-rotate(-32deg);
  --logo-filter: brightness(0.55) sepia(1) saturate(6) hue-rotate(-30deg);
  --logo-opacity: 0.9;
}

/* Hintergrundbild: eine Aufnahme von Manuel, stark zurückgenommen.
   Im Nachtmodus ausgeblendet, damit die Dunkeladaption erhalten bleibt. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("icons/backdrop.jpg") center center / cover no-repeat;
  opacity: 0.3;
  pointer-events: none;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(12, 15, 24, 0.6) 0%,
    rgba(12, 15, 24, 0.15) 30%,
    rgba(12, 15, 24, 0.45) 65%,
    rgba(12, 15, 24, 0.85) 100%
  );
}

.backdrop.strong {
  opacity: 0.55;
}

body.night .backdrop {
  display: none;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

a {
  color: inherit;
}

/* ------------------------------ Layout ----------------------------- */

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 110px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Läuft die App vom Homescreen, reicht der Inhalt unter die
     Statusleiste des Telefons. env(safe-area-inset-*) hält den Platz
     frei – im Browser ist der Wert 0, dort ändert sich nichts. */
  padding: calc(14px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right))
           14px calc(20px + env(safe-area-inset-left));
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}

.brand img {
  height: 22px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  filter: var(--logo-filter);
  opacity: var(--logo-opacity);
}

.brand h1 {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.17em;
  line-height: 1;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

main {
  padding: 24px calc(20px + env(safe-area-inset-right)) 0 calc(20px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.nav-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
}

.nav button {
  flex: 1;
  padding: 16px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  border-top: 2px solid transparent;
}

.nav button.on {
  color: var(--accent);
  border-top-color: var(--accent);
}

/* ------------------------------ Bausteine -------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.card.hi {
  background: var(--surface-hi);
}

.card.accent {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.label {
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 12px;
}

.body {
  font-size: 14.5px;
  line-height: 1.7;
  margin: 0;
}

.body.dim {
  color: var(--muted);
}

.num {
  font-variant-numeric: tabular-nums;
}

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}

.chip.rec {
  border-color: var(--muted);
  color: var(--text);
}

.chip.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.big {
  font-size: 42px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.big.sm {
  font-size: 34px;
}

.warn {
  font-size: 14px;
  line-height: 1.7;
  color: var(--warn);
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.segmented {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.segmented button {
  flex: 1;
  padding: 10px 4px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.segmented button.on {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------- Ergebnis und Feinabstimmung ------------------ */

.hint {
  font-size: 11.5px;
  color: var(--accent);
}

.val {
  font-size: 11.5px;
  color: var(--text);
}

.auto-btn {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 12px;
}

.auto-btn.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.card.controls .label {
  margin-bottom: 12px;
}

.ev-meter {
  position: relative;
  height: 26px;
  margin: 4px 0 10px;
}

.ev-track {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    var(--warn) 0%,
    var(--line) 42%,
    var(--line) 58%,
    var(--warn) 100%
  );
  opacity: 0.7;
}

.ev-center {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 1px;
  height: 14px;
  background: var(--muted);
  opacity: 0.6;
}

.ev-mark {
  position: absolute;
  top: 6px;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--accent);
  transition: left 0.12s linear;
}

.status {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 6px;
}

.status.ok {
  color: var(--accent);
}

.status.off {
  color: var(--warn);
}

/* ------------------------------ Regler ----------------------------- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 100%;
  margin: 0;
  height: 34px;
  touch-action: pan-y;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 24px;
  width: 24px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

input[type="range"]::-moz-range-thumb {
  height: 24px;
  width: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

/* ------------------------------ Mond ------------------------------- */

.moon-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.moon-block svg {
  filter: var(--moon-filter);
}

.moon-name {
  font-size: 20px;
  font-weight: 300;
  margin: 14px 0 0;
}

.moon-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
  font-variant-numeric: tabular-nums;
}

body.night .frame {
  background: #0a0304;
}

.frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0f18;
  overflow: hidden;
}

.frame .caption {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.frame .moon-holder {
  display: flex;
  align-items: center;
  justify-content: center;
  /* kurz genug, dass der Regler direkt reagiert, lang genug,
     um die 10-mm-Schritte weich zu überblenden */
  transition: width 0.12s linear;
  will-change: width;
}

/* ------------------------------ Wissen ----------------------------- */

.sheet {
  border: 1px solid var(--accent);
  border-radius: 16px;
  overflow: hidden;
}

.sheet-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.sheet-body {
  background: var(--surface);
}

.sheet-item {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.sheet-item .row {
  margin-bottom: 6px;
}

.sheet-item .t {
  font-size: 14px;
  font-weight: 700;
}

.sheet-item .v {
  font-size: 12.5px;
  color: var(--accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sheet-item p {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-item {
  width: 100%;
  text-align: left;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.chapter-item .nr {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

.chapter-item.done .nr {
  color: var(--accent);
}

.chapter-item .title {
  display: block;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.3;
}

.chapter-item .teaser {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 4px;
}

.article h2 {
  font-size: 27px;
  font-weight: 300;
  line-height: 1.2;
  margin: 10px 0 0;
}

.article .kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0;
}

.section h3 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 8px;
}

.section p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
  margin: 0;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wide-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
}

.wide-btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.back-btn {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
}

/* ------------------------------ Hilfe ------------------------------ */

.faq {
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

.faq-head {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-size: 15px;
  line-height: 1.4;
}

.faq-head .sign {
  color: var(--accent);
  font-size: 18px;
  line-height: 1.2;
}

.faq p {
  padding: 0 20px 20px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--muted);
  margin: 0;
}

/* ------------------------------ Footer ----------------------------- */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 32px 0 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer img {
  height: 20px;
  width: auto;
  max-width: 200px;
  opacity: 0.55;
  filter: var(--logo-filter);
}

.footer .cta {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 300px;
  margin: 0;
}

.footer .links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer .links a {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  text-decoration: none;
}

.footer .tag {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
  opacity: 0.6;
  margin: 0;
}

.footer .ver {
  font-size: 10.5px;
  color: var(--muted);
  opacity: 0.45;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ Update ----------------------------- */

.updates ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.updates li {
  font-size: 14px;
  line-height: 1.65;
}

.updates .wide-btn {
  margin-top: 16px;
  width: auto;
  padding: 10px 16px;
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

/* ------------------------------ Zugang ----------------------------- */

.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: calc(32px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right))
           calc(32px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.gate img {
  height: 26px;
  width: auto;
  max-width: 240px;
  filter: var(--logo-filter);
}

.gate h1 {
  font-size: 26px;
  font-weight: 300;
  margin: 0;
}

.gate p {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
}

.gate input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gate .err {
  color: var(--warn);
  font-size: 13.5px;
  min-height: 20px;
  margin: 0;
}

.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
