:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #090909;
    color: #f5f5f5;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse at 50% -18%, rgb(255 255 255 / 10%), transparent 49%),
        radial-gradient(ellipse at 50% 100%, rgb(255 32 52 / 6%), transparent 38%),
        #090909;
}

button,
input {
    font: inherit;
}

.app-shell {
    width: min(100% - 40px, 760px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 70px 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-header {
    margin-bottom: 34px;
    text-align: center;
}

.eyebrow,
.page-footer {
    color: #777;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.eyebrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 0 0 15px;
}

.status-dot,
.online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff3548;
    box-shadow: 0 0 12px rgb(255 53 72 / 70%);
}

.app-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(48px, 8vw, 68px);
    font-weight: 800;
    letter-spacing: -0.065em;
    line-height: 1;
    text-shadow: 0 3px 28px rgb(255 255 255 / 12%);
}

.tagline {
    margin: 13px 0 0;
    color: #929292;
    font-size: 15px;
}

.personas-link {
    display: inline-block;
    margin-top: 13px;
    color: #d96a76;
    font-size: 12px;
    text-decoration: none;
    transition: color 150ms ease;
}

.personas-link:hover {
    color: #ff7180;
}

.personas-link:focus-visible,
.persona-card:focus-visible {
    outline: 2px solid #ff5265;
    outline-offset: 4px;
}

.chat-card {
    width: 100%;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #292929;
    border-radius: 20px;
    background: linear-gradient(145deg, rgb(29 29 29 / 97%), rgb(15 15 15 / 98%) 38%, #101010);
    box-shadow:
        0 32px 90px rgb(0 0 0 / 55%),
        0 1px 0 rgb(255 255 255 / 6%) inset,
        0 -1px 0 rgb(255 255 255 / 2%) inset;
}

.chat-topbar {
    min-height: 78px;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #252525;
    background: rgb(255 255 255 / 1.5%);
}

.chat-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid rgb(255 53 72 / 34%);
    border-radius: 13px;
    background: linear-gradient(145deg, #3a1118, #1d0d10);
    color: #ff6878;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 4px 18px rgb(255 43 65 / 10%), 0 1px 0 rgb(255 255 255 / 8%) inset;
}

.chat-identity h2 {
    margin: 0;
    color: #f2f2f2;
    font-size: 14px;
    font-weight: 650;
}

.chat-identity p {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 5px 0 0;
    color: #858585;
    font-size: 12px;
}

.online-dot {
    width: 6px;
    height: 6px;
    background: #79c99b;
    box-shadow: 0 0 9px rgb(121 201 155 / 60%);
}

.mode-label {
    padding: 7px 9px;
    border: 1px solid #303030;
    border-radius: 7px;
    color: #888;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.conversation {
    flex: 1;
    min-height: 290px;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.welcome-message {
    margin: auto;
    max-width: 330px;
    text-align: center;
}

.welcome-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 15px;
    display: grid;
    place-items: center;
    border: 1px solid #342326;
    border-radius: 14px;
    background: linear-gradient(145deg, #261719, #181214);
    color: #ff6878;
    font-size: 20px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 30%), 0 1px 0 rgb(255 255 255 / 6%) inset;
}

.welcome-message h3 {
    margin: 0;
    color: #f0f0f0;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.welcome-message p {
    margin: 9px 0 0;
    color: #858585;
    font-size: 13px;
    line-height: 1.6;
}

.message {
    max-width: min(82%, 500px);
    padding: 12px 15px;
    border: 1px solid #303030;
    border-radius: 15px 15px 15px 4px;
    background: linear-gradient(145deg, #222, #1a1a1a);
    color: #e9e9e9;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.message--user {
    align-self: flex-end;
    border-color: #54202a;
    border-radius: 15px 15px 4px 15px;
    background: linear-gradient(145deg, #491720, #2b1117);
    color: #fff0f2;
}

.message--loading {
    color: #a5a5a5;
    font-style: italic;
}

.message--error {
    border-color: #6b2831;
    color: #ff929d;
}

.composer {
    margin: 0 20px;
    padding: 7px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #333;
    border-radius: 14px;
    background: #111;
    box-shadow: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 8px 25px rgb(0 0 0 / 20%);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
    border-color: #692632;
    box-shadow: 0 0 0 3px rgb(255 53 72 / 9%), 0 1px 0 rgb(255 255 255 / 4%) inset;
}

.composer input {
    width: 100%;
    min-width: 0;
    padding: 10px 10px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f2f2f2;
    font-size: 13px;
}

.composer input::placeholder {
    color: #686868;
}

.composer button {
    min-height: 40px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #ff5265;
    border-radius: 10px;
    background: linear-gradient(180deg, #ff5265, #d91f39);
    color: #fff;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 5px 16px rgb(230 32 56 / 25%), 0 1px 0 rgb(255 255 255 / 28%) inset;
    transition: filter 150ms ease, transform 150ms ease;
}

.composer button:hover {
    filter: brightness(1.08);
}

.composer button:disabled {
    cursor: wait;
    filter: saturate(0.65);
    opacity: 0.75;
}

.composer button:active {
    transform: translateY(1px);
}

.composer button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.composer button svg {
    width: 16px;
    height: 16px;
}

.chat-note {
    margin: 12px 0 18px;
    color: #666;
    font-size: 11px;
    text-align: center;
}

.page-footer {
    margin-top: auto;
    padding-top: 28px;
    color: #555;
    font-size: 9px;
}

.page-footer span {
    padding: 0 5px;
    color: #c84454;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.persona-shell {
    width: min(100% - 40px, 980px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 78px 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.persona-header {
    margin-bottom: 52px;
    text-align: center;
}

.persona-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(52px, 9vw, 76px);
    font-weight: 800;
    letter-spacing: -0.075em;
    line-height: 1;
    text-shadow: 0 3px 28px rgb(255 255 255 / 12%);
}

.persona-header h1 span {
    color: #ff5265;
}

.persona-tagline {
    margin: 15px 0 0;
    color: #999;
    font-size: 16px;
}

.persona-section {
    width: 100%;
}

.persona-section-heading {
    margin-bottom: 22px;
    text-align: center;
}

.persona-section-heading h2 {
    margin: 0;
    color: #f3f3f3;
    font-size: clamp(20px, 4vw, 25px);
    font-weight: 650;
    letter-spacing: -0.035em;
}

.persona-section-heading p {
    margin: 8px 0 0;
    color: #858585;
    font-size: 13px;
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.persona-card {
    min-height: 230px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid #292929;
    border-radius: 18px;
    background: linear-gradient(145deg, rgb(29 29 29 / 97%), rgb(15 15 15 / 98%) 58%, #101010);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 18px 42px rgb(0 0 0 / 28%), 0 1px 0 rgb(255 255 255 / 5%) inset;
    transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.persona-card:hover {
    transform: translateY(-4px);
    border-color: #74313b;
    box-shadow: 0 22px 48px rgb(0 0 0 / 38%), 0 0 24px rgb(255 53 72 / 7%);
}

.persona-icon {
    width: 42px;
    height: 42px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    border: 1px solid rgb(255 53 72 / 28%);
    border-radius: 13px;
    background: linear-gradient(145deg, #32151a, #1b1012);
    color: #ff6878;
    font-size: 19px;
    box-shadow: 0 5px 18px rgb(255 43 65 / 9%), 0 1px 0 rgb(255 255 255 / 6%) inset;
}

.persona-name {
    color: #f5f5f5;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.persona-description {
    margin-top: 8px;
    color: #929292;
    font-size: 13px;
    line-height: 1.6;
}

.persona-action {
    margin-top: auto;
    padding-top: 18px;
    color: #ff7180;
    font-size: 12px;
    font-weight: 650;
}

.persona-action span {
    padding-left: 4px;
    transition: padding 150ms ease;
}

.persona-card:hover .persona-action span {
    padding-left: 8px;
}

.persona-page .page-footer {
    margin-top: auto;
}

@media (max-width: 520px) {
    .app-shell {
        width: min(100% - 24px, 760px);
        padding-top: 48px;
        padding-bottom: 20px;
    }

    .app-header {
        margin-bottom: 26px;
    }

    .chat-card {
        min-height: min(68vh, 540px);
        border-radius: 17px;
    }

    .chat-topbar {
        padding: 14px 15px;
    }

    .mode-label {
        padding: 6px 7px;
        font-size: 8px;
        letter-spacing: 0.06em;
    }

    .conversation {
        padding: 22px 16px;
    }

    .composer {
        margin: 0 12px;
    }

    .composer button {
        padding: 0 11px;
    }

    .persona-shell {
        width: min(100% - 28px, 480px);
        padding-top: 50px;
    }

    .persona-header {
        margin-bottom: 38px;
    }

    .persona-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .persona-card {
        min-height: 190px;
    }
}

@media (min-width: 521px) and (max-width: 760px) {
    .persona-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}