/* =========================================================
   BASIS — gilt auf allen Seiten
   ========================================================= */

/* --- Farben ------------------------------------------- */
:root {
  --seiten-bg: linear-gradient(170deg, #cfe3ff, #ffe9cc);  /* <- überschreibbar */
  --text:   #1c1c1e;
  --sub:    rgba(28,28,30,.6);
  --accent: #2f63d8;
  --card:   #ffffff;
  --line:   rgba(0,0,0,.08);
  --shadow: rgba(0,0,0,.18);
  --dock-bg:     rgba(255,255,255,.45);
  --dock-stroke: rgba(255,255,255,.55);
  --dock-hoehe:  96px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --seiten-bg: linear-gradient(170deg, #17203a, #0f1220);
    --text: #f2f2f7;
    --sub: rgba(242,242,247,.6);
    --accent: #86adff;
    --card: #1b1e2c;
    --line: rgba(255,255,255,.08);
    --shadow: rgba(0,0,0,.5);
    --dock-bg: rgba(120,120,140,.24);
    --dock-stroke: rgba(255,255,255,.14);
  }
}

/* --- Rahmen ------------------------------------------- */
:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  min-height: 100%;
  padding-bottom: var(--dock-hoehe);   /* Platz, damit die Bar nichts verdeckt */
  background: var(--seiten-bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Grundtypografie ---------------------------------- */
.wrap { max-width: 640px; margin: 0 auto; padding: 12px 16px 32px; }
h1 { font-size: 2rem; line-height: 1.15; margin: 6px 0; }
h2 { font-size: 1.25rem; margin: 1.5em 0 .4em; }
a  { color: var(--accent); }
img, video, iframe { max-width: 100%; }

/* --- App-Icons (Homescreen + Bar) --------------------- */
.app {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
button.app {
  -webkit-appearance: none; appearance: none;
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}
.app .icon {
  width: 76px;
  height: 76px;
  border-radius: 23%;
  display: grid;
  place-items: center;
  font-size: 34px;
  line-height: 1;
  background: linear-gradient(155deg, var(--c1, #8e9bff), var(--c2, #4a56d6));
  box-shadow: 0 7px 16px var(--shadow), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .12s ease;
}
.app:active .icon { transform: scale(.9); }
.app:focus-visible { outline: none; }
.app:focus-visible .icon { outline: 3px solid var(--text); outline-offset: 3px; }
.app .label {
  font-size: 12px;
  max-width: 84px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px var(--shadow);
}
/* Eigene Bilder als Icons */
.app .icon {
  position: relative;
  overflow: hidden;        /* Bild wird in die Rundung geschnitten */
}
.app .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Glanzkante über das Bild legen, damit es wie die Emoji-Icons aussieht */
.app .icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  pointer-events: none;
}

/* --- Die Bar unten ------------------------------------ */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 22px;
  padding: 12px 18px;
  border-radius: 30px;
  background: var(--dock-bg);
  border: 1px solid var(--dock-stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.dock .icon { width: 52px; height: 52px; font-size: 24px; }
.dock .app  { width: 52px; }
.dock .label { display: none; }

/* Markiert die Seite, auf der man gerade ist */
.dock [aria-current="page"] .icon { outline: 2px solid var(--text); outline-offset: 3px; }

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