:root {
    color-scheme: light;
    --bg: #f2ede7;
    --ink: #201c16;
    --muted: #6e665b;
    --card: #ffffff;
    --accent: #d66a3a;
    --accent-strong: #a94822;
    --shadow: 0 22px 60px rgba(44, 33, 20, 0.18);
    --soft: #fbf4ec;
    --stroke: rgba(109, 88, 69, 0.2);
    --widget-gold: #927238;
    --widget-gold-dark: #816431;
    --widget-ink: #0f1216;
    --widget-card: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100dvh;
    font-family: 'Inter', "Segoe UI", sans-serif;
    color: var(--ink);
    background: url('image.png') no-repeat center center fixed;
    background-size: 100% 103%;
    display: grid;
    place-items: center;
    padding: 2px 20px 64px;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(214, 106, 58, 0.12), transparent 70%);
    z-index: -1;
    filter: blur(2px);
}

body::before {
    top: 8%;
    left: -120px;
}

body::after {
    bottom: -80px;
    right: -120px;
}

.shell {
    width: min(980px, 100%);
    display: grid;
    gap: 24px;
    align-items: center;
    justify-items: center;
}

.hero {
    text-align: center;
    display: grid;
    gap: 12px;
    max-width: 640px;
    animation: floatIn 0.6s ease both;
}

.hero h1 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: clamp(2.4rem, 4vw, 3.4rem);
    letter-spacing: -0.02em;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.6;
}

.stage {
    width: min(900px, 100%);
    background: var(--card);
    border-radius: 28px;
    padding: clamp(18px, 3vw, 32px);
    box-shadow: var(--shadow);
    display: grid;
    gap: 20px;
    animation: floatIn 0.8s ease both;
}

.video-card {
    border-radius: 22px;
    padding: 12px;
    background: linear-gradient(135deg, #f9efe5, #fffaf5);
    border: 1px solid var(--stroke);
    position: relative;
    overflow: hidden;
}

.video-card.is-compact .video-frame {
    display: none;
}

.video-frame {
    width: 100%;
    height: clamp(360px, 55vw, 520px);
    border-radius: 18px;
    background: var(--soft);
    border: 1px solid rgba(109, 88, 69, 0.12);
    overflow: hidden;
}

.video-overlay {
    position: absolute;
    inset: auto 24px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(109, 88, 69, 0.12);
    backdrop-filter: blur(8px);
}

.audio-only {
    display: none;
    height: clamp(240px, 35vw, 320px);
    border-radius: 18px;
    background: var(--soft);
    border: 1px solid rgba(109, 88, 69, 0.12);
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 1rem;
    align-items: center;
    justify-content: center;
}

.video-card.is-compact .audio-only {
    display: flex;
}

.status {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
}

.status[data-tone="ok"] {
    color: #1a6e3a;
}

.status[data-tone="warn"] {
    color: #9b5c1b;
}

.status[data-tone="error"] {
    color: #b5392b;
}

.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-button {
    appearance: none;
    border: 1px solid rgba(109, 88, 69, 0.25);
    background: #fff8f1;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 12px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.lang-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(109, 88, 69, 0.2);
}

.lang-button.active {
    background: var(--accent);
    color: #fffaf5;
    border-color: transparent;
    box-shadow: 0 12px 26px rgba(214, 106, 58, 0.35);
}

.mode-button {
    appearance: none;
    border: 1px solid rgba(109, 88, 69, 0.25);
    background: #ffffff;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.mode-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(109, 88, 69, 0.2);
}

.mode-button.active {
    background: #f0e6dc;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(109, 88, 69, 0.15);
}

.action-button {
    appearance: none;
    border: none;
    background: var(--accent);
    color: #fffaf5;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(214, 106, 58, 0.25);
}

.action-button.secondary {
    background: #f0e6dc;
    color: var(--ink);
}

.chat {
    display: grid;
    gap: 12px;
    background: var(--soft);
    border-radius: 20px;
    border: 1px solid rgba(109, 88, 69, 0.12);
    padding: 16px;
}

.chat.is-hidden {
    display: none;
}

.chat-log {
    display: grid;
    gap: 10px;
    max-height: 220px;
    overflow: auto;
    padding-right: 4px;
}

.chat-line {
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(109, 88, 69, 0.12);
    font-size: 0.95rem;
    line-height: 1.4;
}

.chat-line.agent {
    background: #fffaf5;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.chat-input {
    border: 1px solid rgba(109, 88, 69, 0.2);
    border-radius: 999px;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
    background: #ffffff;
}

.note {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    body {
        padding-top: 32px;
    }

    .stage {
        border-radius: 20px;
    }

    .video-frame {
        height: 320px;
    }

    .video-overlay {
        position: static;
        margin-top: 12px;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }
}

.assistant-widget {
    position: fixed;
    right: 32px;
    bottom: 28px;
    width: min(460px, 90vw);
    display: grid;
    gap: 16px;
    z-index: 5;
    animation: floatIn 0.6s ease both;
}

.assistant-widget.is-hidden {
    display: none;
}

.assistant-launcher {
    position: fixed;
    right: 32px;
    bottom: 28px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.45);
    background: #3f3e43;
    display: grid;
    place-items: center;
    box-shadow: 0 20px 40px rgba(18, 16, 14, 0.35);
    cursor: pointer;
    z-index: 4;
    overflow: hidden;
}

.assistant-launcher img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.assistant-banner {
    justify-self: end;
    padding: 12px 22px;
    border-radius: 14px;
    background: var(--widget-gold);
    color: #f9f4ec;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.8rem;
    box-shadow: 0 14px 30px rgba(71, 54, 25, 0.25);
}

.assistant-card {
    background: var(--widget-card);
    border-radius: 26px;
    padding: 22px 22px 18px;
    box-shadow: 0 24px 60px rgba(21, 19, 15, 0.3);
    display: grid;
    gap: 14px;
    max-height: 90vh;
    overflow-y: auto;
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.assistant-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
    color: #8f7a4b;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.assistant-logo {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f6e7c8, #c7a56c);
    color: #6b5431;
    font-weight: 700;
    font-size: 0.9rem;
}

.assistant-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.assistant-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(27, 25, 22, 0.12);
}

.assistant-lang {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f5f0e8;
    color: #8f7a4b;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(27, 25, 22, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.assistant-lang:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(27, 25, 22, 0.12);
}

.assistant-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.assistant-greeting {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid #e1d7c7;
    background: #ffffff;
    font-size: 0.95rem;
    color: #2b2620;
    width: fit-content;
}

.assistant-avatar-display {
    display: flex;
    justify-content: center;
    margin: 10px 0 20px 0;
}

.avatar-container {
    position: relative;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.avatar-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.assistant-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.5rem, 2.2vw, 2rem);
    margin: 0 0 16px 0;
    color: #141210;
    text-align: center;
}

.assistant-actions {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 14px;
}

.action-card {
    border-radius: 18px;
    padding: 16px;
    display: grid;
    gap: 16px;
    position: relative;
    overflow: hidden;
    min-height: 90px;
}

.action-card.primary {
    background: var(--widget-gold);
    color: #f7f2e9;
    grid-row: span 2;
    min-height: auto;
}

.action-card.secondary {
    background: #1a1a1c;
    color: #ffffff;
    min-height: 90px;
}

.action-card.video {
    padding: 16px;
    background: #1a1a1c;
    color: #ffffff;
}

.video-shell {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: auto;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    display: grid;
    gap: 16px;
}

.video-shell .video-frame {
    width: 100%;
    height: 100%;
    border-radius: 18px;
}

.video-label {
    position: static;
    font-size: 1.15rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
}

.video-action {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    cursor: pointer;
}

.video-status {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    position: absolute;
    left: 16px;
    top: 14px;
}

.video-shell .action-icon {
    position: static;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.video-shell .action-arrow {
    right: 16px;
    top: 16px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.video-shell .action-arrow svg {
    stroke: #ffffff;
}

.video-shell .video-status {
    display: none;
}

.video-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: end;
    padding: 24px;
    background: transparent;
    backdrop-filter: none;
    z-index: 8;
}

.video-modal.is-hidden {
    display: none;
}

.lang-select-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(7, 7, 9, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9;
}

.lang-select-modal.is-hidden {
    display: none;
}

.lang-select-card {
    background: var(--widget-card);
    border-radius: 24px;
    padding: 32px 28px;
    width: min(380px, 90vw);
    box-shadow: 0 28px 70px rgba(10, 10, 12, 0.5);
    display: grid;
    gap: 24px;
}

.lang-select-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    margin: 0;
    color: #141210;
    text-align: center;
}

.lang-select-options {
    display: grid;
    gap: 12px;
}

.lang-option {
    appearance: none;
    border: 2px solid rgba(109, 88, 69, 0.25);
    background: #ffffff;
    color: var(--ink);
    font-weight: 600;
    font-size: 1rem;
    padding: 14px 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(109, 88, 69, 0.2);
    border-color: var(--widget-gold);
}

.lang-option.selected {
    background: var(--widget-gold);
    color: #f9f4ec;
    border-color: var(--widget-gold);
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.1rem;
}

.lang-select-card .action-button {
    width: 100%;
    padding: 14px 18px;
    background: #927238;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.lang-select-card .action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(146, 114, 56, 0.25);
}

.flag-icon {
    width: 32px;
    height: 22px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    display: block;
    object-fit: cover;
}

.video-modal-card {
    --control-bar-height: 84px;
    width: min(380px, 88vw);
    aspect-ratio: 3 / 4;
    background: #060607;
    border-radius: 22px;
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    box-shadow: 0 30px 80px rgba(10, 10, 12, 0.6);
}

.video-modal-card.is-live .video-modal-ring {
    display: none;
}

.video-modal-call {
    position: absolute;
    inset: 0 0 var(--control-bar-height) 0;
    border-radius: 22px;
    overflow: hidden;
    background: #ffffff;
    display: grid;
    place-items: center;
}

.video-modal-call video {
    width: 100%;
    height: 100%;
    display: none;
    object-fit: cover;
    background: #0b0b0e;
}

.video-modal-call audio {
    display: none;
}

.call-loader {
    position: absolute;
    inset: 0 0 var(--control-bar-height) 0;
    background: #1a1a1a;
    display: grid;
    place-items: center;
    z-index: 2;
}

.video-modal-card.is-live .call-loader {
    display: none;
}

.loader-content {
    width: min(220px, 60%);
    display: grid;
    place-items: center;
    gap: 14px;
    text-align: center;
}

.loader-badge {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
}

.loader-avatar-container {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #e9e4db;
    box-shadow: inset 0 0 0 10px #ffffff;
    position: relative;
}

.loader-avatar-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.loader-avatar-face {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.loader-spinner {
    position: absolute;
    inset: -8px;
    border: 4px solid rgba(143, 122, 75, 0.2);
    border-top: 4px solid var(--widget-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    margin: 0;
    font-size: 0.95rem;
    color: #e9e4db;
    font-weight: 600;
}

.audio-avatar {
    width: min(220px, 60%);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #e9e4db;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 10px #ffffff;
}

.audio-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.video-modal-card.is-video .audio-avatar {
    display: none;
}

.video-modal-card.is-video .video-modal-call video {
    display: block;
}

.video-modal-ring {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.95);
    border-top-color: #a9833f;
    animation: spin 2s linear infinite;
}

.video-modal-controls {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 14px;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 12px 20px;
    border-radius: 20px;
    background: #0b0b0d;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.5);
}

.control-btn {
    height: 50px;
    width: 50px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: #FFFFFF;
    color: #101010;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.control-btn:hover {
    transform: translateY(-1px);
}

.control-btn.is-off {
    background: #666666 !important;
    color: #f5f5f5 !important;
}

.control-btn.is-end {
    background: #ff2140;
    border-radius: 50%;
    color: #ffffff;
}

#toggle-video-btn {
    background: #666666 !important;
    color: #f5f5f5 !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
}

.action-card.secondary .action-icon {
    background: rgba(255, 255, 255, 0.12);
}

.action-label {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
}

.action-arrow {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
}

.assistant-actions-right {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 14px;
}

.assistant-footer {
    text-align: center;
    font-size: 0.82rem;
    color: #8b7c66;
}

@media (max-width: 720px) {
    .video-modal {
        padding: 14px;
    }

    .video-modal-card {
        width: min(86vw, 360px);
    }
}

@media (max-width: 720px) {
    .assistant-widget {
        right: 16px;
        left: 16px;
        width: auto;
    }

    .assistant-actions {
        grid-template-columns: 1fr;
    }

    .assistant-launcher {
        right: 16px;
        bottom: 16px;
    }
}
