* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Pastikan atribut hidden selalu menang atas display flex/grid di bawah */
[hidden] {
    display: none !important;
}

:root {
    --wa-header: #008069;
    --wa-header-dark: #017561;
    --wa-bg: #efeae2;
    --wa-bubble-out: #d9fdd3;
    --wa-bubble-in: #ffffff;
    --wa-panel: #f0f2f5;
    --wa-text: #111b21;
    --wa-text-muted: #667781;
    --wa-check: #53bdeb;
    --wa-unread: #25d366;
    --wa-border: #e9edef;
    --bg-body: #d1d7db;
    --bg-main: #ffffff;
    --bg-hover: #f5f6f6;
    --divider-bg: #ffffff;
    --notice-bg: #ffeecd;
    --quote-bg: rgba(0, 0, 0, .06);
    --input-bg: #ffffff;
    --dots: rgba(0, 0, 0, .04);
    --pub-accent: #008069;
    --pub-accent-light: #00a884;
    --pub-accent-dark: #075e54;
    --pub-surface: rgba(255, 255, 255, .88);
    --pub-border: rgba(0, 128, 105, .12);
    --pub-shadow: 0 12px 40px rgba(7, 94, 84, .12);
    --pub-shadow-lg: 0 20px 60px rgba(7, 94, 84, .18);
    --pub-radius: 16px;
    --pub-radius-sm: 12px;
    --pub-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ===== Mode gelap ===== */
body.dark {
    --wa-bg: #0b141a;
    --wa-panel: #202c33;
    --wa-bubble-out: #005c4b;
    --wa-bubble-in: #202c33;
    --wa-text: #e9edef;
    --wa-text-muted: #8696a0;
    --wa-border: #2a3942;
    --bg-body: #0b141a;
    --bg-main: #111b21;
    --bg-hover: #202c33;
    --divider-bg: #182229;
    --notice-bg: #182229;
    --quote-bg: rgba(255, 255, 255, .07);
    --input-bg: #2a3942;
    --dots: rgba(255, 255, 255, .03);
}

body.dark.hacker {
    --wa-header: #18b85b;
    --wa-header-dark: #0c7839;
    --wa-bg: #07100b;
    --wa-bubble-out: #12351d;
    --wa-bubble-in: #0d1a11;
    --wa-panel: #0a160e;
    --wa-text: #dcffe5;
    --wa-text-muted: #8cb99b;
    --wa-check: #ff6877;
    --wa-unread: #32df78;
    --wa-border: #21472c;
    --bg-body: #030906;
    --bg-main: #08130b;
    --bg-hover: #112318;
    --divider-bg: #0b170f;
    --notice-bg: #172817;
    --quote-bg: rgba(69, 255, 131, .12);
    --input-bg: #102116;
    --dots: rgba(70, 255, 135, .055);
    --pub-accent: #18a951;
    --pub-accent-light: #42e17b;
    --pub-accent-dark: #0b6534;
    --pub-surface: rgba(9, 24, 14, .92);
    --pub-border: rgba(69, 255, 129, .2);
}

body.dark .icon-btn:hover { background: rgba(255, 255, 255, .1); }
body.dark .btn-msg-menu { background: #2a3942; color: #e9edef; }
body.dark .message.out .meta .checks { color: #7a8a94; }
body.dark .message.out .meta .checks.read { color: var(--wa-check); }

body.dark.hacker .chat-body {
    background-image:
        linear-gradient(rgba(54, 255, 132, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(54, 255, 132, .045) 1px, transparent 1px),
        repeating-linear-gradient(0deg, transparent 0 118px, rgba(255, 57, 76, .075) 119px, transparent 121px),
        radial-gradient(var(--dots) 1.5px, transparent 1.5px);
    background-size: 28px 28px, 28px 28px, 100% 240px, 22px 22px;
}

body {
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--wa-text);
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 7px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background .2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, .08);
}

/* ============================================================
   Halaman login / register
   ============================================================ */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 16% 20%, rgba(0, 255, 128, .11), transparent 34%),
        radial-gradient(ellipse at 86% 82%, rgba(255, 36, 65, .08), transparent 32%),
        #030907;
    padding: 16px;
}

.auth-page::before,
.auth-page::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.auth-page::before {
    opacity: .72;
    background-image:
        linear-gradient(rgba(65, 255, 153, .075) 1px, transparent 1px),
        linear-gradient(90deg, rgba(65, 255, 153, .075) 1px, transparent 1px),
        linear-gradient(135deg, transparent 47%, rgba(0, 255, 128, .12) 47.2%, transparent 47.7%),
        repeating-linear-gradient(180deg, transparent 0 52px, rgba(45, 255, 137, .17) 53px, transparent 55px 124px);
    background-size: 56px 56px, 56px 56px, 280px 280px, 72px 248px;
    mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
    animation: auth-grid-flow 24s linear infinite;
}

.auth-page::after {
    opacity: .7;
    background: linear-gradient(
        180deg,
        transparent 0 49.65%,
        rgba(255, 44, 67, .08) 49.78%,
        rgba(255, 44, 67, .82) 49.94%,
        rgba(255, 44, 67, .26) 50.08%,
        transparent 50.32% 100%
    );
    filter: drop-shadow(0 0 8px rgba(255, 44, 67, .8));
    animation: auth-red-scan 8s linear infinite;
}

@keyframes auth-grid-flow {
    from { background-position: 0 0, 0 0, 0 0, 0 -248px; }
    to   { background-position: 0 56px, 56px 0, 280px 280px, 0 0; }
}

@keyframes auth-red-scan {
    from { transform: translateY(-62vh); }
    to   { transform: translateY(62vh); }
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    padding: 36px 32px;
    border: 1px solid rgba(215, 25, 32, .5);
    border-radius: 14px;
    background: linear-gradient(180deg, #d71920 0 190px, #fff 190px 100%);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .58), 0 0 34px rgba(215, 25, 32, .16);
    text-align: center;
}

.auth-logo {
    font-size: 52px;
    margin-bottom: 8px;
}

.auth-card h1 {
    font-size: 26px;
    color: #fff;
}

.auth-subtitle {
    font-size: 13.5px;
    color: rgba(255, 255, 255, .88);
    margin: 6px 0 24px;
}

.auth-tabs {
    display: flex;
    background: #f3f3f3;
    border: 1px solid #e7e7e7;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 9px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 600;
    color: #59605c;
    cursor: pointer;
    transition: all .2s;
}

.auth-tab.active {
    background: #d71920;
    color: #fff;
    box-shadow: 0 2px 10px rgba(215, 25, 32, .22);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 12px 16px;
    border: 1px solid #d9dfdb;
    border-radius: 10px;
    background: rgba(242, 250, 245, .98);
    color: #14231a;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
}

.auth-form input:focus {
    border-color: #d71920;
    box-shadow: 0 0 0 3px rgba(215, 25, 32, .12);
}

.auth-form button {
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #c8141b;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.auth-form button:hover { background: #a80e15; }
.auth-form button:disabled { opacity: .6; cursor: not-allowed; }

.auth-error {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(92, 23, 30, .85);
    color: #ffc2c8;
    border: 1px solid rgba(255, 79, 96, .38);
    border-radius: 8px;
    font-size: 13.5px;
}

.auth-footer {
    margin-top: 20px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #5c665f;
}

.auth-footer a {
    color: #b40f17;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover { text-decoration: underline; }

.auth-logo img { display: block; margin: 0 auto; }

/* ============================================================
   Halaman publik — landing, legal, footer
   ============================================================ */

/* Latar dekoratif */
.pub-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.pub-bg--legal {
    opacity: .55;
}

.pub-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .45;
    animation: pubOrbFloat 18s var(--pub-ease) infinite alternate;
}

.pub-orb-1 {
    width: min(420px, 70vw);
    height: min(420px, 70vw);
    background: radial-gradient(circle, #00a884 0%, transparent 70%);
    top: -8%;
    right: -6%;
}

.pub-orb-2 {
    width: min(320px, 55vw);
    height: min(320px, 55vw);
    background: radial-gradient(circle, #7ee8c7 0%, transparent 70%);
    bottom: 10%;
    left: -8%;
    animation-delay: -6s;
}

.pub-orb-3 {
    width: min(260px, 45vw);
    height: min(260px, 45vw);
    background: radial-gradient(circle, #008069 0%, transparent 70%);
    top: 42%;
    left: 38%;
    animation-delay: -12s;
}

@keyframes pubOrbFloat {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(24px, -18px) scale(1.08); }
}

/* Header publik */
.pub-header {
    position: relative;
    z-index: 20;
}

.pub-header--sticky {
    position: sticky;
    top: 0;
    transition: background .35s var(--pub-ease), box-shadow .35s var(--pub-ease), backdrop-filter .35s;
}

.pub-header--sticky.is-scrolled {
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 var(--pub-border), 0 8px 24px rgba(0, 0, 0, .04);
}

.pub-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 20px;
}

.pub-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    color: var(--pub-accent);
    text-decoration: none;
    letter-spacing: -.02em;
    transition: opacity .2s;
}

.pub-brand:hover { opacity: .85; }

.pub-brand img {
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 128, 105, .2);
}

.pub-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.pub-nav a {
    color: var(--wa-text-muted);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 10px;
    transition: color .2s, background .2s;
}

.pub-nav a:hover {
    color: var(--pub-accent);
    background: rgba(0, 128, 105, .06);
}

.pub-nav a.is-current {
    color: var(--pub-accent);
    background: rgba(0, 128, 105, .1);
}

.pub-menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 128, 105, .08);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.pub-menu-btn:hover { background: rgba(0, 128, 105, .14); }

.pub-menu-icon,
.pub-menu-icon::before,
.pub-menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--pub-accent);
    border-radius: 2px;
    transition: transform .3s var(--pub-ease), opacity .2s;
}

.pub-menu-icon {
    position: relative;
}

.pub-menu-icon::before,
.pub-menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.pub-menu-icon::before { top: -6px; }
.pub-menu-icon::after  { top: 6px; }

.pub-menu-btn[aria-expanded="true"] .pub-menu-icon { background: transparent; }
.pub-menu-btn[aria-expanded="true"] .pub-menu-icon::before { transform: translateY(6px) rotate(45deg); }
.pub-menu-btn[aria-expanded="true"] .pub-menu-icon::after  { transform: translateY(-6px) rotate(-45deg); }

/* Tombol publik */
.pub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform .25s var(--pub-ease), box-shadow .25s, background .25s, color .25s;
}

.pub-btn:active { transform: scale(.98); }

.pub-btn--primary {
    background: linear-gradient(135deg, var(--pub-accent-light), var(--pub-accent));
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 128, 105, .28);
}

.pub-btn--primary:hover {
    box-shadow: 0 12px 32px rgba(0, 128, 105, .36);
    transform: translateY(-2px);
}

.pub-btn--ghost {
    background: var(--pub-surface);
    color: var(--pub-accent);
    border: 1.5px solid var(--pub-border);
    backdrop-filter: blur(8px);
}

.pub-btn--ghost:hover {
    background: #fff;
    border-color: rgba(0, 128, 105, .25);
    transform: translateY(-2px);
}

.pub-btn--outline {
    padding: 8px 16px !important;
    border: 1.5px solid var(--pub-accent) !important;
    color: var(--pub-accent) !important;
    background: transparent !important;
    border-radius: 10px !important;
}

.pub-btn--outline:hover {
    background: rgba(0, 128, 105, .08) !important;
}

/* Scroll reveal */
.pub-reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .65s var(--pub-ease), transform .65s var(--pub-ease);
}

.pub-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.landing-hero.pub-reveal { transition-delay: .05s; }
.landing-feature:nth-child(1).pub-reveal { transition-delay: .08s; }
.landing-feature:nth-child(2).pub-reveal { transition-delay: .14s; }
.landing-feature:nth-child(3).pub-reveal { transition-delay: .2s; }
.landing-feature:nth-child(4).pub-reveal { transition-delay: .26s; }

/* Landing page */
.landing-page {
    min-height: 100vh;
    background: linear-gradient(165deg, #e8f5f1 0%, #f4faf8 35%, #fff 70%);
    color: var(--wa-text);
    position: relative;
}

.landing-main {
    position: relative;
    z-index: 1;
    max-width: 1040px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) 20px 32px;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin-bottom: 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--pub-accent);
    background: rgba(0, 128, 105, .1);
    border: 1px solid var(--pub-border);
    animation: pubBadgeIn .8s var(--pub-ease) both;
}

@keyframes pubBadgeIn {
    from { opacity: 0; transform: translateY(-8px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.landing-hero h1 {
    font-size: clamp(28px, 6vw, 42px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--pub-accent-dark);
    margin-bottom: 14px;
    max-width: 16ch;
}

.landing-lead {
    font-size: clamp(15px, 2.5vw, 17px);
    line-height: 1.7;
    color: var(--wa-text-muted);
    max-width: 640px;
}

.landing-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.landing-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.landing-stat {
    flex: 1 1 120px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: var(--pub-radius-sm);
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    backdrop-filter: blur(10px);
    box-shadow: var(--pub-shadow);
    transition: transform .3s var(--pub-ease), box-shadow .3s;
}

.landing-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--pub-shadow-lg);
}

.landing-stat strong {
    display: block;
    font-size: 15px;
    color: var(--pub-accent);
    margin-bottom: 2px;
}

.landing-stat span {
    font-size: 12px;
    color: var(--wa-text-muted);
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 16px;
    margin-top: clamp(36px, 6vw, 56px);
}

.landing-feature {
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius);
    padding: 22px 20px;
    backdrop-filter: blur(10px);
    box-shadow: var(--pub-shadow);
    transition: transform .35s var(--pub-ease), box-shadow .35s, border-color .35s;
}

.landing-feature:hover {
    transform: translateY(-6px);
    box-shadow: var(--pub-shadow-lg);
    border-color: rgba(0, 128, 105, .22);
}

.landing-feature-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 168, 132, .15), rgba(0, 128, 105, .08));
    color: var(--pub-accent);
    margin-bottom: 14px;
    transition: transform .35s var(--pub-ease);
}

.landing-feature:hover .landing-feature-icon {
    transform: scale(1.08) rotate(-3deg);
}

.landing-feature h2 {
    font-size: 16px;
    font-weight: 800;
    color: var(--pub-accent-dark);
    margin-bottom: 8px;
    letter-spacing: -.02em;
}

.landing-feature p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--wa-text-muted);
}

.landing-trust {
    margin-top: clamp(36px, 6vw, 52px);
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius);
    padding: clamp(22px, 4vw, 32px);
    backdrop-filter: blur(12px);
    box-shadow: var(--pub-shadow);
}

.landing-trust-head h2 {
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 800;
    color: var(--pub-accent-dark);
    margin-bottom: 6px;
    letter-spacing: -.02em;
}

.landing-trust-head p {
    font-size: 14px;
    color: var(--wa-text-muted);
    margin-bottom: 18px;
}

.landing-trust-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.landing-trust-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14.5px;
    line-height: 1.6;
    padding: 12px 14px;
    border-radius: var(--pub-radius-sm);
    background: rgba(0, 128, 105, .04);
    border: 1px solid transparent;
    transition: background .25s, border-color .25s, transform .25s var(--pub-ease);
}

.landing-trust-list li:hover {
    background: rgba(0, 128, 105, .08);
    border-color: var(--pub-border);
    transform: translateX(4px);
}

.landing-trust-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--pub-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.landing-trust-list a {
    color: var(--pub-accent);
    font-weight: 600;
}

/* Footer publik */
.public-footer {
    position: relative;
    z-index: 1;
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 20px clamp(40px, 6vw, 56px);
    text-align: center;
}

.public-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    margin-bottom: 14px;
}

.public-nav a {
    color: var(--pub-accent);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
    transition: background .2s, transform .2s;
}

.public-nav a:hover {
    background: rgba(0, 128, 105, .08);
    transform: translateY(-1px);
}

.public-copy {
    font-size: 12.5px;
    color: var(--wa-text-muted);
    line-height: 1.5;
}

/* Halaman legal */
.legal-page {
    min-height: 100vh;
    background: linear-gradient(165deg, #e8f5f1 0%, #f7faf9 50%, #fff 100%);
    color: var(--wa-text);
    position: relative;
}

.legal-layout {
    position: relative;
    z-index: 1;
    max-width: 1040px;
    margin: 0 auto;
    padding: clamp(16px, 3vw, 28px) 20px 40px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

.legal-layout--single {
    grid-template-columns: 1fr;
    max-width: 760px;
}

.legal-toc {
    position: sticky;
    top: 88px;
    padding: 18px 16px;
    border-radius: var(--pub-radius);
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    backdrop-filter: blur(12px);
    box-shadow: var(--pub-shadow);
}

.legal-toc-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--wa-text-muted);
    margin-bottom: 12px;
}

.legal-toc nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.legal-toc a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wa-text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color .2s, background .2s, border-color .2s, padding-left .2s;
}

.legal-toc a:hover {
    color: var(--pub-accent);
    background: rgba(0, 128, 105, .06);
    padding-left: 14px;
}

.legal-toc a.is-active {
    color: var(--pub-accent);
    background: rgba(0, 128, 105, .1);
    border-left-color: var(--pub-accent);
    padding-left: 14px;
}

.legal-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: calc(var(--pub-radius) + 4px);
    padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 36px);
    box-shadow: var(--pub-shadow-lg);
    backdrop-filter: blur(14px);
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 700;
    color: var(--pub-accent);
    text-decoration: none;
    padding: 6px 12px 6px 8px;
    border-radius: 10px;
    transition: background .2s, transform .2s;
}

.legal-back:hover {
    background: rgba(0, 128, 105, .08);
    transform: translateX(-3px);
}

.legal-hero {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--pub-border);
}

.legal-card h1 {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--pub-accent-dark);
    margin-bottom: 6px;
    line-height: 1.2;
}

.legal-updated {
    font-size: 13px;
    color: var(--wa-text-muted);
    margin: 0;
}

.legal-intro {
    font-size: 15px;
    line-height: 1.7;
    color: var(--wa-text);
    margin-bottom: 8px;
}

.legal-section {
    margin-top: 28px;
    padding-top: 4px;
    scroll-margin-top: 96px;
}

.legal-section h2 {
    font-size: clamp(16px, 2.5vw, 18px);
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--pub-accent);
    letter-spacing: -.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.legal-section h2::before {
    content: '';
    width: 4px;
    height: 1.1em;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--pub-accent-light), var(--pub-accent));
    flex-shrink: 0;
}

.legal-card p,
.legal-card li {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--wa-text);
}

.legal-card ul {
    margin: 10px 0 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legal-card ul li {
    position: relative;
    padding-left: 18px;
}

.legal-card ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--pub-accent-light);
    font-weight: 800;
}

.legal-card a {
    color: var(--pub-accent);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 128, 105, .25);
    transition: border-color .2s;
}

.legal-card a:hover { border-bottom-color: var(--pub-accent); }

.legal-card code {
    font-size: 13px;
    background: rgba(0, 128, 105, .08);
    color: var(--pub-accent-dark);
    padding: 2px 7px;
    border-radius: 6px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.legal-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legal-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--pub-radius-sm);
    background: rgba(0, 128, 105, .05);
    border: 1px solid var(--pub-border);
    transition: transform .25s var(--pub-ease), background .25s;
}

.legal-checklist li:hover {
    background: rgba(0, 128, 105, .09);
    transform: translateX(4px);
}

.legal-checklist li span {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--pub-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

/* About page extras */
.about-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 10px;
    margin-top: 4px;
}

.about-feature-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--pub-radius-sm);
    background: rgba(0, 128, 105, .05);
    border: 1px solid var(--pub-border);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    transition: transform .3s var(--pub-ease), box-shadow .3s, border-color .3s;
}

.about-feature-chip:hover {
    transform: translateY(-3px);
    box-shadow: var(--pub-shadow);
    border-color: rgba(0, 128, 105, .22);
}

.about-chip-icon {
    font-size: 20px;
    line-height: 1;
}

.about-contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 12px;
    margin-top: 4px;
}

.about-contact-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    border-radius: var(--pub-radius-sm);
    background: linear-gradient(135deg, rgba(0, 168, 132, .08), rgba(0, 128, 105, .04));
    border: 1px solid var(--pub-border);
    text-decoration: none;
    color: inherit;
    transition: transform .3s var(--pub-ease), box-shadow .3s, border-color .3s;
}

.about-contact-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pub-shadow-lg);
    border-color: rgba(0, 128, 105, .28);
}

.about-contact-card strong {
    font-size: 15px;
    color: var(--pub-accent-dark);
}

.about-contact-card span {
    font-size: 13px;
    color: var(--wa-text-muted);
    line-height: 1.45;
}

/* Responsif halaman publik */
@media (max-width: 860px) {
    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-toc {
        position: static;
        order: -1;
    }

    .legal-toc nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .legal-toc a {
        font-size: 12px;
        padding: 6px 10px;
        border-left: none;
        background: rgba(0, 128, 105, .06);
    }

    .legal-toc a.is-active,
    .legal-toc a:hover {
        padding-left: 10px;
    }
}

@media (max-width: 720px) {
    .pub-menu-btn {
        display: flex;
    }

    .pub-nav {
        position: fixed;
        top: 68px;
        left: 12px;
        right: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 12px;
        border-radius: var(--pub-radius);
        background: rgba(255, 255, 255, .96);
        border: 1px solid var(--pub-border);
        box-shadow: var(--pub-shadow-lg);
        backdrop-filter: blur(16px);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-12px) scale(.98);
        transition: opacity .3s var(--pub-ease), transform .3s var(--pub-ease), visibility .3s;
    }

    .pub-nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }

    .pub-nav a {
        padding: 12px 14px;
        border-radius: 10px;
    }

    .pub-nav .pub-btn--outline {
        text-align: center;
        margin-top: 4px;
    }

    body.pub-menu-open { overflow: hidden; }

    .landing-hero h1 { max-width: none; }

    .landing-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .landing-stat {
        padding: 12px 10px;
        text-align: center;
    }

    .landing-stat strong { font-size: 13px; }
    .landing-stat span { font-size: 11px; }
}

@media (max-width: 480px) {
    .pub-header-inner { padding: 12px 16px; }

    .landing-main,
    .legal-layout,
    .public-footer { padding-left: 16px; padding-right: 16px; }

    .landing-cta {
        flex-direction: column;
    }

    .landing-cta .pub-btn {
        width: 100%;
    }

    .landing-stats {
        grid-template-columns: 1fr;
    }

    .landing-feature { padding: 18px 16px; }

    .legal-card { padding: 22px 18px; }

    .about-feature-grid,
    .about-contact-cards {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page::before,
    .auth-page::after,
    .pub-orb,
    .pub-reveal,
    .landing-badge,
    .landing-feature,
    .landing-stat,
    .pub-btn,
    .legal-checklist li,
    .about-feature-chip,
    .about-contact-card {
        animation: none !important;
        transition: none !important;
    }

    .pub-reveal { opacity: 1; transform: none; }
}

/* Legacy aliases (terms.php dll.) */
.landing-btn-primary,
.landing-btn-secondary,
.landing-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: transform .25s var(--pub-ease), box-shadow .25s;
}

.landing-btn-primary {
    background: linear-gradient(135deg, var(--pub-accent-light), var(--pub-accent));
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 128, 105, .28);
}

.landing-btn-secondary {
    background: var(--pub-surface);
    color: var(--pub-accent);
    border: 1.5px solid var(--pub-border);
}

.landing-btn-outline {
    padding: 8px 16px;
    border: 1.5px solid var(--pub-accent);
    color: var(--pub-accent);
    background: transparent;
}

.settings-legal-link {
    text-align: center;
    padding: 18px 0 4px;
    font-size: 13px;
}

.settings-legal-link a {
    color: var(--wa-header);
    text-decoration: none;
    font-weight: 600;
}

.settings-legal-link a:hover { text-decoration: underline; }

/* ============================================================
   Layout utama aplikasi
   ============================================================ */
.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--wa-bg);
    box-shadow: 0 0 24px rgba(0, 0, 0, .2);
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 360px;
    min-width: 300px;
    background: var(--bg-main);
    border-right: 1px solid var(--wa-border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--wa-panel);
    flex-shrink: 0;
}

.sidebar-header .header-name { font-size: 15.5px; font-weight: 600; }
.sidebar-header .header-status { font-size: 12.5px; color: var(--wa-text-muted); }

.header-info { flex: 1; min-width: 0; }
.header-info > div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-list {
    flex: 1;
    overflow-y: auto;
}

.contact-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--wa-text-muted);
    font-size: 14px;
}

.contact {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-hover);
    transition: background .2s ease, transform .15s ease;
}

.contact:hover  { background: var(--bg-hover); }
.contact.active { background: var(--wa-panel); }

.contact-info { flex: 1; min-width: 0; }

.contact-name {
    font-size: 15.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wa-unread);
    flex-shrink: 0;
}

.contact-last {
    font-size: 13px;
    color: var(--wa-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.contact-time { font-size: 11.5px; color: var(--wa-text-muted); }

.unread-badge {
    background: var(--wa-unread);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* ===== Panel chat ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--wa-panel);
    border-bottom: 6px solid var(--wa-unread);
    text-align: center;
    padding: 24px;
}

.placeholder-icon { font-size: 64px; }
.chat-placeholder h2 { font-weight: 300; font-size: 30px; color: var(--wa-text); }
.chat-placeholder p { color: var(--wa-text-muted); font-size: 14px; line-height: 1.6; }

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    will-change: transform, opacity;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    background: var(--wa-panel);
    border-left: 1px solid var(--wa-border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chat-header .header-name { font-size: 15.5px; font-weight: 600; }
.chat-header .header-status { font-size: 12.5px; color: var(--wa-text-muted); }

.btn-back { display: none; }

/* ===== Area pesan ===== */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 6%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background-color: var(--wa-bg);
    background-image: radial-gradient(var(--dots) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
}

.chat-encrypt-notice {
    align-self: center;
    background: var(--notice-bg);
    color: var(--wa-text-muted);
    font-size: 12.5px;
    text-align: center;
    padding: 6px 14px;
    border-radius: 8px;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
    margin: 8px 0;
    max-width: 90%;
}

.chat-day-divider {
    align-self: center;
    margin: 10px 0;
}

.chat-day-divider span {
    background: var(--divider-bg);
    color: var(--wa-text-muted);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 8px;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
}

.message {
    max-width: 72%;
    padding: 6px 8px 8px 10px;
    border-radius: 8px;
    box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
    position: relative;
    font-size: 14.5px;
    line-height: 1.35;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    animation: msgPop .28s cubic-bezier(.22, 1, .36, 1);
}

@keyframes msgPop {
    from { transform: translateY(6px) scale(.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.message.out {
    align-self: flex-end;
    background: var(--wa-bubble-out);
    border-top-right-radius: 0;
}

.message.in {
    align-self: flex-start;
    background: var(--wa-bubble-in);
    border-top-left-radius: 0;
}

.group-message-sender {
    display: block;
    margin: 0 0 4px;
    color: var(--wa-header);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.message.out.group-message .group-message-sender { color: #b9f4d0; }

.message.out::after,
.message.in::after {
    content: "";
    position: absolute;
    top: 0;
    border: 6px solid transparent;
}

.message.out::after {
    right: -6px;
    border-top-color: var(--wa-bubble-out);
    border-left-color: var(--wa-bubble-out);
}

.message.in::after {
    left: -6px;
    border-top-color: var(--wa-bubble-in);
    border-right-color: var(--wa-bubble-in);
}

/* ===== Animasi loading bot AI ===== */
.message.bot-typing {
    padding: 12px 16px 12px 14px;
    min-width: 168px;
    overflow: hidden;
    border: 1px solid rgba(0, 168, 132, .12);
}

.message.bot-typing::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(0, 168, 132, .06) 45%,
        rgba(37, 211, 102, .14) 50%,
        rgba(0, 168, 132, .06) 55%,
        transparent 100%
    );
    animation: bot-shimmer 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bot-shimmer {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

.bot-typing-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.bot-typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884, #25d366);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    animation: bot-avatar-pulse 1.6s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(0, 168, 132, .35);
}

@keyframes bot-avatar-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(0, 168, 132, .35); }
    50%      { transform: scale(1.08); box-shadow: 0 4px 14px rgba(37, 211, 102, .45); }
}

.bot-typing-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.bot-typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    height: 10px;
}

.bot-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884, #25d366);
    animation: bot-dot-bounce 1.3s ease-in-out infinite;
}

.bot-typing-dots span:nth-child(1) { animation-delay: 0s; }
.bot-typing-dots span:nth-child(2) { animation-delay: .18s; }
.bot-typing-dots span:nth-child(3) { animation-delay: .36s; }

@keyframes bot-dot-bounce {
    0%, 55%, 100% { transform: translateY(0) scale(.85); opacity: .45; }
    28%           { transform: translateY(-7px) scale(1); opacity: 1; }
}

.bot-typing-label {
    font-size: 12.5px;
    color: var(--wa-text-muted);
    line-height: 1.2;
    transition: opacity .25s ease, transform .25s ease;
}

.bot-typing-label.fade {
    opacity: 0;
    transform: translateY(3px);
}

/* loading bot saat generate gambar */
.message.bot-typing-image {
    min-width: 220px;
    max-width: 280px;
    border-color: rgba(147, 51, 234, .18);
}

.message.bot-typing-image::before {
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(147, 51, 234, .05) 45%,
        rgba(168, 85, 247, .12) 50%,
        rgba(147, 51, 234, .05) 55%,
        transparent 100%
    );
}

.message.bot-typing-image .bot-typing-avatar {
    background: linear-gradient(135deg, #9333ea, #a855f7);
    box-shadow: 0 2px 8px rgba(147, 51, 234, .35);
    animation: bot-image-avatar-pulse 1.8s ease-in-out infinite;
}

@keyframes bot-image-avatar-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%      { transform: scale(1.06) rotate(6deg); }
}

.bot-image-shimmer {
    width: 100%;
    height: 72px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e8e0f0 0%, #f3eef8 40%, #e8e0f0 80%);
    background-size: 200% 100%;
    animation: ai-image-shimmer 1.4s ease-in-out infinite;
    margin-bottom: 2px;
}

@keyframes ai-image-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

body.dark .bot-image-shimmer {
    background: linear-gradient(90deg, #2a2438 0%, #352d48 40%, #2a2438 80%);
    background-size: 200% 100%;
}

body.dark .message.bot-typing-image {
    border-color: rgba(168, 85, 247, .25);
}

/* pesan keluar sedang dikirim (optimistic) */
.message.sending .meta .checks {
    color: var(--wa-text-muted);
    animation: sending-pulse 1.2s ease-in-out infinite;
}

@keyframes sending-pulse {
    0%, 100% { opacity: .35; }
    50%      { opacity: 1; }
}

/* status header: sedang mengetik */
.header-status .status-typing {
    color: var(--wa-check);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #25d366;
    flex-shrink: 0;
    animation: status-dot-pulse 1.2s ease-in-out infinite;
}

@keyframes status-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, .45); }
    50%      { opacity: .75; transform: scale(.92); box-shadow: 0 0 0 5px rgba(37, 211, 102, 0); }
}

/* tombol kirim loading */
.btn-send.loading {
    position: relative;
    pointer-events: none;
}

.btn-send.loading svg {
    opacity: 0;
}

.btn-send.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin .65s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

body.dark .message.bot-typing {
    border-color: rgba(0, 168, 132, .2);
}

/* ===== Balasan AI — gaya ChatGPT (Markdown + syntax highlight) ===== */
.message.ai-rich {
    max-width: 90%;
    padding: 10px 12px 8px;
    white-space: normal;
    background: linear-gradient(145deg, #ffffff 0%, #f8faf9 100%);
    border: 1px solid rgba(0, 168, 132, .1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 168, 132, .08);
}

.message.ai-rich::after {
    border-top-color: #f8faf9;
    border-right-color: #f8faf9;
}

body.dark .message.ai-rich {
    background: linear-gradient(145deg, #1a2428 0%, #1e2a30 100%);
    border-color: rgba(0, 168, 132, .18);
    box-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}

body.dark .message.ai-rich::after {
    border-top-color: #1e2a30;
    border-right-color: #1e2a30;
}

.msg-rich {
    display: block;
    width: 100%;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--wa-text);
    white-space: normal;
    word-wrap: break-word;
}

.msg-rich .md-body + .code-block,
.msg-rich .code-block + .md-body {
    margin-top: 10px;
}

.msg-rich .md-p {
    margin: 0 0 8px;
}

.msg-rich .md-p:last-child {
    margin-bottom: 4px;
}

.msg-rich .md-h2,
.msg-rich .md-h3,
.msg-rich .md-h4 {
    margin: 12px 0 6px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--wa-text);
}

.msg-rich .md-h2 { font-size: 16px; }
.msg-rich .md-h3 { font-size: 15px; color: #00a884; }
.msg-rich .md-h4 { font-size: 14px; color: #008f72; }

body.dark .msg-rich .md-h3 { color: #25d366; }
body.dark .msg-rich .md-h4 { color: #5de09e; }

.msg-rich .md-h3.md-next-steps,
.msg-rich .md-h4.md-next-steps {
    margin-top: 14px;
    margin-bottom: 0;
    padding: 10px 14px;
    font-size: 14px;
    color: #fff !important;
    background: linear-gradient(135deg, #00a884 0%, #25d366 100%);
    border-radius: 10px 10px 0 0;
    border: 1px solid rgba(0, 168, 132, .25);
    box-shadow: 0 2px 8px rgba(0, 168, 132, .2);
}

.msg-rich .md-h3.md-next-steps + .md-ul,
.msg-rich .md-h4.md-next-steps + .md-ul {
    margin-top: 0;
    margin-bottom: 8px;
    padding: 10px 14px 12px 1.6em;
    background: rgba(0, 168, 132, .06);
    border: 1px solid rgba(0, 168, 132, .15);
    border-top: none;
    border-radius: 0 0 10px 10px;
}

.msg-rich .md-h3.md-next-steps + .md-ul li,
.msg-rich .md-h4.md-next-steps + .md-ul li {
    margin-bottom: 6px;
    line-height: 1.45;
}

.msg-rich .md-h3.md-next-steps + .md-ul li::marker,
.msg-rich .md-h4.md-next-steps + .md-ul li::marker {
    color: #00a884;
    font-weight: 700;
}

body.dark .msg-rich .md-h3.md-next-steps + .md-ul,
body.dark .msg-rich .md-h4.md-next-steps + .md-ul {
    background: rgba(0, 168, 132, .12);
    border-color: rgba(37, 211, 102, .2);
}

.msg-rich .md-ul,
.msg-rich .md-ol {
    margin: 4px 0 10px;
    padding-left: 1.35em;
}

.msg-rich .md-ul li,
.msg-rich .md-ol li {
    margin-bottom: 4px;
    padding-left: 2px;
}

.msg-rich .md-ul li::marker { color: #00a884; }
.msg-rich .md-ol li::marker { color: #00a884; font-weight: 600; }

.msg-rich .md-quote {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 3px solid #00a884;
    background: rgba(0, 168, 132, .06);
    border-radius: 0 8px 8px 0;
    color: var(--wa-text-muted);
    font-style: italic;
}

body.dark .msg-rich .md-quote {
    background: rgba(0, 168, 132, .1);
}

.msg-rich .md-hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 168, 132, .35), transparent);
    margin: 12px 0;
}

.msg-rich strong {
    font-weight: 700;
    color: var(--wa-text);
}

.msg-rich em {
    font-style: italic;
    color: var(--wa-text-muted);
}

.msg-rich .inline-code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 12.5px;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(233, 76, 96, .1);
    color: #c7254e;
    border: 1px solid rgba(233, 76, 96, .15);
}

body.dark .msg-rich .inline-code {
    background: rgba(255, 123, 143, .12);
    color: #ff8fa3;
    border-color: rgba(255, 123, 143, .2);
}

.msg-rich .md-link {
    color: #00a884;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.msg-rich .md-link:hover {
    color: #008f72;
}

/* Blok kode — tema gelap ala VS Code / ChatGPT */
.msg-rich .code-block {
    margin: 10px -2px 8px;
    border-radius: 10px;
    overflow: hidden;
    background: #0d1117;
    border: 1px solid #30363d;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.msg-rich .code-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.msg-rich .code-lang {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #8b949e;
}

.msg-rich .code-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #21262d;
    color: #c9d1d9;
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.msg-rich .code-copy-btn:hover {
    background: #30363d;
    border-color: #484f58;
    color: #fff;
}

.msg-rich .code-copy-btn.copied {
    background: rgba(35, 134, 54, .25);
    border-color: #238636;
    color: #3fb950;
}

.msg-rich .code-pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 12.5px;
    line-height: 1.55;
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}

.msg-rich .code-pre code {
    display: block;
    color: #e6edf3;
    white-space: pre;
}

/* Token warna syntax highlighting */
.msg-rich .tok-keyword { color: #c586c0; font-weight: 500; }
.msg-rich .tok-string  { color: #ce9178; }
.msg-rich .tok-comment { color: #6a9955; font-style: italic; }
.msg-rich .tok-number  { color: #b5cea8; }
.msg-rich .tok-func    { color: #dcdcaa; }
.msg-rich .tok-type    { color: #4ec9b0; }
.msg-rich .tok-punct   { color: #808080; }

@media (max-width: 600px) {
    .message.ai-rich { max-width: 94%; }
    .msg-rich .code-pre { font-size: 11.5px; padding: 12px; }
    .msg-rich .code-block { margin-left: -4px; margin-right: -4px; }
}

.message .meta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    float: right;
    margin: 8px 0 -4px 8px;
    font-size: 11px;
    color: var(--wa-text-muted);
}

.message.out .meta .checks {
    font-size: 13px;
    letter-spacing: -3px;
    color: #8696a0;
}

.message.out .meta .checks.read { color: var(--wa-check); }

/* foto dalam pesan */
.message-image {
    display: block;
    max-width: 100%;
    max-height: 320px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    object-fit: cover;
}

/* gambar hasil AI — tampilan lebih besar ala ChatGPT */
.message.has-ai-image {
    max-width: min(92%, 420px);
    padding: 8px 10px 6px;
}

.message-image.ai-generated-image {
    max-height: 380px;
    width: 100%;
    border-radius: 10px;
    object-fit: contain;
    background: #0a0a0a08;
    border: 1px solid rgba(147, 51, 234, .12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
    transition: transform .2s ease, box-shadow .2s ease;
}

.message-image.ai-generated-image:hover {
    transform: scale(1.01);
    box-shadow: 0 6px 20px rgba(147, 51, 234, .15);
}

body.dark .message-image.ai-generated-image {
    background: #00000033;
    border-color: rgba(168, 85, 247, .2);
}

.message.has-ai-image.ai-rich .msg-rich {
    margin-top: 6px;
    font-size: 13px;
}

/* kutipan reply dalam bubble */
.quote {
    background: var(--quote-bg);
    border-left: 4px solid var(--wa-header);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 5px;
    font-size: 13px;
    cursor: pointer;
    overflow: hidden;
}

.quote-name { font-weight: 600; color: var(--wa-header); font-size: 12.5px; }
.quote-text {
    color: var(--wa-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

/* tombol menu ⌄ saat hover bubble (ala WA) */
.btn-msg-menu {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 255, 255, .92);
    color: #54656f;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    z-index: 2;
}

.message:hover .btn-msg-menu { display: flex; }

/* layar sentuh tidak punya hover: tombol menu selalu terlihat samar */
@media (hover: none) {
    .btn-msg-menu { display: flex; opacity: .55; }
}

/* dropdown menu pesan */
.msg-menu {
    position: fixed;
    z-index: 60;
    background: var(--bg-main);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .32);
    padding: 0;
    min-width: 280px;
    max-width: min(340px, 92vw);
    animation: pop .14s ease-out;
    overflow: hidden;
}

.msg-menu-emoji-zone {
    padding: 10px 10px 6px;
    background: linear-gradient(180deg, var(--wa-panel) 0%, var(--bg-main) 100%);
}

.msg-menu-reactions {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.msg-menu-reaction {
    border: none;
    background: var(--bg-main);
    font-size: 24px;
    padding: 6px 2px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .15s, background .15s, box-shadow .15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.msg-menu-reaction:hover {
    transform: scale(1.2);
    background: var(--wa-panel);
    box-shadow: 0 4px 12px rgba(0, 168, 132, .2);
}

.msg-menu-expand-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    border: 1px dashed var(--wa-border);
    background: transparent;
    color: var(--wa-header);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.msg-menu-expand-emoji span { font-size: 18px; }

.msg-menu-expand-emoji svg {
    transition: transform .2s;
    opacity: .7;
}

.msg-menu-expand-emoji:hover {
    background: rgba(0, 168, 132, .08);
    border-color: var(--wa-header);
}

.msg-menu-expand-emoji.open svg { transform: rotate(180deg); }

.msg-menu-divider {
    height: 1px;
    background: var(--wa-border);
    margin: 2px 0;
}

.msg-menu button:not(.msg-menu-reaction):not(.msg-menu-expand-emoji) {
    display: block;
    width: 100%;
    padding: 11px 18px;
    border: none;
    background: transparent;
    color: var(--wa-text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.msg-menu button:not(.msg-menu-reaction):not(.msg-menu-expand-emoji):hover { background: var(--bg-hover); }

/* picker emoji di dalam menu balas */
.emoji-picker--menu {
    height: 300px;
    margin-top: 8px;
    border: 1px solid var(--wa-border);
    border-radius: 10px;
    box-shadow: none;
    animation: none;
}

.emoji-picker--menu .emoji-quick-bar {
    padding: 6px 6px 2px;
    background: var(--bg-main);
}

.emoji-picker--menu .emoji-quick-item {
    width: 36px;
    height: 36px;
    font-size: 22px;
}

.emoji-picker--menu .emoji-search-wrap {
    margin: 4px 6px;
}

.emoji-picker--menu .emoji-scroll {
    padding: 0 6px 10px;
}

/* label "Diedit" & pesan terhapus */
.edited-label {
    font-size: 11px;
    color: var(--wa-text-muted);
    margin-right: 3px;
}

.deleted-text {
    font-style: italic;
    color: var(--wa-text-muted);
}

/* modal konfirmasi hapus */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 27, 33, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
}

.modal-box {
    background: var(--bg-main);
    color: var(--wa-text);
    border-radius: 12px;
    padding: 22px 24px;
    width: 100%;
    max-width: 380px;
    margin: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
    animation: pop .15s ease-out;
}

.modal-box h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 18px;
}

.group-modal {
    max-width: 480px;
    max-height: min(82dvh, 720px);
    overflow-y: auto;
    text-align: left;
}

.group-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.group-modal-header h3 { margin: 4px 0 0; }
.group-modal-kicker { color: var(--wa-header); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.group-modal-header .icon-btn { flex: 0 0 36px; height: 36px; }

.group-modal-note {
    color: var(--wa-text-muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 8px 0 18px;
}

.group-name-field { margin-bottom: 18px; }
.group-name-field .settings-input { width: 100%; }

.group-member-picker h4,
.group-current-members h4 {
    color: var(--wa-text);
    font-size: 13px;
    margin-bottom: 8px;
}

.group-current-members { margin-bottom: 18px; }
.group-member-current-list,
.group-member-options { display: flex; flex-direction: column; gap: 4px; }

.group-member-options {
    max-height: 230px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--wa-border);
    border-radius: 10px;
    background: var(--bg-hover);
}

.group-member-option,
.group-member-current {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 9px;
    border-radius: 8px;
}

.group-member-current { flex-wrap: wrap; }

.group-member-option { cursor: pointer; }
.group-member-option:hover { background: var(--bg-main); }
.group-member-option input { width: 17px; height: 17px; accent-color: var(--wa-header); }

.group-member-initial {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--wa-header);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.group-member-option-name,
.group-member-current-name { min-width: 0; flex: 1; color: var(--wa-text); font-size: 13px; }
.group-member-option-username { color: var(--wa-text-muted); font-size: 11px; }
.group-member-role { color: var(--wa-text-muted); font-size: 11px; }
.group-member-actions { display: flex; gap: 6px; margin-left: auto; }
.group-member-action {
    border: 1px solid var(--wa-border);
    border-radius: 7px;
    padding: 5px 8px;
    background: var(--bg-main);
    color: var(--wa-header);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.group-member-action:hover { background: var(--bg-hover); }
.group-member-action.remove { color: #b4232d; }
.group-member-empty { padding: 12px; color: var(--wa-text-muted); font-size: 13px; }
.group-modal-actions { margin-top: 16px; }
.group-delete-btn { margin-right: auto; }
.group-modal-error { margin-bottom: 8px; }

.delete-modal-note {
    margin: -8px 0 14px;
    color: var(--wa-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.modal-btn {
    border: none;
    background: transparent;
    color: var(--wa-header);
    font-size: 14px;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}

.modal-btn:hover { background: var(--bg-hover); }
.modal-btn.danger { color: #ea5455; }
.modal-btn.plain { color: var(--wa-text-muted); }

body.dark .group-member-options { background: var(--bg-main); }
body.dark .group-member-option:hover { background: var(--bg-hover); }
body.dark .group-modal .auth-error { background: rgba(92, 23, 30, .85); }

@media (max-width: 480px) {
    .group-modal { padding: 20px 16px; }
    .group-member-current { gap: 7px; }
    .group-member-actions { width: 100%; justify-content: flex-end; }
}

.flash {
    animation: flashBg 1s ease-out;
}

@keyframes flashBg {
    0%, 40% { box-shadow: 0 0 0 3px rgba(0, 168, 132, .55); }
    100%    { box-shadow: 0 1px .5px rgba(0, 0, 0, .13); }
}

/* ===== Bar reply, edit & preview media ===== */
.reply-bar,
.edit-bar,
.media-preview-bar {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--wa-panel);
    border-top: 1px solid var(--wa-border);
    flex-shrink: 0;
}

.reply-bar-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
}

.reply-bar-content {
    flex: 1;
    min-width: 0;
    background: var(--bg-main);
    border-left: 4px solid var(--wa-header);
    border-radius: 6px;
    padding: 6px 10px;
}

.reply-emoji-strip {
    display: flex;
    gap: 3px;
    padding: 6px 10px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--wa-border);
    background: linear-gradient(180deg, var(--bg-main) 0%, var(--wa-panel) 100%);
}

.reply-emoji-strip::-webkit-scrollbar { display: none; }

.reply-emoji-btn {
    flex-shrink: 0;
    border: none;
    background: var(--bg-main);
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, background .15s, box-shadow .15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.reply-emoji-btn:hover {
    transform: scale(1.15);
    background: var(--wa-panel);
    box-shadow: 0 3px 10px rgba(0, 168, 132, .18);
}

.reply-emoji-btn:active { transform: scale(.9); }

#btnReplyEmoji {
    font-size: 22px;
    flex-shrink: 0;
}

#btnReplyEmoji:hover { background: rgba(0, 168, 132, .12); }

.edit-bar,
.media-preview-bar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
}

.reply-bar-name { font-size: 12.5px; font-weight: 600; color: var(--wa-header); }
.reply-bar-text {
    font-size: 13px;
    color: var(--wa-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-bar-content {
    flex: 1;
    min-width: 0;
    background: var(--bg-main);
    border-left: 4px solid #f39c12;
    border-radius: 6px;
    padding: 6px 10px;
}

.edit-bar-title { font-size: 12.5px; font-weight: 600; color: #f39c12; }
.edit-bar-text {
    font-size: 13px;
    color: var(--wa-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-preview-bar img,
.media-preview-bar video {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #000;
}

.doc-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
    max-width: 280px;
}

.doc-preview-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, #607d8b, #455a64);
}

.doc-preview-icon.doc-type-pdf   { background: linear-gradient(135deg, #e53935, #c62828); }
.doc-preview-icon.doc-type-word  { background: linear-gradient(135deg, #1e88e5, #1565c0); }
.doc-preview-icon.doc-type-excel { background: linear-gradient(135deg, #43a047, #2e7d32); }
.doc-preview-icon.doc-type-ppt   { background: linear-gradient(135deg, #fb8c00, #ef6c00); }
.doc-preview-icon.doc-type-txt,
.doc-preview-icon.doc-type-csv   { background: linear-gradient(135deg, #78909c, #546e7a); }
.doc-preview-icon.doc-type-zip   { background: linear-gradient(135deg, #8e24aa, #6a1b9a); }

.doc-preview-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.doc-preview-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--wa-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-preview-size {
    font-size: 12px;
    color: var(--wa-text-muted);
}

.media-preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.media-preview-info > span {
    font-size: 13px;
    color: var(--wa-text-muted);
}

.upload-progress {
    height: 6px;
    background: var(--wa-border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--wa-header), var(--wa-unread));
    border-radius: 3px;
    transition: width .2s ease;
}

.upload-progress-text {
    font-size: 11px;
    color: var(--wa-header);
    font-weight: 600;
}

/* Menu lampiran modern (bottom sheet) */
.attach-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-main);
    border-top: 1px solid var(--wa-border);
    border-radius: 20px 20px 0 0;
    padding: 8px 16px 20px;
    z-index: 30;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, .12);
    animation: sheetUp .28s cubic-bezier(.22, 1, .36, 1);
}

body.dark .attach-sheet {
    box-shadow: 0 -8px 36px rgba(0, 0, 0, .45);
}

@keyframes sheetUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.attach-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: var(--wa-border);
    margin: 4px auto 16px;
    opacity: .85;
}

.attach-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px 4px;
    max-width: 480px;
    margin: 0 auto;
}

.attach-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 14px;
    transition: background .18s, transform .15s;
    min-width: 0;
}

.attach-item:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.attach-item:active { transform: scale(.96); }

.attach-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
    transition: box-shadow .2s, transform .15s;
}

.attach-item:hover .attach-icon {
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}

.attach-icon-photo { background: linear-gradient(145deg, #7c4dff, #536dfe); }
.attach-icon-video { background: linear-gradient(145deg, #ff4081, #f50057); }
.attach-icon-doc   { background: linear-gradient(145deg, #00bfa5, #00897b); }
.attach-icon-live  { background: linear-gradient(145deg, #ff5252, #d50000); }

.attach-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--wa-text);
    text-align: center;
    line-height: 1.2;
}

/* Kartu dokumen dalam pesan */
.message-doc {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    max-width: 100%;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .06);
    text-decoration: none;
    color: inherit;
    transition: background .18s, transform .15s, box-shadow .18s;
    border: 1px solid rgba(0, 0, 0, .04);
}

.message.out .message-doc {
    background: rgba(0, 0, 0, .08);
    border-color: rgba(0, 0, 0, .06);
}

body.dark .message-doc {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .06);
}

body.dark .message.out .message-doc {
    background: rgba(0, 0, 0, .2);
}

.message-doc:hover {
    background: rgba(0, 168, 132, .12);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

.message-doc-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, #607d8b, #455a64);
}

.message-doc.doc-type-pdf   .message-doc-icon { background: linear-gradient(135deg, #e53935, #c62828); }
.message-doc.doc-type-word  .message-doc-icon { background: linear-gradient(135deg, #1e88e5, #1565c0); }
.message-doc.doc-type-excel .message-doc-icon { background: linear-gradient(135deg, #43a047, #2e7d32); }
.message-doc.doc-type-ppt   .message-doc-icon { background: linear-gradient(135deg, #fb8c00, #ef6c00); }
.message-doc.doc-type-txt   .message-doc-icon,
.message-doc.doc-type-csv   .message-doc-icon { background: linear-gradient(135deg, #78909c, #546e7a); }
.message-doc.doc-type-zip   .message-doc-icon { background: linear-gradient(135deg, #8e24aa, #6a1b9a); }

.message-doc-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-doc-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--wa-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-doc-size {
    font-size: 12px;
    color: var(--wa-text-muted);
}

.message-doc-dl {
    flex-shrink: 0;
    color: var(--wa-header);
    opacity: .85;
    display: flex;
    align-items: center;
}

/* video dalam pesan */
.message-video {
    display: block;
    max-width: 100%;
    max-height: 360px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: #000;
}

/* ===== Emoji picker modern (ala WA) ===== */
.emoji-picker {
    background: var(--bg-main);
    border-top: 1px solid var(--wa-border);
    height: 380px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    animation: pickerUp .22s cubic-bezier(.22, 1, .36, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .08);
}

body.dark .emoji-picker {
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .35);
}

@keyframes pickerUp {
    from { transform: translateY(18px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* bar reaksi cepat */
.emoji-quick-bar {
    display: flex;
    gap: 2px;
    padding: 8px 10px 4px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
    background: linear-gradient(180deg, var(--wa-panel) 0%, var(--bg-main) 100%);
}

.emoji-quick-bar::-webkit-scrollbar { display: none; }

.emoji-quick-item {
    flex-shrink: 0;
    border: none;
    background: var(--bg-main);
    font-size: 26px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, background .15s, box-shadow .15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.emoji-quick-item:hover {
    transform: scale(1.18) translateY(-2px);
    background: var(--wa-panel);
    box-shadow: 0 4px 12px rgba(0, 168, 132, .18);
}

.emoji-quick-item:active { transform: scale(.92); }

/* kotak pencarian */
.emoji-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 10px 4px;
    padding: 0 12px;
    background: var(--wa-panel);
    border-radius: 20px;
    border: 1px solid var(--wa-border);
    flex-shrink: 0;
    transition: border-color .2s, box-shadow .2s;
}

.emoji-search-wrap:focus-within {
    border-color: var(--wa-header);
    box-shadow: 0 0 0 2px rgba(0, 168, 132, .15);
}

.emoji-search-icon {
    color: var(--wa-text-muted);
    flex-shrink: 0;
}

.emoji-search {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--wa-text);
    font-size: 14px;
    padding: 9px 0;
    outline: none;
    min-width: 0;
}

.emoji-search::placeholder { color: var(--wa-text-muted); }

.emoji-search::-webkit-search-cancel-button {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    background: var(--wa-text-muted);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
    cursor: pointer;
}

.emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 4px 8px 6px;
    border-bottom: 1px solid var(--wa-border);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.emoji-tabs::-webkit-scrollbar { display: none; }

.emoji-tab {
    flex: 0 0 auto;
    min-width: 38px;
    border: none;
    background: transparent;
    font-size: 20px;
    padding: 6px 8px 10px;
    cursor: pointer;
    border-radius: 10px;
    opacity: .4;
    position: relative;
    transition: opacity .15s, background .15s, transform .15s;
    filter: grayscale(40%);
}

.emoji-tab:hover {
    opacity: .8;
    background: var(--bg-hover);
    transform: scale(1.08);
}

.emoji-tab.active {
    opacity: 1;
    filter: none;
    background: var(--wa-panel);
}

.emoji-tab.active::after {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: 2px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--wa-header), var(--wa-unread));
}

.emoji-scroll {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 2px 10px 16px;
    scroll-behavior: smooth;
}

.emoji-section-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--wa-header);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin: 14px 4px 6px;
    opacity: .85;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 3px;
}

.emoji-item {
    border: none;
    background: transparent;
    font-size: 26px;
    padding: 5px;
    cursor: pointer;
    border-radius: 10px;
    line-height: 1.25;
    transition: background .12s, transform .15s;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.emoji-item:hover {
    background: var(--wa-panel);
    transform: scale(1.28);
}

.emoji-item:active { transform: scale(.9); }

.emoji-empty-hint {
    grid-column: 1 / -1;
    font-size: 13px;
    color: var(--wa-text-muted);
    padding: 12px 4px;
    text-align: center;
}

.emoji-search-results .emoji-section-title {
    color: var(--wa-unread);
}

/* pesan hanya emoji — tampil lebih besar (ala WA) */
.message.emoji-only {
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px 6px;
}

.message.emoji-only::after { display: none; }

.message.emoji-only .msg-text {
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: 2px;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.message.emoji-only.emoji-lg-1 .msg-text { font-size: 56px; }
.message.emoji-only.emoji-lg-2 .msg-text { font-size: 48px; }
.message.emoji-only.emoji-lg-3 .msg-text { font-size: 40px; }

.message.emoji-only .meta {
    background: var(--divider-bg);
    border-radius: 6px;
    padding: 2px 6px;
    margin-top: 2px;
    float: none;
    display: inline-flex;
}

/* tombol emoji di footer menyala saat picker terbuka */
#chatForm .icon-btn.active {
    color: var(--wa-header);
    background: rgba(0, 168, 132, .14);
    box-shadow: 0 0 0 2px rgba(0, 168, 132, .2);
}

/* ===== Footer input ===== */
.chat-footer {
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    background: var(--wa-panel);
    flex-shrink: 0;
    position: relative;
    border-top: 1px solid var(--wa-border);
}

#chatForm {
    display: flex;
    align-items: center;
    gap: 6px;
}

#chatForm .icon-btn { color: #54656f; }

#messageInput {
    flex: 1;
    padding: 11px 16px;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    background: var(--input-bg);
    color: var(--wa-text);
    min-width: 0;
}

.btn-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--wa-header);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .1s;
    flex-shrink: 0;
}

.btn-send:hover  { background: var(--wa-header-dark); }
.btn-send:active { transform: scale(.92); }
.btn-send:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Panel pengaturan ===== */
.settings-panel {
    position: absolute;
    inset: 0;
    background: var(--bg-main);
    z-index: 10;
    display: flex;
    flex-direction: column;
    animation: slideIn .2s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-30%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--wa-header);
    color: #fff;
    flex-shrink: 0;
}

.settings-header h2 { font-size: 17px; font-weight: 600; }
.settings-header .icon-btn:hover { background: rgba(255, 255, 255, .15); }

.settings-scroll {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
}

.settings-profile {
    display: flex;
    flex-direction: column;
    padding: 24px 24px 16px;
    border-bottom: 8px solid var(--wa-panel);
}

.settings-avatar-wrap {
    position: relative;
    align-self: center;
    margin-bottom: 18px;
}

.avatar-xl {
    width: 120px;
    height: 120px;
    font-size: 48px;
}

.avatar-cam {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--wa-header);
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    transition: transform .15s;
}

.avatar-cam:hover { transform: scale(1.08); }

.settings-label {
    font-size: 13px;
    color: var(--wa-header);
    font-weight: 600;
    margin: 10px 0 4px;
}

.settings-input {
    padding: 10px 12px;
    border: 1px solid var(--wa-border);
    border-radius: 8px;
    font-size: 14.5px;
    outline: none;
    background: var(--input-bg);
    color: var(--wa-text);
    margin-bottom: 4px;
}

.settings-input:focus { border-color: var(--wa-header); }

.settings-btn {
    margin-top: 12px;
    padding: 11px;
    border: none;
    border-radius: 8px;
    background: var(--wa-header);
    color: #fff;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    width: 100%;
}

.settings-btn:hover { background: var(--wa-header-dark); }
.settings-btn:disabled { opacity: .6; cursor: not-allowed; }

.settings-btn.danger {
    background: transparent;
    color: #ea5455;
    border: 1px solid #ea5455;
    margin-top: 20px;
}

.settings-btn.danger:hover { background: rgba(234, 84, 85, .08); }

.settings-msg {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.settings-msg.ok  { background: rgba(37, 211, 102, .15); color: #1fa855; }
.settings-msg.err { background: rgba(234, 84, 85, .12); color: #ea5455; }

.settings-section {
    padding: 16px 24px;
    border-bottom: 8px solid var(--wa-panel);
    display: flex;
    flex-direction: column;
}

.settings-section h3 {
    font-size: 14px;
    color: var(--wa-header);
    margin-bottom: 6px;
}

.settings-hint {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--wa-text-muted);
    margin: 0 0 14px;
}

.ringtone-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
}

.ringtone-select {
    flex: 1;
    min-width: 0;
    font-size: 13px;
}

.ringtone-preview-btn {
    width: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    background: var(--wa-header);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .15s;
}

.ringtone-preview-btn:hover { background: var(--wa-header-dark); }
.ringtone-preview-btn:active { transform: scale(.94); }

.ringtone-file-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 14px;
}

.ringtone-pick-btn {
    padding: 8px 12px;
    border: 1px dashed var(--wa-border);
    border-radius: 8px;
    background: var(--wa-panel);
    color: var(--wa-text);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.ringtone-pick-btn:hover {
    background: var(--wa-header);
    border-color: var(--wa-green);
}

.ringtone-file-name {
    font-size: 12px;
    color: var(--wa-text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    cursor: pointer;
}

.row-title { font-size: 14.5px; }
.row-desc  { font-size: 12.5px; color: var(--wa-text-muted); margin-top: 2px; }

/* switch toggle ala WA */
.switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    inset: 0;
    background: #c5cdd3;
    border-radius: 12px;
    transition: background .2s;
}

.switch .slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.switch input:checked + .slider { background: var(--wa-unread); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* avatar berupa foto */
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(17, 27, 33, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: zoom-out;
}

.lightbox img {
    max-width: 92%;
    max-height: 92%;
    border-radius: 6px;
}

/* ===== Scrollbar ===== */
.chat-body::-webkit-scrollbar,
.contact-list::-webkit-scrollbar,
.emoji-scroll::-webkit-scrollbar { width: 6px; }

.chat-body::-webkit-scrollbar-thumb,
.contact-list::-webkit-scrollbar-thumb,
.emoji-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .2);
    border-radius: 3px;
}

/* ===== Responsif (mobile: satu panel bergantian) ===== */
@media (max-width: 720px) {
    .sidebar {
        width: 100%;
        min-width: 0;
        border-right: none;
    }

    .chat-panel { display: none; }

    .app.chat-open .sidebar    { display: none; }
    .app.chat-open .chat-panel { display: flex; }

    .btn-back { display: flex; }

    .message { max-width: 84%; }

    .emoji-picker { height: 340px; }
    .emoji-quick-item { width: 38px; height: 38px; font-size: 24px; }
    .emoji-item { font-size: 24px; }
    .message.emoji-only.emoji-lg-1 .msg-text { font-size: 48px; }
    .message.emoji-only.emoji-lg-2 .msg-text { font-size: 42px; }
    .message.emoji-only.emoji-lg-3 .msg-text { font-size: 36px; }

    .msg-menu { min-width: 260px; max-width: 96vw; }
    .msg-menu-reactions { grid-template-columns: repeat(4, 1fr); }
    .emoji-picker--menu { height: 260px; }
    .reply-emoji-btn { width: 36px; height: 36px; font-size: 22px; }
}

/* ===== Live Streaming — TikTok-style ===== */
.btn-live { color: #fe2c55; }
.btn-live:hover { background: rgba(254, 44, 85, .12); }

.live-section {
    border-bottom: 1px solid var(--bg-hover);
    background: linear-gradient(180deg, rgba(254, 44, 85, .05) 0%, transparent 100%);
    padding-bottom: 4px;
}

.live-section-title {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 800;
    color: #fe2c55;
    text-transform: uppercase;
    letter-spacing: .08em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-section-title::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fe2c55;
    animation: livePulse 1.2s ease-in-out infinite;
}

.live-list {
    display: flex;
    gap: 10px;
    padding: 0 12px 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.live-list::-webkit-scrollbar { display: none; }

.live-empty {
    padding: 12px;
    font-size: 13px;
    color: var(--wa-text-muted);
    text-align: center;
    width: 100%;
}

.live-item {
    flex: 0 0 132px;
    scroll-snap-align: start;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(145deg, #1a1028 0%, #2d1b4e 40%, #fe2c55 180%);
    aspect-ratio: 9/14;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .08);
    transition: transform .25s cubic-bezier(.34, 1.2, .64, 1), box-shadow .25s ease;
}

.live-item::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(254, 44, 85, .15) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

.live-item:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 32px rgba(254, 44, 85, .3), 0 0 0 1px rgba(254, 44, 85, .2);
}

.live-item.active {
    outline: 2px solid #fe2c55;
    outline-offset: 2px;
}

.live-item-card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, .75) 100%);
}

.live-item-avatar-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -58%);
}

.live-avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, .9);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

.live-item-live-pill {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    color: #fff;
    background: linear-gradient(90deg, #fe2c55, #ff4d6d);
    text-transform: uppercase;
}

.live-item-live-pill .live-dot {
    width: 5px;
    height: 5px;
    margin: 0;
}

.live-item-viewers {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
}

.live-item-info { min-width: 0; }

.live-item-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.live-item-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, .75);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-cohost-tag {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    color: #e056fd;
    background: rgba(224, 86, 253, .2);
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 3px;
    vertical-align: middle;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .55; transform: scale(.88); }
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: livePulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

.contact-live-badge {
    font-size: 8px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(90deg, #fe2c55, #ff4d6d);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: .04em;
    cursor: pointer;
    animation: livePulse 1.2s ease-in-out infinite;
}

/* Modal mulai live */
.live-start-modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.live-start-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(6px);
}

.live-start-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 28px 24px;
    border-radius: 20px;
    background: linear-gradient(160deg, #1e1e2e 0%, #12121a 100%);
    color: #fff;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    animation: liveModalIn .3s ease-out;
}

@keyframes liveModalIn {
    from { opacity: 0; transform: scale(.92) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.live-start-icon { font-size: 40px; margin-bottom: 8px; }

.live-start-card h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.live-start-card p {
    font-size: 13px;
    color: rgba(255, 255, 255, .6);
    line-height: 1.5;
    margin-bottom: 18px;
}

.live-start-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-size: 15px;
    margin-bottom: 16px;
    outline: none;
}

.live-start-input:focus {
    border-color: #fe2c55;
    box-shadow: 0 0 0 3px rgba(254, 44, 85, .2);
}

.live-start-actions {
    display: flex;
    gap: 10px;
}

.live-start-cancel,
.live-start-go {
    flex: 1;
    padding: 13px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}

.live-start-cancel {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.live-start-go {
    background: linear-gradient(90deg, #fe2c55, #ff4d6d);
    color: #fff;
}

.live-start-go:hover { opacity: .92; transform: scale(1.02); }

/* Panel live fullscreen TikTok */
.live-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
    color: #fff;
}

body.live-active { overflow: hidden; }

.live-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: #000;
}

@media (min-width: 481px) {
    .live-panel { background: #0a0a0a; }
    .live-viewport {
        max-width: 420px;
        height: 100%;
        box-shadow: 0 0 80px rgba(0, 0, 0, .8);
    }
}

.live-video-stage {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.live-vignette {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
}

.live-vignette-top {
    top: 0;
    height: 140px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, transparent 100%);
}

.live-vignette-bottom {
    bottom: 0;
    height: 200px;
    background: linear-gradient(0deg, rgba(0, 0, 0, .65) 0%, transparent 100%);
}

.live-screen-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    z-index: 1;
}

.live-video-stage.has-screen.has-camera-pip .live-local-video {
    width: 100px;
    height: 140px;
    bottom: 100px;
    right: 12px;
    border-radius: 10px;
}

.live-present-badge {
    position: absolute;
    top: 72px;
    left: 12px;
    z-index: 4;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, .15);
}

.live-local-video {
    position: absolute;
    bottom: 88px;
    right: 12px;
    width: 110px;
    height: 155px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, .85);
    z-index: 3;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}

.live-video-stage:not(.has-screen) .live-local-video.main-solo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: none;
    border-radius: 0;
    object-fit: cover;
    box-shadow: none;
    bottom: 0;
    right: 0;
}

.live-remote-grid {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.live-remote-grid video {
    pointer-events: auto;
}

.live-remote-tile {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.live-remote-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-remote-tile video.remote-screen {
    object-fit: contain;
    background: #000;
}

.live-remote-tile .remote-camera-pip {
    position: absolute;
    bottom: 100px;
    right: 12px;
    width: 100px;
    height: 140px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, .85);
    object-fit: cover;
    z-index: 3;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}

.live-remote-tile .remote-camera-main {
    object-fit: cover;
}

.live-remote-tile .live-tile-badge {
    position: absolute;
    top: 72px;
    left: 12px;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 3;
}

.live-remote-label {
    position: absolute;
    bottom: 96px;
    left: 12px;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 3;
}

.live-stage-empty {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, .45);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.live-stage-empty[hidden] {
    display: none !important;
}

.live-stage-empty-icon {
    font-size: 36px;
    opacity: .6;
    animation: livePulse 2s ease-in-out infinite;
}

/* UI overlay layer */
.live-ui-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.live-ui-layer > * { pointer-events: auto; }

.live-top-bar {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 12px 8px;
    padding-top: max(12px, env(safe-area-inset-top));
}

.live-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}

.live-close-btn:hover { background: rgba(0, 0, 0, .55); }

.live-host-card {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(0, 0, 0, .5) 0%, rgba(30, 30, 40, .45) 100%);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}

.live-host-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    font-size: 14px;
}

.live-host-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.live-host-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.live-stream-title {
    font-size: 11px;
    color: rgba(255, 255, 255, .65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-duration {
    font-size: 11px;
    font-weight: 700;
    color: #25f4a0;
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
}

.live-network {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(8px);
}

.live-network-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #25f4a0;
}

.live-network-stable .live-network-dot {
    background: #25f4a0;
    box-shadow: 0 0 6px rgba(37, 244, 160, .6);
}

.live-network-reconnecting .live-network-dot {
    background: #ffc107;
    animation: livePulse 1s ease-in-out infinite;
}

.live-network-weak .live-network-dot {
    background: #ff6b6b;
    animation: livePulse .8s ease-in-out infinite;
}

.live-network-reconnecting .live-network-text { color: #ffc107; }
.live-network-weak .live-network-text { color: #ff8a8a; }
.live-network-stable .live-network-text { color: #9dffd0; }

.live-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    color: #fff;
    background: linear-gradient(135deg, #fe2c55 0%, #ff4d6d 50%, #ff758f 100%);
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(254, 44, 85, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.live-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    animation: livePulse 1s ease-in-out infinite;
}

.live-top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.live-viewers,
.live-viewers-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 6px;
    border-radius: 22px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(12px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .1);
    transition: background .2s, transform .15s, box-shadow .2s;
}

.live-viewers-btn {
    cursor: default;
    font-family: inherit;
}

.live-viewers-btn.is-interactive {
    cursor: pointer;
}

.live-viewers-btn.is-interactive:hover {
    background: rgba(254, 44, 85, .25);
    border-color: rgba(254, 44, 85, .35);
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(254, 44, 85, .2);
}

.live-viewers-btn.is-interactive:active {
    transform: scale(.98);
}

.live-viewer-avatars {
    display: inline-flex;
    align-items: center;
    padding-left: 4px;
}

.live-viewer-avatars[hidden] {
    display: none !important;
}

.live-viewer-avatar-mini {
    width: 22px !important;
    height: 22px !important;
    font-size: 9px !important;
    margin-left: -8px;
    border: 2px solid rgba(0, 0, 0, .6) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.live-viewer-avatar-mini:first-child {
    margin-left: 0;
}

.live-viewer-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Stats bar host — TikTok-style */
.live-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 12px 8px;
    margin-top: -4px;
}

.live-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .08);
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, .9);
}

.live-stat-val {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.live-stat-label {
    font-size: 10px;
    color: rgba(255, 255, 255, .55);
    font-weight: 500;
}

.live-stat-likes .live-stat-val { color: #ff6b8a; }
.live-stat-duration .live-stat-val { color: #25f4a0; }

/* Join toast — "X bergabung" */
.live-join-toast-stack {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100% - 80px);
}

.live-join-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 8px;
    border-radius: 28px;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
    opacity: 0;
    transform: translateX(-24px);
    transition: opacity .35s ease, transform .35s ease;
}

.live-join-toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.live-join-toast.is-leaving {
    opacity: 0;
    transform: translateX(-16px);
}

.live-join-toast-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
    flex-shrink: 0;
}

.live-join-toast-text {
    font-size: 12px;
    color: rgba(255, 255, 255, .9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-join-toast-text strong {
    font-weight: 700;
    color: #fff;
}

/* Viewer list sheet */
.live-viewer-sheet {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
}

.live-viewer-sheet:not([hidden]) {
    pointer-events: auto;
}

.live-viewer-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    transition: opacity .28s ease;
}

.live-viewer-sheet.is-open .live-viewer-sheet-backdrop {
    opacity: 1;
}

.live-viewer-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72vh;
    background: linear-gradient(180deg, #1e1e28 0%, #14141c 100%);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.32, .72, 0, 1);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.live-viewer-sheet.is-open .live-viewer-sheet-panel {
    transform: translateY(0);
}

.live-viewer-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .25);
    margin: 10px auto 6px;
    cursor: pointer;
}

.live-viewer-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 4px 16px 12px;
    gap: 12px;
}

.live-viewer-sheet-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
}

.live-viewer-sheet-sub {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, .5);
    margin-top: 2px;
    font-weight: 500;
}

.live-viewer-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}

.live-viewer-sheet-close:hover {
    background: rgba(255, 255, 255, .2);
}

.live-viewer-sheet-tabs {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
}

.live-viewer-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.live-viewer-tab.active {
    background: linear-gradient(135deg, rgba(254, 44, 85, .3), rgba(255, 77, 109, .2));
    color: #fff;
    border: 1px solid rgba(254, 44, 85, .35);
}

.live-viewer-tab-count {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .3);
}

.live-viewer-sheet-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px 12px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .5);
}

.live-viewer-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.live-viewer-search-input::placeholder {
    color: rgba(255, 255, 255, .35);
}

.live-viewer-sheet-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.live-viewer-sheet-list[hidden] {
    display: none !important;
}

.live-viewer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 14px;
    transition: background .15s;
}

.live-viewer-row:hover {
    background: rgba(255, 255, 255, .05);
}

.live-viewer-row-avatar {
    width: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, .15);
}

.live-viewer-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.live-viewer-row-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-viewer-row-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, .45);
    font-weight: 500;
}

.live-viewer-row-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(254, 44, 85, .2);
    color: #ff8fab;
    white-space: nowrap;
}

.live-viewer-row-tag {
    font-size: 9px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(224, 86, 253, .25);
    color: #e056fd;
    letter-spacing: .04em;
}

.live-viewer-sheet-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 48px;
    text-align: center;
    color: rgba(255, 255, 255, .5);
}

.live-viewer-sheet-empty[hidden] {
    display: none !important;
}

.live-viewer-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: .7;
}

.live-viewer-sheet-empty p {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, .75);
}

.live-viewer-sheet-empty span {
    font-size: 12px;
    color: rgba(255, 255, 255, .4);
}

/* Share, goal bar, chat, milestone, profile, leaderboard */
.live-share-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .1);
    transition: background .15s, transform .15s;
}

.live-share-btn:hover {
    background: rgba(254, 44, 85, .35);
    transform: scale(1.08);
}

.live-viewers-pulse {
    animation: liveViewerPulse .6s ease-out;
}

@keyframes liveViewerPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(254, 44, 85, .5); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(254, 44, 85, 0); }
    100% { transform: scale(1); }
}

.live-goal-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 10px;
}

.live-goal-bar[hidden] { display: none !important; }

.live-goal-item {
    background: rgba(0, 0, 0, .3);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .06);
}

.live-goal-head {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, .65);
    margin-bottom: 6px;
}

.live-goal-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .1);
    overflow: hidden;
}

.live-goal-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s cubic-bezier(.34, 1.2, .64, 1);
    min-width: 0;
}

.live-goal-fill-viewers {
    background: linear-gradient(90deg, #25f4a0, #00d4aa);
}

.live-goal-fill-likes {
    background: linear-gradient(90deg, #fe2c55, #ff6b8a);
}

.live-chat-stage {
    position: absolute;
    left: 12px;
    bottom: 132px;
    max-width: 78%;
    max-height: 40vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 4;
    pointer-events: none;
    scrollbar-width: none;
    mask-image: linear-gradient(0deg, transparent 0%, #000 10%, #000 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(0deg, transparent 0%, #000 10%, #000 92%, transparent 100%);
}

.live-chat-stage::-webkit-scrollbar { display: none; }

.live-chat-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 12px;
    min-height: min-content;
}

.live-chat-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, .52);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, .08);
    animation: liveChatIn .35s ease-out;
    pointer-events: auto;
    max-width: 100%;
}

.live-chat-item.is-me {
    background: rgba(254, 44, 85, .28);
    border-color: rgba(254, 44, 85, .22);
}

.live-chat-item.is-host {
    border-color: rgba(37, 244, 160, .35);
    box-shadow: 0 0 0 1px rgba(37, 244, 160, .08);
}

.live-chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.live-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-chat-body {
    flex: 1;
    min-width: 0;
}

.live-chat-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

.live-chat-name {
    font-weight: 800;
    font-size: 11px;
    color: #ff8fab;
    flex-shrink: 0;
}

.live-chat-item.is-host .live-chat-name { color: #25f4a0; }
.live-chat-item.is-me .live-chat-name { color: #ffb3c6; }

.live-chat-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(37, 244, 160, .2);
    color: #25f4a0;
}

.live-chat-reply-btn {
    margin-left: auto;
    border: none;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .75);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.live-chat-reply-btn:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.live-chat-quote {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-left: 2px solid rgba(254, 44, 85, .6);
    border-radius: 0 6px 6px 0;
    background: rgba(255, 255, 255, .06);
    font-size: 10px;
    line-height: 1.3;
}

.live-chat-quote-name {
    font-weight: 700;
    color: rgba(255, 255, 255, .65);
}

.live-chat-quote-msg {
    color: rgba(255, 255, 255, .45);
    word-break: break-word;
}

.live-chat-msg {
    margin: 0;
    font-size: 12px;
    color: #fff;
    line-height: 1.4;
    word-break: break-word;
}

.live-chat-reply-bar {
    position: absolute;
    left: 12px;
    right: 72px;
    bottom: 64px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(20, 20, 28, .92);
    border: 1px solid rgba(254, 44, 85, .35);
    z-index: 8;
    pointer-events: auto;
    animation: liveChatIn .25s ease-out;
}

.live-chat-reply-bar[hidden] { display: none !important; }

.live-chat-reply-inner {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.live-chat-reply-label {
    font-size: 10px;
    font-weight: 700;
    color: #fe2c55;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.live-chat-reply-preview {
    font-size: 11px;
    color: rgba(255, 255, 255, .7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-chat-reply-cancel {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.live-chat-reply-cancel:hover { background: rgba(255, 255, 255, .22); }

.live-ended-toast {
    position: fixed;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(16px);
    padding: 12px 20px;
    border-radius: 24px;
    background: rgba(20, 20, 28, .94);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
}

.live-ended-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@keyframes liveChatIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.live-chat-input-wrap {
    position: absolute;
    left: 12px;
    right: 72px;
    bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    z-index: 7;
    pointer-events: auto;
}

.live-chat-input-wrap[hidden] { display: none !important; }

.live-chat-input {
    flex: 1;
    border: none;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: inherit;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(12px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .12);
    outline: none;
}

.live-chat-input::placeholder { color: rgba(255, 255, 255, .4); }

.live-chat-input-wrap.is-host {
    bottom: max(92px, calc(20px + env(safe-area-inset-bottom)));
    right: 12px;
}

.live-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #fe2c55, #ff4d6d);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(254, 44, 85, .35);
}

.live-milestone-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s ease;
}

.live-milestone-overlay.is-active {
    opacity: 1;
}

.live-milestone-burst {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(254, 44, 85, .4) 0%, transparent 70%);
    animation: liveMilestoneBurst 2s ease-out infinite;
}

@keyframes liveMilestoneBurst {
    0%, 100% { transform: scale(.8); opacity: .6; }
    50% { transform: scale(1.2); opacity: 1; }
}

.live-milestone-emoji {
    font-size: 56px;
    z-index: 1;
    animation: liveMilestoneBounce .6s ease-out;
}

.live-milestone-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, .5);
    z-index: 1;
    margin-top: 8px;
}

.live-milestone-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, .75);
    z-index: 1;
    margin-top: 4px;
}

@keyframes liveMilestoneBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.live-vip-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 800;
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a1a;
    vertical-align: middle;
    letter-spacing: .04em;
}

.live-viewer-row.is-vip {
    background: linear-gradient(90deg, rgba(255, 215, 0, .08) 0%, transparent 100%);
    border: 1px solid rgba(255, 215, 0, .15);
}

.live-viewer-rank {
    font-size: 18px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.live-viewer-row-kick {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(254, 44, 85, .25);
    color: #ff8fab;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.live-viewer-row-kick:hover {
    background: rgba(254, 44, 85, .5);
    color: #fff;
}

.live-leaderboard-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 8px;
    -webkit-overflow-scrolling: touch;
}

.live-leaderboard-list[hidden] { display: none !important; }

.live-profile-card {
    position: absolute;
    inset: 0;
    z-index: 35;
    pointer-events: none;
}

.live-profile-card:not([hidden]) { pointer-events: auto; }

.live-profile-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    opacity: 0;
    transition: opacity .28s;
}

.live-profile-card.is-open .live-profile-backdrop { opacity: 1; }

.live-profile-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.9);
    width: min(300px, 88%);
    padding: 28px 24px 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, #252530 0%, #1a1a22 100%);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    text-align: center;
    opacity: 0;
    transition: opacity .28s, transform .32s cubic-bezier(.34, 1.2, .64, 1);
}

.live-profile-card.is-open .live-profile-panel {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.live-profile-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.live-profile-avatar {
    width: 72px !important;
    height: 72px !important;
    font-size: 28px !important;
    margin: 0 auto 12px;
    border: 3px solid rgba(254, 44, 85, .5);
}

.live-profile-name {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.live-profile-vip {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #1a1a1a;
    margin-bottom: 10px;
}

.live-profile-about {
    font-size: 12px;
    color: rgba(255, 255, 255, .55);
    line-height: 1.45;
    margin: 0 0 16px;
    max-height: 48px;
    overflow: hidden;
}

.live-profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.live-profile-stats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.live-profile-stats strong {
    font-size: 18px;
    color: #fff;
}

.live-profile-stats span {
    font-size: 10px;
    color: rgba(255, 255, 255, .45);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.live-profile-kick {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: rgba(254, 44, 85, .25);
    color: #ff8fab;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.live-profile-kick:hover {
    background: #fe2c55;
    color: #fff;
}

.live-goals-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.live-goals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.live-goal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, .55);
}

.live-goal-field input {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, .3);
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}

.live-role-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .15);
    text-transform: uppercase;
}

.live-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.live-action-btn.end {
    background: #fe2c55;
    color: #fff;
}

.live-side-rail {
    position: absolute;
    right: 10px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 6;
}

.live-rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 48px;
    padding: 10px 6px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    transition: transform .15s, background .15s;
}

.live-rail-btn:hover {
    background: rgba(0, 0, 0, .5);
    transform: scale(1.05);
}

.live-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 6;
    background: linear-gradient(0deg, rgba(0, 0, 0, .55) 0%, transparent 100%);
}

.live-round-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(14px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, background .15s, opacity .15s, box-shadow .15s;
    border: 1px solid rgba(255, 255, 255, .15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.live-round-btn:hover {
    background: rgba(255, 255, 255, .25);
    transform: scale(1.08);
}

.live-round-btn.off {
    opacity: .4;
    background: rgba(255, 255, 255, .08);
}

.live-round-btn-accent {
    background: linear-gradient(135deg, #fe2c55, #ff6b8a);
    border: none;
    box-shadow: 0 4px 20px rgba(254, 44, 85, .4);
}

/* Tools drawer (bottom sheet) */
.live-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 8;
    animation: fadeIn .2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.live-tools-drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9;
    max-height: 70vh;
    background: #16161e;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .5);
    animation: slideUp .3s cubic-bezier(.32, .72, 0, 1);
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.live-drawer-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .25);
    margin: 10px auto 4px;
    flex-shrink: 0;
    cursor: grab;
}

.live-drawer-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.live-sidebar {
    width: 100%;
    padding: 8px 20px 20px;
    background: transparent;
}

.live-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.live-title-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-size: 15px;
    margin-bottom: 20px;
    outline: none;
}

.live-title-input:focus {
    border-color: #fe2c55;
}

.live-broadcast-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.live-present-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.live-present-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    color: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
}

.live-present-btn:hover {
    background: rgba(255, 255, 255, .08);
    transform: translateY(-1px);
}

.live-present-btn.active {
    border-color: #fe2c55;
    background: rgba(254, 44, 85, .15);
    box-shadow: 0 0 0 1px rgba(254, 44, 85, .3);
}

.live-present-icon { font-size: 22px; line-height: 1; }
.live-present-text { font-size: 10px; font-weight: 700; text-align: center; }

.live-present-status {
    font-size: 12px;
    font-weight: 600;
    color: #fe2c55;
    margin-bottom: 6px;
}

.live-present-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
    line-height: 1.5;
}

.live-cohost-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-size: 14px;
    margin-bottom: 10px;
}

.live-btn {
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    width: 100%;
    transition: opacity .15s;
}

.live-btn:hover { opacity: .88; }

.live-btn.cohost {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    margin-top: 4px;
}

.live-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, .35);
    line-height: 1.5;
    margin-top: 12px;
    text-align: center;
}

.live-cohost-section { margin-bottom: 8px; }

/* ── Live effects: beauty + background (TikTok-style) ── */
.live-effects-section {
    margin: 16px 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.live-effects-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, .45);
    line-height: 1.45;
    margin: -4px 0 14px;
}

.live-label-sub {
    margin-top: 14px !important;
    font-size: 11px !important;
    opacity: .75;
}

.live-beauty-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.live-effect-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 72px;
    padding: 10px 8px;
    border: 2px solid rgba(255, 255, 255, .12);
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
    color: #fff;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
    -webkit-tap-highlight-color: transparent;
}

.live-effect-toggle:hover {
    background: rgba(255, 255, 255, .1);
    transform: scale(1.02);
}

.live-effect-toggle.active {
    border-color: #fe2c55;
    background: rgba(254, 44, 85, .18);
    box-shadow: 0 0 20px rgba(254, 44, 85, .25);
}

.live-effect-toggle-icon {
    font-size: 22px;
    line-height: 1;
    animation: liveFxSparkle 2.5s ease-in-out infinite;
}

.live-effect-toggle.active .live-effect-toggle-icon {
    animation: liveFxSparkleActive 1.2s ease-in-out infinite;
}

@keyframes liveFxSparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: .85; }
    50% { transform: scale(1.08) rotate(8deg); opacity: 1; }
}

@keyframes liveFxSparkleActive {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.15); filter: brightness(1.3) drop-shadow(0 0 6px #fe2c55); }
}

.live-effect-toggle-text {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .03em;
}

.live-beauty-slider-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.live-beauty-range {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, .15);
    outline: none;
}

.live-beauty-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fe2c55, #ff6b8a);
    box-shadow: 0 2px 8px rgba(254, 44, 85, .45);
    cursor: pointer;
}

.live-beauty-val {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, .7);
    min-width: 34px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.live-bg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.live-bg-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px 8px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
    transition: border-color .15s, transform .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}

.live-bg-item:hover {
    background: rgba(255, 255, 255, .08);
    transform: scale(1.04);
}

.live-bg-item.active {
    border-color: #fe2c55;
    background: rgba(254, 44, 85, .12);
    box-shadow: 0 0 12px rgba(254, 44, 85, .2);
}

.live-bg-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}

.live-bg-label {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, .65);
    text-align: center;
    line-height: 1.2;
}

.live-bg-thumb-none { background: repeating-conic-gradient(#333 0% 25%, #444 0% 50%) 50% / 12px 12px; }
.live-bg-thumb-blur { background: linear-gradient(135deg, #667eea, #764ba2); filter: blur(2px); }
.live-bg-thumb-sunset { background: linear-gradient(135deg, #ff6b6b, #feca57, #ff9ff3); }
.live-bg-thumb-ocean { background: linear-gradient(180deg, #48dbfb, #006266); }
.live-bg-thumb-purple { background: linear-gradient(135deg, #5f27cd, #fd79a8); }
.live-bg-thumb-neon { background: linear-gradient(135deg, #00f5d4, #7b2cbf, #ff006e); }
.live-bg-thumb-studio { background: linear-gradient(180deg, #dfe6e9, #b2bec3); }
.live-bg-thumb-forest { background: linear-gradient(135deg, #00b894, #2d3436); }
.live-bg-thumb-night { background: radial-gradient(circle at 50% 30%, #2c3e50, #0c0c1e); }
.live-bg-thumb-candy { background: linear-gradient(135deg, #ff9a9e, #fecfef, #a18cd1); }
.live-bg-thumb-custom { background: rgba(255, 255, 255, .1); border: 1px dashed rgba(255, 255, 255, .25); }

.live-round-btn-fx {
    background: linear-gradient(135deg, rgba(254, 44, 85, .35), rgba(255, 107, 138, .25)) !important;
    border: 1px solid rgba(254, 44, 85, .4);
}

.live-round-btn-fx:hover {
    background: linear-gradient(135deg, rgba(254, 44, 85, .5), rgba(255, 107, 138, .4)) !important;
}

.live-local-video.has-beauty-fx {
    box-shadow: 0 0 0 2px rgba(254, 44, 85, .35), 0 8px 32px rgba(254, 44, 85, .15);
}

@media (max-width: 480px) {
    .live-bg-grid { grid-template-columns: repeat(3, 1fr); }
    .live-beauty-row { flex-wrap: wrap; }
    .live-beauty-slider-wrap { width: 100%; }
}

/* Banner undangan co-host */
.live-invite-banner {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(22, 22, 30, .92);
    backdrop-filter: blur(16px);
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
    border: 1px solid rgba(254, 44, 85, .3);
    font-size: 13px;
    font-weight: 600;
    max-width: calc(100% - 32px);
}

.live-invite-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.live-invite-btn.accept {
    background: linear-gradient(90deg, #fe2c55, #ff4d6d);
    color: #fff;
}

.live-invite-btn.reject {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

/* Reaksi live — TikTok-style */
.live-reaction-float {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.live-float-emoji {
    position: absolute;
    right: 18px;
    bottom: 110px;
    font-size: 28px;
    line-height: 1;
    animation: liveEmojiFloat 2.8s ease-out forwards;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .35));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    --drift: 0px;
    --scale: 1;
    transform: scale(var(--scale));
}

.live-float-emoji.is-heart {
    font-size: 32px;
    color: #fe2c55;
    filter: drop-shadow(0 0 12px rgba(254, 44, 85, .55));
}

.live-float-name {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, .85);
    background: rgba(0, 0, 0, .4);
    padding: 2px 6px;
    border-radius: 8px;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes liveEmojiFloat {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0) scale(calc(var(--scale) * .5));
    }
    12% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translateY(-220px) translateX(var(--drift)) scale(var(--scale));
    }
}

.live-reaction-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.live-like-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #fe2c55, #ff6b8a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(254, 44, 85, .45);
    transition: transform .15s;
}

.live-like-btn:hover { transform: scale(1.1); }

.live-like-btn.pulse {
    animation: liveLikePulse .35s ease-out;
}

@keyframes liveLikePulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.live-like-btn-icon {
    font-size: 24px;
    line-height: 1;
}

.live-emoji-react {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(10px);
    font-size: 20px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .12);
    transition: transform .15s, background .15s;
}

.live-emoji-react:hover {
    transform: scale(1.12);
    background: rgba(0, 0, 0, .55);
}

.live-likes {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(254, 44, 85, .25);
    backdrop-filter: blur(10px);
    color: #ff8fa3;
}

.live-audio-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 7;
    pointer-events: auto;
}

.live-audio-hint-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    border: none;
    border-radius: 28px;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(14px);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    animation: liveAudioHintPulse 2s ease-in-out infinite;
}

@keyframes liveAudioHintPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, .4); }
    50%      { box-shadow: 0 8px 32px rgba(254, 44, 85, .35); }
}

.live-audio-hint-btn:hover {
    background: rgba(254, 44, 85, .75);
}

@media (max-width: 720px) {
    .live-viewport { max-width: 100%; }
    .live-side-rail { bottom: 110px; right: 8px; }
    .live-emoji-react { width: 40px; height: 40px; font-size: 18px; }
    .live-like-btn { width: 48px; height: 48px; }
    .live-rail-btn { width: 44px; padding: 8px 4px; }
    .live-bottom-bar { gap: 16px; }
    .live-round-btn { width: 48px; height: 48px; }
    .live-stats-bar { gap: 6px; padding: 0 10px 6px; }
    .live-stat-chip { padding: 4px 10px; font-size: 10px; }
    .live-stat-label { display: none; }
    .live-viewer-sheet-panel { max-height: 78vh; }
    .live-join-toast-stack { left: 8px; max-width: calc(100% - 64px); }
    .live-chat-stage { max-width: 85%; bottom: 120px; max-height: 32vh; }
    .live-chat-input-wrap { right: 64px; }
    .live-chat-reply-bar { right: 64px; bottom: 56px; }
    .live-goal-bar { padding: 0 10px 6px; }
    .live-viewer-sheet-tabs { flex-wrap: wrap; }
    .live-viewer-tab { font-size: 12px; padding: 8px 10px; }
    .live-invite-banner {
        flex-wrap: wrap;
        justify-content: center;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .live-item { flex: 0 0 118px; }
    .live-present-btns { grid-template-columns: 1fr; }
    .live-present-btn {
        flex-direction: row;
        justify-content: center;
        padding: 12px;
    }
    .live-present-text { font-size: 12px; }

    .attach-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px 8px;
        max-width: 100%;
    }

    .attach-icon {
        width: 58px;
        height: 58px;
    }

    .attach-label { font-size: 12px; }

    .message-doc {
        min-width: 0;
        width: 100%;
    }

    .media-preview-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .doc-preview { max-width: 100%; }
}

/* ===== Video/Voice Call (ala WhatsApp) ===== */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.btn-call { color: var(--wa-header); }
.btn-call:hover { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════════════
   CALL — Modern video/voice overlay
   ═══════════════════════════════════════════════════════════ */

.call-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: #0a0f14;
    font-family: inherit;
}

body.call-active { overflow: hidden; }

.call-view {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 20%, rgba(37, 211, 102, .18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(0, 168, 132, .12) 0%, transparent 55%),
        linear-gradient(165deg, #0d3d36 0%, #128c7e 35%, #0a1a22 100%);
    opacity: 1;
}

.call-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 28px 24px;
    width: 100%;
    max-width: 400px;
}

.call-type-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.15);
    margin-bottom: 28px;
    backdrop-filter: blur(8px);
}

.call-type-badge[data-type="video"] {
    background: rgba(52, 152, 219, .2);
    border-color: rgba(52, 152, 219, .35);
}

.call-avatar-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-avatar-wrap .call-peer-avatar,
.call-avatar-wrap .call-voice-avatar {
    position: relative;
    z-index: 2;
    width: 120px !important;
    height: 120px !important;
    font-size: 48px;
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
    border: 3px solid rgba(255,255,255,.25);
}

.call-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, .45);
    animation: callRingPulse 2.4s ease-out infinite;
    pointer-events: none;
}

.call-ring-2 { animation-delay: .8s; }
.call-ring-3 { animation-delay: 1.6s; }

.call-avatar-wrap.is-pulsing .call-ring,
.call-incoming .call-ring {
    border-color: rgba(37, 211, 102, .5);
}

.call-avatar-wrap.is-connected .call-ring {
    border-color: rgba(37, 211, 102, .3);
    animation-duration: 3s;
}

@keyframes callRingPulse {
    0% { transform: scale(.85); opacity: .8; }
    100% { transform: scale(1.45); opacity: 0; }
}

.call-peer-name {
    color: #fff;
    font-size: clamp(22px, 5vw, 28px);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -.02em;
}

.call-status-text, .call-timer {
    color: rgba(255,255,255,.72);
    font-size: 15px;
    margin-bottom: 24px;
    font-variant-numeric: tabular-nums;
}

.call-wave-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    height: 32px;
    margin: 8px auto 32px;
}

.call-wave-bars span {
    display: block;
    width: 4px;
    border-radius: 4px;
    background: rgba(37, 211, 102, .7);
    animation: callWave 1.1s ease-in-out infinite;
}

.call-wave-bars span:nth-child(1) { height: 12px; animation-delay: 0s; }
.call-wave-bars span:nth-child(2) { height: 20px; animation-delay: .1s; }
.call-wave-bars span:nth-child(3) { height: 28px; animation-delay: .2s; }
.call-wave-bars span:nth-child(4) { height: 18px; animation-delay: .3s; }
.call-wave-bars span:nth-child(5) { height: 24px; animation-delay: .4s; }
.call-wave-bars span:nth-child(6) { height: 16px; animation-delay: .5s; }
.call-wave-bars span:nth-child(7) { height: 22px; animation-delay: .6s; }

.call-wave-bars.is-active span {
    background: linear-gradient(180deg, #25d366, #128c7e);
}

@keyframes callWave {
    0%, 100% { transform: scaleY(.4); opacity: .5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.call-actions {
    display: flex;
    justify-content: center;
    gap: 56px;
    margin-top: 16px;
}

.call-actions.incoming { gap: 72px; }

.call-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border: none;
    background: none;
    color: rgba(255,255,255,.9);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform .2s;
    -webkit-tap-highlight-color: transparent;
}

.call-action-btn:active { transform: scale(.94); }

.call-action-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.call-action-btn:hover .call-action-icon { transform: scale(1.06); }
.call-action-btn.accept .call-action-icon {
    background: linear-gradient(135deg, #25d366, #128c7e);
}
.call-action-btn.reject .call-action-icon {
    background: linear-gradient(135deg, #ff6b6b, #e74c3c);
}

/* ── Active call ── */
.call-active-view {
    flex-direction: column;
    background: #000;
}

.call-active-view[data-mode="voice"] {
    background:
        radial-gradient(ellipse 70% 50% at 50% 40%, rgba(18, 140, 126, .25) 0%, transparent 70%),
        #0a1218;
}

.call-remote-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a2a32;
    z-index: 0;
}

/* Video stage — responsive ala WhatsApp */
.call-video-stage {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #0a0f12;
    overflow: hidden;
}

.call-video-stage[hidden] { display: none !important; }

.call-video-main {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0f12;
    overflow: hidden;
}

.call-video-main .call-stream-vid {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    background: #0a0f12;
    transition: opacity .25s ease;
}

.call-video-pip {
    position: absolute;
    top: max(72px, calc(env(safe-area-inset-top, 0px) + 72px));
    right: max(16px, env(safe-area-inset-right, 16px));
    width: clamp(104px, 27vw, 148px);
    aspect-ratio: 3 / 4;
    border: 2.5px solid rgba(255, 255, 255, .92);
    border-radius: 16px;
    padding: 0;
    margin: 0;
    background: #152028;
    overflow: hidden;
    z-index: 3;
    cursor: pointer;
    box-shadow: 0 10px 36px rgba(0, 0, 0, .55);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1), box-shadow .28s ease, width .3s ease;
    -webkit-tap-highlight-color: transparent;
}

.call-video-pip:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, .65);
    transform: scale(1.02);
}

.call-video-pip:active { transform: scale(.96); }

.call-video-pip .call-stream-vid {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    pointer-events: none;
    background: #152028;
}

.call-video-pip.is-screen-share .call-stream-vid {
    object-fit: contain;
    background: #07100b;
}

.call-pip-tag {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    z-index: 2;
}

.call-pip-swap-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    pointer-events: none;
    z-index: 2;
}

.call-video-stage[data-layout="local-full"] .call-video-pip {
    animation: callPipPulse .4s ease;
}

@keyframes callPipPulse {
    0% { transform: scale(.92); opacity: .7; }
    100% { transform: scale(1); opacity: 1; }
}

.call-video-main .call-local-vid,
.call-video-pip .call-local-vid {
    transform: scaleX(-1);
}

.call-video-main {
    cursor: pointer;
}

.call-ctrl-btn:disabled {
    opacity: .45;
    pointer-events: none;
}

/* Legacy alias */
.call-local-video {
    position: absolute;
    top: max(16px, env(safe-area-inset-top, 16px));
    right: max(16px, env(safe-area-inset-right, 16px));
    width: clamp(90px, 22vw, 130px);
    height: clamp(120px, 30vw, 175px);
    object-fit: cover;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,.85);
    z-index: 3;
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    transition: opacity .2s, transform .2s;
}

.call-voice-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 24px;
}

.call-voice-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 211, 102, .15) 0%, transparent 70%);
    animation: callGlow 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes callGlow {
    0%, 100% { transform: scale(1); opacity: .6; }
    50% { transform: scale(1.15); opacity: 1; }
}

.call-voice-stage .call-voice-avatar {
    width: 140px !important;
    height: 140px !important;
    font-size: 56px;
}

.call-top-bar {
    position: absolute;
    top: max(20px, env(safe-area-inset-top, 20px));
    left: max(20px, env(safe-area-inset-left, 20px));
    right: max(20px, env(safe-area-inset-right, 20px));
    z-index: 4;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.call-active-info {
    text-align: left;
    min-width: 0;
}

.call-active-info .call-peer-name {
    font-size: clamp(18px, 4vw, 22px);
    margin-bottom: 4px;
    text-shadow: 0 2px 8px rgba(0,0,0,.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55vw;
}

.call-active-info .call-timer {
    margin-bottom: 0;
    font-size: 14px;
    color: rgba(255,255,255,.8);
}

.call-network {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}

.call-network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #25d366;
    box-shadow: 0 0 8px rgba(37, 211, 102, .6);
}

.call-network[data-state="connecting"] .call-network-dot {
    background: #f1c40f;
    box-shadow: 0 0 8px rgba(241, 196, 15, .6);
    animation: callNetBlink 1s ease infinite;
}

.call-network[data-state="weak"] .call-network-dot {
    background: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, .6);
}

@keyframes callNetBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.call-network-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.85);
    white-space: nowrap;
}

.call-audio-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.call-audio-hint-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 28px;
    background: rgba(37, 211, 102, .92);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(37, 211, 102, .35);
    transition: transform .15s, background .15s;
    white-space: nowrap;
}

.call-audio-hint-btn:hover { background: #20bd5a; transform: scale(1.03); }
.call-audio-hint-btn:active { transform: scale(.97); }

.call-mute-banner {
    position: absolute;
    top: max(72px, calc(env(safe-area-inset-top, 0px) + 72px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 24px;
    background: rgba(231, 76, 60, .88);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(231, 76, 60, .35);
    animation: callMuteBannerIn .25s ease;
    white-space: nowrap;
}

@keyframes callMuteBannerIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.call-controls-bar {
    position: absolute;
    bottom: max(28px, env(safe-area-inset-bottom, 28px));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: clamp(8px, 2.5vw, 18px);
    z-index: 4;
    padding: 12px clamp(14px, 4vw, 24px);
    max-width: min(96vw, 440px);
    width: calc(100% - 32px);
    justify-content: space-around;
    background: rgba(15, 20, 28, .72);
    border-radius: 48px;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
}

.call-ctrl-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 56px;
    padding: 0;
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
    transition: transform .15s;
    -webkit-tap-highlight-color: transparent;
}

.call-ctrl-btn:active { transform: scale(.92); }

.call-ctrl-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.14);
    transition: background .2s, box-shadow .2s, transform .2s;
}

.call-ctrl-btn:hover .call-ctrl-icon {
    background: rgba(255,255,255,.22);
    transform: scale(1.05);
}

.call-ctrl-btn.is-muted .call-ctrl-icon,
.call-ctrl-btn.is-off .call-ctrl-icon {
    background: rgba(231, 76, 60, .85);
    box-shadow: 0 4px 16px rgba(231, 76, 60, .4);
}

.call-ctrl-btn.is-sharing .call-ctrl-icon {
    background: #168747;
    box-shadow: 0 0 0 3px rgba(55, 220, 125, .18), 0 6px 18px rgba(22, 135, 71, .4);
}

.call-ctrl-btn.is-sharing .call-ctrl-label { color: #9ff5bd; }

.call-ctrl-btn.end .call-ctrl-icon {
    background: linear-gradient(135deg, #ff6b6b, #e74c3c);
    box-shadow: 0 6px 20px rgba(231, 76, 60, .4);
}

.call-ctrl-btn.end:hover .call-ctrl-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.call-ctrl-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.75);
    letter-spacing: .02em;
}

.call-ctrl-btn.is-muted .call-ctrl-label { color: #ff8a80; }

#callRemoteAudio {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 720px) {
    .call-avatar-wrap { width: 120px; height: 120px; }
    .call-avatar-wrap .call-peer-avatar,
    .call-avatar-wrap .call-voice-avatar {
        width: 100px !important;
        height: 100px !important;
        font-size: 40px;
    }
    .call-actions { gap: 48px; }
    .call-actions.incoming { gap: 56px; }
    .call-action-icon { width: 60px; height: 60px; }
    .call-controls-bar {
        gap: clamp(4px, 1.5vw, 8px);
        padding: 10px clamp(8px, 2vw, 14px);
        bottom: max(20px, env(safe-area-inset-bottom, 20px));
        width: calc(100% - 24px);
        max-width: 560px;
        justify-content: space-around;
    }
    .call-ctrl-icon { width: 44px; height: 44px; }
    .call-ctrl-btn { min-width: 44px; }
    .call-ctrl-label { font-size: 9px; }
    .call-mute-banner { font-size: 12px; padding: 8px 14px; }
}

@media (max-width: 380px) {
    .call-ctrl-label { display: none; }
    .call-controls-bar { border-radius: 40px; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE POLISH — Chat + Call (semua perangkat)
   ═══════════════════════════════════════════════════════════ */

/* Animasi masuk/keluar chat (mobile) */
@keyframes chatSlideIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes chatSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(18px); }
}

.chat-view-enter {
    animation: chatSlideIn .32s cubic-bezier(.22, 1, .36, 1) both;
}

.chat-view-exit {
    animation: chatSlideOut .26s cubic-bezier(.4, 0, .2, 1) both;
}

/* Animasi overlay panggilan */
@keyframes callOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes callOverlayOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes callViewIn {
    from { opacity: 0; transform: scale(.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.call-overlay.call-enter {
    animation: callOverlayIn .35s cubic-bezier(.22, 1, .36, 1) both;
}

.call-overlay.call-exit {
    animation: callOverlayOut .28s ease-in both;
    pointer-events: none;
}

.call-view.call-view-enter {
    animation: callViewIn .4s cubic-bezier(.22, 1, .36, 1) both;
}

.call-overlay .call-bg {
    animation: callBgShift 8s ease-in-out infinite alternate;
}

@keyframes callBgShift {
    0%   { filter: hue-rotate(0deg) brightness(1); }
    100% { filter: hue-rotate(8deg) brightness(1.05); }
}

/* Tablet: sidebar lebih ramping */
@media (min-width: 721px) and (max-width: 1024px) {
    .sidebar {
        width: 300px;
        min-width: 260px;
    }

    .chat-body {
        padding: 12px 4%;
    }

    .message { max-width: 78%; }
}

/* Mobile: transisi panel + safe area penuh */
@media (max-width: 720px) {
    body {
        background: var(--bg-body);
    }

    .app {
        max-width: none;
        box-shadow: none;
        height: 100dvh;
    }

    .sidebar,
    .chat-panel {
        transition: opacity .28s ease, transform .32s cubic-bezier(.22, 1, .36, 1);
    }

    .app.chat-open .sidebar {
        display: none;
        opacity: 0;
        transform: translateX(-12px);
    }

    .app.chat-open .chat-panel {
        display: flex;
        animation: chatSlideIn .32s cubic-bezier(.22, 1, .36, 1) both;
    }

    .chat-panel {
        width: 100%;
    }

    .chat-header {
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
    }

    .chat-body {
        padding: 10px 10px 6px;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .chat-footer {
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    }

    #messageInput {
        font-size: 16px; /* cegah zoom iOS */
        min-height: 44px;
    }

    .btn-send,
    #chatForm .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .chat-placeholder {
        padding: 20px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    }

    .placeholder-icon {
        font-size: clamp(48px, 14vw, 64px);
        animation: placeholderFloat 3s ease-in-out infinite;
    }

    .chat-placeholder h2 {
        font-size: clamp(22px, 6vw, 30px);
    }

    .contact {
        padding: 12px 14px;
        min-height: 72px;
    }

    .contact:active {
        background: var(--bg-hover);
        transform: scale(.99);
        transition: transform .12s ease, background .12s ease;
    }

    .attach-sheet {
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .chat-header-actions .btn-call {
        min-width: 44px;
        min-height: 44px;
    }
}

@keyframes placeholderFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Panggilan: landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .call-content {
        max-width: 520px;
        padding: 16px 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .call-avatar-wrap {
        width: 100px;
        height: 100px;
        margin-bottom: 12px;
    }

    .call-avatar-wrap .call-peer-avatar,
    .call-avatar-wrap .call-voice-avatar {
        width: 84px !important;
        height: 84px !important;
        font-size: 34px;
    }

    .call-peer-name { margin-bottom: 4px; }
    .call-status-text, .call-timer { margin-bottom: 12px; }

    .call-wave-bars {
        height: 24px;
        margin: 4px auto 16px;
    }

    .call-actions { margin-top: 8px; }

    .call-active-view[data-mode="voice"] .call-voice-stage {
        padding: 12px;
    }

    .call-voice-stage .call-voice-avatar {
        width: 100px !important;
        height: 100px !important;
        font-size: 40px;
    }

    .call-video-pip {
        width: clamp(88px, 24vw, 120px);
        top: max(64px, calc(env(safe-area-inset-top, 0px) + 64px));
        right: max(12px, env(safe-area-inset-right, 12px));
        border-radius: 14px;
    }

    .call-top-bar {
        top: max(12px, env(safe-area-inset-top, 12px));
        left: max(12px, env(safe-area-inset-left, 12px));
        right: max(12px, env(safe-area-inset-right, 12px));
    }

    .call-controls-bar {
        bottom: max(12px, env(safe-area-inset-bottom, 12px));
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .call-video-pip {
        width: clamp(88px, 18vh, 120px);
        top: max(56px, calc(env(safe-area-inset-top, 0px) + 56px));
    }

    .call-controls-bar {
        bottom: max(12px, env(safe-area-inset-bottom, 12px));
        padding: 8px 12px;
    }

    .call-ctrl-label { display: none; }
}

/* Panggilan: notch / dynamic island */
.call-overlay {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

.call-action-btn span:last-child {
    font-size: clamp(11px, 2.8vw, 13px);
}

.call-action-icon {
    transition: transform .25s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease;
}

.call-action-btn.accept .call-action-icon {
    box-shadow: 0 8px 28px rgba(37, 211, 102, .4);
}

.call-action-btn.reject .call-action-icon {
    box-shadow: 0 8px 28px rgba(231, 76, 60, .35);
}

.call-action-btn:hover .call-action-icon {
    transform: scale(1.08);
}

.call-controls-bar {
    transition: transform .3s cubic-bezier(.22, 1, .36, 1), opacity .3s ease;
}

.call-active-view .call-controls-bar {
    animation: callControlsUp .45s cubic-bezier(.22, 1, .36, 1) .15s both;
}

@keyframes callControlsUp {
    from { opacity: 0; transform: translateX(-50%) translateY(24px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Desktop lebar: chat centering */
@media (min-width: 1025px) {
    .chat-body {
        padding: 16px 8%;
    }

    .message { max-width: 65%; }

    .chat-placeholder {
        background:
            radial-gradient(ellipse 60% 50% at 50% 40%, rgba(0, 128, 105, .06) 0%, transparent 70%),
            var(--wa-panel);
    }
}

/* Kurangi animasi jika user prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chat-view-enter,
    .chat-view-exit,
    .call-overlay.call-enter,
    .call-overlay.call-exit,
    .call-view.call-view-enter,
    .call-active-view .call-controls-bar,
    .call-overlay .call-bg,
    .placeholder-icon,
    .message {
        animation: none !important;
        transition: none !important;
    }

    .contact:active { transform: none; }
}
