/* Kino — Web. Apple-Look: Systemschrift, Systemfarben, Hell/Dunkel nach Gerät. */
:root {
  --bg: #ffffff;
  --bg2: #f2f2f7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --label: #000000;
  --label2: rgba(60, 60, 67, 0.6);
  --label3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.29);
  --tint: #007aff;
  --red: #ff3b30;
  --bar: rgba(249, 249, 249, 0.82);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 18px rgba(0, 0, 0, 0.08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --gutter: 20px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg2: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --label: #ffffff;
    --label2: rgba(235, 235, 245, 0.6);
    --label3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.65);
    --tint: #0a84ff;
    --red: #ff453a;
    --bar: rgba(22, 22, 23, 0.8);
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--label); }
body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

#app { padding-bottom: calc(96px + var(--safe-b)); }
.page { max-width: 1280px; margin: 0 auto; padding: calc(var(--safe-t) + 12px) var(--gutter) 0; }
.large-title {
  font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.01em;
  margin: 28px 0 8px;
}
.header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.header-row .link { color: var(--tint); font-size: 17px; margin-bottom: 14px; }

/* Regale */
.shelf { margin-top: 26px; }
.shelf h2 { font-size: 22px; line-height: 28px; font-weight: 700; margin: 0 0 10px; letter-spacing: 0.005em; }
.row {
  display: grid; grid-auto-flow: column; gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
  scroll-padding: 0 var(--gutter);
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row.posters { grid-auto-columns: 132px; }
.row.wide { grid-auto-columns: 272px; }
@media (min-width: 700px) {
  .row.posters { grid-auto-columns: 164px; }
  .row.wide { grid-auto-columns: 320px; }
}

.card { display: block; min-width: 0; }
.art {
  position: relative; overflow: hidden; border-radius: 10px;
  background: var(--fill); box-shadow: var(--shadow);
}
.art img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
.art img.loaded { opacity: 1; }
.art.poster { aspect-ratio: 2 / 3; }
.art.thumb { aspect-ratio: 16 / 9; }
.art .fallback {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 10px;
  text-align: center; font-size: 13px; color: var(--label2);
}
.progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.progress i { display: block; height: 100%; background: #fff; }
.card .t { font-size: 15px; line-height: 20px; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { font-size: 13px; line-height: 18px; color: var(--label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:active .art { transform: scale(.97); transition: transform .12s ease; }

/* Raster */
.grid {
  display: grid; gap: 18px 12px; margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* Segmente */
.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--fill); border-radius: 9px; padding: 2px; margin: 4px 0 6px;
}
.segmented button { padding: 6px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; }
.segmented button.on { background: var(--bg); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }
@media (prefers-color-scheme: dark) { .segmented button.on { background: #636366; } }

/* Suche */
.searchfield {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px;
  background: var(--fill); border-radius: 10px; margin-top: 4px;
}
.searchfield svg { width: 18px; height: 18px; stroke: var(--label2); fill: none; stroke-width: 2; flex: none; }
.searchfield input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--label);
  font: inherit; font-size: 17px;
}
.searchfield input::placeholder { color: var(--label2); }

.empty { color: var(--label2); text-align: center; padding: 60px 20px; font-size: 15px; }

/* Detail */
.hero { position: relative; margin: 0 calc(var(--gutter) * -1); aspect-ratio: 16 / 9; max-height: 62vh; overflow: hidden; background: var(--bg2); }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, var(--bg)); }
.back {
  position: fixed; z-index: 20; top: calc(var(--safe-t) + 10px); left: 12px;
  width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.back svg { width: 20px; height: 20px; stroke: var(--tint); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.detail-head { position: relative; margin-top: -56px; z-index: 1; }
.detail-head h1 { font-size: 30px; line-height: 36px; font-weight: 700; margin: 0; letter-spacing: 0.005em; }
.meta { color: var(--label2); font-size: 15px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.actions { display: flex; gap: 10px; margin: 18px 0 16px; }
.btn {
  height: 50px; padding: 0 22px; border-radius: 12px; font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.primary { background: var(--label); color: var(--bg); flex: 1; max-width: 360px; }
.btn.secondary { background: var(--fill); color: var(--label); }
.btn:active { opacity: .7; }
.overview { font-size: 15px; line-height: 21px; color: var(--label); max-width: 70ch; margin: 0 0 8px; }
.people { font-size: 13px; color: var(--label2); margin: 10px 0 0; max-width: 70ch; }

/* Episoden */
.episodes { margin-top: 12px; border-top: .5px solid var(--sep); }
.ep { display: grid; grid-template-columns: 148px 1fr; gap: 12px; padding: 12px 0; border-bottom: .5px solid var(--sep); align-items: start; }
@media (min-width: 700px) { .ep { grid-template-columns: 220px 1fr; gap: 16px; } }
.ep .t { font-size: 15px; font-weight: 600; margin: 0; }
.ep .s { font-size: 13px; color: var(--label2); margin-top: 2px; }
.ep p { font-size: 13px; line-height: 18px; color: var(--label2); margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep .watched { color: var(--tint); }

/* Tab-Leiste */
.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 0 calc(var(--safe-b) + 4px);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; color: var(--label2); font-size: 10px; font-weight: 500; padding: 2px 0; }
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tabbar a.on { color: var(--tint); }
.tabbar a.on svg { stroke-width: 2.1; }
@media (min-width: 900px) {
  .tabbar { top: 0; bottom: auto; padding: calc(var(--safe-t) + 6px) calc(50% - 240px) 6px; border-top: 0; border-bottom: .5px solid var(--sep); }
  .tabbar a { grid-auto-flow: column; align-items: center; gap: 6px; font-size: 13px; }
  .tabbar svg { width: 20px; height: 20px; }
  #app { padding-top: 52px; padding-bottom: 40px; }
  .back { top: calc(var(--safe-t) + 62px); }
}

/* Anmeldung */
.login { position: fixed; inset: 0; overflow-y: auto; display: grid; place-items: center; padding: 24px var(--gutter) calc(24px + var(--safe-b)); background: var(--bg2); }
.login-box { width: 100%; max-width: 380px; text-align: center; }
.login-icon { width: 76px; height: 76px; border-radius: 18px; margin: 0 auto 16px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.login h1 { font-size: 28px; font-weight: 700; margin: 0; }
.login .sub { color: var(--label2); font-size: 15px; margin: 6px 0 26px; }
.group { background: var(--bg); border-radius: 12px; overflow: hidden; text-align: left; }
@media (prefers-color-scheme: dark) { .group { background: #2c2c2e; } }
.group input {
  display: block; width: 100%; height: 48px; border: 0; outline: 0; padding: 0 16px;
  background: none; color: var(--label); font: inherit; font-size: 17px;
}
.group input + input { border-top: .5px solid var(--sep); }
.login .btn { width: 100%; max-width: none; margin-top: 16px; }
.login .btn.primary { background: var(--tint); color: #fff; }
.login .alt { display: block; width: 100%; margin-top: 14px; color: var(--tint); font-size: 15px; }
.login .err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 10px; }
.code {
  font: 600 40px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.18em;
  background: var(--bg); border-radius: 12px; padding: 22px 0; margin: 4px 0 12px;
}
@media (prefers-color-scheme: dark) { .code { background: #2c2c2e; } }
.hint { font-size: 13px; color: var(--label2); line-height: 18px; }

/* Einstellungen */
.list { background: var(--bg2); border-radius: 12px; overflow: hidden; margin-top: 24px; }
.list .item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 17px; }
.list .item + .item { border-top: .5px solid var(--sep); }
.list .item span:last-child { color: var(--label2); }
.list button.item { width: 100%; color: var(--red); justify-content: center; }

/* Player */
.player { position: fixed; inset: 0; z-index: 100; background: #000; display: grid; place-items: center; }
.player video { width: 100%; height: 100%; background: #000; }
.player-close {
  position: absolute; top: calc(var(--safe-t) + 14px); left: 14px; width: 36px; height: 36px; border-radius: 18px;
  display: grid; place-items: center; background: rgba(40,40,40,.6);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.player-close svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; fill: none; }

.spinner { width: 28px; height: 28px; margin: 80px auto; border-radius: 50%; border: 3px solid var(--fill-strong); border-top-color: var(--label2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
