/* © 2026 SnakeIndex. Snakebook styles. Light and dark themes via html[data-theme]. */
:root,html[data-theme="light"]{
  --bg:#f4f6f5;--panel:#ffffff;--panel2:#f0f3f1;--fg:#18201b;--muted:#5f6b64;--line:#dfe5e1;
  --g:#1b7a34;--g2:#2e9d4c;--g-soft:#e5f4ea;--g-fg:#ffffff;--danger:#c5221f;--danger-soft:#fdecea;
  --shadow:0 1px 3px rgba(20,40,28,.08),0 1px 2px rgba(20,40,28,.05);--pop:0 8px 28px rgba(20,40,28,.18);
  color-scheme:light}
html[data-theme="dark"]{
  --bg:#0e1310;--panel:#161d19;--panel2:#1c2520;--fg:#e6ece8;--muted:#98a69d;--line:#26322b;
  --g:#5fe08a;--g2:#3fbf6a;--g-soft:#1b3324;--g-fg:#07140c;--danger:#ff6b6b;--danger-soft:#3a1b1b;
  --shadow:0 1px 3px rgba(0,0,0,.45);--pop:0 8px 28px rgba(0,0,0,.6);
  color-scheme:dark}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.5 "Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;-webkit-text-size-adjust:100%}
a{color:var(--g);text-decoration:none}a:hover{text-decoration:underline}
:focus-visible{outline:2px solid var(--g);outline-offset:2px}
h1{font-size:24px;margin:0 0 6px;line-height:1.25}h2{font-size:17px;margin:0 0 12px}
p{margin:0 0 10px}.muted{color:var(--muted)}.small{font-size:13px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
img,video{max-width:100%}
.ic{width:24px;height:24px;flex:none}

/* shell */
.shell{min-height:100vh;display:flex;flex-direction:column}
.main{flex:1;width:100%;max-width:680px;margin:0 auto;padding:20px 16px 24px}
.foot{text-align:center;color:var(--muted);font-size:13px;padding:14px 16px 18px}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:20px;color:var(--fg);letter-spacing:.2px}
.brand:hover{text-decoration:none}.brand img{display:block}
.side{display:none}
.top{position:sticky;top:0;z-index:30;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;padding-top:max(8px,env(safe-area-inset-top));background:var(--panel);border-bottom:1px solid var(--line)}
.top .brand{font-size:18px}
.top-actions{display:flex;align-items:center;gap:4px}
.top-link{position:relative;display:flex;width:40px;height:40px;align-items:center;justify-content:center;border-radius:50%;color:var(--fg)}
.top-link .lbl{display:none}.top-link[aria-current]{color:var(--g)}
.tabs{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;background:var(--panel);border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom)}
.tab{position:relative;flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:7px 2px 6px;color:var(--muted);font-size:11px}
.tab:hover{text-decoration:none}.tab[aria-current]{color:var(--g)}
.is-app .shell{padding-bottom:calc(62px + env(safe-area-inset-bottom))}
.badge{position:absolute;top:2px;left:calc(50% + 4px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--danger);color:#fff;font-size:11px;font-weight:700;line-height:18px;text-align:center}
.top-link .badge{left:auto;right:0;top:0}
.bare-top{display:flex;justify-content:space-between;align-items:center;max-width:680px;width:100%;margin:0 auto;padding:14px 16px}

/* theme toggle */
.theme-toggle{display:flex;align-items:center;justify-content:center;gap:10px;width:40px;height:40px;border-radius:50%;border:1px solid var(--line);background:var(--panel);color:var(--fg);cursor:pointer;padding:0;font:inherit}
.theme-toggle:hover{border-color:var(--g)}
.theme-toggle .th{width:19px;height:19px;display:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .th-moon{fill:currentColor;stroke:none}
.theme-toggle .theme-label{display:none}
html[data-theme-pref="light"] .th-sun,html[data-theme-pref="dark"] .th-moon,html[data-theme-pref="system"] .th-system,html:not([data-theme-pref]) .th-system{display:block}

/* desktop */
@media (min-width:900px){
  .is-app .shell{padding-bottom:0;padding-left:250px}
  .top,.tabs{display:none}
  .side{display:flex;flex-direction:column;position:fixed;top:0;bottom:0;left:0;width:250px;padding:20px 14px;border-right:1px solid var(--line);background:var(--panel);z-index:20}
  .side .brand{padding:0 10px 18px}
  .side-nav{display:flex;flex-direction:column;gap:2px}
  .side-link{position:relative;display:flex;align-items:center;gap:14px;padding:11px 12px;border-radius:12px;color:var(--fg);font-size:16px}
  .side-link:hover{background:var(--panel2);text-decoration:none}
  .side-link[aria-current]{background:var(--g-soft);color:var(--g);font-weight:600}
  .side-link .badge{position:static;margin-left:auto;order:3}
  .side-foot{margin-top:auto;display:flex;flex-direction:column;gap:10px}
  .side-foot .theme-toggle{width:100%;border-radius:12px;justify-content:flex-start;padding:0 12px;height:42px}
  .side-foot .theme-label{display:inline;font-size:14px}
  .me{display:flex;align-items:center;gap:10px;padding:8px;border-radius:12px;color:var(--fg);min-width:0}
  .me:hover{background:var(--panel2);text-decoration:none}
  .me span{display:flex;flex-direction:column;min-width:0}.me b,.me small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.me small{color:var(--muted)}
  .main{padding-top:28px}
}

/* building blocks */
.card{background:var(--panel);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:16px;margin-bottom:14px}
.page-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:8px 16px;border-radius:20px;border:1px solid var(--line);background:var(--panel);color:var(--fg);font:inherit;font-weight:600;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn:hover{border-color:var(--g);text-decoration:none}
.btn.primary{background:var(--g);border-color:var(--g);color:var(--g-fg)}.btn.primary:hover{background:var(--g2)}
.btn.ghost{background:transparent}.btn.danger{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.sm{min-height:32px;padding:4px 12px;font-size:13px}.btn.wide{width:100%}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn .ic{width:20px;height:20px}
.link{background:none;border:0;padding:0;color:var(--muted);font:inherit;font-size:13px;cursor:pointer}.link:hover{color:var(--g);text-decoration:underline}
.inline{display:inline}
.stack{display:flex;flex-direction:column;gap:12px}
label{display:flex;flex-direction:column;gap:6px;font-weight:600;font-size:14px}
input[type=text],input[type=search],input[type=password],input:not([type]),textarea{width:100%;font:inherit;font-weight:400;color:var(--fg);background:var(--panel2);border:1px solid var(--line);border-radius:12px;padding:10px 12px}
textarea{resize:vertical;min-height:44px}
input:focus,textarea:focus{outline:none;border-color:var(--g);box-shadow:0 0 0 3px var(--g-soft)}
.file{position:relative;overflow:hidden;flex-direction:row;font-weight:600}.file input{position:absolute;inset:0;opacity:0;cursor:pointer}
fieldset.radio{border:1px solid var(--line);border-radius:12px;padding:10px 14px;margin:0}
fieldset.radio legend{font-weight:600;font-size:14px;padding:0 4px}
fieldset.radio label,label.check{flex-direction:row;align-items:center;gap:8px;font-weight:400;padding:4px 0}
.error{color:var(--danger);background:var(--danger-soft);border-radius:10px;padding:8px 12px;margin:0}
.notice{background:var(--g-soft);color:var(--fg);border-radius:12px;padding:10px 14px;margin-bottom:14px}
.empty{text-align:center;color:var(--muted);padding:28px 12px}.empty img{opacity:.85;margin-bottom:6px}.empty p{margin-bottom:12px}
.count{display:inline-block;min-width:22px;padding:0 7px;border-radius:11px;background:var(--g-soft);color:var(--g);font-size:13px;text-align:center}
.back{font-weight:600}

/* avatars */
.avatar{display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:50%;overflow:hidden;background:var(--g-soft);color:var(--g);font-weight:700}
.avatar img{width:100%;height:100%;object-fit:cover;display:block}
.avatar.sm{width:32px;height:32px;font-size:14px}.avatar.md{width:42px;height:42px;font-size:17px}
.avatar.lg{width:72px;height:72px;font-size:28px}.avatar.xl{width:96px;height:96px;font-size:38px}
.who{display:flex;align-items:center;gap:10px;color:var(--fg);min-width:0}.who:hover{text-decoration:none}
.who-t{display:flex;flex-direction:column;min-width:0;line-height:1.3}.who-t a{color:var(--fg)}.who-av{display:flex}.who-t b,.who-t small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.who-t small{color:var(--muted)}.who-t .time{color:var(--muted)}

/* composer + posts */
.composer-row{display:flex;gap:12px;align-items:flex-start}
.composer textarea{border:0;background:transparent;padding:8px 0;font-size:16px;box-shadow:none}
.composer-a{display:flex;justify-content:space-between;align-items:center;border-top:1px solid var(--line);padding-top:10px;margin-top:6px}
.img-preview{margin:8px 0}.img-preview img{max-height:260px;border-radius:12px;display:block}
.seg{display:flex;gap:4px;background:var(--panel2);border:1px solid var(--line);border-radius:22px;padding:4px;margin:0 0 14px}
.seg a{flex:1;text-align:center;padding:7px 10px;border-radius:18px;color:var(--muted);font-weight:600;font-size:14px}
.seg a:hover{text-decoration:none;color:var(--fg)}.seg a[aria-current]{background:var(--panel);color:var(--g);box-shadow:var(--shadow)}
.post-h{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:10px}
.post-body{white-space:normal;overflow-wrap:anywhere;font-size:15.5px;margin-bottom:10px}
.post-img{display:block;margin:0 -16px 10px}.post-img img{display:block;width:100%;max-height:640px;object-fit:contain;background:var(--panel2)}
.post-vid{display:block;width:100%;max-height:640px;border-radius:12px;background:#000;margin-bottom:10px}
.post-a{display:flex;gap:6px;border-top:1px solid var(--line);padding-top:8px}
.act{display:inline-flex;align-items:center;gap:6px;background:none;border:0;color:var(--muted);font:inherit;font-weight:600;padding:6px 10px;border-radius:18px;cursor:pointer}
.act:hover{background:var(--panel2);color:var(--fg);text-decoration:none}
.act.on{color:var(--danger)}.act.on svg,.ract.on svg{fill:currentColor}
.act .ic{width:20px;height:20px}
.pager{display:flex;justify-content:space-between;margin:6px 0 10px}
.menu{position:relative}.menu summary{list-style:none;cursor:pointer;color:var(--muted);border-radius:50%;padding:4px;display:flex}
.menu summary::-webkit-details-marker{display:none}
.menu-pop{position:absolute;right:0;top:34px;min-width:190px;background:var(--panel);border:1px solid var(--line);border-radius:12px;box-shadow:var(--pop);padding:6px 0;z-index:25}
.mi{display:block;width:100%;text-align:left;padding:9px 14px;background:none;border:0;color:var(--fg);font:inherit;cursor:pointer}
.mi:hover{background:var(--panel2);text-decoration:none}.mi.danger{color:var(--danger)}
.comment-list{list-style:none;margin:0 0 12px;padding:0}
.comment{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.comment-b{flex:1;min-width:0;overflow-wrap:anywhere}.comment-b p{margin:0 0 2px}.comment-a{display:flex;gap:12px;margin-top:4px}

/* people, profile, notifications, search */
.people{list-style:none;margin:0;padding:0}
.person{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.person:last-child{border-bottom:0}.person-a{display:flex;gap:6px;flex:none}
ul.card.people{padding:4px 16px}
.searchbar{display:flex;gap:8px;margin-bottom:14px}.searchbar input{flex:1}
.profile-head{display:flex;gap:18px;align-items:flex-start}
.profile-t{flex:1;min-width:0}.profile-t h1{overflow-wrap:anywhere}.bio{overflow-wrap:anywhere}
.stats{display:flex;gap:16px;flex-wrap:wrap;color:var(--muted);font-size:14px}.stats a{color:var(--muted)}.stats b{color:var(--fg)}
.profile-a{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.sub{margin:18px 2px 10px}
.reel-strip{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-bottom:8px}
.reel-thumb{display:block;aspect-ratio:9/16;border-radius:10px;overflow:hidden;background:#000}.reel-thumb video{width:100%;height:100%;object-fit:cover;display:block}
.notes{list-style:none;padding:4px 0}
.note a{display:flex;gap:12px;align-items:center;padding:10px 16px;color:var(--fg)}.note a:hover{background:var(--panel2);text-decoration:none}
.note span{display:flex;flex-direction:column}.note.unread a{background:var(--g-soft)}
.avatar-edit{display:flex;gap:16px;align-items:center}
.danger-zone{border-color:var(--danger)}
.auth{max-width:420px;margin:20px auto;text-align:center}.auth .stack{text-align:left;margin:14px 0}.auth-logo{display:block;margin:0 auto 10px}
.errorbox{text-align:center}

/* reels */
.reels-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.reels-head h1{margin:0}
.reel-feed{height:calc(100dvh - 210px);min-height:420px;overflow-y:auto;scroll-snap-type:y mandatory;border-radius:18px;background:#000;overscroll-behavior:contain;scrollbar-width:none}
.reel-feed::-webkit-scrollbar{display:none}
.reel{position:relative;height:100%;scroll-snap-align:start;scroll-snap-stop:always;display:flex;align-items:center;justify-content:center;background:#000;color:#fff}
.reel-v{width:100%;height:100%;object-fit:contain;display:block}
.reel-info{position:absolute;left:0;right:64px;bottom:0;padding:40px 16px 16px;background:linear-gradient(transparent,rgba(0,0,0,.7))}
.reel-info .who,.reel-info .who-t small,.reel-info .who-t a{color:#fff}.reel-cap{margin:8px 0 0;overflow-wrap:anywhere}
.reel-acts{position:absolute;right:8px;bottom:18px;display:flex;flex-direction:column;align-items:center;gap:14px}
.ract{display:flex;flex-direction:column;align-items:center;gap:2px;background:none;border:0;color:#fff;font:inherit;font-size:13px;font-weight:600;cursor:pointer;filter:drop-shadow(0 1px 2px rgba(0,0,0,.6))}
.ract .ic{width:30px;height:30px}.ract.on{color:#ff5c6c}.ract:hover{text-decoration:none}
.reel-acts .menu summary{color:#fff}.reel-acts .menu-pop{top:auto;bottom:36px;color:var(--fg)}
.reel-sound{position:absolute;top:12px;right:12px;width:42px;height:42px;border-radius:50%;border:0;background:rgba(0,0,0,.45);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer}
.reel-sound.on{background:var(--g);color:var(--g-fg)}
.reel-more{height:30%}
.reel-preview{width:100%;max-height:420px;border-radius:12px;background:#000}
@media (max-width:899px){
  .reels-page .main{padding:10px 0 0;max-width:none}
  .reels-page .reels-head{padding:0 12px}
  .reels-page .reel-feed{height:calc(100dvh - 57px - 62px - 52px - env(safe-area-inset-bottom));border-radius:0;min-height:0}
  .reels-page .foot{display:none}
}
@media (min-width:900px){.reel-feed{max-width:430px;margin:0 auto;height:calc(100vh - 150px)}}
@media (max-width:520px){
  .profile-head{flex-direction:column;align-items:center;text-align:center}.profile-a,.stats{justify-content:center}
  .card{border-radius:14px}
}
