/* ================= PHONE — iPhone 16 Frame ================= */
.device{width:421px;height:884px;border-radius:56px;padding:14px;
  background:linear-gradient(160deg,#1e1e20 0%,#111113 40%,#0d0d0f 100%);
  flex:none;position:relative;
  box-shadow:
    0 40px 80px rgba(0,0,0,.55),
    0 8px 20px rgba(0,0,0,.4),
    inset 0 0 0 1px rgba(255,255,255,.08),
    inset 0 1px 0 rgba(255,255,255,.12)}

/* iPhone 16 side buttons */
.hw-btn{position:absolute;z-index:20;pointer-events:none;
  background:linear-gradient(90deg,#0e0e10,#1a1a1c);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07),inset 0 -1px 0 rgba(0,0,0,.6)}
.hw-action{left:-3.5px;top:172px;width:4px;height:36px;border-radius:3px 0 0 3px}
.hw-vup{left:-3.5px;top:232px;width:4px;height:74px;border-radius:3px 0 0 3px}
.hw-vdown{left:-3.5px;top:324px;width:4px;height:74px;border-radius:3px 0 0 3px}
.hw-power{right:-3.5px;top:232px;width:4px;height:118px;border-radius:0 3px 3px 0}
.hw-camctrl{right:-3.5px;top:416px;width:4px;height:70px;border-radius:0 3px 3px 0}


.screen{width:100%;height:100%;border-radius:44px;overflow:hidden;display:flex;flex-direction:column;
  background:var(--wa-chat);font-family:var(--sysfont);position:relative;
  outline:1.5px solid rgba(255,255,255,.05)}
/* Chat wallpaper lives on the screen, not on the body, so the frosted bars
   above and below it have something to blur. */
.screen.wallpaper{background-image:url("../assets/wallpaper.png");
  background-size:cover;background-position:center;background-repeat:no-repeat}

/* Dynamic Island */
.dynamic-island{position:absolute;top:11px;left:50%;transform:translateX(-50%);
  width:120px;height:34px;background:#000;border-radius:17px;z-index:10;pointer-events:none;
  box-shadow:0 0 0 1px rgba(255,255,255,.07),inset 0 0 8px rgba(0,0,0,.8)}
.dynamic-island::after{content:"";position:absolute;right:13px;top:50%;transform:translateY(-50%);
  width:11px;height:11px;background:#0a0a0c;border-radius:50%;
  box-shadow:0 0 0 2px rgba(255,255,255,.06),inset 0 0 4px rgba(0,0,0,.7)}

/* status bar — floats over the chat body so the frosted glass has messages to blur */
.sb{height:59px;display:flex;align-items:center;justify-content:space-between;
  padding:0 30px 5px 32px;font-weight:600;font-size:15px;position:absolute;top:0;left:0;right:0;z-index:5;direction:ltr}
/* Bar heights are measured into these by syncBarInsets(); --kbd-h tracks the
   video-generator keyboard, which slides the input bar up. */
.screen{--kbd-h:0px}
.screen:has(#vkbd.kshow){--kbd-h:260px}
.sb .r{display:flex;align-items:center;gap:7px}
.sb .r svg.sb-icons{height:13px;width:auto;display:block}
.sb .batt{display:flex;align-items:center;gap:3px}
.sb .batt .shell{width:23px;height:12px;border:1px solid;border-radius:3px;display:flex;padding:1.4px;opacity:.9}
.sb .batt .shell::after{content:"";position:absolute;margin-inline-start:23px;width:2px;height:4px;border-radius:0 2px 2px 0;background:currentColor;opacity:.5;align-self:center}
.sb .batt .fill{flex:1;border-radius:1px;background:currentColor}
.screen.android .sb{background:var(--wa-android-head);color:#fff}
/* iOS: one frosted-glass panel behind BOTH the status bar and the chat header,
   so they read as a single continuous piece instead of two blurs meeting at a
   seam. The bars themselves stay transparent and just hold their text/icons.
   Height tracks the measured bar heights (--sb-h / --chead-h). */
.screen.ios::before{content:"";position:absolute;top:0;left:0;right:0;z-index:4;pointer-events:none;
  height:calc(var(--sb-h,59px) + var(--chead-h,56px));
  background:var(--glass-ios);
  -webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur)}
.screen.ios .sb{background:transparent;color:#0b0b0b}

/* chat header — floats over the chat body, directly under the status bar */
.chead{display:flex;align-items:center;gap:8px;padding:7px 10px 9px;position:absolute;top:var(--sb-h,59px);left:0;right:0;z-index:5;direction:ltr}
.chead .bk{display:flex;align-items:center;padding:2px;gap:2px}
.chead .bk .badge{font-size:17px;font-weight:400;color:inherit;line-height:1}
.chead .bk svg{height:23px;width:auto}
.chead .who .nm{display:flex;align-items:center;gap:5px}
.chead .mute{width:14px;height:14px;opacity:.9;flex:none}
.screen.android .chead{background:var(--wa-android-head);color:#fff}
.screen.ios .chead{background:transparent;color:#0a0a0a}
.chead .cav{width:40px;height:40px;border-radius:50%;overflow:hidden;flex:none;background:#cfd6db center/cover no-repeat;display:grid;place-items:center;border:none}
.chead .cav svg{width:40px;height:40px;fill:rgba(255,255,255,.92)}
.screen.ios .chead .cav svg{fill:#fff}
.chead .who{flex:1;min-width:0;display:flex;flex-direction:column}
.chead .who .nm{font-size:17px;font-weight:600;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chead .who .st{font-size:13px;line-height:1.2;opacity:.55;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chead .acts{display:flex;align-items:center;gap:18px;padding-inline-end:8px}
.chead .acts svg{height:23px;width:auto}
.screen.ios .chead{flex-direction:row}
.screen.ios .chead .acts{gap:20px}

/* chat body — transparent, the wallpaper/colour behind it belongs to .screen.
   Fills the whole screen and reserves room for the bars floating over it. */
.body{flex:1;overflow-y:auto;position:relative;display:flex;flex-direction:column;gap:5px;z-index:1;
  background:transparent;
  padding:calc(var(--sb-h,59px) + var(--chead-h,56px) + 10px) 10px calc(var(--ibar-h,77px) + var(--kbd-h,0px) + 8px);
  scrollbar-width:none}
/* hide the chat scrollbar — it still scrolls, just like a real phone */
.body::-webkit-scrollbar{display:none;width:0;height:0}

.day{align-self:center;display:flex;align-items:center;height:20px;padding:0 12px;
  background:#fff;color:#0A0A0A;font-size:12px;font-weight:600;
  border-radius:8px;border:.33px solid rgba(0,0,0,.06);margin:4px 0;white-space:nowrap}

.line{display:flex;width:100%}
.line.me{justify-content:flex-start}
.line.them{justify-content:flex-end}
.bub{max-width:80%;border-radius:12px;padding:7px 10px 22px;font-size:15px;line-height:1.34;color:#111b21;
  box-shadow:none;position:relative;word-wrap:break-word;overflow:visible}
.bub.img,.bub.link-card{overflow:hidden}
.me .bub{background:var(--wa-me);border:none;outline:0.66px solid rgba(0,0,0,0.06)}
.them .bub{background:var(--wa-them);border:none;outline:0.66px solid rgba(0,0,0,0.06)}
.screen.dark .them .bub{outline-color:rgba(255,255,255,.1)}
.bub-tail{position:absolute;bottom:0;overflow:visible;pointer-events:none;display:block}
.meta{position:absolute;right:9px;bottom:4px;display:inline-flex;align-items:center;
  gap:3px;font-size:11px;color:var(--wa-meta);white-space:nowrap;direction:ltr}
.meta .tk{display:flex}
.meta .tk.read{color:var(--wa-tick)}
.meta .ed{font-style:italic;opacity:.8}
.line.hasreact{margin-bottom:13px}
.react{position:absolute;bottom:-12px;inset-inline-start:8px;background:#fff;border:1px solid rgba(0,0,0,.06);
  border-radius:12px;padding:1px 5px;font-size:12px;line-height:1.4;box-shadow:0 1px 3px rgba(0,0,0,.18);z-index:2}
.screen.dark .react{background:#2a3942;border-color:rgba(255,255,255,.08)}
.bub.deleted{color:#8696a0;font-style:italic;display:inline-flex;align-items:center;gap:6px}
.bub.deleted svg{width:15px;height:15px;fill:none;stroke:#8696a0;stroke-width:2;flex:none}

.fwd{display:flex;align-items:center;gap:4px;font-size:12px;font-style:italic;color:#8696a0;margin-bottom:2px}
.fwd svg{width:13px;height:13px;fill:#8696a0}
.reply{border-inline-start:3px solid var(--accent);background:rgba(0,0,0,.04);border-radius:5px;
  padding:4px 7px;margin-bottom:3px;font-size:12.5px}
.reply .rn{color:var(--accent);font-weight:600;font-size:12px;display:block}
.reply .rt{color:#5a6770;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;max-width:200px}
/* Media bubble sized like WhatsApp iPhone: caps width ~72% AND height, keeps
   the original aspect ratio, and the green/white bubble shrink-wraps the media.
   Portrait → narrow & tall; landscape → wide but within the max width. */
.bub.img{padding:3px;max-width:72%;position:relative;line-height:0}
.bub.img img{display:block;border-radius:6px;max-width:100%;max-height:320px;width:auto;height:auto}
.bub.img .img-ph{width:180px;height:230px;background:#cfd6db;border-radius:6px;
  display:grid;place-items:center;color:#7a8893;font-size:12px;line-height:1.4}
.bub.img .cap{padding:5px 7px 3px;line-height:1.34}
/* video play overlay — same sizing rules as images */
.bub.img .vid-play{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  width:46px;height:46px;border-radius:50%;background:rgba(0,0,0,.5);display:grid;place-items:center;z-index:2}
.bub.img .vid-play svg{width:22px;height:22px;fill:#fff;margin-left:2px}
/* time over media (no caption): white with a subtle gradient scrim, like WhatsApp */
.bub.img:not(.hascap) .meta{right:11px;bottom:8px;color:#fff;z-index:3}
.bub.img:not(.hascap) .meta .tk.read{color:#fff}
.bub.img:not(.hascap)::after{content:"";position:absolute;left:0;right:0;bottom:0;height:40px;
  border-radius:0 0 6px 6px;background:linear-gradient(transparent,rgba(0,0,0,.34));pointer-events:none;z-index:1}

/* voice message */
.bub.vbub{padding:9px 10px 22px 9px}
.vfl{display:flex;align-items:center;gap:0;direction:ltr}
.vav{width:52px;height:52px;border-radius:50%;flex:none;position:relative;
  background:#cfd6db center/cover no-repeat;border:.33px solid rgba(10,10,10,.1)}
.vbadge{position:absolute;right:-2px;bottom:-2px;width:23px;height:23px;border-radius:50%;
  border:2.5px solid;display:grid;place-items:center}
.me .vbadge{background:var(--wa-me);border-color:var(--wa-me)}
.them .vbadge{background:var(--wa-them);border-color:var(--wa-them)}
.screen.dark .me .vbadge{background:#005c4b;border-color:#005c4b}
.screen.dark .them .vbadge{background:#202c33;border-color:#202c33}
.vbadge svg{width:13px;height:13px;fill:#767779;display:block}
.vprow{flex:1;display:flex;align-items:center;margin-left:10px;gap:0;min-width:0}
.vpbtn{flex:none;margin-right:14px;display:flex;align-items:center;line-height:0}
.vpbtn svg{display:block}
.vwrap{flex:1;height:28px;position:relative;display:flex;align-items:center}
.vdot{position:absolute;left:0;top:50%;transform:translate(-50%,-50%);
  width:14px;height:14px;border-radius:50%;background:#007BFC;flex:none;z-index:1}
.vbars{display:flex;align-items:center;gap:1.5px;height:100%;padding-left:12px;flex:1}
.vbars i{width:2px;flex:none;border-radius:2px;background:rgba(0,0,0,.2)}
.me .vbars i{background:rgba(0,0,0,.25)}
.them .vbars i{background:rgba(0,0,0,.18)}
.screen.dark .me .vbars i{background:rgba(255,255,255,.35)}
.screen.dark .them .vbars i{background:rgba(255,255,255,.22)}
.vdur{position:absolute;left:73px;bottom:5px;font-size:11px;
  color:var(--wa-meta);direction:ltr;white-space:nowrap}

/* missed call bubble */
.bub.cbub-wrap{padding:12px 12px 22px 12px;min-width:235px}
.bub.cbub-wrap::before{content:'';position:absolute;inset:4px;border-radius:8px;
  background:rgba(10,10,10,.04);pointer-events:none}
.cbuf{display:flex;align-items:center;gap:9px;position:relative;direction:ltr}
.cico{width:44px;height:44px;border-radius:50%;background:rgba(255,255,255,.7);
  display:grid;place-items:center;flex:none}
.cico svg{width:16px;height:16px;display:block}
.cbdy{flex:1;display:flex;flex-direction:column;gap:5px}
.ctit{font-size:14px;font-weight:600;color:#0A0A0A;line-height:1.3}
.csub{font-size:14px;color:rgba(0,0,0,.5);line-height:1.3}
.cbub-wrap .meta{bottom:5px}

/* link card */
.link-card{max-width:78%}
.lc-top{display:flex;flex-direction:column;background:rgba(0,0,0,.045);border-radius:7px;overflow:hidden;margin-bottom:4px}
.lc-top img{width:100%;display:block}
.lc-yt{position:relative}
.lc-yt .play{position:absolute;inset:0;display:grid;place-items:center}
.lc-yt .play span{width:44px;height:30px;background:rgba(0,0,0,.75);border-radius:7px;display:grid;place-items:center}
.lc-yt .play span::after{content:"";border-left:13px solid #fff;border-top:8px solid transparent;border-bottom:8px solid transparent;margin-left:3px}
.lc-info{padding:7px 9px}
.lc-info .t{font-size:13px;font-weight:600;line-height:1.25}
.lc-info .d{font-size:12px;color:var(--wa-meta);margin-top:2px}
.lc-url{color:var(--wa-link);font-size:13.5px;word-break:break-all;text-decoration:underline;text-decoration-color:rgba(2,126,181,.4)}

/* document */
.doc{display:flex;align-items:center;gap:9px;background:rgba(0,0,0,.05);border-radius:8px;padding:9px;min-width:200px}
.doc .ic{width:34px;height:40px;background:#ea4335;border-radius:5px;flex:none;display:grid;place-items:center;
  color:#fff;font-size:9px;font-weight:800}
.doc .dn{font-size:13px;font-weight:600;line-height:1.2;word-break:break-word}
.doc .ds{font-size:11px;color:var(--wa-meta);margin-top:2px}

/* typing bubble */
.typing{display:flex;gap:5px;padding:11px 14px 11px 14px;align-items:center}
.typing i{width:8px;height:8px;border-radius:50%;background:#9aa6ad;animation:tp 1.3s ease-in-out infinite;flex:none}
.typing i:nth-child(2){animation-delay:.22s}.typing i:nth-child(3){animation-delay:.44s}
@keyframes tp{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-4px)}}
.bub.typing-bub{padding:0;display:inline-block}

/* input bar — floats over the chat body, riding above the keyboard when it opens */
.ibar{display:flex;align-items:center;z-index:5;direction:ltr;position:absolute;left:0;right:0;
  bottom:var(--kbd-h,0px);transition:bottom .28s cubic-bezier(.4,0,.2,1)}
.screen.android .ibar{gap:8px;padding:8px 10px 22px;background:var(--wa-chat)}
.screen.ios .ibar{min-height:77px;height:auto;padding:8px 17px 28px 13px;align-items:flex-end;
  background:var(--glass-ios);
  -webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur)}
.ifield{flex:1;background:#fff;border-radius:24px;min-height:44px;display:flex;align-items:center;
  padding:0 14px;color:#8696a0;font-size:16px;gap:8px;box-shadow:0 1px 1px rgba(0,0,0,.06)}
.ibar .ic{color:#54656f;flex:none;display:grid;place-items:center}
.ibar .ic svg{width:26px;height:26px;fill:#54656f}
.ibar .send{width:46px;height:46px;border-radius:50%;background:var(--wa-android-head);flex:none;display:grid;place-items:center}
.ibar .send svg{width:24px;height:24px;fill:#fff}
/* iOS ibar */
.ipls{flex:none;width:20px;height:33px;display:flex;align-items:center;justify-content:center}
/* iOS text field: grows vertically + wraps, then scrolls at max height (like WhatsApp) */
.ifld{flex:1;min-height:33px;max-height:98px;border-radius:17px;background:#fff;border:0.33px solid #B2B2B2;
  display:flex;align-items:flex-end;gap:6px;margin-left:14px;padding:5px 8px 5px 14px;box-sizing:border-box;
  overflow-y:auto;overflow-x:hidden}
.ifld-gap{flex:1}
.istk{display:block;flex:none;width:18px;height:18px;margin-bottom:4px}
.icam{flex:none;height:28.67px;display:flex;align-items:center;margin-left:18px}
.imic{flex:none;height:28.67px;display:flex;align-items:center;margin-left:19px}
.homebar{position:absolute;bottom:8px;left:50%;transform:translateX(-50%);width:134px;height:5px;border-radius:3px;background:rgba(0,0,0,.75);z-index:6}
.screen.android .homebar{display:none}
