/* ================================================
   FACADE v2 — lightweight, real UI
   ================================================ */

#facade {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    background: linear-gradient(-45deg, #0d0221, #1a0533, #0a1628, #160a2e);
    background-size: 400% 400%;
    animation: bgFlow 10s ease infinite;
}

@keyframes bgFlow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* subtle noise overlay */
#facade::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ── Ticker ── */
.facade-ticker-bar {
    position: relative;
    z-index: 10;
    height: 32px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    display: flex;
    align-items: center;
}

#facade-ticker {
    display: flex;
    white-space: nowrap;
    will-change: transform;
}

.tick-item {
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    color: rgba(255,255,255,0.65);
    padding: 0 28px;
    border-right: 1px solid rgba(255,255,255,0.07);
    letter-spacing: 0.2px;
}

/* ── Stories ── */
.facade-stories {
    position: relative;
    z-index: 10;
    background: rgba(8,4,18,0.65);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 10px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    display: flex;
    align-items: center;
}
.facade-stories::-webkit-scrollbar { display: none; }

#stories-bar {
    display: flex;
    gap: 14px;
    align-items: center;
}

.st-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.st-ring {
    width: 54px; height: 54px;
    border-radius: 50%;
    padding: 2.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.st-bubble.seen .st-ring { background: rgba(255,255,255,0.12) !important; }

.st-av {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 2.5px solid #0d0221;
}

.st-name {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-weight: 500;
    max-width: 54px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-align: center;
}

/* legacy sizes (kept for any remaining refs) */
.phone-lg  { width: 300px; }
.phone-sm  { width: 200px; }
.phone-tilt-left  { transform: rotateY(10deg) rotateZ(-3deg); }
.phone-tilt-right { transform: rotateY(-10deg) rotateZ(3deg); }

.phone-notch {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 96px; height: 26px;
    background: #1c1c1e;
    border-radius: 0 0 18px 18px;
    z-index: 10;
}

.phone-status {
    background: #000;
    color: rgba(255,255,255,0.9);
    font-size: 10px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px 3px;
    position: relative;
    z-index: 5;
    letter-spacing: 0.1px;
}

.phone-screen {
    height: 510px;
    overflow: hidden;
    position: relative;
}

.phone-screen-lg { height: 580px; }
.phone-screen-sm { height: 360px; }

/* ─────────────────────────────────
   iMESSAGE — pixel-perfect iOS 17
   ───────────────────────────────── */

.imessage-screen {
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
}

/* contact header */
.imsg-header {
    background: rgba(28,28,30,0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-bottom: 0.5px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.imsg-av-wrap {
    position: relative;
    width: 48px; height: 48px;
}

.imsg-av {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #30c060, #1a9940);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    font-family: -apple-system, sans-serif;
}

.imsg-online-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 12px; height: 12px;
    background: #30d158;
    border-radius: 50%;
    border: 2px solid #1c1c1e;
}

.imsg-contact-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.2px;
}

.imsg-contact-sub {
    font-size: 10px;
    color: #8e8e93;
}

.imsg-actions-row {
    display: flex;
    gap: 24px;
    margin-top: 4px;
}
.imsg-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.imsg-action-icon {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.imsg-action-label {
    font-size: 9px;
    color: #8e8e93;
}

/* messages feed */
#imessage-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: none;
    background: #000;
}
#imessage-feed::-webkit-scrollbar { display: none; }

.imsg-time-label {
    text-align: center;
    font-size: 10px;
    color: #636366;
    margin: 6px 0;
    font-weight: 500;
}

.imsg-row {
    display: flex;
    flex-direction: column;
    max-width: 78%;
}
.imsg-row.row-them { align-self: flex-start; }
.imsg-row.row-me   { align-self: flex-end; }

.imsg-bubble {
    padding: 7px 13px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
}

.imsg-row.row-them .imsg-bubble {
    background: #1c1c1e;
    color: #fff;
    border-bottom-left-radius: 4px;
}
.imsg-row.row-me .imsg-bubble {
    background: #0a84ff;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* tail */
.imsg-row.row-them .imsg-bubble::before {
    display: none;
}

/* delivered / read */
.imsg-delivered {
    font-size: 10px;
    color: #636366;
    text-align: right;
    margin-top: 1px;
    padding-right: 2px;
}

/* typing */
.imsg-typing-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    align-self: flex-start;
}
.imsg-typing-av {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #30c060, #1a9940);
    flex-shrink: 0;
}
.imsg-typing-bubble {
    background: #1c1c1e;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 9px 14px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.imsg-typing-bubble span {
    width: 6px; height: 6px;
    background: #636366;
    border-radius: 50%;
    animation: typDot 1.2s ease-in-out infinite;
}
.imsg-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.imsg-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typDot {
    0%,60%,100% { transform: translateY(0); opacity:0.4; }
    30%          { transform: translateY(-4px); opacity:1; }
}

/* input bar */
.imsg-input-bar {
    background: rgba(28,28,30,0.95);
    backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(255,255,255,0.1);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.imsg-input-field {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 0.5px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 7px 12px;
    font-size: 14px;
    font-family: -apple-system, sans-serif;
    color: #636366;
}

.imsg-send {
    width: 30px; height: 30px;
    background: #0a84ff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

/* ─────────────────────────────────
   TIKTOK — pixel-perfect
   ───────────────────────────────── */

.tiktok-screen {
    height: 100%;
    background: #000;
    position: relative;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

/* TikTok top bar */
.tt-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px 4px;
    gap: 20px;
}

.tt-tab {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}
.tt-tab.active {
    color: #fff;
    font-weight: 700;
    border-bottom: 2px solid #fff;
    padding-bottom: 2px;
}
.tt-search-icon { position: absolute; right: 14px; top: 10px; font-size: 18px; }

/* video area */
.tt-video-area {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.tt-clip {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.tt-clip-bg {
    position: absolute;
    inset: 0;
    transition: background 0.5s ease;
}

.tt-clip-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.tt-clip-emoji {
    font-size: 72px;
    display: block;
    margin-bottom: 8px;
    animation: clipEmoji 2s ease-in-out infinite;
}
@keyframes clipEmoji {
    0%,100% { transform: scale(1) rotate(-2deg); }
    50% { transform: scale(1.08) rotate(2deg); }
}

.tt-clip-overlay-text {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* progress bar */
.tt-progress-bar {
    position: absolute;
    bottom: 55px; left: 0; right: 0;
    height: 2px;
    background: rgba(255,255,255,0.2);
    z-index: 20;
}
.tt-progress-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: none;
}

/* right sidebar */
.tt-sidebar {
    position: absolute;
    right: 8px;
    bottom: 70px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.tt-sidebar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tt-sidebar-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    line-height: 1;
}

.tt-sidebar-count {
    font-size: 10px;
    color: rgba(255,255,255,0.9);
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.tt-disc-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg,#333,#111);
    border: 3px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    animation: discSpin 4s linear infinite;
}
@keyframes discSpin { to { transform: rotate(360deg); } }

/* bottom info */
.tt-bottom-info {
    position: absolute;
    bottom: 60px;
    left: 10px;
    right: 56px;
    z-index: 20;
}

.tt-username {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.tt-caption {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tt-song-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    overflow: hidden;
    white-space: nowrap;
}

.tt-song-text {
    animation: songSlide 8s linear infinite;
    display: inline-block;
}
@keyframes songSlide {
    0%,15% { transform: translateX(0); }
    85%,100% { transform: translateX(-40%); }
}

.tt-note-bounce {
    animation: noteBounce 0.5s ease-in-out infinite alternate;
    flex-shrink: 0;
}
@keyframes noteBounce { from { transform: translateY(0); } to { transform: translateY(-3px); } }

/* TikTok bottom nav */
.tt-bottom-nav {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 52px;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    border-top: 0.5px solid rgba(255,255,255,0.08);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
}

.tt-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.tt-nav-icon { font-size: 20px; }
.tt-nav-label {
    font-size: 9px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}
.tt-nav-item.active .tt-nav-label { color: #fff; font-weight: 700; }

.tt-plus-btn {
    background: linear-gradient(90deg, #69c9d0 0%, #fff 40%, #ee1d52 60%, #ee1d52 100%);
    padding: 2px;
    border-radius: 8px;
    display: flex;
}
.tt-plus-inner {
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 900;
    color: #000;
    padding: 2px 10px;
}

/* ─────────────────────────────────
   INSTAGRAM phone (right)
   ───────────────────────────────── */

.instagram-screen {
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

.ig-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 0.5px solid #dbdbdb;
    flex-shrink: 0;
}

.ig-logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    font-style: italic;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.ig-topbar-icons { display: flex; gap: 14px; font-size: 20px; color: #1a1a1a; }

.ig-post-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
}

.ig-av {
    width: 32px; height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ig-av-ring {
    padding: 2px;
    border-radius: 50%;
}

.ig-meta-user { font-size: 12px; font-weight: 700; color: #1a1a1a; }
.ig-meta-loc  { font-size: 10px; color: #8e8e93; margin-top: 1px; }
.ig-more { margin-left: auto; font-size: 16px; color: #1a1a1a; letter-spacing: 1px; }

.ig-img-area {
    width: 100%;
    aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.ig-post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ig-actions-bar {
    padding: 8px 10px 4px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.ig-action-ico { font-size: 22px; color: #1a1a1a; cursor: default; }

.ig-likes {
    padding: 0 10px 3px;
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
}

.ig-caption-text {
    padding: 0 10px 3px;
    font-size: 12px;
    color: #1a1a1a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-timestamp {
    padding: 0 10px 8px;
    font-size: 9px;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Instagram feed card in facade ── */
.facade-ig-feed {
    display: flex;
    justify-content: center;
    padding: 24px 16px 40px;
    position: relative;
    z-index: 5;
}

.facade-ig-card {
    background: #fff;
    border-radius: 14px;
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}

#ig-post-area {
    display: flex;
    flex-direction: column;
}

/* ── iOS 18 notification banners ── */
#facade-notifs {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 360px;
    max-width: calc(100vw - 24px);
    pointer-events: none;
}

.ios-notif {
    will-change: transform, opacity;
}

.ios-notif-inner {
    background: rgba(30, 30, 32, 0.82);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.45),
        0 2px 8px rgba(0,0,0,0.3),
        inset 0 0 0 0.5px rgba(255,255,255,0.12);
    color: #fff;
}

.ios-notif-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.3px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ios-notif-content {
    flex: 1;
    min-width: 0;
}

.ios-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1px;
}

.ios-notif-app-name {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ios-notif-time {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.ios-notif-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.1px;
}

.ios-notif-body {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.72);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    letter-spacing: -0.1px;
}


/* ── Flying chaos texts ── */
.chaos-flying-text {
    position: absolute;
    pointer-events: none;
    z-index: 30;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    color: hsl(var(--hue, 200), 100%, 70%);
    text-shadow: 0 0 12px hsl(var(--hue, 200), 100%, 60%),
                 0 0 24px hsl(var(--hue, 200), 100%, 40%);
    will-change: transform, opacity;
}


/* ── Chaos scanlines overlay ── */
#facade::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
    z-index: 2;
    animation: scanMove 8s linear infinite;
}
@keyframes scanMove {
    from { background-position: 0 0; }
    to   { background-position: 0 100px; }
}

/* ── Section color flash ── */
#facade.chaos-flash {
    animation: bgFlow 10s ease infinite, chaosFlash 0.08s ease forwards;
}
@keyframes chaosFlash {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(1.4) saturate(1.6); }
    100% { filter: brightness(1); }
}

/* ── Big chaos flying text ── */
.chaos-flying-text {
    font-size: clamp(11px, 1.4vw, 18px);
    padding: 3px 8px;
    background: rgba(0,0,0,0.35);
    border-radius: 6px;
}

/* ════════════════════════════════════════
   CHAOS OVERRIDES — max visual intensity
   ════════════════════════════════════════ */

/* Faster, more saturated bg */
#facade {
    background: linear-gradient(-45deg, #0d0221, #1a0533, #080c28, #1d0a30, #0a1620) !important;
    background-size: 600% 600% !important;
    animation: bgFlow 6s ease infinite !important;
}

/* Notification stack — show more at once */
#facade-notifs {
    max-height: 80vh !important;
}

/* Flying text bigger */
.chaos-flying-text {
    font-size: clamp(12px, 1.6vw, 20px) !important;
    font-weight: 900 !important;
    text-shadow:
        0 0 8px  hsl(var(--hue, 200), 100%, 70%),
        0 0 20px hsl(var(--hue, 200), 100%, 50%),
        0 0 40px hsl(var(--hue, 200), 100%, 30%) !important;
}

