/* styles.css (mobile-first rewrite) */

:root{
  /* safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* palette */
  --bg0:#0b0f14;
  --bg1:#0f1520;
  --panel:rgba(18,24,34,.72);
  --panel2:rgba(12,16,24,.78);
  --stroke:rgba(255,255,255,.10);
  --stroke2:rgba(255,255,255,.07);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.62);
  --muted2:rgba(255,255,255,.45);
  --shadow:0 18px 60px rgba(0,0,0,.55);
  --shadow2:0 10px 30px rgba(0,0,0,.45);
  --r:16px;

  --accent:#33e6c6;
  --accent2:#8a5dff;

  /* bars */
  --topbar-h: calc(56px + var(--safe-top));
  --bottombar-h: calc(56px + var(--safe-bottom));

  /* drawers */
  --tool-w: min(86vw, 340px);
  --right-w: min(92vw, 360px);

  /* motion */
  --t:220ms;
  --t2:420ms;
  --ease:cubic-bezier(.2,.85,.2,1);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

:root[data-theme="light"]{
  --bg0:#f7f8fb;
  --bg1:#e9edf6;
  --panel:rgba(255,255,255,.72);
  --panel2:rgba(255,255,255,.82);
  --stroke:rgba(0,0,0,.10);
  --stroke2:rgba(0,0,0,.06);
  --text:rgba(9,12,16,.92);
  --muted:rgba(9,12,16,.62);
  --muted2:rgba(9,12,16,.45);
  --shadow:0 18px 60px rgba(0,0,0,.16);
  --shadow2:0 10px 30px rgba(0,0,0,.12);
}

@media (prefers-reduced-motion: reduce){
  :root{ --t:1ms; --t2:1ms; }
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(51,230,198,.12), transparent 55%),
    radial-gradient(900px 600px at 80% 12%, rgba(138,93,255,.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow:hidden;
  -webkit-text-size-adjust: 100%;
}
a{ color:inherit; text-decoration:none; }
button{ font:inherit; color:inherit; }
kbd{ font-family:var(--mono); font-size:12px; opacity:.9; }

#app{
  height:100%;
  overflow:hidden;
}

/* scanlines */
.scanlines{
  pointer-events:none;
  position:fixed; inset:0;
  background: linear-gradient(to bottom, rgba(255,255,255,.04), rgba(255,255,255,0) 8px);
  background-size: 100% 8px;
  opacity:.06;
  mix-blend-mode:overlay;
}

/* ---------- App shell ---------- */
/* Use dynamic viewport height for mobile browser chrome behavior */
.shell{
  height:100%;
  height:100dvh;
  width:100%;
  display:grid;
  grid-template-rows: var(--topbar-h) 1fr var(--bottombar-h);
  position: relative;
  z-index: 20;
  overflow:hidden;
}

/* ---------- Top bar: single horizontal scroller (mobile-first) ---------- */
.topbar{
  position:relative;
  z-index: 100;
  isolation:isolate;

  display:flex;
  align-items:center;
  gap:10px;

  padding: calc(8px + var(--safe-top)) 10px 8px;

  border-bottom:1px solid var(--stroke2);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
  backdrop-filter: blur(10px);

  min-height: var(--topbar-h);

  /* mobile behavior: EVERYTHING in one row and scrollable */
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topbar::-webkit-scrollbar{ height:0; width:0; }

/* spacer is not allowed to steal room on mobile */
.topbar .spacer{ display:none; }

/* prevent children from shrinking into unreadable pills */
.topbar > *{ flex: 0 0 auto; }

.brand{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px;
  border:1px solid var(--stroke2);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  cursor:pointer;
  user-select:none;
  touch-action: manipulation;
}
.brand .dot{
  width:10px; height:10px; border-radius:50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), rgba(51,230,198,.1));
  box-shadow: 0 0 18px rgba(51,230,198,.35);
}
.brand .title{ display:flex; flex-direction:column; line-height:1.05; }
.brand .title b{ font-size:13px; letter-spacing:.2px; }
.brand .title span{ font-size:11px; color:var(--muted2); }

/* menu group stays in-row; it can also scroll inside itself if needed */
.menubar{
  display:flex; align-items:center; gap:8px;
  flex: 0 0 auto;
}

.iconbtn{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px;
  border:1px solid var(--stroke2);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  cursor:pointer;
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease), background var(--t) var(--ease);
  user-select:none;
  touch-action: manipulation;
  white-space: nowrap;
}
.iconbtn:hover{ transform: translateY(-1px); border-color: var(--stroke); background: rgba(255,255,255,.05); }
.iconbtn:active{ transform: translateY(0px) scale(.99); }
.iconbtn:focus{ outline:none; box-shadow: 0 0 0 3px rgba(51,230,198,.18); border-color: rgba(51,230,198,.35); }
.pill{ border-radius:999px; }
.small{ padding:7px 10px; font-size:12px; }

.menu{ position:relative; }
.menu-panel{
  z-index: 110;
  position:absolute;
  top: calc(100% + 10px);
  left:0;

  min-width: 240px;
  max-width: min(92vw, 360px);

  padding:10px;
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: var(--panel);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(14px);

  transform: translateY(-6px);
  opacity:0;
  pointer-events:none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.menu.open .menu-panel{
  opacity:1;
  transform: translateY(0px);
  pointer-events:auto;
}
.menu-item{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  padding:10px 10px;
  border-radius:12px;
  cursor:pointer;
  border:1px solid transparent;
}
.menu-item:hover{
  background: rgba(255,255,255,.06);
  border-color: var(--stroke2);
}
.menu-item .meta{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.menu-item b{ font-size:13px; }
.menu-item span{ font-size:11px; color:var(--muted2); }
.menu-item .kbd{
  font-family:var(--mono);
  font-size:11px;
  color:var(--muted2);
  border:1px solid var(--stroke2);
  padding:2px 6px;
  border-radius:8px;
  white-space: nowrap;
}

/* ---------- Middle stage area: vertically scrollable on mobile ---------- */
/* This is where the “behind shutters” vertical scrolling happens. */
.stage-wrap{
  position:relative;

  /* allow vertical scroll in the middle row */
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  padding: 10px;

  /* prevent horizontal bounce */
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
}

.stage{
  position:relative;
  width:100%;

  /* make stage taller than viewport if content needs it */
  min-height: 100%;
  min-height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 20px);

  border-radius: calc(var(--r) + 6px);
  border:1px solid var(--stroke2);
  background:
    radial-gradient(800px 520px at 20% 10%, rgba(51,230,198,.08), transparent 55%),
    radial-gradient(800px 520px at 80% 90%, rgba(138,93,255,.06), transparent 55%),
    rgba(255,255,255,.02);
  box-shadow: var(--shadow);
  overflow:hidden;

  /* mobile layout: 3 rows (top zone, center gap, bottom zone) */
  display:grid;
  grid-template-rows: auto 1fr auto;
}


/* --- Stage: 3-part layout (top / middle / bottom) ------------------- */
.stage.has-middle::after{
  content: none !important; /* disables the old placeholder spacer */
}

.middle-zone{
  grid-row: 2;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 22vh; /* gives the main screen a real presence */
}

.main-screen{
  border-radius: 18px;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow2);
  overflow: hidden;
  min-height: 220px;
  display: flex;
}

.main-screen-inner{
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.main-screen-inner b{
  font-size: 16px;
  letter-spacing: .2px;
}

.main-screen-inner span{
  font-size: 12px;
  color: var(--muted2);
}

/* zones become in-flow (no absolute) so the stage can scroll naturally */
.top-zone, .bottom-zone{
  position:relative;
  left:auto; right:auto;
  height:auto;

  padding: 14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.top-zone{ grid-row: 1; }
.bottom-zone{ grid-row: 3; }

/* center gap row is reserved for your main screen/background/branding */
.stage::after{
  content:"";
  grid-row: 2;
  display:block;
  min-height: 22vh; /* middle “main screen” space */
}

/* titles */
.zone-title{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
}
.zone-title b{
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:.8px;
  color:var(--muted);
  text-transform:uppercase;
}
.zone-title span{ font-size:12px; color:var(--muted2); }

/* Top zone video feed: horizontal only */
.video-strip{
  display:flex;
  gap:10px;
  overflow-x:auto;
  overflow-y:hidden;
  padding-bottom: 6px;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Range scrollbar under the top video strip */
.hscroll-wrap{
  margin-top: 10px;
}

.hscroll{
  width: 100%;
  height: 16px;
  background: transparent;
  appearance: none;
}

.hscroll:disabled{ opacity: .35; }

/* WebKit */
.hscroll::-webkit-slider-runnable-track{
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid var(--stroke2);
}
.hscroll::-webkit-slider-thumb{
  appearance: none;
  width: 22px;
  height: 12px;
  margin-top: -5px;
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.22);
}

/* Firefox */
.hscroll::-moz-range-track{
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid var(--stroke2);
}
.hscroll::-moz-range-thumb{
  width: 22px;
  height: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.22);
}



/* Top feed scrollbar (range) under the strip */
.hscroll-wrap{
  margin-top: 8px;
}

.hscroll{
  width: 100%;
  height: 16px;
  background: transparent;
  appearance: none;
}

.hscroll:disabled{
  opacity: .35;
}

/* WebKit */
.hscroll::-webkit-slider-runnable-track{
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid var(--stroke2);
}
.hscroll::-webkit-slider-thumb{
  appearance: none;
  width: 22px;
  height: 12px;
  margin-top: -4px;
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.22);
}

/* Firefox */
.hscroll::-moz-range-track{
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid var(--stroke2);
}
.hscroll::-moz-range-thumb{
  width: 22px;
  height: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.22);
}

.video-card{
  flex: 0 0 78vw;
  max-width: 320px;
  height: 140px;
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  backdrop-filter: blur(10px);
  scroll-snap-align:start;
  position:relative;
  overflow:hidden;
}

  /* Keep top-zone strip horizontally scrollable on desktop (enables wheel-to-scroll) */
  .top-zone .video-strip{
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;

    max-width: 100%;
    width: 100%;


    /* desktop-friendly snapping + visible scrollbar */
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }


.video-card:before{
  content:"";
  position:absolute; inset:-1px;
  background:
    radial-gradient(240px 160px at 30% 30%, rgba(51,230,198,.18), transparent 55%),
    radial-gradient(240px 160px at 80% 80%, rgba(138,93,255,.14), transparent 60%);
  opacity:.9;
}
.video-card .label{
  position:absolute; left:12px; bottom:12px; right:12px;
  display:flex; flex-direction:column;
  gap:2px;
}
.video-card .label b{ font-size:13px; }
.video-card .label span{ font-size:11px; color:var(--muted2); }

/* Bottom zone: single-column on phones */
.cats{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
.cat{
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  padding:12px;
  min-height: 86px;
  display:flex; flex-direction:column;
  justify-content:space-between;
}
.cat b{ font-size:13px; }
.cat span{ font-size:11px; color:var(--muted2); }
.cat .tag{
  align-self:flex-start;
  margin-top:10px;
  font-family:var(--mono);
  font-size:11px;
  color:var(--muted);
  border:1px solid var(--stroke2);
  border-radius:999px;
  padding:3px 8px;
}

/* ---------- Center feed overlay (My ID) ---------- */
.center-feed{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
  width: calc(100% - 20px);
  max-width: 720px;
  max-height: 64%;
  z-index: 6;
  border-radius: calc(var(--r) + 10px);
  border:1px solid var(--stroke);
  background: var(--panel2);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow2);
  overflow:hidden;
  display: flex;
  flex-direction: column;
  display: flex;
  flex-direction: column;


}

/* --- My ID bottom action bar --------------------------------------- */
.myid-bottombar{
  position: sticky;
  bottom: 0;
  z-index: 20;

  display: flex;
  gap: 10px;
  padding: 10px 12px;

  border-top: 1px solid var(--stroke2);
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(14px);
}
:root[data-theme="light"] .myid-bottombar{
  background: rgba(255,255,255,.55);
}

.myid-bottombar .iconbtn{
  flex: 1 1 0;
  justify-content: center;
  white-space: nowrap;
}




/* --- My ID: dock to top (over the top shutter) ---------------------- */
.center-feed.myid-top{
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 720px;

  /* keep it in the top half area so it "lives" on the top shutter */
 
  max-height: calc(100% - var(--topbar-h) - var(--bottombar-h) - 20px);
  height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 20px);


  z-index: 12; /* above shutters (shutters are lower) */
}

/* make the feed scroll within the docked panel */
.center-feed.myid-top .feed{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- My ID: background behind posts area ---------------------------- */
.center-feed.myid-top .feed.myid-feed{
  position: relative;
}

.center-feed.myid-top .myid-posts-bg{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(1.15) contrast(1.06);
  opacity: .85;
  pointer-events: none;
}

:root[data-theme="light"] .center-feed.myid-top .myid-posts-bg{
  opacity: .55;
}

.center-feed.myid-top .feed.myid-feed .feed-list{
  position: relative;
  z-index: 1;
}



.center-feed .head{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  padding:12px 12px;
  border-bottom:1px solid var(--stroke2);
}
.center-feed .head .left{
  display:flex; align-items:center;
  gap:12px;
  min-width: 0;
}
.center-feed .head .left b{ font-size:14px; letter-spacing:.2px; }
.center-feed .head .left span{ font-size:12px; color:var(--muted2); }
.center-feed .head .right{
  display:flex; gap:8px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* --- My ID compact header ------------------------------------------ */
.center-feed .head.compact{
  padding: 8px 10px;
  gap: 10px;
  align-items: flex-start;
}

.center-feed .head.compact .profile-mini{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 58px;
}

.center-feed .head.compact .myid-avatar.mini{
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.center-feed .head.compact .profile-name{
  font-size: 11px;
  color: var(--muted2);
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.center-feed .head.compact .actions{
  flex: 1 1 auto;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
  align-items: center;
}

.center-feed .head.compact .actions .iconbtn.small{
  width: 100%;
  justify-content: center;
  padding: 8px 6px;
}


.myid-avatar{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  box-shadow: 0 0 0 3px rgba(51,230,198,.10);
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}
.myid-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
/* --- My ID upgraded header (bigger avatar + credential area) -------- */
.center-feed .head.myid-head{
  padding: 12px 12px 10px;
  gap: 12px;
  align-items: stretch;
  min-height: 112px; /* taller top bar */
}

.center-feed .head.myid-head .myid-head-left{
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
}

.myid-avatar.big{
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.center-feed .head.myid-head .myid-head-main{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.center-feed .head.myid-head .myid-head-name{
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.center-feed .head.myid-head .myid-head-meta{
  font-size: 12px;
  color: var(--muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.center-feed .head.myid-head .myid-head-stats{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted2);
  min-height: 14px;
}

.center-feed .head.myid-head .myid-head-bio{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.center-feed .head.myid-head .myid-head-actions{
  flex: 0 0 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  justify-content: flex-start;
}

.iconbtn.thin{
  padding: 6px 8px;  /* thinner buttons */
  justify-content: center;
  width: 100%;
}

/* --- My ID bottom bar: smaller + pinned to bottom ------------------- */
.myid-bottombar{
  margin-top: auto;               /* forces it to the bottom of the ID window */
  padding: 6px 10px;              /* compressed */
  gap: 8px;
  bottom: 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}

.myid-bottombar .iconbtn{
  padding: 6px 8px;
  font-size: 12px;
}

.myid-avatar input{ position:absolute; inset:0; opacity:0; cursor:pointer; }
.myid-avatar .hint{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted2);
  background: rgba(0,0,0,.22);
}
:root[data-theme="light"] .myid-avatar .hint{ background: rgba(255,255,255,.35); }

.feed{
  padding: 10px 12px 12px;
  overflow:auto;
  max-height: calc(64vh - 56px);
  -webkit-overflow-scrolling: touch;
}
.post{
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.02);
  border-radius: 14px;
  padding:12px;
  margin-bottom:10px;
}
.post .row{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}
.post .row b{ font-size:13px; }
.post .row span{
  font-family:var(--mono);
  font-size:11px;
  color:var(--muted2);
  white-space: nowrap;
}
.post p{
  margin:0;
  font-size:13px;
  color:var(--muted);
  line-height:1.35;
}

/* ---------- Shutters: always fit stage; toggles stay thumb-friendly ---------- */
.shutter{
  position:absolute; left:0; right:0;
  height:50%;
  z-index: 6;
  pointer-events: none;

  border-top:1px solid var(--stroke2);
  border-bottom:1px solid var(--stroke2);

  backdrop-filter: blur(14px);
  filter: saturate(1.05);
  transform: translateZ(0);

  transition:
    transform 700ms cubic-bezier(.18,.92,.22,1),
    opacity 220ms var(--ease),
    filter 700ms cubic-bezier(.18,.92,.22,1);
  will-change: transform;
}
.shutter.top{ top:0; border-top:none; }
.shutter.bottom{ bottom:0; border-bottom:none; }

.shutter.top{
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.55)),
    url("assets/img/shutter-top.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.shutter.bottom{
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.35)),
    url("assets/img/shutter-bottom.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.shutter.open.top{ transform: translateY(-100%); }
.shutter.open.bottom{ transform: translateY(100%); }

/* shutter arrow buttons */
.shutter-toggle{
  position:absolute;
  left:50%;
  transform: translateX(-50%);
  z-index: 8;

  width: 48px;
  height: 40px;

  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(12px);

  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;

  transition:
    top 520ms var(--ease),
    bottom 520ms var(--ease),
    transform var(--t) var(--ease),
    background var(--t) var(--ease),
    border-color var(--t) var(--ease);

  user-select:none;
  touch-action: manipulation;
}
:root[data-theme="light"] .shutter-toggle{ background: rgba(255,255,255,.35); }
.shutter-toggle:hover{ border-color: var(--stroke); background: rgba(255,255,255,.06); }
.shutter-toggle:focus{ outline:none; box-shadow: 0 0 0 3px rgba(51,230,198,.18); border-color: rgba(51,230,198,.35); }
.shutter-toggle .arr{
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 18px rgba(51,230,198,.18);
}

/* center toggles sit near the “middle row” */
.stage .shutter-toggle.top{ top: calc(50% - 52px); }
.stage .shutter-toggle.bottom{ bottom: calc(50% - 52px); }
.stage.top-open .shutter-toggle.top{ top: 10px; }
.stage.bottom-open .shutter-toggle.bottom{ bottom: 10px; }

/* ---------- Side panels (kept compatible) ---------- */
.panel{
  position:fixed;
  top: var(--topbar-h);
  bottom: var(--bottombar-h);
  background: var(--panel);
  border:1px solid var(--stroke2);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow2);
  transition: transform var(--t2) var(--ease);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

/* left 1 shutter panel */
.panel.left.shutter-x{
  left: 0;
  width: min(86vw, 340px);
  transform: translateX(-100%);
  transition: transform 700ms cubic-bezier(.18,.92,.22,1);
  will-change: transform;
  z-index: 10;
  border-right: 1px solid var(--stroke2);
  border-radius: 0 18px 18px 0;
}
.panel.left.shutter-x.open{ transform: translateX(0); }

/* left 2 shutter panel */
.panel.tools.shutter-x{
  left: 0;
  width: var(--tool-w);
  transform: translateX(-100%);
  transition: transform 700ms cubic-bezier(.18,.92,.22,1);
  will-change: transform;
  z-index: 10;
  border-right: 1px solid var(--stroke2);
  border-radius: 0 18px 18px 0;
}
.panel.tools.shutter-x.open{ transform: translateX(0); }

/* right inspector */
.panel.right{
  right:8px;
  width: var(--right-w);
  transform: translateX(calc(100% + 24px));
  border-radius: 18px;
  z-index: 20;
}
.panel.right.open{ transform: translateX(0); }

.panel .phead{
  padding:12px 12px;
  border-bottom:1px solid var(--stroke2);
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
}
.panel .phead b{
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:.8px;
  text-transform:uppercase;
  color:var(--muted);
}
.panel .pbody{
  padding:12px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  -webkit-overflow-scrolling: touch;
}
.panel .tile{
  border:1px solid var(--stroke2);
  border-radius: 14px;
  padding:10px;
  background: rgba(255,255,255,.02);
}
.panel .tile b{ font-size:13px; }
.panel .tile span{ display:block; font-size:11px; color:var(--muted2); margin-top:4px; }

/* left toggles (kept; if you remove them in JS/HTML, these won’t matter) */
.shutter-toggle.left{
  position: fixed;
  top: 50%;
  left: 12px;
  transform: translate(0, -50%);
  z-index: 13;
  transition: left 700ms cubic-bezier(.18,.92,.22,1), transform 180ms ease, background 180ms ease;
}
.panel.left.shutter-x.open ~ .shutter-toggle.left{
  left: calc(min(86vw, 340px) + 12px);
}
.shutter-toggle.tools{
  position: fixed;
  top: calc(50% + 56px);
  left: 34px; /* JS can override */
  transform: translate(-50%, -50%);
  z-index: 13;
  transition: left 700ms cubic-bezier(.18,.92,.22,1), transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

/* ---------- Backdrop ---------- */
.backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.45);
  opacity:0;
  pointer-events:none;
  z-index: 19;
  transition: opacity var(--t) var(--ease);
}
.backdrop.show{
  opacity:1;
  pointer-events:auto;
}

/* ---------- Bottom bar: single horizontal scroller (mobile-first) ---------- */
.bottombar{
  display:flex; align-items:center;
  gap:10px;

  padding: 8px 10px calc(8px + var(--safe-bottom));
  border-top:1px solid var(--stroke2);
  background: linear-gradient(0deg, rgba(255,255,255,.06), rgba(255,255,255,0));
  backdrop-filter: blur(10px);
  min-height: var(--bottombar-h);

  /* scroll the whole bar so Post is included */
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bottombar::-webkit-scrollbar{ height:0; width:0; }
.bottombar > *{ flex: 0 0 auto; }

.switches{
  display:flex;
  gap:10px;
  align-items:center;

  /* don’t force it to eat all space; let bar scroll */
  flex: 0 0 auto;

  overflow: visible;
  padding-bottom: 0;
}

.switch{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  cursor:pointer;
  white-space:nowrap;
  user-select:none;
  touch-action: manipulation;
}
.switch .dot{
  width:10px; height:10px; border-radius:50%;
  background: rgba(255,255,255,.18);
}
.switch.on .dot{
  background: radial-gradient(circle at 30% 30%, var(--accent), rgba(51,230,198,.1));
  box-shadow: 0 0 18px rgba(51,230,198,.35);
}
.switch b{ font-size:12px; }
.switch span{ font-size:11px; color:var(--muted2); }



/* --- AUTH OVERLAY (top-most, blocks everything underneath) ----------- */
.auth-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  opacity: 0;
  pointer-events: none;
  z-index: 500;
  transition: opacity 220ms cubic-bezier(.2,.85,.2,1);
}
.auth-backdrop.show{
  opacity: 1;
  pointer-events: auto;
}

.auth-modal{
  position: fixed;
  left: 50%;
  top: calc(var(--topbar-h) + 12px);
  transform: translate(-50%, 14px);
  width: min(92vw, 440px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(18,24,34,.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  z-index: 501;
  overflow: hidden;
  transition: transform 420ms cubic-bezier(.2,.85,.2,1), opacity 220ms cubic-bezier(.2,.85,.2,1);
}
.auth-modal.show{
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0px);
}

:root[data-theme="light"] .auth-modal{
  background: rgba(255,255,255,.78);
  border-color: rgba(0,0,0,.12);
  box-shadow: 0 18px 60px rgba(0,0,0,.16);
}

.auth-head{
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
:root[data-theme="light"] .auth-head{
  border-bottom-color: rgba(0,0,0,.10);
}

.auth-title b{ font-size: 14px; letter-spacing: .2px; display:block; }
.auth-title span{ font-size: 12px; opacity: .65; display:block; margin-top: 2px; }

.auth-tabs{
  display: flex;
  gap: 8px;
}
.auth-tab{
  flex: 1 1 0;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  cursor: pointer;
}
.auth-tab.on{
  border-color: rgba(51,230,198,.35);
  box-shadow: 0 0 0 3px rgba(51,230,198,.14);
}
:root[data-theme="light"] .auth-tab{
  border-color: rgba(0,0,0,.12);
  background: rgba(0,0,0,.03);
}

.auth-body{
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field span{
  font-size: 12px;
  opacity: .7;
}

.auth-input{
  width: 100%;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: inherit;
  outline: none;
}
.auth-input:focus{
  border-color: rgba(51,230,198,.35);
  box-shadow: 0 0 0 3px rgba(51,230,198,.14);
}
:root[data-theme="light"] .auth-input{
  border-color: rgba(0,0,0,.12);
  background: rgba(0,0,0,.03);
}

.auth-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.auth-skip{
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  opacity: .85;
  white-space: nowrap;
}
.auth-skip:hover{ opacity: 1; border-color: rgba(255,255,255,.18); }
:root[data-theme="light"] .auth-skip{
  border-color: rgba(0,0,0,.14);
}





/* ---------- Modal ---------- */
.modal-backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  opacity:0;
  pointer-events:none;
  z-index: 40;
  transition: opacity var(--t) var(--ease);
}
.modal-backdrop.show{
  opacity:1;
  pointer-events:auto;
}
.modal{
  position:fixed;
  left:50%;
  bottom: calc(var(--bottombar-h) + 12px);
  transform: translate(-50%, 24px);
  width: calc(100% - 20px);
  max-width: 720px;
  border-radius: 18px;
  border:1px solid var(--stroke);
  background: var(--panel2);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  z-index: 41;
  opacity:0;
  pointer-events:none;
  transition: transform var(--t2) var(--ease), opacity var(--t) var(--ease);
  overflow:hidden;
}
.modal.show{
  opacity:1;
  pointer-events:auto;
  transform: translate(-50%, 0px);
}
.modal .mhead{
  padding:12px 12px;
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  border-bottom:1px solid var(--stroke2);
}
.modal .mhead b{
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:.8px;
  text-transform:uppercase;
  color:var(--muted);
}
.modal .mbody{
  padding:12px;
  display:flex; flex-direction:column; gap:10px;
}
textarea{
  width:100%;
  min-height: 120px;
  resize: vertical;
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  color:var(--text);
  padding:10px;
  outline:none;
}
textarea:focus{ box-shadow: 0 0 0 3px rgba(51,230,198,.18); border-color: rgba(51,230,198,.35); }
.row2{ display:flex; gap:10px; justify-content:flex-end; }

/* ---------- Profile Editor ---------- */
.profile-backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.65);
  opacity:0;
  pointer-events:none;
  z-index: 70;
  transition: opacity var(--t) var(--ease);
}
.profile-backdrop.show{
  opacity:1;
  pointer-events:auto;
}

.profile-modal{
  position:fixed;
  left:50%;
  top: calc(var(--topbar-h) + 10px);
  transform: translate(-50%, 18px);
  width: calc(100% - 20px);
  max-width: 920px;
  max-height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 20px);
  border-radius: 18px;
  border:1px solid var(--stroke);
  background: var(--panel2);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  z-index: 71;
  opacity:0;
  pointer-events:none;
  transition: transform var(--t2) var(--ease), opacity var(--t) var(--ease);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.profile-modal.show{
  opacity:1;
  pointer-events:auto;
  transform: translate(-50%, 0px);
}

.pedit-head{
  padding:12px 12px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid var(--stroke2);
}
.pedit-title{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}
.pedit-title b{
  font-size: 13px;
  letter-spacing:.4px;
}
.pedit-title span{
  font-size: 12px;
  color: var(--muted2);
}

.pedit-body{
  padding:12px;
  overflow:auto;
  min-height:0;
  -webkit-overflow-scrolling: touch;
}

.pedit-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}
@media (min-width: 860px){
  .pedit-grid{ grid-template-columns: 1fr 1fr; }
}

.pedit-card{
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  padding:12px;
}
.pedit-cardhead{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.pedit-cardhead b{ font-size:13px; }
.pedit-cardhead span{ font-size:11px; color:var(--muted2); }

.pedit-avatar{
  width: 92px;
  height: 92px;
  border-radius: 18px;
  border: 1px solid var(--stroke2);
  overflow:hidden;
  background: rgba(0,0,0,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:10px;
}
.pedit-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }

.pedit-banner{
  width: 100%;
  height: 120px;
  border-radius: 16px;
  border: 1px solid var(--stroke2);
  overflow:hidden;
  background: rgba(0,0,0,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:10px;
}
.pedit-banner img{ width:100%; height:100%; object-fit:cover; display:block; }

.pedit-empty{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted2);
  opacity:.9;
}

.pedit-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.file-hidden{ display:none; }

.pedit-fields{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.pedit-field{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.pedit-field span{
  font-size: 12px;
  color: var(--muted2);
}
.pedit-input{
  width:100%;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  color: inherit;
  outline:none;
}
.pedit-input:focus{
  border-color: rgba(51,230,198,.35);
  box-shadow: 0 0 0 3px rgba(51,230,198,.14);
}
.pedit-textarea{
  width:100%;
  min-height: 90px;
  resize: vertical;
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  color:var(--text);
  padding:10px;
  outline:none;
}
.pedit-textarea:focus{
  box-shadow: 0 0 0 3px rgba(51,230,198,.14);
  border-color: rgba(51,230,198,.35);
}

.pedit-row2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.pedit-rewards{ display:flex; flex-direction:column; gap:10px; }

.reward-pills{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.reward-pill{
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  border-radius: 999px;
  padding: 8px 10px;
  display:flex;
  align-items:baseline;
  gap:10px;
}
.reward-pill b{ font-size:12px; }
.reward-pill span{ font-family: var(--mono); font-size:12px; color: var(--muted); }

.badge-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap:10px;
}
.badge{
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.02);
  border-radius: 12px;
  padding: 10px;
  font-size:12px;
  color: var(--muted);
  text-align:center;
}

.pedit-foot{
  padding:12px 12px;
  border-top:1px solid var(--stroke2);
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

/* ---------- Toasts ---------- */
.toasts{
  position:fixed;
  right: 10px;
  bottom: calc(var(--bottombar-h) + 10px);
  z-index: 60;
  display:flex;
  flex-direction:column;
  gap:10px;
  width: min(360px, calc(100% - 20px));
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow2);
  padding: 10px 12px;
  transform: translateY(6px);
  opacity:0;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show{ opacity:1; transform: translateY(0px); }
.toast b{ font-size:13px; }
.toast p{ margin:6px 0 0; font-size:12px; color:var(--muted2); }

/* ---------- Scrollbars (desktop only; hidden on mobile scrollers above) ---------- */
*::-webkit-scrollbar{ height:10px; width:10px; }
*::-webkit-scrollbar-track{ background: rgba(255,255,255,.04); }
*::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0);
  background-clip: padding-box;
}
:root[data-theme="light"] *::-webkit-scrollbar-track{ background: rgba(0,0,0,.04); }
:root[data-theme="light"] *::-webkit-scrollbar-thumb{ background: rgba(0,0,0,.16); }

/* ---------- Desktop refinements (wider screens) ---------- */
@media (min-width: 700px){
  :root{
    --tool-w: 240px;
    --right-w: 320px;
    --topbar-h: calc(58px + var(--safe-top));
    --bottombar-h: calc(58px + var(--safe-bottom));
  }

  /* Keep 3-zone layout on desktop when middle zone is enabled */
  .stage.has-middle{
    display: grid !important;
    grid-template-rows: auto 1fr auto !important;
  }

  .stage.has-middle .top-zone,
  .stage.has-middle .middle-zone,
  .stage.has-middle .bottom-zone{
    position: relative !important;
    height: auto !important;
  }

  /* topbar behaves like a normal bar on desktop */
  .topbar{
    overflow: visible;
    scrollbar-width: auto;
  }

  /* (rest of your desktop rules...) */


  .topbar .spacer{ display:block; flex:1; }

  /* keep menubar inline without forcing full-bar scroll */
  .topbar > *{ flex: 0 0 auto; }
  .menubar{ flex: 0 1 auto; }
  .brand .title span{ display:none; }

  /* stage padding */
  .stage-wrap{ padding: 12px; }

  /* desktop stage layout: classic “two halves” like your original */
  /* IMPORTANT: only apply this when middle zone is NOT enabled */
  .stage:not(.has-middle){
    display:block;
    height:100%;
    min-height: 100%;
  }
  .stage:not(.has-middle) .top-zone,
  .stage:not(.has-middle) .bottom-zone{
    position:absolute; left:0; right:0;
    padding: 18px;
    height:50%;
  }
  .stage:not(.has-middle) .top-zone{ top:0; }
  .stage:not(.has-middle) .bottom-zone{ bottom:0; }
  .stage:not(.has-middle)::after{ content:none; }

  .cats{
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .video-card{
    flex: 0 0 240px;
    max-width: none;
    height: 140px;
  }

  /* bottom bar on desktop can behave normally; switches keep their own scroller */
  .bottombar{
    overflow: visible;
    scrollbar-width: auto;
  }
  .switches{
    flex: 1 1 auto;
    overflow: auto hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .bottombar > *{ flex: 0 0 auto; }
}

@media (min-width: 1024px){
  .cats{ grid-template-columns: repeat(3, minmax(0,1fr)); }
  .panel.right{ right:10px; }
}

/* ================================
   Step 6: Compose + Attachments UI
   ================================ */

/* Compose upgrades */
.compose-title{
  width:100%;
  border-radius: 14px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  color:var(--text);
  padding:10px;
  outline:none;
}
.compose-title:focus{
  box-shadow: 0 0 0 3px rgba(51,230,198,.18);
  border-color: rgba(51,230,198,.35);
}

.compose-uploads{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-start;
}

.attach-empty{
  font-size:12px;
  color: var(--muted2);
}

.attach-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.attach-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid var(--stroke2);
  border-radius: 12px;
  padding:10px;
  background: rgba(255,255,255,.02);
}
.attach-meta{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}
.attach-meta b{
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.attach-meta span{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted2);
}

/* My ID: background behind posts */
.center-feed.myid-top .feed.myid-feed{ position: relative; }
.center-feed.myid-top .myid-posts-bg{
  position:absolute;
  inset:0;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  opacity:.85;
  pointer-events:none;
}
:root[data-theme="light"] .center-feed.myid-top .myid-posts-bg{ opacity:.55; }
.center-feed.myid-top .feed.myid-feed .feed-list{ position:relative; z-index:1; }

/* Post attachments */
.post-author{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted2);
  margin-bottom: 8px;
}

.attachments{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:10px;
}

.att-img{
  width:100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
  border:1px solid var(--stroke2);
  background: rgba(0,0,0,.12);
}

.att-audio{
  width:100%;
}

.att-video{
  width:100%;
  max-height: 360px;
  border-radius: 12px;
  border:1px solid var(--stroke2);
  background: rgba(0,0,0,.12);
}

.att-file{
  display:block;
  padding:10px;
  border-radius: 12px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.02);
  color: var(--text);
  text-decoration:none;
}

.post-actions{
  margin-top:10px;
  display:flex;
  justify-content:flex-end;
}

.pedit-check{
  display:flex;
  align-items:center;
  gap:10px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border:1px solid var(--stroke2);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
}
.pedit-check span{
  font-size: 12px;
  color: var(--muted2);
}


/* Netlify Identity widget must sit above our auth gate */
.netlify-identity-widget,
#netlify-identity-widget,
.netlify-identity-widget iframe {
  z-index: 100000 !important;
}















