/* V4 interaction and mobile-fit corrections */
.screen[data-screen="friends"],
.screen[data-screen="profile"]{
  overflow-y:auto;
  overscroll-behavior:contain;
  touch-action:pan-y;
}

.feed-lock{z-index:10}

/* Every post is a true 4:5 image, with the second angle inset. */
.dual-photo{
  height:auto;
  aspect-ratio:4 / 5;
}

/* The posting preview uses exactly the same portrait ratio. */
.your-dual{
  height:auto;
  aspect-ratio:4 / 5;
}
.sheet-content{
  max-height:100dvh;
  overflow-y:auto;
}

/* Keep the shutter safely inside compact phone screens. */
.camera-page{
  min-height:100%;
  display:flex;
  flex-direction:column;
}
.camera-intro{margin-bottom:16px}
.camera-preview{
  width:min(100%,340px);
  height:auto;
  aspect-ratio:4 / 5;
  align-self:center;
  margin:16px 0 12px;
  flex:0 0 auto;
}
.capture-button{
  position:relative;
  z-index:5;
  flex:0 0 66px;
  margin:0 auto;
  box-shadow:0 0 0 4px #070a08,0 0 0 5px #ffffff55;
}
.capture-copy{margin:9px 0 0}

@media (max-height:700px){
  .camera-page h1{font-size:26px}
  .order-option{padding:9px}
  .screen[data-screen="camera"]{overflow-y:auto;touch-action:pan-y}
  .camera-preview{width:min(100%,250px)}
}

/* V14: real friend search and friendship states. */
.friend-search-results{display:grid;gap:7px;margin:-2px 0 12px}
.friend-result,.friend{display:flex;align-items:center;gap:10px;padding:11px 0;border-bottom:1px solid #1d251f}
.friend-result>div,.friend>div{display:grid;gap:1px;flex:1;min-width:0}
.friend-result b,.friend b{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.friend-result small,.friend small{color:var(--muted);font-size:10px}
.avatar-generic{background:linear-gradient(135deg,#244c35,#8fcfa0);color:#071009}
.friend-add{border:1px solid #447956;background:#13251a;color:#dff6e6;border-radius:10px;padding:7px 9px;font-size:10px;font-weight:800}
.friend-state{font:500 9px 'DM Mono';color:var(--muted);text-align:right}
.friends-empty{color:var(--muted);font-size:11px;padding:4px 0 12px;margin:0}

/* V15: real profile archive and direct, permanent post deletion. */
.profile-section-title>span{font:500 9px 'DM Mono';color:var(--muted)}
.profile-empty{grid-column:1/-1;color:var(--muted);font-size:11px;text-align:center;margin:12px 0}
.profile-moment{position:relative;aspect-ratio:1;border:0;border-radius:9px;overflow:hidden;background:#111;padding:0;isolation:isolate}
.profile-moment-main,.profile-moment-inset{position:absolute;background-size:cover;background-position:center}
.profile-moment-main{inset:0}
.profile-moment-inset{width:46%;aspect-ratio:4/5;right:5px;bottom:5px;border:1px solid #dce8dfaa;border-radius:5px;box-shadow:0 4px 13px #000a}
.profile-moment.is-blurred .profile-moment-main,.profile-moment.is-blurred .profile-moment-inset{filter:blur(7px);transform:scale(1.08)}
.profile-moment-lock{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:#07100944;color:#fff;font:500 8px 'DM Mono';letter-spacing:.5px}
.delete-moment{position:absolute;z-index:4;top:5px;right:5px;width:23px;height:23px;border:1px solid #ffffff55;background:#090c0acc;color:#fff;border-radius:50%;display:grid;place-items:center;padding:0}
.delete-moment svg{width:12px;height:12px}

/* V16: no demo people, a sharper mobile surface and deliberate scrolling. */
.screen{overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;scroll-behavior:smooth;touch-action:pan-y;scroll-snap-type:y proximity}
.screen .post-card,.screen .profile-section-title{scroll-snap-align:start}
.topbar{background:linear-gradient(180deg,#070a08 55%,#070a0800);backdrop-filter:blur(14px)}
.daily-row h1{font-size:31px;letter-spacing:-1.85px}
.activity-strip{padding-bottom:3px;scroll-snap-type:x proximity;overscroll-behavior-x:contain}
.activity-card{scroll-snap-align:start;border-color:#344139;background:linear-gradient(145deg,#151d17,#0d120f);box-shadow:inset 0 1px #ffffff08,0 10px 24px #0003}
.you-card{background:linear-gradient(140deg,#163422,#0e1811);border-color:#4c9667}
.mini-plus{box-shadow:0 0 0 3px #1a3523}
.feed{gap:22px;padding-bottom:8px}
.post-card{border:1px solid #263229;border-radius:23px;padding:8px 8px 12px;background:linear-gradient(155deg,#111812,#0a0e0b);box-shadow:0 16px 34px #0004}
.dual-photo{border-radius:16px}
.post-meta{padding:11px 4px 0}
.reaction-pill{background:#182019;border-color:#354139;transition:transform .16s ease,background .16s ease}
.reaction-pill:active{transform:scale(.92);background:#27432f}
.feed-empty{padding:25px 12px;border:1px dashed #334137;border-radius:18px;background:#0d130f}
.tabbar{background:#090d0bf2;border-top-color:#2c382f;box-shadow:0 -12px 36px #0005}
.tab{transition:color .16s ease,transform .16s ease}.tab:active{transform:scale(.91)}
.dose-button{box-shadow:0 0 0 1px #7bd69e88,0 10px 24px #0008}

/* V17: Safari visual viewport – camera controls must never sit behind navigation. */
:root{--app-vh:100dvh}
@media (max-width:700px){
  body,.app-shell{height:var(--app-vh);min-height:var(--app-vh)}
  .app{height:var(--app-vh)!important;min-height:0!important}
  .tabbar{height:calc(76px + env(safe-area-inset-bottom));padding:8px 15px calc(10px + env(safe-area-inset-bottom))}
  .screen{padding-bottom:calc(92px + env(safe-area-inset-bottom))}
  .screen[data-screen="camera"]{padding:10px 20px calc(86px + env(safe-area-inset-bottom));overflow:hidden!important}
  .camera-page{height:100%;min-height:0;gap:10px}
  .camera-page>.eyebrow{margin:0;flex:0 0 auto}
  .order-picker{flex:0 0 auto}
  .order-option{padding:9px 10px}
  .camera-preview{height:clamp(190px,calc(var(--app-vh) - 410px),330px);width:auto;max-width:100%;margin:0 auto;flex:0 0 auto}
  .capture-button{flex-basis:60px;width:60px;height:60px;margin:0 auto}
  .capture-copy{margin:0 0 2px}
}
@media (max-width:700px) and (max-height:680px){
  .screen[data-screen="camera"]{padding-top:6px}
  .camera-preview{height:clamp(170px,calc(var(--app-vh) - 385px),250px)}
  .order-option{padding:7px 9px}
  .capture-copy{display:none}
}

/* V19: clearer friends area for a deliberately small private circle. */
.friends-hero{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.friends-hero h1{margin:0}.friends-hero>div>p:not(.eyebrow){color:var(--muted);font-size:11px;margin:7px 0 0}.friends-total{min-width:58px;padding:9px 8px;border:1px solid #405046;border-radius:15px;background:linear-gradient(145deg,#17231a,#0d130f);display:grid;gap:1px;text-align:center}.friends-total b{font-size:16px;color:var(--green-bright)}.friends-total small,.finder-label{font:500 8px 'DM Mono';letter-spacing:.7px;color:var(--muted)}
.friend-finder{margin-top:25px;padding:12px 13px 2px;border:1px solid #29362e;border-radius:18px;background:#0c120e}.finder-label{margin:0 0 2px}.friend-finder .search{margin:0;border:0;background:transparent;padding:0;height:40px}.friend-finder .search:focus-within{box-shadow:none}.friend-search-results{margin:8px 0 0}.share-circle{width:100%;margin:13px 0 4px;padding:12px;border:1px solid #2d4034;border-radius:15px;background:linear-gradient(145deg,#122018,#0d130f);color:var(--text);display:grid;grid-template-columns:18px 1fr 16px;align-items:center;gap:8px;text-align:left;font-size:11px;font-weight:700}.share-circle svg{width:15px;height:15px;color:var(--green-bright)}.share-circle svg:last-child{justify-self:end;color:var(--muted)}
.friends-page .section-label{display:flex;justify-content:space-between;margin:27px 0 9px;padding-bottom:8px;border-bottom:1px solid #253028}.request,.friend,.friend-result{padding:10px 3px}.request,.friend{border-bottom:1px solid #202a23}.request button{width:29px;height:29px;border-radius:10px}.request button[data-friend-action="accept"]{background:#1b422a;border-color:#3e9b61;color:#ddf7e6}.friend{border:1px solid #27342c;border-radius:16px;background:linear-gradient(145deg,#111913,#0b100d);padding:10px;margin-bottom:7px}.friend .post-number{font-size:9px;padding:5px 7px;border:1px solid #355443;border-radius:20px;background:#142319}.friends-empty{padding:12px;border:1px dashed #314036;border-radius:13px;background:#0c120e;text-align:center}
.invite-panel{margin:14px 0 4px;padding:14px;border:1px solid #2d4034;border-radius:17px;background:linear-gradient(145deg,#122018,#0c120e)}
.invite-panel>div:first-child{display:grid;gap:5px}.invite-panel small,.qr-copy{color:var(--muted);font-size:10px;line-height:1.5}
.invite-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.invite-button{height:38px;border:1px solid #334338;border-radius:11px;background:#111914;color:var(--text);font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;gap:7px}
.invite-button svg{width:14px;height:14px;color:var(--green-bright)}.invite-primary{background:#1a3423;border-color:#456d50}
.profile-header{text-align:left;padding:17px;border-radius:21px;border:1px solid #2c3b30;background:radial-gradient(ellipse at 90% 0,#25452f 0,transparent 53%),linear-gradient(145deg,#151d17,#0c100d);min-height:146px}
.profile-identity{display:flex;align-items:center;gap:13px;padding-right:28px}.profile-avatar{flex:none;margin:0;background:linear-gradient(135deg,#254833,var(--profile-accent,#65c982));background-size:cover;background-position:center;color:#071009}
.profile-copy{min-width:0}.profile-copy h1{font-size:19px;letter-spacing:-.7px;margin:0;overflow-wrap:anywhere}.profile-copy>p:not(.bio){font:10px 'DM Mono';color:var(--muted);margin:4px 0}.profile-copy .bio{font-size:11px;line-height:1.5;color:#d1d7d1;margin:8px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}
.profile-header .settings{top:12px;right:12px}.profile-buttons{display:flex;gap:7px;margin-top:13px}.profile-header .edit-profile{display:flex;align-items:center;justify-content:center;gap:6px;border-radius:10px;color:var(--text);padding:8px 11px;font-size:9px}.profile-header .edit-profile svg{width:13px;height:13px;color:var(--profile-accent,#65c982)}.profile-header .profile-share{width:37px;padding:0}
.profile-stats{margin:12px 0 21px}.profile-stats b{color:var(--profile-accent,#65c982)}
.profile-edit-content,.qr-content{max-height:min(88dvh,760px);overflow:auto;padding-bottom:max(24px,env(safe-area-inset-bottom))}
.profile-edit-content form{padding-top:17px}.profile-photo-control{display:flex;align-items:center;gap:12px;padding:11px;margin-bottom:16px;border:1px solid #29362e;border-radius:14px;background:#0b100d;cursor:pointer}.profile-photo-control .profile-avatar{width:47px;height:47px;margin:0;font-size:15px}.profile-photo-control>span:nth-child(2){display:grid;gap:4px;flex:1}.profile-photo-control b{font-size:11px}.profile-photo-control small{font-size:9px;line-height:1.4;color:var(--muted)}.profile-photo-control>svg{width:15px;color:var(--muted)}
.profile-edit-content .field{margin-bottom:13px}.profile-edit-content .field input,.profile-edit-content .field textarea{width:100%;background:#0b0f0c;border:1px solid var(--line);border-radius:11px;color:var(--text);padding:11px;font-size:12px;resize:vertical}.profile-edit-content .field textarea{min-height:72px}.profile-edit-content .color-input{height:40px;padding:4px!important;max-width:90px}.profile-edit-content .auth-message{margin:3px 0 11px}
.qr-content{padding-bottom:max(28px,env(safe-area-inset-bottom))}.qr-copy{margin:12px 0 17px}.qr-canvas-wrap{display:grid;place-items:center;min-height:245px;margin-bottom:15px;border-radius:17px;background:#f5f7f5}.qr-canvas-wrap canvas{display:block;max-width:100%;height:auto}.qr-canvas-wrap p{padding:16px;color:#29352d;text-align:center;font-size:12px}.invite-url{margin:10px 0 0;text-align:center;overflow-wrap:anywhere;color:var(--muted);font:9px 'DM Mono'}

/* Feed stays freely scrollable; no vertical snapping that can trap the header. */
.screen[data-screen="feed"]{scroll-snap-type:none!important;scroll-behavior:auto!important;scroll-padding-top:0}
.screen[data-screen="feed"] .post-card,.screen[data-screen="feed"] .profile-section-title{scroll-snap-align:none!important}
