/* =========================================================
   Zoe · Zangari — design system v2
   ========================================================= */

:root {
    /* Brand */
    --brand-50:  #fff1f2;
    --brand-100: #ffe4e6;
    --brand-300: #fda4af;
    --brand-500: #e11d48;
    --brand-600: #c01138;
    --brand-700: #9f0d2e;
    --brand-900: #5b0418;

    /* Neutrals (warm) */
    --ink-900: #0c0a09;
    --ink-700: #292524;
    --ink-500: #57534e;
    --ink-400: #78716c;
    --ink-300: #a8a29e;
    --ink-200: #d6d3d1;
    --ink-100: #e7e5e4;
    --ink-50:  #f5f5f4;
    --ink-25:  #fafaf9;
    --paper:   #ffffff;

    /* Semantic */
    --bg: var(--ink-25);
    --text: var(--ink-900);
    --muted: var(--ink-400);
    --border: rgba(12, 10, 9, 0.08);
    --border-strong: rgba(12, 10, 9, 0.14);

    /* Bubbles */
    --bubble-bot-bg: rgba(255, 255, 255, 0.92);
    --bubble-bot-border: rgba(12, 10, 9, 0.06);
    --bubble-bot-text: var(--ink-900);

    /* Type */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Plus Jakarta Sans", var(--font-sans);

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(12,10,9,.04), 0 1px 1px rgba(12,10,9,.02);
    --shadow-md: 0 6px 16px -4px rgba(12,10,9,.10), 0 2px 6px -2px rgba(12,10,9,.06);
    --shadow-lg: 0 24px 48px -16px rgba(12,10,9,.18), 0 8px 16px -8px rgba(12,10,9,.10);
    --shadow-glow: 0 0 0 6px rgba(225, 29, 72, 0.10);

    /* Motion */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    /* Geometry */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

body {
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(225, 29, 72, 0.06), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(225, 29, 72, 0.04), transparent 60%),
        var(--bg);
}

/* ---------- Aurora background -------------------------------- */
.aurora {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.aurora__blob {
    position: absolute;
    width: 50vmax;
    height: 50vmax;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .35;
    will-change: transform;
}
.aurora__blob--1 { background: radial-gradient(circle, var(--brand-500), transparent 70%); top: -20vmax; left: -10vmax; animation: drift1 24s ease-in-out infinite alternate; }
.aurora__blob--2 { background: radial-gradient(circle, #fb7185, transparent 70%); bottom: -25vmax; right: -15vmax; animation: drift2 30s ease-in-out infinite alternate; opacity: .25; }
.aurora__blob--3 { background: radial-gradient(circle, #fda4af, transparent 70%); top: 40%; left: 60%; animation: drift3 28s ease-in-out infinite alternate; opacity: .18; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.05); } }
@keyframes drift2 { to { transform: translate(-6vmax, -8vmax) scale(0.95); } }
@keyframes drift3 { to { transform: translate(-10vmax, 5vmax) scale(1.1); } }

@media (prefers-reduced-motion: reduce) {
    .aurora__blob { animation: none; }
}

/* ---------- App shell ---------------------------------------- */
.app {
    position: relative;
    z-index: 1;
    width: min(1280px, calc(100vw - 32px));
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    margin: 16px auto;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(140%) blur(18px);
    -webkit-backdrop-filter: saturate(140%) blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* ---------- Topbar ------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.65), rgba(255,255,255,.30));
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.brand__avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: visible;
    flex-shrink: 0;
}
.brand__avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--paper), 0 6px 14px -4px rgba(225,29,72,.30);
}
.brand__status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--paper);
    box-shadow: 0 0 0 0 rgba(34,197,94,.6);
    animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.brand__text { min-width: 0; }
.brand__text h1 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--ink-900);
}
.brand__text p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--ink-400);
    font-weight: 500;
    letter-spacing: 0.01em;
}
.topbar__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,.7);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--ink-500);
    font-weight: 500;
}
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-300);
}
.dot--idle { background: var(--ink-300); }
.dot--active { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,.5); }
.dot--working { background: var(--brand-500); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .55; transform: scale(.85); }
}
@media (max-width: 600px) {
    .topbar__metaText { display: none; }
    .topbar__meta { padding: 6px; }
}

/* ---------- Stage / Screens ---------------------------------- */
.stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }
.hidden:not(.screen) { display: none !important; }

/* ---------- Form screen -------------------------------------- */
.screen--form,
.screen--blocked {
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}
.hero {
    text-align: center;
    max-width: 460px;
    margin-bottom: 32px;
    animation: rise .7s var(--ease-out) both;
}
.hero__avatar {
    width: 112px;
    height: 112px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--paper);
    box-shadow:
        0 0 0 4px rgba(255,255,255,.7),
        0 24px 48px -12px rgba(225,29,72,.35),
        0 12px 24px -8px rgba(12,10,9,.2);
    overflow: hidden;
    transform: translateZ(0);
}
.hero__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hero__title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 10px;
    background: linear-gradient(180deg, var(--ink-900) 30%, var(--ink-700) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero__sub {
    margin: 0;
    color: var(--ink-500);
    font-size: 15.5px;
    line-height: 1.55;
}
.form {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: rise .8s .1s var(--ease-out) both;
}

/* Floating-label fields */
.field {
    position: relative;
    display: block;
}
.field input {
    width: 100%;
    height: 56px;
    padding: 22px 16px 8px;
    font: inherit;
    font-size: 15.5px;
    font-weight: 500;
    color: var(--ink-900);
    background: var(--paper);
    border: 1.5px solid var(--ink-100);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.field__label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-400);
    font-size: 15px;
    font-weight: 500;
    pointer-events: none;
    transition: top .18s var(--ease), font-size .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.field input:focus {
    border-color: var(--brand-500);
    background: var(--paper);
    box-shadow: var(--shadow-glow);
}
.field input:focus + .field__label,
.field input:not(:placeholder-shown) + .field__label {
    top: 12px;
    transform: translateY(0);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--brand-600);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.005em;
    cursor: pointer;
    transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), opacity .2s var(--ease);
}
.btn--primary {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    color: white;
    box-shadow: 0 8px 18px -6px rgba(225,29,72,.55), inset 0 1px 0 rgba(255,255,255,.18);
    margin-top: 6px;
}
.btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -6px rgba(225,29,72,.55), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn--primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 10px -4px rgba(225,29,72,.5), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn:disabled { opacity: .55; cursor: wait; }

/* ---------- Loading screen ----------------------------------- */
.screen--loading {
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}
.loader {
    position: relative;
    width: 132px;
    height: 132px;
    margin-bottom: 24px;
}
.loader__avatar {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paper);
    box-shadow: var(--shadow-md);
}
.loader__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.loader__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--brand-500);
    opacity: .4;
    animation: loader-pulse 1.6s var(--ease-out) infinite;
}
.loader__pulse::before,
.loader__pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--brand-500);
    opacity: 0;
    animation: loader-pulse 1.6s var(--ease-out) infinite;
}
.loader__pulse::before { animation-delay: .35s; }
.loader__pulse::after { animation-delay: .7s; }
@keyframes loader-pulse {
    0% { transform: scale(.95); opacity: .55; }
    80% { transform: scale(1.18); opacity: 0; }
    100% { transform: scale(1.18); opacity: 0; }
}
.loader__title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink-900);
    margin: 0 0 8px;
}
.loader__status {
    margin: 0;
    color: var(--ink-500);
    font-size: 14px;
    font-weight: 500;
}

/* ---------- Chat screen -------------------------------------- */
.screen--chat {
    background: linear-gradient(180deg, transparent, rgba(245,245,244,.4));
}
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-200) transparent;
}
.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--ink-200); border: 3px solid transparent; background-clip: padding-box; border-radius: 10px; }
.messages::-webkit-scrollbar-thumb:hover { background: var(--ink-300); background-clip: padding-box; border: 3px solid transparent; }

.bubble {
    position: relative;
    max-width: min(640px, 72%);
    padding: 11px 16px;
    border-radius: var(--radius-lg);
    line-height: 1.45;
    font-size: 14.5px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    animation: bubble-in .35s var(--ease-out) both;
}
@keyframes bubble-in {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble.in {
    align-self: flex-start;
    background: var(--bubble-bot-bg);
    color: var(--bubble-bot-text);
    border: 1px solid var(--bubble-bot-border);
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
}
.bubble.out {
    align-self: flex-end;
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px -4px rgba(225,29,72,.45), inset 0 1px 0 rgba(255,255,255,.18);
}
.bubble.out .ts { color: rgba(255,255,255,.78); }

.bubble .author {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-600);
    margin-bottom: 4px;
}
.bubble .ts {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--ink-400);
    margin-top: 4px;
    text-align: right;
    letter-spacing: 0.02em;
}

.bubble a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.bubble.in a { color: var(--brand-600); }
.bubble.out a { font-weight: 600; }

/* Group bubbles tightly */
.bubble + .bubble.in { margin-top: 2px; }
.bubble.in + .bubble.out,
.bubble.out + .bubble.in { margin-top: 8px; }

/* Media bubbles --------------------------------------------- */
.bubble--media {
    padding: 6px;
    overflow: hidden;
}
.bubble--media .bubble__media {
    display: block;
    max-width: 100%;
    max-height: 360px;
    width: auto;
    height: auto;
    border-radius: calc(var(--radius-lg) - 8px);
    cursor: zoom-in;
    background: var(--ink-50);
}
.bubble--media .ts {
    margin: 6px 8px 4px;
}

.bubble--file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
}
.bubble--file:hover { filter: brightness(.97); }
.bubble--file__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(225, 29, 72, 0.10);
    color: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bubble.out .bubble--file__icon {
    background: rgba(255,255,255,0.18);
    color: white;
}
.bubble--file__icon svg { width: 22px; height: 22px; }
.bubble--file__meta { flex: 1; min-width: 0; }
.bubble--file__name {
    font-weight: 600;
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bubble--file__hint {
    font-size: 11px;
    opacity: .7;
    margin-top: 2px;
}

.bubble.bubble--audio,
.bubble.bubble--media,
.bubble.bubble--file {
    white-space: normal;  /* avoid \n in template strings rendering as blank lines */
}
.bubble.bubble--audio {
    padding: 8px 10px 6px;
    width: 320px;
    max-width: min(320px, 80%);
    box-sizing: border-box;
}
.bubble--audio audio { display: none; }
.bubble--audio .ts { margin: 4px 8px 0; }
.bubble--audio .audio-player { width: 100%; min-width: 0; }
.bubble--audio .audio-player__main { min-width: 0; }

.audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
}
.audio-player__play {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    background: var(--brand-600);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .12s var(--ease), background .15s var(--ease);
    box-shadow: 0 4px 10px -4px rgba(225, 29, 72, .45);
}
.audio-player__play:hover { background: var(--brand-700); }
.audio-player__play:active { transform: scale(.92); }
.bubble.out .audio-player__play {
    background: rgba(255, 255, 255, 0.22);
    color: white;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.bubble.out .audio-player__play:hover { background: rgba(255, 255, 255, 0.32); }

.audio-player__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.audio-player__bar-wrap {
    position: relative;
    height: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.audio-player__bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    overflow: hidden;
    pointer-events: none;
}
.audio-player__bar-fill {
    height: 100%;
    width: 0%;
    background: var(--brand-600);
    border-radius: 999px;
    transition: width .08s linear;
}
.audio-player__bar-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--brand-600);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    pointer-events: none;
    left: 0;
    opacity: 0;
    transition: opacity .15s var(--ease);
}
.audio-player__bar-wrap:hover .audio-player__bar-thumb { opacity: 1; }
.bubble.out .audio-player__bar { background: rgba(255, 255, 255, 0.30); }
.bubble.out .audio-player__bar-fill { background: white; }
.bubble.out .audio-player__bar-thumb { background: white; }

.audio-player__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-400);
    font-weight: 500;
}
.bubble.out .audio-player__meta { color: rgba(255,255,255,.78); }
.audio-player__time { letter-spacing: .02em; }
.audio-player__speed {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    border: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font: inherit;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: background .15s var(--ease);
}
.audio-player__speed:hover { background: rgba(0, 0, 0, 0.14); }
.bubble.out .audio-player__speed { background: rgba(255, 255, 255, 0.22); }
.bubble.out .audio-player__speed:hover { background: rgba(255, 255, 255, 0.32); }

/* Lightbox -------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 9, .85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(6px);
    animation: fadein .2s var(--ease);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    cursor: zoom-out;
}

.bubble.system {
    align-self: center;
    background: rgba(254, 243, 199, 0.85);
    color: #78350f;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(120, 53, 15, .12);
    box-shadow: var(--shadow-sm);
}

/* ---------- Typing indicator --------------------------------- */
.typing {
    align-self: flex-start;
    margin: 0 28px 6px;
    background: var(--bubble-bot-bg);
    border: 1px solid var(--bubble-bot-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
    width: fit-content;
    display: flex;
    gap: 4px;
    align-items: center;
    animation: bubble-in .25s var(--ease-out);
}
.typing span {
    width: 7px;
    height: 7px;
    background: var(--ink-300);
    border-radius: 50%;
    animation: typing-bounce 1.3s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Upload preview chip ------------------------------ */
.upload-preview {
    margin: 0 20px;
    padding: 10px 14px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    animation: rise .25s var(--ease-out);
}
.upload-preview__thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--ink-50);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-600);
}
.upload-preview__thumb svg { width: 22px; height: 22px; }
.upload-preview__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.upload-preview__name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-preview__size {
    font-size: 11.5px;
    color: var(--ink-400);
    font-weight: 500;
}
.upload-preview__remove {
    background: transparent;
    border: 0;
    color: var(--ink-400);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.upload-preview__remove:hover { background: var(--ink-50); color: var(--ink-700); }

/* ---------- Composer ----------------------------------------- */
.composer {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 14px 20px 18px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,.7) 30%);
    flex-shrink: 0;
}
#msg-input {
    flex: 1;
    font: inherit;
    font-size: 15px;
    line-height: 1.45;
    padding: 14px 18px;
    color: var(--ink-900);
    background: var(--paper);
    border: 1.5px solid var(--ink-100);
    border-radius: 22px;
    resize: none;
    max-height: 140px;
    overflow-y: auto;
    outline: none;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
    box-shadow: var(--shadow-sm);
}
#msg-input:focus {
    border-color: var(--brand-500);
    box-shadow: var(--shadow-glow), var(--shadow-sm);
}
#msg-input::placeholder { color: var(--ink-400); }

.composer__attach,
.composer__mic {
    width: 42px;
    height: 42px;
    background: transparent;
    color: var(--ink-400);
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .18s var(--ease), color .18s var(--ease), transform .15s var(--ease), opacity .25s var(--ease);
}
.composer__attach:hover,
.composer__mic:hover {
    background: var(--brand-50);
    color: var(--brand-600);
}
.composer__attach:active,
.composer__mic:active {
    transform: scale(.92);
}
.composer__attach.hidden,
.composer__mic.hidden {
    width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    border: 0;
}

/* Composer input wrapper (so we can swap with the recording bar) */
.composer__input {
    flex: 1;
    min-width: 0;
    display: flex;
}
.composer__input.hidden {
    display: none;
}

/* Recording bar (shown while MediaRecorder is active) */
.recording-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(180deg, var(--brand-50), #fff5f5);
    border: 1.5px solid var(--brand-300);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    animation: rise .2s var(--ease-out);
}
.recording-bar.hidden { display: none; }
.rec-cancel {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(225, 29, 72, 0.12);
    color: var(--brand-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s var(--ease);
}
.rec-cancel:hover { background: rgba(225, 29, 72, 0.22); }
.rec-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand-500);
    box-shadow: 0 0 0 0 rgba(225,29,72,.6);
    animation: rec-pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes rec-pulse {
    0% { box-shadow: 0 0 0 0 rgba(225,29,72,.55); transform: scale(.95); }
    70% { box-shadow: 0 0 0 10px rgba(225,29,72,0); transform: scale(1.1); }
    100% { box-shadow: 0 0 0 0 rgba(225,29,72,0); transform: scale(.95); }
}
.rec-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--brand-700);
    font-size: 15px;
    letter-spacing: .02em;
}
.rec-waveform {
    flex: 1;
    height: 28px;
    min-width: 60px;
    display: block;
}

.composer__send {
    width: 46px;
    height: 46px;
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    color: white;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 18px -6px rgba(225,29,72,.5), inset 0 1px 0 rgba(255,255,255,.18);
    transition: transform .15s var(--ease), box-shadow .2s var(--ease);
}
.composer__send svg { transform: translateX(-1px) translateY(0); }
.composer__send:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 12px 24px -6px rgba(225,29,72,.55), inset 0 1px 0 rgba(255,255,255,.22);
}
.composer__send:active:not(:disabled) {
    transform: translateY(0) scale(.96);
}
.composer__send:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.composer__send.hidden {
    width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    box-shadow: none;
}

/* ---------- Finalization card -------------------------------- */
.finalization {
    align-self: center;
    margin: 24px 0;
    background: linear-gradient(180deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    color: #065f46;
    border-radius: var(--radius-xl);
    padding: 24px 28px;
    text-align: center;
    max-width: 380px;
    box-shadow: var(--shadow-md);
    animation: bubble-in .5s var(--ease-out);
}
.finalization svg {
    width: 40px;
    height: 40px;
    color: #059669;
    margin-bottom: 10px;
}
.finalization p {
    margin: 0 0 16px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    color: #064e3b;
}
.finalization button {
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    color: white;
    border: 0;
    padding: 11px 22px;
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 14px -4px rgba(225,29,72,.45), inset 0 1px 0 rgba(255,255,255,.18);
    transition: transform .15s var(--ease), box-shadow .2s var(--ease);
}
.finalization button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -4px rgba(225,29,72,.5), inset 0 1px 0 rgba(255,255,255,.22);
}

/* ---------- Animations --------------------------------------- */
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive --------------------------------------- */
@media (max-width: 720px) {
    .app {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        border: 0;
    }
    .topbar { padding: 14px 16px; }
    .brand__text h1 { font-size: 16px; }
    .brand__text p { font-size: 11.5px; }
    .messages { padding: 16px 14px 4px; }
    .typing { margin: 0 14px 4px; }
    .composer { padding: 10px 12px 14px; gap: 8px; }
    .bubble { max-width: 86%; font-size: 14.5px; }
    .screen--form { padding: 24px 18px; }
    .hero__title { font-size: 24px; }
    .hero__sub { font-size: 14.5px; }
    .field input { font-size: 16px; height: 54px; }
    #msg-input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}
