/* Hörwelt – Claymorphism, touch-first, für Kinder auf Tablets */
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url(fonts/poppins-500.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url(fonts/poppins-700.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 800; font-display: swap; src: url(fonts/poppins-800.woff2) format("woff2"); }

:root {
  --primary: #3B82F6;
  --primary-deep: #1D4ED8;
  --text: #1C398E;
  --text-soft: #5B6B9A;
  --surface: #FFFFFF;
  --bg-1: #E6EEFF;
  --bg-2: #FFF1E3;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --accent: var(--primary);

  --r-lg: 32px;
  --r-md: 24px;
  --r-sm: 16px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px;

  /* Knete: weicher Außenschatten + Licht oben links + Tiefe unten rechts */
  --clay: 10px 12px 24px rgba(28, 57, 142, .16),
          inset -6px -8px 14px rgba(28, 57, 142, .10),
          inset 6px 6px 12px rgba(255, 255, 255, .85);
  --clay-pressed: 4px 4px 10px rgba(28, 57, 142, .14),
          inset -3px -4px 8px rgba(28, 57, 142, .12),
          inset 4px 4px 8px rgba(255, 255, 255, .7);
  --tap: 72px;

  --bg-base: #F4F6FF;
  --soft: #EEF2FF;          /* Nummernkreise, Emoji-Knöpfe */
  --soft-2: #F7F9FF;        /* Listen im Elternbereich */
  --track-bg: #E3E9FB;      /* Fortschrittsbalken-Hintergrund */
  --line: #D6DEF7;
  --player-bg: rgba(255, 255, 255, .96);
  --hero-end: var(--primary-deep);
  --badge-shadow: 4px 5px 10px rgba(28, 57, 142, .25);
  --img-filter: none;
  color-scheme: light;
}

/* Dunkel: blendfrei fürs Auto und abends – tiefes Nachtblau, gedämpfte Flächen */
:root[data-theme="dark"] {
  --text: #E6ECFF;
  --text-soft: #9AA8CF;
  --surface: #1A2440;
  --bg-base: #0A0F1E;
  --bg-1: #101A35;
  --bg-2: #181430;
  --soft: #26314F;
  --soft-2: #212B47;
  --track-bg: #2A3556;
  --line: #34416A;
  --player-bg: rgba(18, 25, 46, .97);
  --hero-end: #0F1A3A;
  --success: #22C55E;
  --clay: 10px 12px 24px rgba(0, 0, 0, .5),
          inset -6px -8px 14px rgba(0, 0, 0, .35),
          inset 6px 6px 12px rgba(255, 255, 255, .06);
  --clay-pressed: 4px 4px 10px rgba(0, 0, 0, .5),
          inset -3px -4px 8px rgba(0, 0, 0, .4),
          inset 4px 4px 8px rgba(255, 255, 255, .05);
  --badge-shadow: 4px 5px 10px rgba(0, 0, 0, .45);
  --img-filter: brightness(.88);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Poppins", system-ui, sans-serif; font-weight: 500;
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% 0%, var(--bg-1), transparent 60%),
              radial-gradient(1000px 700px at 100% 100%, var(--bg-2), transparent 60%), var(--bg-base);
  background-attachment: fixed;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: manipulation;
}
body.kid { overflow-x: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid var(--primary); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

#app { min-height: 100%; padding: var(--s-5) var(--s-5) var(--s-5); max-width: 1400px; margin: 0 auto; }

/* ---------------------------------------------------------------- Clay ---- */
.clay { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--clay); }
.press { transition: transform .12s ease, box-shadow .12s ease; }
.press:active { transform: scale(.96); box-shadow: var(--clay-pressed); }

.round-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  display: inline-grid; place-items: center; background: var(--surface); box-shadow: var(--clay);
}
.round-btn svg { width: 36px; height: 36px; }
.round-btn.primary { background: var(--accent); color: #fff; }
.round-btn.big { width: 104px; height: 104px; }
.round-btn.big svg { width: 52px; height: 52px; }

/* ------------------------------------------------------------- Kopfzeile -- */
.topbar { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-5); min-height: var(--tap); }
.topbar h1 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; margin: 0; flex: 1; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.avatar-chip { width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center;
  font-size: 40px; box-shadow: var(--clay); flex: none; }

/* Elternmodus-Schloss: unauffällig, 3 s halten */
.lock { position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text-soft); opacity: .45; flex: none; }
.lock svg.icon { width: 26px; height: 26px; }
.lock .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.lock .ring circle { fill: none; stroke: var(--primary); stroke-width: 5; stroke-dasharray: 163; stroke-dashoffset: 163; }
.lock.holding { opacity: 1; }
.lock.holding .ring circle { transition: stroke-dashoffset 3s linear; stroke-dashoffset: 0; }

/* -------------------------------------------------------------- Profile --- */
.who { text-align: center; padding-top: 6vh; }
.who h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 800; margin: 0 0 var(--s-6); }
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-6); }
.profile-btn { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.profile-btn .face { width: 180px; height: 180px; border-radius: 50%; display: grid; place-items: center;
  font-size: 96px; box-shadow: var(--clay); }
.profile-btn span { font-size: 28px; font-weight: 800; }

/* --------------------------------------------------------------- Kacheln -- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s-5); }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.tile { display: flex; flex-direction: column; text-align: left; padding: var(--s-3); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--clay); position: relative; }
.tile .art { aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; position: relative;
  display: grid; place-items: center; }
.tile .art img, .hero .art img, .album-cover img, .player .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block; filter: var(--img-filter); }
.ph { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-weight: 800;
  font-size: 72px; text-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.tile .name { font-weight: 700; font-size: 20px; line-height: 1.2; padding: var(--s-3) var(--s-2) var(--s-1);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.badge { position: absolute; top: 10px; left: 10px; min-width: 52px; height: 52px; padding: 0 12px; border-radius: 26px;
  background: var(--surface); color: var(--text); display: grid; place-items: center; font-weight: 800;
  font-size: 22px; box-shadow: var(--badge-shadow); z-index: 1; }
.stack { position: absolute; top: 10px; right: 10px; width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; z-index: 1;
  box-shadow: var(--badge-shadow); }
.stack svg { width: 28px; height: 28px; }
.bar { height: 10px; border-radius: 5px; background: var(--track-bg); margin: var(--s-2) var(--s-2) var(--s-1); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--success); border-radius: 5px; }
.done { position: absolute; bottom: 10px; right: 10px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--success); color: #fff; display: grid; place-items: center; z-index: 1; }
.done svg { width: 28px; height: 28px; }
.tile.hidden-node { opacity: .45; }

/* ----------------------------------------------------------- Weiterhören -- */
.hero { display: flex; align-items: center; gap: var(--s-5); padding: var(--s-4); margin-bottom: var(--s-6);
  width: 100%; text-align: left; background: linear-gradient(135deg, var(--accent), var(--hero-end)); color: #fff; }
.hero .art { width: 140px; height: 140px; border-radius: var(--r-md); overflow: hidden; flex: none;
  box-shadow: 6px 8px 16px rgba(0, 0, 0, .2); }
.hero .label { font-size: 18px; opacity: .9; }
.hero .title { font-size: clamp(24px, 3vw, 34px); font-weight: 800; line-height: 1.15; }
.hero .round-btn { margin-left: auto; flex: none; color: var(--accent); }
.section-title { font-size: 24px; font-weight: 800; margin: 0 0 var(--s-4); }

/* ----------------------------------------------------------------- Album -- */
.album { display: grid; grid-template-columns: minmax(260px, 38%) 1fr; gap: var(--s-6); align-items: start; }
@media (max-width: 760px) { .album { grid-template-columns: 1fr; } }
.album-cover { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 1; box-shadow: var(--clay); position: sticky; top: 24px; }
.play-main { display: flex; align-items: center; gap: var(--s-4); width: 100%; padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg); background: var(--accent); color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: var(--clay); margin-bottom: var(--s-5); min-height: 104px; }
.play-main svg { width: 56px; height: 56px; flex: none; }
.tracks { display: flex; flex-direction: column; gap: var(--s-3); }
.track { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-4); min-height: var(--tap);
  border-radius: var(--r-md); background: var(--surface); box-shadow: var(--clay); text-align: left; font-size: 20px; }
.track .no { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--soft); font-weight: 800; }
.track .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track.current { outline: 4px solid var(--accent); }
.track.current .no { background: var(--accent); color: #fff; }
.track.past .no { background: color-mix(in srgb, var(--success) 22%, var(--surface)); color: var(--success); }

/* ---------------------------------------------------------------- Player -- */
.player { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 20; max-width: 1368px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); background: var(--player-bg); box-shadow: var(--clay); }
.player[hidden] { display: none; }
.player .thumb { width: 88px; height: 88px; border-radius: var(--r-sm); overflow: hidden; }
.player .info { min-width: 0; }
.player .pt { font-weight: 800; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .ps { color: var(--text-soft); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .seekrow { display: flex; align-items: center; gap: var(--s-2); margin-top: 2px; }
.player .seek { position: relative; flex: 1; height: 48px; display: flex; align-items: center; cursor: pointer;
  touch-action: none; }  /* Wischen spult, statt die Seite zu verschieben */
.player .seek .bar { flex: 1; margin: 0; height: 14px; border-radius: 7px; }
.player .seek .bar i { background: var(--accent); border-radius: 7px; }
.player .seek .knob { position: absolute; top: 50%; left: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border-radius: 50%; background: var(--surface); border: 5px solid var(--accent); box-shadow: var(--badge-shadow);
  pointer-events: none; transition: transform .1s ease; }
.player .seek.active .knob { transform: scale(1.25); }
.player .skip { min-width: 52px; height: 44px; border-radius: 22px; background: var(--soft); font-weight: 800; font-size: 15px; }
.player .time { font-size: 14px; color: var(--text-soft); min-width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .player .time { display: none; } }
.player .ctrls { display: flex; gap: var(--s-3); align-items: center; }
.sleep-on { color: var(--warning); font-weight: 700; }
.round-btn.small { width: 60px; height: 60px; }
.round-btn.small svg { width: 28px; height: 28px; }
.player .vol { display: flex; align-items: center; gap: var(--s-2); padding: 6px; border-radius: 40px; background: var(--soft); }
.player .volshow { display: flex; align-items: flex-end; gap: 4px; padding: 0 4px; color: var(--text); }
.player .volshow > svg { width: 30px; height: 30px; align-self: center; }
.player .volshow .bars { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.player .volshow .bars i { width: 7px; border-radius: 4px; background: var(--track-bg); }
.player .volshow .bars i.on { background: var(--accent); }
.player .volshow .bars i.half { background: color-mix(in srgb, var(--accent) 45%, var(--track-bg)); }
.player .pclose { color: var(--danger); }
@media (max-width: 1100px) { .player .thumb { display: none; } .player { grid-template-columns: 1fr auto auto auto; } }
@media (max-width: 820px) {
  .player { grid-template-columns: 1fr auto; row-gap: var(--s-2); }
  .player .info { grid-column: 1 / -1; }
  .player .ctrls { justify-self: start; }
  .player .vol { justify-self: end; }
  .player .pclose { position: absolute; top: -20px; right: -8px; }
}

/* --------------------------------------------------------------- PIN-Pad -- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(28, 57, 142, .35); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: var(--s-5); }
.pinpad { width: min(420px, 100%); padding: var(--s-6); text-align: center; }
.pinpad h2 { margin: 0 0 var(--s-2); font-weight: 800; }
.pinpad p { margin: 0 0 var(--s-4); color: var(--text-soft); min-height: 1.5em; }
.pinpad .dots { display: flex; justify-content: center; gap: var(--s-3); margin-bottom: var(--s-5); }
.pinpad .dots i { width: 20px; height: 20px; border-radius: 50%; background: var(--track-bg); }
.pinpad .dots i.on { background: var(--primary); }
.pinpad .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.pinpad .keys button { height: 76px; border-radius: var(--r-md); font-size: 30px; font-weight: 700; background: var(--surface); box-shadow: var(--clay); }
.pinpad .err { color: var(--danger); }

/* ------------------------------------------------------------ Elternmodus - */
body.admin { user-select: text; -webkit-user-select: text; }
.admin-wrap { max-width: 1100px; margin: 0 auto; }
.tabs { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.tabs button { padding: var(--s-3) var(--s-5); border-radius: 999px; background: var(--surface); box-shadow: var(--clay); font-weight: 700; min-height: 52px; }
.tabs button.on { background: var(--primary); color: #fff; }
.card { padding: var(--s-5); margin-bottom: var(--s-4); }
.card h3 { margin: 0 0 var(--s-3); font-weight: 800; }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin: var(--s-2) 0; }
.row label { min-width: 160px; color: var(--text-soft); }
.btn { padding: 12px 20px; border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--clay); font-weight: 700; min-height: 48px; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
input[type=text], input[type=password], select { font: inherit; color: var(--text); padding: 12px 14px; border-radius: var(--r-sm);
  border: 2px solid var(--line); background: var(--surface); min-height: 48px; }
input[type=range] { width: 220px; }
.emojis, .colors { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.emojis button { width: 52px; height: 52px; font-size: 30px; border-radius: 50%; background: var(--soft); }
.emojis button.on { outline: 4px solid var(--primary); }
.colors button { width: 44px; height: 44px; border-radius: 50%; }
.colors button.on { outline: 4px solid var(--text); outline-offset: 3px; }
.list { display: flex; flex-direction: column; gap: var(--s-2); }
.list .item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--soft-2); }
.list .item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.muted { color: var(--text-soft); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-weight: 700; }
.empty { text-align: center; padding: 10vh var(--s-5); color: var(--text-soft); font-size: 22px; }

/* Coversuche im Elternbereich */
.coverpick { width: min(1100px, 100%); max-height: 90vh; overflow: auto; padding: var(--s-5); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.cpick { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2); border-radius: var(--r-sm);
  background: var(--soft-2); text-align: left; font-size: 13px; color: var(--text-soft); }
.cpick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--soft); }
.cpick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Umschalter Hörbücher / Toonies */
.catswitch { display: inline-flex; gap: var(--s-2); padding: var(--s-2); border-radius: 999px; margin-bottom: var(--s-5); }
.catswitch button { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: 0 var(--s-6);
  border-radius: 999px; font-size: 24px; font-weight: 800; color: var(--text-soft); transition: background .15s ease; }
.catswitch button span { font-size: 32px; }
.catswitch button.on { background: var(--accent); color: #fff; box-shadow: var(--clay); }
@media (max-width: 640px) { .catswitch { display: flex; } .catswitch button { flex: 1; justify-content: center; padding: 0 var(--s-3); font-size: 20px; } }

/* Toonies: runde Kacheln wie Figuren */
.grid.toonies .tile { background: transparent; box-shadow: none; padding: 0; align-items: center; text-align: center; }
.grid.toonies .tile .art { border-radius: 50%; box-shadow: var(--clay); width: 100%; }
.grid.toonies .tile .name { text-align: center; }
.grid.toonies .badge { top: 4%; left: 4%; }

/* Vollbild + Schloss nebeneinander, beide klein und unauffällig */
.hold-tools { display: flex; gap: var(--s-2); flex: none; }
.lock { touch-action: none; -webkit-user-select: none; user-select: none; }
.lock.armed { color: var(--accent); transform: scale(1.15); transition: transform .15s ease; }
/* Fortlaufende Wiedergabe: Symbol mit Zahl (1–5 / ∞) */
.lock.cont { touch-action: manipulation; }
.lock.cont.on { opacity: 1; color: var(--primary); }
.lock .cbadge { position: absolute; right: 2px; bottom: 2px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 11px; background: var(--primary); color: #fff; font: 800 13px/22px Poppins, sans-serif; text-align: center; }
/* Oben links: Tastensperre + Suche */
.lock.keylock.on { opacity: 1; color: var(--accent); }
.lock.nudge { animation: nudge .6s ease; opacity: 1; }
@keyframes nudge { 0%,100% { transform: scale(1); } 30% { transform: scale(1.3); } 60% { transform: scale(.95); } }
body.keylocked.kid #app .press, body.keylocked.kid #player .press, body.keylocked.kid .seek { filter: saturate(.6); }
/* ALL neben dem Rubrik-Umschalter */
.catrow { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); flex-wrap: wrap; }
.catrow .catswitch { margin-bottom: 0; }
.allbtn { min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s-4); border-radius: 999px; font: 800 18px Poppins, sans-serif;
  color: var(--text); letter-spacing: .04em; }
.allbtn.on { background: var(--accent); color: #fff; }
@media (max-width: 640px) { .catrow .catswitch { flex: 1; } }
/* Suche */
.search-ov { place-items: start center; padding-top: 6vh; }
.searchbox { width: min(1100px, 94vw); max-height: 86vh; overflow: auto; padding: var(--s-5); border-radius: 32px; }
.searchbox .row { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.searchbox .sicon svg { width: 32px; height: 32px; }
.searchbox input { flex: 1; min-height: 64px; font: 700 26px Poppins, sans-serif; padding: 0 var(--s-4); border-radius: 20px;
  border: 2px solid var(--line); background: var(--soft); color: var(--text); }
.sresults .name small { display: block; font-size: 13px; opacity: .65; font-weight: 600; }
/* Fußzeile + Impressum */
.foot { text-align: center; font-size: 13px; color: var(--text-soft); padding: var(--s-4) var(--s-4) 170px; opacity: .8; }
.foot a { color: inherit; }
body.admin .foot { padding-bottom: var(--s-5); }
.legal { max-width: 820px; margin: var(--s-5) auto; padding: var(--s-6); border-radius: 32px; line-height: 1.6; }
.legal h1 { margin-top: 0; }
.legal h2 { font-size: 20px; margin: var(--s-5) 0 var(--s-2); }
/* ALL: Abschnitte Hörbücher / Toonies */
.grid + .section-title { margin-top: var(--s-6); }
/* Schmale Bildschirme: 5 Symbole passen in eine Zeile, Überschrift darunter */
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: var(--s-2); }
  .topbar h1 { order: 9; flex-basis: 100%; }
  .hold-tools { margin-left: auto; gap: 4px; }
  .hold-tools .lock { width: 46px; height: 46px; }
}
