/* LumiScrive styles */
:root{
  color-scheme: light;
  --bg:#F3F6F5; --surface:#FFFFFF; --surface-2:#ECF2F0; --surface-3:#E2EAE7;
  --ink:#15282C; --muted:#5A6D72; --line:#DCE5E2;
  --accent:#1F6B66; --accent-hover:#185A56; --accent-ink:#FFFFFF; --accent-soft:#E0EFEC;
  --deep:#123F3C; --deep-ink:#F1F7F5; --deep-muted:#A9C9C3;
  --glow:#A86E0B; --glow-fill:#E9B949; --glow-soft:#FBF1D8;
  --danger:#A33A3A; --danger-soft:#F8E4E2;
  --shadow:0 1px 2px rgba(18,52,50,.05), 0 6px 20px -10px rgba(18,52,50,.18);
  --h0-bg:#E1F0E8; --h0-ink:#25584A; --h1-bg:#E1ECF8; --h1-ink:#2A4F7A; --h2-bg:#ECE6F7; --h2-ink:#56408A;
  --h3-bg:#F8E5E8; --h3-ink:#8A3B4A; --h4-bg:#F6EDD8; --h4-ink:#7A5A16; --h5-bg:#DDF0F2; --h5-ink:#22626A;
  --serif:"Newsreader", Georgia, "Times New Roman", serif;
  --sans:"Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing:border-box;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --bg:#111819; --surface:#182123; --surface-2:#1F2B2D; --surface-3:#273537;
    --ink:#E4ECEA; --muted:#9BACAF; --line:#2A383A;
    --accent:#7CC3B9; --accent-hover:#93D0C7; --accent-ink:#0D1A1A; --accent-soft:#1C3532;
    --deep:#0F2E2C; --deep-ink:#EEF6F4; --deep-muted:#93B8B1;
    --glow:#EEC463; --glow-fill:#E9B949; --glow-soft:#372D16;
    --danger:#EB9A90; --danger-soft:#3A2321;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
    --h0-bg:#1D3329; --h0-ink:#A6D7C2; --h1-bg:#1C2A3B; --h1-ink:#A8C6EA; --h2-bg:#2A2340; --h2-ink:#C9B9EE;
    --h3-bg:#3A2329; --h3-ink:#EDB2BD; --h4-bg:#342B17; --h4-ink:#E7CB86; --h5-bg:#173235; --h5-ink:#9AD6DC;
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:#111819; --surface:#182123; --surface-2:#1F2B2D; --surface-3:#273537;
  --ink:#E4ECEA; --muted:#9BACAF; --line:#2A383A;
  --accent:#7CC3B9; --accent-hover:#93D0C7; --accent-ink:#0D1A1A; --accent-soft:#1C3532;
  --deep:#0F2E2C; --deep-ink:#EEF6F4; --deep-muted:#93B8B1;
  --glow:#EEC463; --glow-fill:#E9B949; --glow-soft:#372D16;
  --danger:#EB9A90; --danger-soft:#3A2321;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --h0-bg:#1D3329; --h0-ink:#A6D7C2; --h1-bg:#1C2A3B; --h1-ink:#A8C6EA; --h2-bg:#2A2340; --h2-ink:#C9B9EE;
  --h3-bg:#3A2329; --h3-ink:#EDB2BD; --h4-bg:#342B17; --h4-ink:#E7CB86; --h5-bg:#173235; --h5-ink:#9AD6DC;
}
*,*::before,*::after{box-sizing:inherit}
html{height:100%;scroll-padding-top:calc(env(safe-area-inset-top,0px) + 72px)}
body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font:16px/1.6 var(--sans);-webkit-font-smoothing:antialiased}
img{max-width:100%}
a{color:var(--accent);text-underline-offset:3px}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
h1,h2,h3,h4{margin:0;line-height:1.25}
h1{font-family:var(--serif);font-weight:500;font-size:2.15rem;letter-spacing:-.01em}
h2{font-family:var(--serif);font-weight:500;font-size:1.4rem}
h3{font-size:1.04rem;font-weight:700}
p{margin:0}
[hidden]{display:none!important}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.ic{display:inline-flex;width:1.15em;height:1.15em;flex:none}
.ic svg{width:100%;height:100%}

/* ---------- Shell ---------- */
.app{display:grid;grid-template-columns:260px minmax(0,1fr);min-height:100%}
.side{position:sticky;top:0;align-self:start;height:100dvh;overflow:auto;padding:24px 16px 20px;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:20px}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);font-family:var(--serif);font-size:1.45rem;font-weight:500;padding:0 8px}
.side nav{display:flex;flex-direction:column;gap:2px}
.navhead{font-size:.78rem;color:var(--muted);margin:16px 12px 6px;font-weight:700;letter-spacing:.02em}
.side nav a{display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:10px;color:var(--ink);text-decoration:none;font-size:.96rem}
.side nav a .ic{color:var(--muted);width:20px;height:20px}
.side nav a:hover{background:var(--surface-2)}
.side nav a[aria-current="page"]{background:var(--accent-soft);font-weight:700}
.side nav a[aria-current="page"] .ic{color:var(--accent)}
.side nav a .count{margin-left:auto}
.count{font-size:.74rem;background:var(--danger);color:#fff;border-radius:999px;padding:1px 8px;font-weight:700;line-height:1.5}
.count:empty{display:none}
.lvlcard{margin-top:auto;border:1px solid var(--line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px;text-decoration:none;color:var(--ink);background:var(--bg)}
.lvlcard:hover{border-color:var(--accent)}
.lvlcard .who{display:flex;align-items:center;gap:10px;min-width:0}
.lvlcard .who b{display:block;font-size:.95rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lvlcard small{color:var(--muted);font-size:.8rem}
.sidefoot{display:flex;flex-direction:column;gap:2px;font-size:.86rem}
.sidefoot a{color:var(--muted);text-decoration:none;padding:4px 12px;display:flex;gap:8px;align-items:center}
.sidefoot a:hover{color:var(--ink)}
.col{min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:env(safe-area-inset-top,0px);z-index:20;display:flex;align-items:center;gap:16px;padding:12px clamp(18px,3vw,40px);background:color-mix(in srgb, var(--bg) 88%, transparent);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:10;background:color-mix(in srgb, var(--bg) 88%, transparent);backdrop-filter:blur(10px)}
.topbar .brand{display:none;padding:0;font-size:1.3rem}
.searchbox{flex:1;max-width:520px;position:relative}
.searchbox .ic{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted)}
.searchbox input[type=search]{width:100%;padding:9px 14px 9px 40px;border:1px solid var(--line);border-radius:999px;background:var(--surface)}
.topactions{margin-left:auto;display:flex;align-items:center;gap:10px}
.iconbtn{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink);text-decoration:none;position:relative}
.iconbtn:hover{border-color:var(--accent);color:var(--accent)}
.iconbtn .count{position:absolute;top:-4px;right:-4px}
.mobileonly{display:none!important}
#banner:empty{display:none}
#banner{display:flex;gap:10px;align-items:center;padding:10px clamp(18px,3vw,40px);background:var(--glow-soft);color:var(--ink);font-size:.9rem;border-bottom:1px solid var(--line)}
#banner .ic{color:var(--glow)}
.main{padding:32px clamp(18px,3vw,40px) 96px;outline:none;flex:1}
.wrap{max-width:1080px;margin:0 auto}
.wrap.narrow{max-width:800px}
.tabs{display:none}
.footer{max-width:1080px;margin:56px auto 0;padding-top:20px;border-top:1px solid var(--line);font-size:.84rem;color:var(--muted);display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}

@media (max-width:900px){
  .app{grid-template-columns:1fr}
  .side{display:none}
  .topbar{padding:10px 16px}
  .topbar .brand{display:flex}
  .searchbox{display:none}
  .mobileonly{display:inline-flex!important}
  .tabs{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;bottom:0;left:0;right:0;z-index:20;background:var(--surface);border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom,0px)}
  .tabs a{display:flex;flex-direction:column;align-items:center;gap:3px;padding:9px 2px 10px;font-size:.72rem;color:var(--muted);text-decoration:none}
  .tabs a .ic{width:22px;height:22px}
  .tabs a[aria-current="page"]{color:var(--accent);font-weight:700}
  .main{padding:22px 16px 120px}
  h1{font-size:1.75rem}
}

/* ---------- Building blocks ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}
.pad{padding:22px}
.pagehead{display:flex;gap:16px;align-items:flex-end;justify-content:space-between;flex-wrap:wrap;margin-bottom:24px}
.pagehead .lede{margin-top:6px}
.lede{color:var(--muted);max-width:62ch}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);padding:10px 18px;border-radius:10px;font-weight:700;cursor:pointer;text-decoration:none;font-size:.95rem;white-space:nowrap}
.btn:hover{background:var(--accent-hover);border-color:var(--accent-hover)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn.quiet{background:var(--surface);color:var(--accent);border-color:var(--line)}
.btn.quiet:hover{border-color:var(--accent)}
.btn.small{padding:7px 13px;font-size:.88rem;border-radius:8px}
.btn.danger{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.gold{background:var(--glow-fill);border-color:var(--glow-fill);color:#2B2005}
.btn.gold:hover{filter:brightness(1.05)}
.btn.onDeep{background:transparent;color:var(--deep-ink);border-color:color-mix(in srgb, var(--deep-ink) 35%, transparent)}
.ghost{display:inline-flex;align-items:center;gap:6px;background:none;border:0;padding:5px 8px;margin:-5px -8px;border-radius:8px;color:var(--muted);cursor:pointer;font-size:.86rem}
.ghost:hover{background:var(--surface-2);color:var(--ink)}
.ghost:disabled{opacity:.6}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}
.chip{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:6px 14px;font-size:.88rem;cursor:pointer;color:var(--ink)}
.chip:hover{border-color:var(--accent)}
.chip[aria-pressed="true"]{background:var(--deep);color:var(--deep-ink);border-color:var(--deep)}
.tag{display:inline-flex;align-items:center;gap:5px;font-size:.78rem;font-weight:700;padding:2px 10px;border-radius:999px;background:var(--surface-2);color:var(--muted);white-space:nowrap}
.tag .ic{width:13px;height:13px}
.hue0{--hb:var(--h0-bg);--hi:var(--h0-ink)} .hue1{--hb:var(--h1-bg);--hi:var(--h1-ink)} .hue2{--hb:var(--h2-bg);--hi:var(--h2-ink)}
.hue3{--hb:var(--h3-bg);--hi:var(--h3-ink)} .hue4{--hb:var(--h4-bg);--hi:var(--h4-ink)} .hue5{--hb:var(--h5-bg);--hi:var(--h5-ink)}
.tag.hue{background:var(--hb);color:var(--hi)}
.tag.hiddentag{background:var(--danger-soft);color:var(--danger)}
.tag.best{background:var(--glow-soft);color:var(--glow)}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:20px}
.toolbar .searchbox{display:block;max-width:none;flex:2 1 260px}
.toolbar select{flex:1 1 180px;width:auto}
input[type=text],input[type=url],input[type=search],select,textarea{width:100%;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:10px 12px}
textarea{min-height:120px;resize:vertical;line-height:1.55}
input:focus,select:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:0;border-color:transparent}
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}
.field label{font-weight:700;font-size:.9rem}
.hint{font-size:.84rem;color:var(--muted)}
.check{display:flex;gap:10px;align-items:flex-start;margin-bottom:16px;font-size:.94rem;cursor:pointer}
.check input{margin-top:5px;accent-color:var(--accent);width:16px;height:16px}
.err{color:var(--danger);font-size:.9rem;margin-bottom:12px}
.err:empty{display:none}
.meta{font-size:.84rem;color:var(--muted);display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center}
.meta .ic{width:15px;height:15px;vertical-align:-3px;margin-right:4px}
.meta > span{display:inline}
.meta > span.tag,.meta > span.urgent{display:inline-flex}
.meta .av{vertical-align:middle;margin-right:6px}
.tag .ic{margin-right:0}
.excerpt{color:var(--muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.clamp3{-webkit-line-clamp:3}
.body{white-space:pre-wrap;overflow-wrap:anywhere;max-width:70ch;line-height:1.65}
.actions{display:flex;gap:16px;flex-wrap:wrap;align-items:center}
.back{display:inline-flex;align-items:center;gap:6px;margin-bottom:18px;font-size:.92rem;text-decoration:none}
.sechead{display:flex;justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:14px}
.sechead a{font-size:.9rem;font-weight:700;text-decoration:none}
.sechead a:hover{text-decoration:underline}
.av{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:var(--surface-3);color:var(--muted);flex:none;overflow:hidden}
.av img{width:100%;height:100%;object-fit:cover}
.av .ic{width:55%;height:55%}
.av.sm{width:26px;height:26px}
.av.lg{width:72px;height:72px}
.av.anon{background:var(--h2-bg);color:var(--h2-ink)}
.bar{height:8px;border-radius:999px;background:var(--surface-3);overflow:hidden}
.bar > i{display:block;height:100%;background:var(--glow-fill);border-radius:inherit}
.empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;padding:44px 20px;color:var(--muted)}
.empty .bubble{width:56px;height:56px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center}
.empty .bubble .ic{width:26px;height:26px}
.empty h3{color:var(--ink)}
.empty p{max-width:44ch}
.empty .btn{margin-top:6px}
.loading{padding:40px;text-align:center;color:var(--muted)}

/* ---------- Today ---------- */
.hero{position:relative;overflow:hidden;background:var(--deep);color:var(--deep-ink);border-radius:20px;padding:34px 36px;display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:24px;align-items:center;margin-bottom:28px}
.hero .display{font-family:var(--serif);font-size:2.5rem;font-weight:400;letter-spacing:-.015em;line-height:1.1}
.hero .lede{color:var(--deep-muted);margin-top:10px;font-size:1.02rem}
.hero .art{justify-self:end;width:100%;max-width:320px}
.lvl{margin-top:22px;max-width:420px}
.lvl .row1{display:flex;justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:8px;font-size:.9rem}
.lvl .row1 b{font-family:var(--serif);font-weight:500;font-size:1.3rem;color:var(--glow-fill)}
.lvl .row1 span{color:var(--deep-muted)}
.hero .bar{background:color-mix(in srgb, var(--deep-ink) 16%, transparent)}
@media (max-width:900px){.hero{grid-template-columns:1fr;padding:26px 22px}.hero .art{display:none}.hero .display{font-size:2rem}}
.todayhead{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:14px}
.lamps{display:flex;align-items:center;gap:6px;font-size:.88rem;color:var(--muted)}
.lamp{width:34px;height:8px;border-radius:999px;background:var(--surface-3);transition:background .5s, box-shadow .5s}
.lamp.on{background:var(--glow-fill);box-shadow:0 0 12px 1px color-mix(in srgb, var(--glow-fill) 55%, transparent)}
.lamps span:last-child{margin-left:8px}
.daily{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:28px}
.dcard{padding:22px;display:flex;flex-direction:column;gap:12px;min-width:0;position:relative}
.dcard .kind{display:flex;align-items:center;gap:10px;font-size:.86rem;font-weight:700;color:var(--muted)}
.dcard .kind .badge{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;background:var(--hb);color:var(--hi)}
.dcard .kind .badge .ic{width:18px;height:18px}
.dcard .grow{flex:1;display:flex;flex-direction:column;gap:8px}
.dcard .word{font-family:var(--serif);font-size:1.9rem;line-height:1.1}
.dcard .pos{font-style:italic;color:var(--muted);font-size:.9rem}
.dcard .quote{border-left:3px solid var(--line);padding-left:10px;color:var(--muted);font-size:.92rem}
.dcard.done{background:linear-gradient(var(--surface),var(--surface)) padding-box}
.donepill{display:inline-flex;align-items:center;gap:6px;font-size:.86rem;font-weight:700;color:var(--glow);background:var(--glow-soft);border-radius:999px;padding:5px 12px;align-self:flex-start}
@media (max-width:900px){.daily{grid-template-columns:1fr}}
.tiles{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:32px}
.tile{padding:18px 20px;display:flex;gap:14px;align-items:center;text-decoration:none;color:var(--ink)}
a.tile:hover{border-color:var(--accent)}
.tile .ti{width:44px;height:44px;border-radius:12px;display:flex;align-items:center;justify-content:center;background:var(--hb);color:var(--hi);flex:none}
.tile .ti .ic{width:22px;height:22px}
.tile b{display:block;font-family:var(--serif);font-weight:500;font-size:1.75rem;line-height:1.05}
.tile span{font-size:.84rem;color:var(--muted)}
@media (max-width:900px){.tiles{grid-template-columns:1fr 1fr}.tile{padding:14px}.tile b{font-size:1.4rem}.tile .ti{width:38px;height:38px}}
.split{display:grid;grid-template-columns:1fr 1fr;gap:20px}
@media (max-width:900px){.split{grid-template-columns:1fr}}
.feed{padding:6px 20px}
.fitem{display:flex;gap:12px;padding:14px 0;border-bottom:1px solid var(--line);text-decoration:none;color:var(--ink)}
.fitem:last-child{border-bottom:0}
.fitem:hover h3{text-decoration:underline}
.fitem .meta{margin-top:4px}

/* ---------- Materials ---------- */
.mgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:16px}
.mcard{padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}
.mcard.dim,.qrow.dim,.prow.dim{opacity:.6}
.mtop{display:flex;gap:14px;align-items:flex-start}
.ftype{width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;background:var(--hb);color:var(--hi);flex:none}
.ftype .ic{width:22px;height:22px}
.mtop h3{margin-bottom:6px;overflow-wrap:anywhere}
.attach{display:flex;gap:12px;align-items:center;padding:10px 12px;border-radius:10px;background:var(--surface-2);font-size:.9rem;text-decoration:none;color:var(--ink);min-width:0}
.attach:hover{background:var(--surface-3)}
.attach img{width:56px;height:44px;object-fit:cover;border-radius:6px}
.attach .nm{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700}
.mfoot{margin-top:auto;display:flex;justify-content:space-between;align-items:center;gap:10px;padding-top:12px;border-top:1px solid var(--line);flex-wrap:wrap}
.by{display:flex;align-items:center;gap:8px;font-size:.84rem;color:var(--muted);min-width:0}
.by b{color:var(--ink);font-weight:700}

/* ---------- Questions ---------- */
.qlist{display:flex;flex-direction:column;gap:12px}
.qrow{display:flex;gap:18px;padding:18px 20px;align-items:flex-start}
.qcount{width:64px;flex:none;text-align:center;border-radius:12px;padding:8px 4px;background:var(--surface-2);color:var(--muted)}
.qcount b{display:block;font-family:var(--serif);font-size:1.5rem;font-weight:500;line-height:1.1;color:var(--ink)}
.qcount small{font-size:.72rem}
.qcount.has{background:var(--accent-soft)}
.qcount.has b{color:var(--accent)}
.qcount.solved{background:var(--accent);color:var(--accent-ink)}
.qcount.solved b{color:var(--accent-ink)}
.qmain{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
.qmain h3 a{color:var(--ink);text-decoration:none}
.qmain h3 a:hover{text-decoration:underline}
.thread{padding:26px 28px}
.thread h1{margin:10px 0 12px;font-size:1.9rem}
.authorline{display:flex;align-items:center;gap:10px;font-size:.88rem;color:var(--muted)}
.authorline b{color:var(--ink)}
.answers{display:flex;flex-direction:column;gap:12px;margin-top:12px}
.answer{padding:20px 22px;display:flex;flex-direction:column;gap:10px}
.answer.best{border-color:var(--glow-fill);box-shadow:0 0 0 1px var(--glow-fill), var(--shadow)}
.composer{padding:22px;margin-top:20px}
.composer .row2{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}

/* ---------- Discussion ---------- */
.plist{display:flex;flex-direction:column;gap:12px}
.prow{display:flex;gap:14px;padding:18px 20px;text-decoration:none;color:var(--ink)}
.prow:hover{border-color:var(--accent)}
.prow .pmain{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
.prow h3{font-size:1.06rem}
.welltip{display:flex;gap:16px;align-items:center;padding:16px 20px;margin-bottom:16px;background:var(--h2-bg);border-color:transparent;box-shadow:none}
.welltip .ic{width:26px;height:26px;color:var(--h2-ink)}
.welltip p{flex:1;font-size:.94rem}
.reply{display:flex;gap:12px}
.reply .bubble2{flex:1;min-width:0;padding:16px 18px;display:flex;flex-direction:column;gap:8px}

/* ---------- Leaderboard ---------- */
.podium{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;align-items:end;margin-bottom:24px}
.pod{padding:22px 16px;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}
.pod .medal{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.9rem;margin-top:-36px;border:3px solid var(--surface)}
.pod.p1{padding-top:34px;border-color:var(--glow-fill)} .pod.p1 .medal{background:var(--glow-fill);color:#2B2005}
.pod.p2 .medal{background:#C9D3D6;color:#2A3437} .pod.p3 .medal{background:#D9B48C;color:#3A2410}
.pod .av{margin-bottom:6px}
.pod b{font-size:1rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.pod .pts{font-family:var(--serif);font-size:1.6rem;color:var(--glow)}
.board{list-style:none;margin:0;padding:6px 20px}
.board li{display:grid;grid-template-columns:36px 36px minmax(0,1fr) auto;gap:14px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
.board li:last-child{border-bottom:0}
.board .rank{font-family:var(--serif);font-size:1.2rem;color:var(--muted);text-align:center}
.board .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}
.board .nm small{display:block;font-weight:400;color:var(--muted);font-size:.8rem}
.board .p{font-weight:700;color:var(--glow)}
.board li.mine{background:var(--accent-soft);margin:0 -12px;padding:12px;border-radius:10px}
.howto{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:28px}
.howto .tile b{color:var(--glow)}
@media (max-width:700px){.howto{grid-template-columns:1fr}.podium{gap:8px}.pod{padding:18px 8px}.pod .pts{font-size:1.25rem}}

/* ---------- Profile ---------- */
.phead{display:flex;gap:22px;align-items:center;padding:26px 28px;flex-wrap:wrap;margin-bottom:20px}
.phead .info{flex:1;min-width:220px;display:flex;flex-direction:column;gap:8px}
.phead h1{font-size:1.8rem}
.badges{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.bdg{padding:16px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px}
.bdg .medal{width:52px;height:52px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--glow-soft);color:var(--glow)}
.bdg .medal .ic{width:24px;height:24px}
.bdg b{font-size:.92rem}
.bdg small{font-size:.78rem;color:var(--muted);line-height:1.4}
.bdg.locked .medal{background:var(--surface-2);color:var(--muted)}
.bdg.locked b{color:var(--muted)}
.stack{display:flex;height:12px;border-radius:999px;overflow:hidden;background:var(--surface-3);margin:12px 0}
.stack i{display:block;height:100%}
.legend{display:flex;gap:18px;flex-wrap:wrap;font-size:.86rem;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{width:10px;height:10px;border-radius:3px;display:inline-block}

/* ---------- Support ---------- */
.supportgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:28px}
.scard{padding:22px;display:flex;flex-direction:column;gap:10px}
.scard .ti{width:44px;height:44px;border-radius:12px;display:flex;align-items:center;justify-content:center;background:var(--hb);color:var(--hi)}
.scard .ti .ic{width:22px;height:22px}
.scard.urgentcard{background:var(--danger-soft);border-color:transparent;box-shadow:none}
.scard.urgentcard .ti{background:var(--danger);color:#fff}
@media (max-width:900px){.supportgrid{grid-template-columns:1fr}}
.support{display:flex;flex-direction:column;gap:10px;padding:16px 18px;border-radius:12px;background:var(--surface-2);margin-bottom:16px;font-size:.94rem}
.support .emergency{font-weight:700;display:flex;gap:8px;align-items:flex-start}
.support .emergency .ic{color:var(--danger);margin-top:3px}
.support ul{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:6px}
.prose{display:flex;flex-direction:column;gap:12px;max-width:68ch}
.twocol{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media (max-width:900px){.twocol{grid-template-columns:1fr}}

/* ---------- Moderation ---------- */
.reports{display:flex;flex-direction:column;gap:12px}
.report{padding:20px 22px;display:flex;flex-direction:column;gap:10px}
.report.isurgent{border-left:4px solid var(--danger)}
.urgent{display:inline-flex;align-items:center;gap:5px;background:var(--danger-soft);color:var(--danger);font-weight:700;font-size:.78rem;border-radius:999px;padding:2px 10px}
.guide{display:flex;gap:14px;background:var(--danger-soft);border-radius:14px;padding:18px 20px;margin-bottom:22px;font-size:.94rem}
.guide > .ic{color:var(--danger);width:24px;height:24px;margin-top:2px}
.guide p + p{margin-top:6px}
.reveal{font-size:.9rem;background:var(--h2-bg);color:var(--h2-ink);padding:8px 12px;border-radius:8px}

/* ---------- Search ---------- */
.results{display:flex;flex-direction:column;gap:28px}

/* ---------- Welcome ---------- */
body.landing .side, body.landing .topbar, body.landing .tabs{display:none!important}
body.landing .app{grid-template-columns:1fr}
body.landing .main{padding-top:0}
.lnav{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 0}
.lnav .links{display:flex;gap:22px;align-items:center;font-size:.94rem}
.lnav .links a:not(.btn){color:var(--ink);text-decoration:none}
@media (max-width:700px){.lnav .links a:not(.btn){display:none}}
.lhero{background:var(--deep);color:var(--deep-ink);border-radius:24px;padding:clamp(32px,6vw,72px) clamp(24px,5vw,64px);display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:32px;align-items:center}
.lhero h1{font-size:clamp(2.3rem,5vw,3.6rem);font-weight:400;line-height:1.05;letter-spacing:-.02em}
.lhero .lede{color:var(--deep-muted);font-size:1.1rem;margin-top:18px}
.lhero .ctas{display:flex;gap:12px;margin-top:28px;flex-wrap:wrap}
.lhero .art{max-width:420px;justify-self:end;width:100%}
@media (max-width:860px){.lhero{grid-template-columns:1fr}.lhero .art{justify-self:center;max-width:300px}}
.lsec{margin-top:64px}
.lsec > h2{font-size:clamp(1.6rem,3vw,2.1rem);margin-bottom:8px}
.lsec > .lede{margin-bottom:26px}
.features{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.feature{padding:26px;display:flex;flex-direction:column;gap:12px}
.feature .ti{width:48px;height:48px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:var(--hb);color:var(--hi)}
.feature .ti .ic{width:24px;height:24px}
.feature ul{margin:4px 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px;color:var(--muted);font-size:.94rem}
.feature li{display:flex;gap:8px}
.feature li .ic{color:var(--accent);margin-top:4px;width:15px;height:15px}
@media (max-width:860px){.features{grid-template-columns:1fr}}
.safety{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.safety .card{padding:22px;display:flex;gap:14px}
.safety .ic{width:22px;height:22px;color:var(--accent);margin-top:2px}
@media (max-width:860px){.safety{grid-template-columns:1fr}}
.sdg{display:flex;gap:20px;align-items:center;padding:24px 28px;flex-wrap:wrap}
.sdg .goals{display:flex;gap:10px;flex-wrap:wrap}
.sdg .goal{display:inline-flex;align-items:center;gap:10px;padding:8px 14px 8px 8px;border-radius:12px;background:var(--surface-2);font-weight:700;font-size:.9rem}
.sdg .goal b{width:34px;height:34px;border-radius:8px;display:flex;align-items:center;justify-content:center;color:#fff;font-family:var(--serif);font-size:1.15rem}
.lcta{margin-top:64px;text-align:center;padding:48px 24px;border-radius:24px;background:var(--accent-soft)}
.lcta h2{font-size:clamp(1.6rem,3vw,2.2rem);margin-bottom:10px}
.lcta .btn{margin-top:20px}

/* ---------- Dialog & toasts ---------- */
dialog{border:0;border-radius:18px;padding:0;background:var(--surface);color:var(--ink);width:min(580px,calc(100vw - 24px));max-height:calc(100dvh - 40px);box-shadow:0 24px 70px -20px rgba(8,30,30,.5)}
dialog::backdrop{background:rgba(12,24,26,.5);backdrop-filter:blur(2px)}
.dlg{padding:24px 26px}
.dlghead{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;gap:12px}
.x{background:none;border:0;cursor:pointer;color:var(--muted);padding:6px;border-radius:8px;display:flex}
.x:hover{background:var(--surface-2);color:var(--ink)}
.dlgactions{display:flex;justify-content:flex-end;gap:10px;margin-top:10px;flex-wrap:wrap}
.radio{display:flex;gap:12px;align-items:center;padding:11px 14px;border:1px solid var(--line);border-radius:10px;margin-bottom:8px;cursor:pointer}
.radio:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.radio input{accent-color:var(--accent)}
.drop{display:flex;flex-direction:column;align-items:center;gap:6px;padding:22px;border:1.5px dashed var(--line);border-radius:12px;text-align:center;cursor:pointer;color:var(--muted);font-size:.9rem}
.drop:hover{border-color:var(--accent)}
.drop .ic{width:26px;height:26px;color:var(--accent)}
.drop b{color:var(--ink)}
#toasts{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:50;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;width:max-content;max-width:calc(100vw - 32px)}
@media (max-width:900px){#toasts{bottom:calc(86px + env(safe-area-inset-bottom,0px))}}
.toast{display:flex;gap:10px;align-items:center;background:var(--deep);color:var(--deep-ink);padding:11px 16px;border-radius:12px;font-size:.92rem;box-shadow:var(--shadow);transition:opacity .4s, transform .4s}
.toast.good{background:var(--glow-fill);color:#2B2005;font-weight:700}
.toast.bad{background:var(--danger);color:#fff}
.toast.out{opacity:0;transform:translateY(6px)}
@media (prefers-reduced-motion: reduce){*{transition:none!important}}

/* ---------- Initial avatars ---------- */
.av.ini{background:var(--hb);color:var(--hi);font-weight:700;font-size:.8rem;letter-spacing:.02em}
.av.sm.ini{font-size:.62rem}
.av.lg.ini{font-size:1.5rem}

/* ---------- Sign in / sign up ---------- */
.authwrap{min-height:calc(100dvh - 180px);display:flex;align-items:center;justify-content:center;padding:24px 0}
.authcard{width:min(460px,100%);padding:32px 30px}
.authcard h1{font-size:1.9rem;margin-bottom:6px}
.authcard .lede{margin-bottom:22px}
.authtabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;background:var(--surface-2);padding:4px;border-radius:12px;margin-bottom:22px}
.authtabs button{border:0;background:transparent;padding:9px;border-radius:9px;font-weight:700;color:var(--muted);cursor:pointer}
.authtabs button[aria-pressed="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--shadow)}
.authcard .btn{width:100%;margin-top:6px}
.authcard input[type=email],.authcard input[type=password],.authcard input[type=text]{width:100%;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:10px 12px}
.notice{padding:12px 14px;border-radius:10px;background:var(--accent-soft);font-size:.92rem;margin-bottom:14px}
.notice:empty{display:none}
.setup code{background:var(--surface-2);padding:2px 6px;border-radius:6px;font-size:.9em}
.inline{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.inline input{flex:1;min-width:200px}
.sidefoot button{background:none;border:0;color:var(--muted);padding:4px 12px;display:flex;gap:8px;align-items:center;cursor:pointer;font-size:.86rem}
.sidefoot button:hover{color:var(--ink)}

/* =============================================================================
   Study materials: University materials and Student notes (append to styles.css)
   ============================================================================= */
.ptsbadge{font-size:.76rem;font-weight:700;background:color-mix(in srgb, var(--accent-ink) 18%, transparent);padding:1px 8px;border-radius:999px}

/* Segmented tabs */
.segtabs{display:inline-flex;gap:4px;padding:4px;background:var(--surface-2);border-radius:14px;margin-bottom:22px;max-width:100%;overflow-x:auto}
.segtab{display:inline-flex;align-items:center;gap:8px;border:0;background:transparent;color:var(--muted);font-weight:700;font-size:.94rem;padding:10px 18px;border-radius:11px;cursor:pointer;white-space:nowrap}
.segtab:hover{color:var(--ink)}
.segtab[aria-selected="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--shadow)}
.segtab[aria-selected="true"] .ic{color:var(--accent)}
.mpanel:focus{outline:none}

/* Breadcrumbs */
.crumbrow{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.crumbs ol{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;align-items:center;font-size:.92rem}
.crumbs li{display:flex;align-items:center}
.crumbs li + li::before{content:"›";color:var(--muted);margin:0 10px}
.crumbs [aria-current="page"]{font-weight:700;color:var(--ink)}
.crumb{background:none;border:0;padding:2px 0;color:var(--accent);font-weight:700;cursor:pointer;text-decoration:underline;text-underline-offset:3px}

/* Level 1: department directory */
.deptgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.deptcard{display:flex;align-items:center;gap:14px;padding:18px 18px 18px 20px;text-align:left;cursor:pointer;color:var(--ink);font:inherit;width:100%}
.deptcard:hover{border-color:var(--accent)}
.deptcard .ti{width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;background:var(--hb);color:var(--hi);flex:none}
.deptcard .ti .ic{width:22px;height:22px}
.dmain{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.dmain b{font-family:var(--serif);font-weight:500;font-size:1.35rem;line-height:1.1}
.dname{font-size:.9rem}
.go{color:var(--muted);width:20px;height:20px}

/* Level 2: course list */
.lvlhead{margin:4px 0 14px}
.courselist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.courserow{display:flex;align-items:center;gap:16px;width:100%;padding:14px 18px;text-align:left;cursor:pointer;color:var(--ink);font:inherit}
.courserow:hover{border-color:var(--accent)}
.ccode{display:inline-flex;align-items:center;justify-content:center;min-width:84px;padding:6px 10px;border-radius:10px;background:var(--hb);color:var(--hi);font-weight:700;letter-spacing:.02em;font-size:.92rem;flex:none}
.ccode.lg{font-size:1.15rem;min-width:110px;padding:12px 14px}
.cmain{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.cmain b{font-size:1rem}

/* Level 3: one course */
.coursehead{display:flex;align-items:center;gap:18px;padding:20px 22px;margin-bottom:22px;flex-wrap:wrap}
.coursehead h2{font-size:1.5rem}
.resgroup{margin-bottom:26px}
.resgroup h3{display:flex;align-items:center;gap:8px;font-size:1.05rem}
.resgroup h3 .ic{color:var(--accent)}
.resempty{color:var(--muted);font-size:.92rem;padding:14px 16px;border:1px dashed var(--line);border-radius:12px}
.bridge{display:flex;justify-content:flex-end;padding-top:8px;border-top:1px solid var(--line)}

/* Official cards */
.tag.official{background:var(--deep);color:var(--deep-ink);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--glow-fill) 40%, transparent)}
.tag.official .ic{color:var(--glow-fill)}
.mcard.official{border-top:3px solid var(--accent)}

/* Student filters */
#mpanel-student .toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr);gap:10px}
#mpanel-student .toolbar select{width:100%}
@media (max-width:1100px){
  #mpanel-student .toolbar{grid-template-columns:1fr 1fr}
  #mpanel-student .toolbar .searchbox{grid-column:1 / -1}
}
.filterline{display:flex;align-items:center;gap:14px;font-size:.9rem;color:var(--muted);margin:-8px 0 16px}
.linkbtn{background:none;border:0;padding:0;color:var(--accent);font-weight:700;cursor:pointer;text-decoration:underline;text-underline-offset:3px;font-size:.9rem}

/* Share dialog */
.twofield{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.twofield .field{min-width:0}
.officialcheck{padding:12px 14px;border-radius:12px;background:var(--surface-2)}
select:disabled{opacity:.6}

@media (max-width:640px){
  .segtabs{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .segtab{padding:9px 8px;font-size:.86rem;white-space:normal;justify-content:center;text-align:center;line-height:1.25}
  .twofield{grid-template-columns:1fr}
  .courserow{gap:12px;padding:12px 14px}
  .ccode{min-width:72px}
  .bridge{justify-content:stretch}
  .bridge .btn{width:100%}
}
