:root {
  --bg: #f4f5f8; --fg: #14161b; --card: #fff; --line: #d9dce3; --accent: #3d5fe0;
  --muted: #5f6573; --ready-bg: #a9b6ea;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111318; --fg: #e8eaf0; --card: #1b1e26; --line: #2c303b; --accent: #6b8cff;
          --muted: #9aa0ad; --ready-bg: #3a4672; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding: var(--safe-top) var(--safe-r) var(--safe-bot) var(--safe-l);
}
.view { height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* Eingaben mind. 16px, sonst zoomt iOS beim Fokus */
input, button { font: inherit; font-size: 16px; }
input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
        background: var(--card); color: var(--fg); }
button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px;
         background: var(--accent); color: #fff; touch-action: manipulation; }
button:disabled { opacity: .5; }

#login { justify-content: center; align-items: center; padding: 16px; }
#login-form { width: min(360px, 100%); display: grid; gap: 12px; }
#login-msg { min-height: 1.4em; margin: 0; color: #d33; }
header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
         padding: 4px 8px; border-bottom: 1px solid var(--line); }
header #heading { font-weight: 600; text-align: center; }
header #back { justify-self: start; }
header #logout { justify-self: end; grid-column: 3; }
button.plain { background: none; color: var(--accent); padding: 0 8px; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0; min-height: 1.4em; }

/* Liste */
#texts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { width: 100%; text-align: left; display: grid; gap: 2px; padding: 12px 14px;
        background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.item:active { background: var(--line); }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-info { font-size: 13px; color: var(--muted); }

/* Player */
#player-view { display: flex; flex-direction: column; gap: 12px; }
#title { font-size: 21px; line-height: 1.3; margin: 8px 0 0; overflow-wrap: anywhere; }
.timeline { margin-top: 12px; }
#seek { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; padding: 0;
        border: 0; border-radius: 3px; margin: 14px 0;
        background: linear-gradient(to right, var(--accent) var(--played, 0%),
          var(--ready-bg) var(--played, 0%), var(--ready-bg) var(--ready, 0%),
          var(--line) var(--ready, 0%)); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px;
        border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }
.times { display: flex; justify-content: space-between; font-size: 13px;
         color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 8px 0; }
.controls button { width: 64px; height: 64px; border-radius: 50%; padding: 0;
                   background: var(--card); color: var(--fg); border: 1px solid var(--line);
                   display: grid; place-content: center; line-height: 1; font-size: 20px; }
.controls button .big { font-size: 24px; }
.controls button small { font-size: 11px; color: var(--muted); }
.controls button.primary { width: 80px; height: 80px; font-size: 28px;
                           background: var(--accent); color: #fff; border: 0; }
.speed { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.speed .hint { width: 100%; text-align: center; }
.speed button { min-width: 52px; padding: 0 10px; background: var(--card); color: var(--fg);
                border: 1px solid var(--line); }
.speed button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
