:root {
  --bg: #0d1117; --bg2: #161b22; --bg3: #21262d; --line: #30363d; --fg: #e6edf3; --dim: #8b949e;
  --acc: #2f81f7; --acc2: #1f6feb; --ok: #3fb950; --warn: #d29922; --bad: #f85149; --r: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--acc); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--bg3); border-radius: 8px; padding: 7px 14px; }
button:hover { border-color: var(--dim); }
button.primary { background: var(--acc2); border-color: var(--acc2); color: #fff; }
button.primary:hover { background: var(--acc); }
button.danger { color: var(--bad); }
button.ghost { background: none; border-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=search], input[type=url], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc2); border-color: transparent; }
label { display: block; margin: 10px 0 4px; color: var(--dim); font-size: 13px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--bg3); color: var(--dim); border: 1px solid var(--line); }
.badge.new { background: #3d2e00; color: #f2cc60; border-color: #6e5100; }
.badge.ok { background: #0f2e18; color: var(--ok); border-color: #1f6f33; }
.badge.bad { background: #3a1214; color: var(--bad); border-color: #6e1d20; }

/* Kopfzeile */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: rgba(13,17,23,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
header.top .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-right: 14px; color: var(--fg); }
header.top .logo img { width: 26px; height: 26px; }
header.top nav a { color: var(--dim); padding: 6px 12px; border-radius: 8px; }
header.top nav a.on, header.top nav a:hover { color: var(--fg); background: var(--bg3); }
header.top .search { margin-left: auto; width: 260px; position: relative; }
.vpndot { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); color: var(--dim); }
.vpndot i { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.vpndot.ok i { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.vpndot.warn i { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.searchres { position: absolute; right: 0; top: 42px; width: 420px; max-height: 70vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: 0 10px 30px #0008; }
.searchres h4 { margin: 8px 6px 4px; font-size: 12px; color: var(--dim); text-transform: uppercase; }
.searchres .it { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 6px; cursor: pointer; }
.searchres .it:hover { background: var(--bg3); }
.searchres img { width: 34px; height: 34px; object-fit: contain; border-radius: 4px; background: var(--bg); }

main { padding: 18px; max-width: 1700px; margin: 0 auto; }

/* Anmeldung */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 360px; }
.login h1 { font-size: 22px; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; }
.err { color: var(--bad); min-height: 20px; margin-top: 8px; font-size: 14px; }

/* Live-TV */
.live { display: grid; grid-template-columns: 220px 360px 1fr; gap: 14px; height: calc(100vh - 92px); }
.live .col { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.cats a { display: flex; justify-content: space-between; padding: 8px 12px; color: var(--fg); border-left: 3px solid transparent; }
.cats a:hover { background: var(--bg3); }
.cats a.on { background: var(--bg3); border-left-color: var(--acc); }
.cats a span { color: var(--dim); font-size: 12px; }
.cats .sep { height: 1px; background: var(--line); margin: 6px 0; }
.chans .ch { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #ffffff08; }
.chans .ch:hover { background: var(--bg3); }
.chans .ch.on { background: #1f6feb33; }
.chans .ch img, .chans .ch .noimg { width: 46px; height: 34px; object-fit: contain; flex: none; border-radius: 4px; background: #0005; }
.chans .ch .t { flex: 1; min-width: 0; }
.chans .ch .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.chans .ch .p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--dim); }
.bar { height: 3px; background: var(--bg3); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--acc); }
.star { background: none; border: 0; padding: 4px; color: var(--dim); font-size: 17px; line-height: 1; }
.star.on { color: #f2cc60; }
.chans .filter { position: sticky; top: 0; padding: 8px; background: var(--bg2); border-bottom: 1px solid var(--line); z-index: 2; }
.stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; overflow: auto; }
.screen { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 16/9; width: 100%; max-height: 68vh; }
.screen video { width: 100%; height: 100%; background: #000; display: block; }
.screen .msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--dim); pointer-events: none; }
.screen .msg b { color: var(--fg); display: block; font-size: 17px; margin-bottom: 6px; }
.spinner { width: 42px; height: 42px; border: 4px solid #fff3; border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.nowinfo { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.nowinfo h2 { margin: 0; font-size: 19px; display: flex; gap: 10px; align-items: center; }
.nowinfo .prog { margin-top: 10px; }
.nowinfo .list { margin-top: 12px; max-height: 260px; overflow: auto; }
.nowinfo .list div { display: flex; gap: 12px; padding: 5px 0; border-top: 1px solid #ffffff08; font-size: 14px; }
.nowinfo .list time { color: var(--dim); width: 48px; flex: none; }
.nowinfo .list .cur { color: var(--acc); }

/* Raster Filme/Serien */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 180px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.tile { cursor: pointer; position: relative; }
.tile .pic { aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; background: var(--bg3); position: relative; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.tile:hover .pic img { transform: scale(1.04); }
.tile .pic .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center; color: var(--dim); font-size: 13px; }
.tile .n { margin-top: 6px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .y { font-size: 12px; color: var(--dim); }
.tile .bar { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 0; height: 4px; }
.tile .fav { position: absolute; top: 6px; right: 6px; color: #f2cc60; text-shadow: 0 0 4px #000; }
.tile.wide .pic { aspect-ratio: 16/9; }
.shelf { margin-bottom: 26px; }
.shelf h2 { font-size: 17px; margin: 0 0 10px; }
.shelf .scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.shelf .scroller.wide { grid-auto-columns: 260px; }
.chip-ch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; text-align: center; font-size: 13px; }
.chip-ch img { width: 90px; height: 60px; object-fit: contain; }
.chip-ch:hover { border-color: var(--dim); }
.more { display: block; margin: 20px auto; }

/* Detail-Fenster */
.modal { position: fixed; inset: 0; background: #000b; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal .box { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; width: min(1000px, 100%); max-height: 92vh; overflow: auto; position: relative; }
.modal .close { position: absolute; top: 10px; right: 10px; z-index: 3; background: #000a; border: 0; font-size: 20px; border-radius: 50%; width: 36px; height: 36px; padding: 0; }
.detail .hero { position: relative; min-height: 240px; background: var(--bg3) center/cover no-repeat; }
.detail .hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 20%, var(--bg2)); }
.detail .head { display: flex; gap: 22px; padding: 0 24px; margin-top: -150px; position: relative; z-index: 2; }
.detail .head img { width: 170px; border-radius: 8px; box-shadow: 0 6px 20px #000a; flex: none; aspect-ratio: 2/3; object-fit: cover; background: var(--bg3); }
.detail .head h1 { margin: 90px 0 6px; font-size: 26px; }
.detail .head .noposter { width: 170px; aspect-ratio: 2/3; border-radius: 8px; background: var(--bg3) url(/icon.svg) center/40% no-repeat; flex: none; opacity: .6; }
.stats > .dim { grid-column: 1 / -1; }
.detail .body { padding: 18px 24px 24px; }
.detail .meta { color: var(--dim); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.seasons { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 10px; }
.seasons button.on { background: var(--acc2); border-color: var(--acc2); color: #fff; }
.ep { display: flex; gap: 14px; padding: 10px; border-radius: 8px; cursor: pointer; align-items: center; }
.ep:hover { background: var(--bg3); }
.ep .th { width: 150px; aspect-ratio: 16/9; border-radius: 6px; background: var(--bg3) center/cover; flex: none; position: relative; overflow: hidden; }
.ep .th .bar { position: absolute; bottom: 0; left: 0; right: 0; margin: 0; }
.ep .t { flex: 1; min-width: 0; }
.ep .t p { margin: 3px 0 0; font-size: 13px; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep .seen { color: var(--ok); font-size: 18px; }

/* Video-Spieler (Filme/Folgen) */
.vod { position: fixed; inset: 0; z-index: 60; background: #000; }
.vod video { width: 100%; height: 100%; display: block; }
.vod .ui { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; transition: opacity .25s; background: linear-gradient(#000a, transparent 20%, transparent 70%, #000c); }
.vod.idle .ui { opacity: 0; cursor: none; }
.vod .tb { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.vod .tb h2 { margin: 0; font-size: 18px; flex: 1; }
.vod .cb { padding: 10px 20px 18px; }
.vod .cb .row { gap: 14px; }
.vod button.ic { background: none; border: 0; font-size: 22px; padding: 4px 8px; }
.seek { position: relative; height: 18px; cursor: pointer; display: flex; align-items: center; }
.seek .tr { position: absolute; left: 0; right: 0; height: 5px; background: #fff3; border-radius: 3px; }
.seek .bf { position: absolute; left: 0; height: 5px; background: #fff5; border-radius: 3px; }
.seek .pl { position: absolute; left: 0; height: 5px; background: var(--acc); border-radius: 3px; }
.seek .kn { position: absolute; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; }
.seek .tip { position: absolute; bottom: 20px; transform: translateX(-50%); background: #000c; padding: 2px 6px; border-radius: 4px; font-size: 12px; display: none; }
.seek:hover .tip { display: block; }
.vod .center-msg { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; padding: 30px; }
.vod select { width: auto; background: #0008; }
.vod input[type=range] { width: 100px; }
.upnext { position: absolute; right: 24px; bottom: 100px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; width: 300px; }

/* TV-Programm */
.guide { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg2); height: calc(100vh - 160px); position: relative; }
.guide .g-row { display: flex; border-bottom: 1px solid var(--line); height: 58px; }
.guide .g-ch { position: sticky; left: 0; z-index: 3; width: 190px; flex: none; background: var(--bg2); border-right: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 8px; cursor: pointer; font-size: 13px; }
.guide .g-ch img { width: 42px; height: 30px; object-fit: contain; flex: none; }
.guide .g-ch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide .g-track { position: relative; flex: none; }
.guide .g-p { position: absolute; top: 4px; bottom: 4px; background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.guide .g-p small { display: block; color: var(--dim); font-size: 11px; }
.guide .g-p.now { background: #1f6feb33; border-color: var(--acc2); }
.guide .g-p:hover { border-color: var(--dim); }
.guide .g-head { position: sticky; top: 0; z-index: 4; display: flex; height: 30px; background: var(--bg); border-bottom: 1px solid var(--line); }
.guide .g-head .g-ch { background: var(--bg); cursor: default; }
.guide .g-head .tick { position: absolute; top: 6px; font-size: 12px; color: var(--dim); border-left: 1px solid var(--line); padding-left: 5px; height: 24px; }
.guide .nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; pointer-events: none; }

/* Einstellungen */
.settings { display: grid; grid-template-columns: 210px 1fr; gap: 18px; }
.settings nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--fg); }
.settings nav a.on { background: var(--bg3); }
.settings nav a:hover { background: var(--bg3); }
.settings .pane { min-width: 0; max-width: 980px; }
.list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list .li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.list .li:last-child { border-bottom: 0; }
.list .li.dragging { opacity: .4; }
.list .li.over { box-shadow: inset 0 2px 0 var(--acc); }
.list .li .grip { cursor: grab; color: var(--dim); user-select: none; padding: 0 4px; }
.list .li img { width: 40px; height: 28px; object-fit: contain; }
.list .li input[type=text] { padding: 4px 8px; }
.list .li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .li.off .nm { color: var(--dim); text-decoration: line-through; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button.on { background: var(--acc2); border-color: var(--acc2); color: #fff; }
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.langs label { margin: 0; display: flex; gap: 10px; align-items: center; padding: 9px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; color: var(--fg); cursor: pointer; font-size: 14px; }
.langs label.on { border-color: var(--acc2); background: #1f6feb22; }
.langs label small { color: var(--dim); margin-left: auto; font-size: 12px; text-align: right; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--acc2); flex: none; }
textarea { min-height: 160px; font-family: ui-monospace, monospace; font-size: 13px; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--bg3); border: 1px solid var(--line); border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--dim); border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--acc2); border-color: var(--acc2); }
.switch input:checked + span::before { transform: translateX(18px); background: #fff; }

/* VPN-Seite */
.vpnhero { display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--bg2); }
.vpnhero .big { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; flex: none; }
.vpnhero.ok { border-color: #1f6f33; background: linear-gradient(90deg, #0f2e18, var(--bg2)); }
.vpnhero.ok .big { background: #1f6f33; box-shadow: 0 0 24px #3fb95066; }
.vpnhero.warn { border-color: #6e5100; background: linear-gradient(90deg, #3d2e00, var(--bg2)); }
.vpnhero.warn .big { background: #6e5100; }
.vpnhero.bad { border-color: #6e1d20; background: linear-gradient(90deg, #3a1214, var(--bg2)); }
.vpnhero.bad .big { background: #6e1d20; }
.vpnhero h2 { margin: 0 0 4px; font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.stat.ok::before { background: var(--ok); } .stat.warn::before { background: var(--warn); } .stat.bad::before { background: var(--bad); }
.stat .k { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .v small { font-size: 14px; font-weight: 400; color: var(--dim); }
.stat.ok .v { color: var(--ok); } .stat.warn .v { color: var(--warn); } .stat.bad .v { color: var(--bad); }
.stat .s { font-size: 12px; color: var(--dim); margin-top: 2px; }
.gauge { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.gauge i { display: block; height: 100%; transition: width .4s; }
.stat.ok .gauge i { background: var(--ok); } .stat.warn .gauge i { background: var(--warn); } .stat.bad .gauge i { background: var(--bad); }
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 26px; text-align: center; color: var(--dim); cursor: pointer; }
.drop.over { border-color: var(--acc); color: var(--fg); background: #1f6feb11; }
ol.steps { padding-left: 20px; margin: 6px 0; } ol.steps li { margin: 4px 0; }

/* Meldungen */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--bg3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px #0008; max-width: 90vw; }
.toast.bad { border-color: var(--bad); }
.toast.ok { border-color: var(--ok); }
.empty { text-align: center; color: var(--dim); padding: 50px 20px; }
.empty b { color: var(--fg); display: block; font-size: 18px; margin-bottom: 6px; }

@media (max-width: 1100px) {
  .live { grid-template-columns: 1fr; height: auto; }
  .live .col { max-height: 320px; }
  .live .stage { order: -1; }
  .settings { grid-template-columns: 1fr; }
  header.top .search { width: 160px; }
}
@media (max-width: 700px) {
  header.top { flex-wrap: wrap; }
  header.top nav { order: 3; width: 100%; overflow-x: auto; white-space: nowrap; }
  .searchres { width: 92vw; }
  .detail .head { flex-direction: column; margin-top: -80px; }
  .detail .head h1 { margin-top: 0; }
}
