:root{
  --bg:#f4f5f7; --surface:#ffffff; --surface2:#eceef2; --line:#dde0e6;
  --text:#14171c; --muted:#5f6775; --accent:#d9472b; --accent-text:#ffffff;
  --good:#1f8a5a; --radius:12px; --nav-h:58px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#101217; --surface:#191c23; --surface2:#232731; --line:#2c313c;
    --text:#e9ecf1; --muted:#9aa2b1; --accent:#ff6a4d; --accent-text:#14171c;
    --good:#4cc38a; color-scheme:dark;
  }
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--bg); color:var(--text);
  font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  padding-bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  overflow-x:hidden;
}
body.locked{overflow:hidden}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--accent)}
.muted{color:var(--muted)}
.center{text-align:center}
.pad{padding:32px 16px}
.small{font-size:13px}
[hidden]{display:none!important}

/* Kopf */
#top{
  position:sticky; top:0; z-index:20; background:var(--bg);
  border-bottom:1px solid var(--line);
}
.top-in{
  max-width:1100px; margin:0 auto; padding:10px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.brand{font-weight:700; font-size:18px; letter-spacing:-.01em}
.userbtn{
  background:none; border:1px solid var(--line); border-radius:999px;
  padding:5px 12px; max-width:50%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* Navigation */
#nav{
  position:fixed; left:0; right:0; bottom:0; z-index:20;
  background:var(--surface); border-top:1px solid var(--line);
  padding-bottom:env(safe-area-inset-bottom);
}
.nav-in{max-width:640px; margin:0 auto; display:flex}
.nav-in a{
  flex:1; min-width:0; height:var(--nav-h); display:flex; align-items:center; justify-content:center;
  text-decoration:none; color:var(--muted); font-size:14px; font-weight:600;
  border-top:2px solid transparent; white-space:nowrap;
}
.nav-in a.on{color:var(--text); border-top-color:var(--accent)}
.badge{
  display:inline-block; min-width:18px; padding:0 5px; margin-left:4px; border-radius:9px;
  background:var(--accent); color:var(--accent-text); font-size:11px; line-height:18px; text-align:center;
}

main{max-width:1100px; margin:0 auto; padding:14px 16px}
h2{font-size:20px; margin:6px 0 12px}
h3{font-size:16px; margin:18px 0 8px}

/* Segmente */
.seg{display:flex; background:var(--surface2); border-radius:10px; padding:3px; margin-bottom:14px}
.seg button{
  flex:1; min-width:0; border:0; background:none; padding:8px 6px; border-radius:8px;
  font-weight:600; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.seg button.on{background:var(--surface); color:var(--text); box-shadow:0 1px 2px rgba(0,0,0,.12)}

/* Knöpfe */
.btn{
  border:1px solid var(--line); background:var(--surface); border-radius:10px;
  padding:10px 14px; font-weight:600; min-height:42px;
}
.btn.primary{background:var(--accent); border-color:var(--accent); color:var(--accent-text)}
.btn.on{border-color:var(--accent); color:var(--accent)}
.btn.primary.on{color:var(--accent-text)}
.btn.block{width:100%}
.btn:disabled{opacity:.45; cursor:default}
.btn.danger{color:var(--accent)}
.row{display:flex; gap:8px; flex-wrap:wrap}
.row > .btn{flex:1 1 0; min-width:0}

/* Karten / Raster */
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(100px,1fr)); gap:14px 10px}
@media (min-width:700px){ .grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:18px 14px} }
.card{background:none; border:0; padding:0; text-align:left; min-width:0; align-self:start; display:block; width:100%}
.poster{
  position:relative; aspect-ratio:2/3; border-radius:10px; overflow:hidden;
  background:var(--surface2); display:flex; align-items:center; justify-content:center;
}
.poster img{width:100%; height:100%; object-fit:cover; display:block}
.poster .ph{padding:8px; font-size:12px; color:var(--muted); text-align:center; word-break:break-word}
.card .t{font-weight:600; font-size:13px; margin-top:6px; line-height:1.25;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
.card .m{font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.tag{
  position:absolute; left:6px; bottom:6px; max-width:calc(100% - 12px);
  background:rgba(0,0,0,.72); color:#fff; font-size:11px; font-weight:600;
  padding:2px 6px; border-radius:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.empty{padding:28px 12px; text-align:center; color:var(--muted)}

/* Suche */
.searchbar{position:sticky; top:53px; z-index:10; background:var(--bg); padding:2px 0 10px}
.input{
  width:100%; border:1px solid var(--line); background:var(--surface); border-radius:10px;
  padding:11px 12px; font-size:16px; min-height:44px;
}
.input:focus,select:focus{outline:2px solid var(--accent); outline-offset:-1px}
.list{display:flex; flex-direction:column; gap:8px}
.item{
  display:flex; align-items:center; gap:12px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--radius); padding:8px; min-width:0;
}
.item .thumb{width:46px; flex:none}
.item .thumb .poster{border-radius:6px}
.item .info{flex:1; min-width:0; background:none; border:0; padding:0; text-align:left}
.item .info b{display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.item .btn{flex:none; padding:8px 10px; min-height:38px; font-size:14px}

/* Zufall */
.hero{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:14px; margin-bottom:18px;
}
.hero p{margin:4px 0 12px}
.chips{display:flex; flex-wrap:wrap; gap:6px}
.chip{
  border:1px solid var(--line); background:var(--surface); border-radius:999px;
  padding:6px 12px; font-size:14px; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.chip.on{background:var(--accent); border-color:var(--accent); color:var(--accent-text)}
.field{margin-bottom:14px}
.field label{display:block; font-size:13px; font-weight:600; color:var(--muted); margin-bottom:6px}
select.input{appearance:none; -webkit-appearance:none; background-image:none}
.two{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.pick{
  display:flex; gap:14px; align-items:flex-start; background:var(--surface2);
  border-radius:var(--radius); padding:12px; margin:14px 0;
}
.pick .poster{width:96px; flex:none}
.pick .pi{min-width:0; flex:1}
.pick b{font-size:17px; display:block; word-break:break-word}

/* Detail-Blatt */
#sheet{
  position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.55);
  display:flex; align-items:flex-end; justify-content:center;
}
.sheet-in{
  background:var(--bg); width:100%; max-width:640px; max-height:92vh; max-height:92dvh; overflow-y:auto;
  border-radius:16px 16px 0 0; padding:16px 16px calc(20px + env(safe-area-inset-bottom));
  overscroll-behavior:contain;
}
@media (min-width:700px){
  #sheet{align-items:center}
  .sheet-in{border-radius:16px; max-height:88vh}
}
.sheet-head{display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:12px}
.sheet-head b{font-size:17px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.x{border:0; background:var(--surface2); border-radius:999px; padding:6px 14px; font-weight:600; flex:none}
.dt{display:flex; gap:14px; margin-bottom:14px}
.dt .poster{width:110px; flex:none}
.dt .dm{min-width:0; flex:1}
.dt h2{margin:0 0 4px; word-break:break-word}
.kv{font-size:14px; color:var(--muted); margin:2px 0}
.overview{margin:0 0 14px}
.rate{display:grid; grid-template-columns:repeat(10,minmax(0,1fr)); gap:4px; margin:6px 0 4px}
.rate button{
  border:1px solid var(--line); background:var(--surface); border-radius:8px;
  height:40px; padding:0; font-weight:700; font-size:14px; min-width:0;
}
.rate button.on{background:var(--accent); border-color:var(--accent); color:var(--accent-text)}
.friends{display:flex; flex-direction:column; gap:6px; margin-top:6px}
.friends div{
  display:flex; justify-content:space-between; gap:10px; background:var(--surface);
  border:1px solid var(--line); border-radius:10px; padding:8px 12px; font-size:14px;
}
.friends span:first-child{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.friends span:last-child{flex:none; color:var(--muted)}

/* Abstimmung */
.poll{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:14px; margin-bottom:14px}
.poll-h{display:flex; justify-content:space-between; gap:10px; align-items:baseline; margin-bottom:10px}
.poll-h b{font-size:16px; min-width:0; word-break:break-word}
.opt{
  position:relative; display:flex; align-items:center; gap:10px; width:100%;
  border:1px solid var(--line); background:var(--bg); border-radius:10px;
  padding:8px 10px; margin-bottom:6px; text-align:left; overflow:hidden; min-height:48px;
}
.opt .bar{position:absolute; left:0; top:0; bottom:0; background:var(--surface2); z-index:0}
.opt > *:not(.bar){position:relative; z-index:1}
.opt .ot{flex:1; min-width:0}
.opt .ot b{display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:14px}
.opt .ot span{display:block; font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.opt .n{flex:none; font-weight:700}
.opt.mine{border-color:var(--accent)}
.opt.win{border-color:var(--good)}
.opt:disabled{cursor:default; opacity:1}
.check{
  display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--line);
  border-radius:10px; padding:8px 10px; margin-bottom:6px; min-width:0; cursor:pointer;
}
.check input{width:20px; height:20px; flex:none; accent-color:var(--accent)}
.check span{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

/* Anmeldung */
.auth{max-width:380px; margin:24px auto}
.auth h1{font-size:28px; margin:0 0 4px}
.auth .input{margin-bottom:10px}
.err{color:var(--accent); font-size:14px; min-height:20px; margin:4px 0 8px}

#toast{
  position:fixed; left:50%; transform:translateX(-50%); z-index:60;
  bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  background:var(--text); color:var(--bg); padding:9px 16px; border-radius:10px;
  font-size:14px; max-width:calc(100% - 32px); text-align:center;
}
.foot{font-size:12px; color:var(--muted); text-align:center; margin-top:24px}
