/* Device frames + things every platform shares (status bar, layers, media, carousel, overlays, animations).
   Sizes come from data-device on .phone: android (default), iphone, desktop. */
.phone {
  --bezel: 10px;
  --sw: 412px;
  --sh: 910px;
  --r-out: 40px;
  --r-in: 30px;
  width: calc(var(--sw) + var(--bezel) * 2);
  height: calc(var(--sh) + var(--bezel) * 2);
  padding: var(--bezel);
  border-radius: var(--r-out);
  background: #050506;
  box-shadow: 0 0 0 1.5px #2e2f34, 0 0 0 3px #111114, 0 30px 80px -20px rgba(0,0,0,.6), inset 0 0 2px 1px rgba(255,255,255,.08);
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}
.phone[data-device='iphone'] { --bezel: 12px; --sw: 390px; --sh: 844px; --r-out: 64px; --r-in: 52px; }
.phone[data-device='desktop'] { --bezel: 10px; --sw: 1280px; --sh: 760px; --r-out: 14px; --r-in: 6px; background: #1b1c20; }
.phone.no-frame { --bezel: 0px; --r-out: 0px; --r-in: 0px; box-shadow: 0 10px 40px rgba(0,0,0,.45); background: none; }
.phone.no-frame .island, .phone.no-frame .cam { display: none; }

.phone-screen {
  --st: 34px;       /* status bar / safe area top */
  --sb: 18px;       /* gesture bar / home indicator area */
  --tab: 54px;      /* tab bar height (without the safe area) */
  --tabbar: calc(var(--tab) + var(--sb));
  position: relative;
  width: var(--sw);
  height: var(--sh);
  overflow: hidden;
  border-radius: var(--r-in);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
  contain: layout paint;
}
.phone[data-device='iphone'] .phone-screen { --st: 54px; --sb: 30px; --tab: 50px; }
.phone[data-device='desktop'] .phone-screen { --st: 0px; --sb: 0px; --tab: 0px; }
.phone-screen button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.phone-screen .ico { width: 24px; height: 24px; display: block; flex: none; }
.phone-screen .sp { flex: 1; }

/* Status bar */
.statusbar {
  position: absolute; inset: 0 0 auto 0; height: var(--st); z-index: 60; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; padding: 2px 18px 0 22px;
  font-family: Roboto, 'Segoe UI', Arial, sans-serif; font-weight: 500; font-size: 14px; color: var(--fg); transition: color .25s;
}
.statusbar .sb-left { display: flex; align-items: center; gap: 8px; }
.statusbar .sb-left svg { width: 14px; height: 14px; }
.statusbar .sb-icons { display: flex; align-items: center; gap: 6px; }
.statusbar .sb-icons svg { height: 12px; width: auto; display: block; }
.phone[data-device='iphone'] .statusbar { padding: 6px 30px 0 44px; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif; font-weight: 600; font-size: 16px; }
.phone[data-device='desktop'] .statusbar, .phone[data-device='desktop'] .home-ind { display: none; }
.cam, .island { position: absolute; left: 50%; z-index: 70; pointer-events: none; background: #000; display: none; }
.phone[data-device='android'] .cam { display: block; top: calc(var(--bezel) + 11px); width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 1.5px #111; }
.phone[data-device='iphone'] .island { display: block; top: calc(var(--bezel) + 11px); width: 122px; height: 35px; margin-left: -61px; border-radius: 20px; }
.home-ind {
  position: absolute; bottom: 6px; left: 50%; width: 110px; height: 4px; margin-left: -55px; border-radius: 3px;
  background: var(--fg); opacity: .9; z-index: 70; pointer-events: none; transition: background .25s;
}
.phone[data-device='iphone'] .home-ind { bottom: 8px; width: 136px; height: 5px; margin-left: -68px; }
.phone[data-chrome='dark'] .statusbar { color: #fff; }
.phone[data-chrome='dark'] .home-ind { background: #fff; }

/* Screens stack */
.layers { position: absolute; inset: 0; }
.layer { position: absolute; inset: 0; background: var(--bg); overflow: hidden; }
.layer.anim-in-fade { animation: layerFade .18s ease-out; }
.layer.anim-in-push { animation: layerPushIn .34s cubic-bezier(.2,.8,.2,1); box-shadow: -10px 0 30px rgba(0,0,0,.15); }
.layer.anim-out-push { animation: layerPushOut .34s cubic-bezier(.2,.8,.2,1) forwards; }
.layer.anim-in-pop { animation: layerPopIn .3s cubic-bezier(.2,.8,.2,1); }
.layer.anim-out-pop { animation: layerPopOut .3s cubic-bezier(.2,.8,.2,1) forwards; z-index: 2; box-shadow: -10px 0 30px rgba(0,0,0,.15); }
.layer.anim-in-up { animation: layerUp .34s cubic-bezier(.2,.8,.2,1); z-index: 2; }
.layer.anim-out-down { animation: layerDown .3s cubic-bezier(.4,0,.8,.4) forwards; z-index: 2; }
@keyframes layerFade { from { opacity: 0; } }
@keyframes layerPushIn { from { transform: translateX(100%); } }
@keyframes layerPushOut { to { transform: translateX(-28%); filter: brightness(.85); } }
@keyframes layerPopIn { from { transform: translateX(-28%); filter: brightness(.85); } }
@keyframes layerPopOut { to { transform: translateX(100%); } }
@keyframes layerUp { from { transform: translateY(100%); } }
@keyframes layerDown { to { transform: translateY(100%); } }

.scr { position: absolute; inset: 0; }
.scroller {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: none; padding-bottom: var(--tabbar);
}
.scroller::-webkit-scrollbar { display: none; }
.scroller.is-dragging { cursor: grabbing; }
.snap { scroll-snap-type: y mandatory; padding-bottom: 0; }
.snap > * { scroll-snap-align: start; scroll-snap-stop: always; }
.hscroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
.hscroll::-webkit-scrollbar { display: none; }
.autohide { position: absolute; left: 0; right: 0; top: 0; z-index: 20; will-change: transform; background: var(--bg); padding-top: var(--st); }
.status-cover { position: absolute; inset: 0 0 auto 0; height: var(--st); background: var(--bg); z-index: 21; }

/* Tab bar */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabbar); padding-bottom: var(--sb); z-index: 40;
  display: flex; align-items: stretch; background: var(--bg); border-top: .5px solid var(--sep);
  transition: background .25s, color .25s, transform .3s cubic-bezier(.2,.8,.2,1);
}
.tabbar.hidden { transform: translateY(100%); }
.tabbar > button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; }
.tabbar .ico { width: 26px; height: 26px; }
.tabbar .tab-av { width: 27px; height: 27px; border-radius: 50%; overflow: hidden; }
.tabbar .on .tab-av { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px var(--fg); }
.phone[data-chrome='dark'] .tabbar { background: #000; color: #fff; border-top-color: #262626; }
.tabbar .red-dot, .red-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #ff3040; box-shadow: 0 0 0 1.5px var(--bg); }
.tabbar .dm .red-dot { top: 50%; left: 50%; margin: 3px 0 0 8px; }

/* Media */
.m { width: 100%; height: 100%; display: block; object-fit: cover; background: #111; }
.m-filler { background-size: cover; }
.m-filler.anim { background-size: 180% 180% !important; animation: fillerPan 9s ease-in-out infinite alternate; }
@keyframes fillerPan { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
/* Placeholder "videos" (photos) zoom and drift so they read as playing: 7 s one way, then back.
   Each move stays inside the photo (the zoom is always larger than the drift). */
img.m.kenburns { animation: kb0 7s ease-in-out infinite alternate; will-change: transform; }
img.m.kenburns.kb1 { animation-name: kb1; }
img.m.kenburns.kb2 { animation-name: kb2; }
img.m.kenburns.kb3 { animation-name: kb3; }
@keyframes kb0 { from { transform: scale(1.05); } to { transform: scale(1.3) translate(-5%, -3%); } }
@keyframes kb1 { from { transform: scale(1.3) translate(5%, 2%); } to { transform: scale(1.08) translate(-1.5%, 0); } }
@keyframes kb2 { from { transform: scale(1.15) translate(-5%, 4%); } to { transform: scale(1.3) translate(5%, -4%); } }
@keyframes kb3 { from { transform: scale(1.25) translate(0, 6%); } to { transform: scale(1.12) translate(0, -4%); } }
.m-missing { display: grid; place-items: center; background: repeating-linear-gradient(45deg, #2a2a2a 0 12px, #333 12px 24px); color: #ddd; text-align: center; font-size: 12px; }
.m-missing small { opacity: .7; }

/* Avatars */
.av {
  width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; display: inline-block; flex: none; position: relative;
  background: #c7c7cc; vertical-align: middle;
}
.av > .m, .av > svg { width: 100%; height: 100%; display: block; }
.av-ring {
  --ring: 2px;
  --gap: 2px;
  width: calc(var(--s) + (var(--ring) + var(--gap)) * 2); height: calc(var(--s) + (var(--ring) + var(--gap)) * 2);
  padding: var(--ring); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(45deg, #f9ce34, #ee2a7b 55%, #6228d7);
}
.av-ring > .av { box-shadow: 0 0 0 var(--gap) var(--bg); }
.av-ring.seen { background: var(--sep); }

/* Carousel */
.car { position: relative; overflow: hidden; width: 100%; height: 100%; touch-action: pan-y; }
.car-track { display: flex; width: 100%; height: 100%; will-change: transform; }
.car-slide { flex: 0 0 100%; width: 100%; height: 100%; position: relative; overflow: hidden; }
.car-count {
  position: absolute; top: 12px; right: 12px; background: rgba(18,18,18,.72); color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 12px; opacity: 0; transition: opacity .35s; pointer-events: none; z-index: 2;
}
.car-count.show { opacity: 1; }
.car-arrow {
  position: absolute; top: 50%; margin-top: -14px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.85) !important; color: #262626 !important; display: grid; place-items: center; z-index: 2;
  opacity: 0; transition: opacity .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.car-arrow .ico { width: 16px !important; height: 16px !important; }
.car-prev { left: 8px; }
.car-next { right: 8px; }
.car:hover > .car-arrow { opacity: 1; }
.car-dots { display: flex; gap: 4px; justify-content: center; align-items: center; }
.car-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--dot-off, #c7c7c7); transition: background .2s, transform .2s; }
.car-dots i.on { background: var(--dot-on, #0095f6); }

/* Feedback animations */
.heart-pop {
  position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: #fff; z-index: 5; pointer-events: none;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); animation: heartPop .9s cubic-bezier(.2,.8,.3,1) forwards;
}
.heart-pop .ico { width: 100% !important; height: 100% !important; }
@keyframes heartPop {
  0% { transform: scale(0) rotate(-12deg); opacity: 0; }
  15% { transform: scale(1.2) rotate(6deg); opacity: 1; }
  30% { transform: scale(.95) rotate(0); }
  45% { transform: scale(1); }
  80% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(.6) translateY(-60px); opacity: 0; }
}
.bump { animation: bump .45s cubic-bezier(.2,.9,.3,1.4); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.3); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }
.flash-ico {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; z-index: 80; pointer-events: none;
  animation: flashIco .8s ease-out forwards;
}
.flash-ico .ico { width: 34px !important; height: 34px !important; }
@keyframes flashIco { 0% { transform: scale(.6); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 70% { opacity: 1; } 100% { transform: scale(1.1); opacity: 0; } }
.focus-flash { animation: focusFlash 1.8s ease-out; }
@keyframes focusFlash { 0%, 35% { box-shadow: inset 0 0 0 3px #4f8cff; } 100% { box-shadow: inset 0 0 0 3px transparent; } }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--tabbar) + 16px); transform: translateX(-50%); z-index: 90;
  background: rgba(30,30,30,.92); color: #fff; padding: 9px 16px; border-radius: 20px; font-size: 13px; white-space: nowrap;
  animation: toastIn .25s ease-out; transition: opacity .35s, transform .35s;
}
.toast.out { opacity: 0; transform: translate(-50%, 8px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Overlays (stories, lightbox) */
.overlay-root { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.overlay-root > * { pointer-events: auto; }
.overlay { position: absolute; inset: 0; }

.empty-hint {
  margin: 14px; padding: 18px; border-radius: 14px; border: 1.5px dashed var(--sep); text-align: center; color: var(--fg2); font-size: 13px;
}
.empty-hint p { margin: 0 0 10px; }
.pill-btn { background: var(--accent) !important; color: #fff !important; font-weight: 600; font-size: 13px; padding: 7px 16px !important; border-radius: 8px; }
.tag { color: var(--link, var(--accent)); }
