/* Dreaming Clone — MVP styles. Tokens from design/reference/watch-page-spec.md (measured). */
:root{
  --page:#F3F2F7;
  --surface:#FFFFFF;
  --text:#272D37;
  --muted:#6B7280;
  --action:#FF9301;
  --status:#6354B1;
  --chip:#EEF2F6;
  --line:#E4E6EB;
  --radius:10px;
  --side:256px;
  --topbar:56px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--page);color:var(--text);
  font-family:"Readex Pro",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  font-size:16px;-webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
img{display:block;max-width:100%}

/* ---------- sidebar ---------- */
.side{
  position:fixed;left:0;top:0;bottom:0;width:var(--side);
  padding:18px 0 16px;display:flex;flex-direction:column;gap:8px;z-index:20;
}
.brand{display:flex;align-items:center;gap:8px;padding:0 24px 18px;font-weight:600;font-size:15px;letter-spacing:-.2px}
.brand .dot{width:10px;height:10px;border-radius:50%;background:var(--action)}
.side nav{display:flex;flex-direction:column;gap:24px;padding:8px 0}
.side-item{
  position:relative;display:flex;align-items:center;height:40px;padding:0 24px;
  font-size:16px;font-weight:400;color:var(--text);border-radius:0 6px 6px 0;
}
.side-item:hover{background:rgba(39,45,55,.04)}
.side-item.active{font-weight:500}
.side-item.active::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:#FF7EAE;border-radius:0 3px 3px 0;
}
.side-foot{margin-top:auto;padding:8px 24px;display:flex;flex-direction:column;gap:6px;font-size:14px}
.side-foot .who{font-weight:500}
.side-foot .ghost{color:var(--status)}
.muted{color:var(--muted)}

/* ---------- main ---------- */
.main{margin-left:var(--side);min-height:100vh;padding-bottom:64px}
.topbar{
  position:sticky;top:0;height:var(--topbar);background:var(--surface);
  display:flex;align-items:center;gap:16px;padding:0 16px;z-index:10;
}
.goalpill{
  display:flex;align-items:center;gap:12px;height:40px;padding:8px 16px;border-radius:5px;
  background:rgba(99,86,172,.1);font-size:14px;
}
.goal-label{font-weight:500;color:var(--status)}
.goal-val{font-variant-numeric:tabular-nums}
.goal-bar{position:relative;width:120px;height:6px;border-radius:3px;background:rgba(99,86,172,.2);overflow:hidden}
.goal-bar i{position:absolute;inset:0 auto 0 0;background:var(--status);border-radius:3px}
.muted-pill{background:rgba(39,45,55,.06)}
.top-right{margin-left:auto;display:flex;align-items:center;gap:12px;font-size:14px}
.top-right a{color:var(--status);font-weight:500}
.signin-hint{color:var(--muted)}
.avatar{width:40px;height:40px;border-radius:50%;background:var(--status);color:#fff;display:grid;place-items:center;font-weight:600}

/* ---------- filter row ---------- */
.filterbar{margin:0;padding:0 16px}
.chipgroup{
  display:flex;align-items:center;gap:8px;flex-wrap:nowrap;overflow-x:auto;
  background:var(--surface);border-radius:var(--radius);padding:10px;margin-top:8px;
  scrollbar-width:none;
}
.chipgroup::-webkit-scrollbar{display:none}
.chip{
  height:36px;min-width:96px;padding:0 12px;border-radius:var(--radius);white-space:nowrap;justify-content:center;
  background:var(--chip);display:inline-flex;align-items:center;justify-content:center;
  font-size:14px;color:var(--text);transition:background .15s;
}
.chip:hover{background:#E3E8EF}
.chip.on{background:var(--status);color:#fff}
.chipdiv{width:1px;height:24px;background:var(--line);margin:0 4px}

/* ---------- grid ---------- */
.grid{
  display:grid;grid-template-columns:repeat(4,264px);gap:21px;
  padding:21px 16px;justify-content:start;
}
.card{display:block;width:264px}
.thumb{position:relative;border-radius:5px;overflow:hidden;background:#ddd;aspect-ratio:264/149}
.thumb img{width:100%;height:100%;object-fit:cover}
.dur{
  position:absolute;right:6px;bottom:6px;background:rgba(13,16,22,.82);color:#fff;
  font-size:12px;padding:2px 6px;border-radius:4px;font-variant-numeric:tabular-nums;
}
.progressline{position:absolute;left:0;right:0;bottom:0;height:3px;background:rgba(255,255,255,.35)}
.progressline i{display:block;height:100%;background:var(--action)}
.cardbody{padding-top:10px}
.card h3{
  font-size:14px;font-weight:500;line-height:1.35;margin:0 0 8px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:38px;
}
.meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.level{
  font-size:12px;font-weight:500;padding:3px 8px;border-radius:999px;
  background:color-mix(in srgb,var(--lv) 16%,white);color:color-mix(in srgb,var(--lv) 78%,black);
  border:1px solid color-mix(in srgb,var(--lv) 28%,white);
}
.series{color:var(--muted)}
.card:hover .thumb img{transform:scale(1.02)}
.thumb img{transition:transform .2s ease}

/* ---------- pages ---------- */
.page{font-size:24px;font-weight:600;margin:24px 16px 8px}
.lede{margin:8px 16px 0;color:var(--muted);max-width:70ch;line-height:1.5}
.sub{font-size:18px;font-weight:600;margin:32px 16px 0}
.note{margin:12px 16px;padding:10px 14px;background:#FFF4E5;border:1px solid #FFD9A0;border-radius:8px;font-size:14px}
.note a{color:var(--status);font-weight:500}
.more{
  margin:8px 16px 40px;height:40px;padding:0 20px;border-radius:8px;border:1px solid var(--line);
  background:var(--surface);font:inherit;font-size:14px;cursor:pointer;
}
.more:disabled{opacity:.5;cursor:default}

/* series */
.seriesgrid{display:grid;grid-template-columns:repeat(auto-fill,264px);gap:21px;padding:16px}
.seriescard{width:264px}
.seriescard h3{font-size:15px;font-weight:600;margin:10px 0 4px}
.seriescard p{margin:0 0 8px;font-size:13px;color:var(--muted);line-height:1.4;min-height:36px}

/* stats */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px;padding:16px}
.stat{background:var(--surface);border-radius:var(--radius);padding:16px}
.stat .k{display:block;font-size:13px;color:var(--muted);margin-bottom:8px}
.stat .v{font-size:28px;font-weight:600;font-variant-numeric:tabular-nums}
.levelbox{margin:8px 16px;background:var(--surface);border-radius:var(--radius);padding:20px}
.levelbox h2{margin:0 0 8px;font-size:16px;font-weight:600}
.big{font-size:28px;font-weight:600;margin:0 0 4px}
.ladder{display:flex;gap:8px;margin-top:16px}
.ladder span{padding:6px 12px;border-radius:999px;background:var(--chip);font-size:13px}
.ladder span.on{background:var(--status);color:#fff}

/* empty / auth */
.empty{margin:48px 16px;padding:32px;background:var(--surface);border-radius:var(--radius);text-align:left;max-width:520px}
.empty h3{margin:0 0 8px;font-size:18px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 18px;
  border-radius:8px;background:var(--action);color:#241700;font:inherit;font-size:14px;font-weight:600;
  border:0;cursor:pointer;margin-top:12px;
}
.authbox{max-width:420px;margin:64px auto;background:var(--surface);border-radius:var(--radius);padding:28px}
.authbox h1{margin:0 0 8px;font-size:22px}
.authbox form{display:flex;flex-direction:column;gap:12px;margin:20px 0 12px}
.authbox label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted)}
.authbox input{height:42px;border:1px solid var(--line);border-radius:8px;padding:0 12px;font:inherit;font-size:15px}
.authbox input:focus{outline:2px solid var(--status);outline-offset:1px;border-color:transparent}
.err{color:#C0392B;font-size:13px;min-height:16px;margin:0}
body.bare{background:var(--page)}
body.bare .main{margin:0;min-height:100vh}

/* player */
.playerwrap{max-width:960px;margin:0 auto;padding:16px}
.playerwrap video{width:100%;border-radius:var(--radius);background:#000;aspect-ratio:16/9}
.ptitle{font-size:24px;font-weight:600;margin:16px 0 8px}
.playerwrap .lede{margin:12px 0 0}
.playerwrap .meta{margin-top:6px}

/* help fab */
.help{
  position:fixed;right:20px;bottom:20px;width:52px;height:52px;border-radius:50%;
  background:var(--surface);color:var(--text);display:grid;place-items:center;
  font-size:20px;font-weight:600;box-shadow:0 4px 18px rgba(20,24,35,.16);z-index:15;
}

/* ---------- responsive ---------- */
@media (max-width:1100px){
  .grid,.seriesgrid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));justify-content:stretch}
  .card,.seriescard{width:auto}
}
@media (max-width:860px){
  :root{--side:0px}
  .side{
    position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;height:60px;
    flex-direction:row;align-items:center;gap:0;background:var(--surface);
    border-top:1px solid var(--line);padding:0;z-index:30;
  }
  .brand,.side-foot{display:none}
  .side nav{flex-direction:row;flex:1;justify-content:space-around;gap:0;padding:0}
  .side-item{height:60px;padding:0 8px;font-size:13px;justify-content:center;flex:1;border-radius:0}
  .side-item.active::before{left:0;right:0;top:0;bottom:auto;width:auto;height:3px;border-radius:0}
  .main{margin-left:0;padding-bottom:80px}
  .goalpill{height:36px;padding:6px 10px;font-size:13px;gap:8px}
  .goal-bar{width:70px}
  .signin-hint{display:none}
  .grid,.seriesgrid{grid-template-columns:repeat(2,1fr);gap:12px;padding:12px}
  .thumb{aspect-ratio:16/9}
  .chipgroup{overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .chipgroup::-webkit-scrollbar{display:none}
  .chip{min-width:auto;white-space:nowrap}
  .page{font-size:20px;margin:16px 12px 8px}
  .help{width:44px;height:44px;right:12px;bottom:76px}
}
@media (max-width:420px){
  .grid,.seriesgrid{grid-template-columns:1fr}
}

/* ---------- icons ---------- */
.ico{width:17px;height:17px;flex:0 0 auto;display:inline-block;vertical-align:-3px}
.side-item .ico{width:18px;height:18px;margin-right:11px;color:#9AA0AE}
.side-item:hover .ico,.side-item.active .ico{color:#5B6472}
.goal-ico{width:15px;height:15px;color:var(--status);opacity:.85}
.hint-ico{width:14px;height:14px;color:var(--muted);margin-right:1px}
.more .ico{width:14px;height:14px;margin-left:5px}
.page .ico{width:19px;height:19px;margin-right:9px;color:#8E86B8;vertical-align:-3px}
.levelbox h2 .ico{width:15px;height:15px;margin-right:7px;color:#8E86B8;vertical-align:-2px}
.stat .k{display:flex;align-items:center;gap:7px}
.stat .k .ico{width:14px;height:14px;color:#8E86B8}
.btn{display:inline-flex;align-items:center;gap:7px}
.btn .ico{width:14px;height:14px;margin:0}
.authbox h1{display:flex;align-items:center}
.authbox h1 .ico{width:20px;height:20px;margin-right:9px;color:#8E86B8}
.field{position:relative;display:block}
.field .ico{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:#9AA0AE}
.field input{width:100%;padding-left:38px}
.empty-ico{width:26px;height:26px;color:#8E86B8;margin-bottom:12px;display:block}
.meta .ico{width:12px;height:12px;margin-right:4px;vertical-align:-1px;color:var(--muted)}
.playerwrap .meta .ico{width:14px;height:14px;margin-right:5px}
.help .ico{width:19px;height:19px;color:#5B6472}
.top-right .ico{vertical-align:-2px}
@media (max-width:860px){
  .side-item{flex-direction:column;gap:2px;font-size:10.5px;padding:0 4px;letter-spacing:.1px}
  .side-item .ico{margin-right:0;width:19px;height:19px}
  .goal-ico{width:14px;height:14px}
  .hint-ico{display:none}
  .page .ico{width:17px;height:17px;margin-right:7px}
}

/* ---------- youtube embeds ---------- */
.ytwrap{position:relative;width:100%;aspect-ratio:16/9;border-radius:var(--radius);overflow:hidden;background:#000}
.ytwrap iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.srctag{
  font-size:11px;font-weight:500;letter-spacing:.3px;text-transform:uppercase;
  padding:3px 8px;border-radius:999px;background:#FDE7E7;color:#C0392B;
}
