/* v65 — Reference-led WhatsApp iOS visual pass.
   Scoped to WhatsApp so iMessage and the editor surfaces remain unchanged. */

html[data-social-app="whatsapp"][data-theme="light"]{
  --bubble-out:#d7fdd2;
  --bubble-in:#ffffff;
  --bubble-out-text:#080808;
  --bubble-in-text:#080808;
  --bubble-meta:#626a65;
  --chat-bg:#edeae3;
  /* Native header is a frosted bar with a near-opaque neutral tint: over the
     default wallpaper it reads as a faint lighter band, over photos as a bar. */
  --nav-bg:rgba(241,241,236,.98);   /* near-opaque: photos must not show through, live or exported */
  --composer-field:rgba(255,255,255,.92);
  --input-border:rgba(60,60,67,.13);
  --statusbar-text:#050505;
}
html[data-social-app="whatsapp"][data-theme="dark"]{
  --bubble-out:#134d37;
  --bubble-in:#242626;
  --bubble-out-text:#f7f8f7;
  --bubble-in-text:#f7f8f7;
  --bubble-meta:#adb7b2;
  --chat-bg:#0b0c0c;
  --nav-bg:rgba(18,21,20,.98);
  --composer-field:rgba(26,29,29,.94);
  --input-border:rgba(255,255,255,.08);
  --statusbar-text:#fff;
}

/* The desktop canvas now uses the same tall, edge-to-edge phone ratio as the
   supplied captures instead of shrinking the usable screen inside a thick bezel. */
@media (min-width:781px){
  html[data-social-app="whatsapp"] #stage{padding:12px}
  html[data-social-app="whatsapp"] #phone-frame{
    height:min(968px,calc(100dvh - 24px));
    width:auto;
    aspect-ratio:946/2048;
    padding:0;
    border-radius:38px;
    background:transparent;
    box-shadow:0 28px 86px rgba(0,0,0,.46),0 0 0 1px rgba(255,255,255,.08);
  }
  html[data-social-app="whatsapp"] #phone-screen{border-radius:38px}
  html[data-social-app="whatsapp"] #phone-frame::before{display:none}
}

html[data-social-app="whatsapp"] .chat-scroll{
  padding:14px 12px 24px!important;
  scroll-padding-bottom:92px;
}
html[data-social-app="whatsapp"] .wa-composer-surface{
  background-color:var(--wa-room-color,var(--chat-bg));
  background-image:var(--wa-room-image,none);
  background-size:var(--wa-room-size,auto);
  background-repeat:var(--wa-room-repeat,repeat);
  background-position:var(--wa-room-position,center);
}
html[data-social-app="whatsapp"] .composer{
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
}
/* Header proportions and floating circular controls follow the supplied iOS UI. */
html[data-social-app="whatsapp"] .statusbar{
  font-size:16px;
  font-weight:650;
  padding-left:28px;
  padding-right:27px;
}
html[data-social-app="whatsapp"] .chat-navbar{
  height:calc(var(--status-h) + 64px);
  background:var(--nav-bg);
  border-bottom:0;
}
html[data-social-app="whatsapp"] .chat-navbar-inner{
  height:64px;
  padding:6px 15px 7px;
  gap:10px;
}
html[data-social-app="whatsapp"] .chat-back-pill,
html[data-social-app="whatsapp"] .chat-call-pill{
  height:48px;
  min-height:48px;
  border-radius:25px;
  border:.5px solid rgba(120,120,128,.10);
  box-shadow:0 2px 12px rgba(0,0,0,.055);
}
html[data-social-app="whatsapp"] .chat-back-pill{
  min-width:48px;
  padding:0 11px;
}
html[data-social-app="whatsapp"] .chat-back-pill svg{width:27px;height:27px}
html[data-social-app="whatsapp"] .chat-contact-button>.avatar{width:43px;height:43px}
html[data-social-app="whatsapp"] .chat-contact-copy strong{
  font-size:18px;
  line-height:22px;
  letter-spacing:-.25px;
}
html[data-social-app="whatsapp"] .chat-contact-copy span{
  font-size:13.5px;
  line-height:17px;
}
html[data-social-app="whatsapp"] .chat-call-pill{padding:0 5px}
html[data-social-app="whatsapp"] .chat-call-pill button{width:42px;height:42px}
html[data-social-app="whatsapp"] .chat-call-pill svg{width:27px;height:27px}
html[data-social-app="whatsapp"][data-theme="light"] .chat-back-pill,
html[data-social-app="whatsapp"][data-theme="light"] .chat-call-pill{background:rgba(255,255,255,.82)}
html[data-social-app="whatsapp"][data-theme="dark"] .chat-back-pill,
html[data-social-app="whatsapp"][data-theme="dark"] .chat-call-pill{
  background:rgba(29,35,33,.94);
  border-color:rgba(255,255,255,.08);
}

/* Bubble rhythm, scale and colour. The v63 SVG tail remains the single source
   of truth for both the app and exported screenshots. */
html[data-social-app="whatsapp"] .msg-row{margin:4px 0}
html[data-social-app="whatsapp"] .wa-cluster-start,
html[data-social-app="whatsapp"] .wa-cluster-mid{margin-bottom:1px}
html[data-social-app="whatsapp"] .wa-cluster-mid,
html[data-social-app="whatsapp"] .wa-cluster-end{margin-top:1px}
html[data-social-app="whatsapp"] .bubble{
  max-width:84%;
  border-radius:18px!important;
  padding:8px 11px 7px;
  font-size:17px;
  line-height:1.31;
  letter-spacing:-.12px;
  box-shadow:0 .5px 1.5px rgba(0,0,0,.13);
}
/* Text bubbles wrap at ~74% of the screen like the native app (measured from
   iOS captures); media, voice, document, location, contact and call cards keep
   their own widths. */
html[data-social-app="whatsapp"] .bubble:not(.media):not(.voice):not(.doc):not(.location):not(.contact-card):not(.call-entry){max-width:78%}
html[data-social-app="whatsapp"] .bubble.in{border-bottom-left-radius:18px!important}
html[data-social-app="whatsapp"] .bubble.out{border-bottom-right-radius:18px!important}
html[data-social-app="whatsapp"] .bubble-meta-inline{
  margin:10px 0 -2px 10px!important;
  top:2px;
  height:13px;
  line-height:13px;
  font-size:11.5px;
}
html[data-social-app="whatsapp"] .bubble-meta-inline svg{height:12px!important}
html[data-social-app="whatsapp"] .wa-wingtail{
  width:19px!important;
  height:19px!important;
  bottom:-1px!important;
}
html[data-social-app="whatsapp"] .bubble.in>.wa-wingtail{left:-8px!important}
html[data-social-app="whatsapp"] .bubble.out>.wa-wingtail{right:-8px!important}
html[data-social-app="whatsapp"] .date-chip-wrap{margin:8px 0 12px}
html[data-social-app="whatsapp"] .date-chip,
html[data-social-app="whatsapp"] .sys-chip{
  padding:5px 11px;
  border-radius:10px;
  font-size:12.5px;
  font-weight:600;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
html[data-social-app="whatsapp"][data-theme="light"] .date-chip,
html[data-social-app="whatsapp"][data-theme="light"] .sys-chip{
  background:rgba(255,255,255,.90);
  color:#3b403d;
}
html[data-social-app="whatsapp"][data-theme="dark"] .date-chip,
html[data-social-app="whatsapp"][data-theme="dark"] .sys-chip{
  background:rgba(31,37,36,.92);
  color:#f2f3f2;
}

/* Composer mirrors the reference: plus, roomy field, camera, green mic/send. */
html[data-social-app="whatsapp"] .composer{
  padding:9px 12px calc(12px + env(safe-area-inset-bottom,0px));
  gap:7px;
  background:transparent;
}
html[data-social-app="whatsapp"] .composer-round{
  width:46px;
  height:46px;
  min-width:46px;
  min-height:46px;
  border-radius:24px;
  box-shadow:0 2px 9px rgba(0,0,0,.06);
}
html[data-social-app="whatsapp"] .composer-round svg{width:27px;height:27px}
html[data-social-app="whatsapp"] .composer-field-wrap{
  min-height:46px;
  border-radius:24px;
  padding:2px 4px 2px 15px;
  box-shadow:0 2px 9px rgba(0,0,0,.045);
}
html[data-social-app="whatsapp"] .composer-field-wrap textarea{
  font-size:17px;
  line-height:22px;
  padding:9px 0 9px;
}
html[data-social-app="whatsapp"] .composer-inline-btn{width:37px;height:42px}
html[data-social-app="whatsapp"] .clock-control{display:flex}
html[data-social-app="whatsapp"] .voice-main{
  background:#18c56e!important;
  color:#fff!important;
  border-color:transparent!important;
}
html[data-social-app="whatsapp"][data-theme="light"] .composer-round:not(.voice-main),
html[data-social-app="whatsapp"][data-theme="light"] .composer-field-wrap{background:rgba(255,255,255,.91)}
html[data-social-app="whatsapp"][data-theme="dark"] .composer-round:not(.voice-main),
html[data-social-app="whatsapp"][data-theme="dark"] .composer-field-wrap{
  background:rgba(26,29,29,.94);
  color:#fff;
  border-color:rgba(255,255,255,.07);
}

@media (max-width:420px){
  html[data-social-app="whatsapp"] .chat-navbar-inner{padding-left:10px;padding-right:10px;gap:7px}
  html[data-social-app="whatsapp"] .chat-back-pill{min-width:46px;height:46px}
  html[data-social-app="whatsapp"] .chat-contact-button>.avatar{width:40px;height:40px}
  html[data-social-app="whatsapp"] .chat-contact-copy strong{font-size:17px}
  html[data-social-app="whatsapp"] .chat-call-pill button{width:38px}
  html[data-social-app="whatsapp"] .chat-scroll{padding-left:9px!important;padding-right:9px!important}
  html[data-social-app="whatsapp"] .bubble{max-width:87%;font-size:16.5px}
  html[data-social-app="whatsapp"] .composer{padding-left:9px;padding-right:9px;gap:5px}
  html[data-social-app="whatsapp"] .composer-round{width:44px;height:44px;min-width:44px;min-height:44px}
}

/* v65.4 — measured against native WhatsApp iOS captures (6.1" iPhone, 393pt).
   Every value below was read from the captures at 1:1 point scale; keep them
   together so the room geometry has one owner instead of more layers. */
html[data-social-app="whatsapp"] .chat-navbar{
  height:calc(var(--status-h) + 56px)!important;   /* bar ends ~106pt */
}
html[data-social-app="whatsapp"] .chat-navbar-inner{
  height:49px!important;
  margin-top:-3px!important;            /* pills start at y=47 */
  padding:0 16.5px 5px!important;
  gap:8px!important;
  align-items:flex-start!important;
}
html[data-social-app="whatsapp"] .chat-back-pill,
html[data-social-app="whatsapp"] .chat-call-pill{
  height:44px!important;
  min-height:44px!important;
  border-radius:22px!important;
}
html[data-social-app="whatsapp"] .chat-back-pill{
  min-width:44px!important;
  padding:0 9px 0 8px!important;
  gap:2px!important;
  font-size:17px!important;
  font-weight:400!important;
}
/* The chevron path sits inside a 24-unit box with ~7 units of air each side. */
html[data-social-app="whatsapp"] .chat-back-pill svg{width:20px!important;height:20px!important;margin:0 -5.5px 0 -5px!important}
html[data-social-app="whatsapp"] .chat-back-pill svg path{stroke-width:2.05!important}
html[data-social-app="whatsapp"] .chat-contact-button{gap:11px!important;align-self:center!important}
html[data-social-app="whatsapp"] .chat-contact-button>.avatar{
  width:36px!important;
  height:36px!important;
  min-width:36px!important;
  font-size:14px!important;
}
html[data-social-app="whatsapp"] .chat-contact-copy strong{
  font-size:17px!important;
  font-weight:600!important;
  line-height:21px!important;
  letter-spacing:-.4px!important;
}
html[data-social-app="whatsapp"] .chat-contact-copy span{
  font-size:12.5px!important;
  line-height:15px!important;
}
html[data-social-app="whatsapp"] .chat-call-pill{
  width:102px!important;
  padding:0 4px 0 6px!important;
  justify-content:space-between!important;
}
html[data-social-app="whatsapp"] .chat-call-pill button{width:44px!important;height:44px!important}
/* ios-legacy-compat-v34 pins icons with flex:0 0 25px, which beats width. */
html[data-social-app="whatsapp"] .chat-back-pill svg,
html[data-social-app="whatsapp"] .chat-call-pill svg,
html[data-social-app="whatsapp"] .composer-round svg,
html[data-social-app="whatsapp"] .composer-inline-btn svg{flex:none!important;max-width:none!important;max-height:none!important}
html[data-social-app="whatsapp"] .chat-call-pill [aria-label="Video call"] svg{width:35px!important;height:35px!important}
html[data-social-app="whatsapp"] .chat-call-pill [aria-label="Voice call"] svg{width:29px!important;height:29px!important}

/* Bubbles sit 16.5pt from both edges; text bubbles wrap at ~290pt. */
html[data-social-app="whatsapp"] .chat-scroll{
  padding-left:16.5px!important;
  padding-right:16.5px!important;
}
/* Tail box matches the 24x18 native wedge drawn by whatsapp-polish-v63.js. */
html[data-social-app="whatsapp"] .wa-wingtail{
  width:24px!important;
  height:18px!important;
  bottom:0!important;
}
html[data-social-app="whatsapp"] .bubble.in>.wa-wingtail{left:-6px!important}
html[data-social-app="whatsapp"] .bubble.out>.wa-wingtail{right:-6px!important}
/* The tail forms that corner, so a tailed bubble is square there; otherwise
   the rounded corner's shadow shows through as a faint seam. */
html[data-social-app="whatsapp"] .bubble.in:has(>.wa-wingtail){border-bottom-left-radius:0!important}
html[data-social-app="whatsapp"] .bubble.out:has(>.wa-wingtail){border-bottom-right-radius:0!important}
html[data-social-app="whatsapp"] .bubble:not(.media):not(.voice):not(.doc):not(.location):not(.contact-card):not(.call-entry){
  max-width:80.5%!important;
}
/* Timestamp size lives in social-typography-v88 (it honours the text-size
   setting); only its box follows the larger native size here. */
html[data-social-app="whatsapp"] .bubble-meta-inline{
  height:15px!important;
  line-height:15px!important;
}

/* Group sender avatars: 28.5pt, 8pt from the screen edge (the row itself
   keeps the 16.5pt bubble margin), so bubbles start at ~45pt like native. */
html[data-social-app="whatsapp"] .msg-row .group-sender-avatar{
  width:28.5px!important;
  height:28.5px!important;
  margin:0 8.5px 0 -8.5px!important;
}
html[data-social-app="whatsapp"] .msg-row .group-sender-avatar>.avatar{
  width:28.5px!important;
  height:28.5px!important;
  font-size:11px!important;
}

/* Composer: 40pt round controls and field, 16.5pt side margins. The native
   field has no placeholder text. */
html[data-social-app="whatsapp"] .composer{
  padding-left:16.5px!important;
  padding-right:16.5px!important;
  gap:8.5px!important;
}
html[data-social-app="whatsapp"] .composer-round{
  width:40px!important;
  height:40px!important;
  min-width:40px!important;
  min-height:40px!important;
  border-radius:20px!important;
}
html[data-social-app="whatsapp"] .composer-round svg{width:24px!important;height:24px!important}
html[data-social-app="whatsapp"] #cv-plus svg{width:28px!important;height:28px!important}
html[data-social-app="whatsapp"] #cv-camera svg{width:31px!important;height:31px!important}
html[data-social-app="whatsapp"] #cv-sticker svg{width:24px!important;height:24px!important}
/* Mic/send takes the chat theme colour (custom bubble colour) like native
   chat themes; default rooms keep WhatsApp green. */
html[data-social-app="whatsapp"][data-theme="light"] .voice-main{background:var(--wa-accent,#1daa61)!important;color:var(--wa-accent-ink,#fff)!important}
html[data-social-app="whatsapp"][data-theme="dark"] .voice-main{background:var(--wa-accent,#21c063)!important;color:var(--wa-accent-ink,#fff)!important}
html[data-social-app="whatsapp"] .composer-field-wrap{
  min-height:40px!important;
  height:40px!important;
  border-radius:20px!important;
  padding:0 4px 0 14px!important;
}
html[data-social-app="whatsapp"] .composer-field-wrap textarea{
  padding:9px 0!important;
  max-height:none;
}
html[data-social-app="whatsapp"] .composer-field-wrap .composer-inline-btn{height:40px!important;width:34px!important}
html[data-social-app="whatsapp"] #cv-input::placeholder{color:transparent!important;opacity:0!important}
html[data-social-app="whatsapp"] #cv-send svg{width:22px!important;height:22px!important}

/* Native composer controls and header pills are translucent glass: the
   wallpaper tints through them instead of sitting under solid discs. */
html[data-social-app="whatsapp"][data-theme="light"] .composer-round:not(.voice-main),
html[data-social-app="whatsapp"][data-theme="light"] .composer-field-wrap,
html[data-social-app="whatsapp"][data-theme="light"] .chat-back-pill,
html[data-social-app="whatsapp"][data-theme="light"] .chat-call-pill{
  background:rgba(255,255,255,.64)!important;
  border:.5px solid rgba(255,255,255,.7)!important;
  box-shadow:0 1px 8px rgba(0,0,0,.06)!important;
  -webkit-backdrop-filter:blur(14px) saturate(1.5)!important;
  backdrop-filter:blur(14px) saturate(1.5)!important;
}
html[data-social-app="whatsapp"][data-theme="dark"] .composer-round:not(.voice-main),
html[data-social-app="whatsapp"][data-theme="dark"] .composer-field-wrap,
html[data-social-app="whatsapp"][data-theme="dark"] .chat-back-pill,
html[data-social-app="whatsapp"][data-theme="dark"] .chat-call-pill{
  background:rgba(30,30,32,.46)!important;
  border:.5px solid rgba(255,255,255,.14)!important;
  box-shadow:none!important;
  -webkit-backdrop-filter:blur(14px) saturate(1.4)!important;
  backdrop-filter:blur(14px) saturate(1.4)!important;
}

/* Native receipt ticks (whatsapp-polish-v63). feature-v13 pins every read
   tick to #53bdeb; on theme bubbles native ticks use the pale meta tone. */
html[data-social-app="whatsapp"] .bubble-meta-inline svg.wa-native-tick{
  width:auto!important;
  height:12px!important;
  flex:none!important;
}
html[data-social-app="whatsapp"] [data-wa-custom-bubble="1"] .bubble.out .read-tick svg{
  color:var(--bubble-out-read,#53bdeb)!important;
}
