
.chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ghost-btn {
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    cursor: pointer;
    font-weight: 600;
}

.ghost-btn.danger {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.3);
}

.ghost-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #020617, #111827 40%, #0f172a);
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -1px;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #cbd5e1;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.app-container {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px;
}

.screen {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.welcome-card {
    width: 100%;
    max-width: 500px;
    padding: 45px 35px;
    text-align: center;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.logo-large {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 15px;
    letter-spacing: -2px;
}

.welcome-card h1 {
    font-size: 30px;
    margin-bottom: 10px;
}

.subtitle {
    color: #94a3b8;
    font-size: 16px;
    margin-bottom: 30px;
}

.rules {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
    text-align: left;
}

.match-options {
    display: grid;
    gap: 10px;
    margin: 0 0 24px;
    text-align: left;
}

.options-label {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
}

.options-label span {
    color: #94a3b8;
    font-weight: 400;
}

.mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 6px;
}

.mode-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 14px;
}

.mode-option:has(input:checked) {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.18);
    color: #fff;
}

.mode-option input,
.age-consent input {
    accent-color: #3b82f6;
}

.mode-hint {
    margin: -3px 0 5px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.45;
}

.interests-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    outline: none;
    background: rgba(255, 255, 255, 0.04);
    color: white;
    font-size: 14px;
}

.interests-input:focus {
    border-color: #60a5fa;
}

.age-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 4px;
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.45;
    cursor: pointer;
}

.age-consent input {
    flex: 0 0 auto;
    margin-top: 2px;
}

.interest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.interest-chip {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.interest-chip:hover {
    border-color: rgba(96, 165, 250, 0.7);
}

.interest-chip[aria-pressed="true"] {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.22);
    color: #fff;
}

.rule {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    font-size: 14px;
}

.primary-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: white;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.primary-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.age-warning {
    margin-top: 20px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.chat-screen {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 1200px;
    height: min(700px, calc(100dvh - 150px));
    min-height: 480px;
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 15px;
}

.chat-screen.text-mode {
    grid-template-columns: minmax(0, 1fr);
}

.chat-screen.text-mode .video-area,
.chat-screen.text-mode .video-controls {
    display: none;
}

.video-area {
    position: relative;
    min-width: 0;
    background: #020617;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    min-height: 0;
}

.stranger-video-container {
    position: absolute;
    inset: 0;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    cursor: pointer;
}

.stranger-video-container:focus-visible,
.my-video-container:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: -3px;
}

.video-placeholder,
.stranger-video-label,
.my-video-label {
    pointer-events: none;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #020617;
}

.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    padding: 20px;
}

.video-loader {
    position: relative;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    margin-bottom: 18px;
    border-radius: 50%;
    animation: video-loader-spin 1.8s linear infinite;
}

.video-loader span {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.video-loader span:nth-child(1) {
    top: 0;
    left: 22px;
    background: #ff5c7a;
}

.video-loader span:nth-child(2) {
    top: 6px;
    right: 7px;
    background: #ffbd4a;
}

.video-loader span:nth-child(3) {
    top: 22px;
    right: 0;
    background: #f5e642;
}

.video-loader span:nth-child(4) {
    right: 7px;
    bottom: 6px;
    background: #47d7ac;
}

.video-loader span:nth-child(5) {
    bottom: 0;
    left: 22px;
    background: #40b9ff;
}

.video-loader span:nth-child(6) {
    bottom: 6px;
    left: 7px;
    background: #7b72ff;
}

.video-loader span:nth-child(7) {
    top: 22px;
    left: 0;
    background: #d56bff;
}

.video-loader span:nth-child(8) {
    top: 6px;
    left: 7px;
    background: #ff8a4c;
}

@keyframes video-loader-spin {
    to {
        transform: rotate(1turn);
    }
}

@media (prefers-reduced-motion: reduce) {
    .video-loader {
        animation: none;
    }
}

.video-placeholder p {
    font-size: 15px;
    margin-bottom: 5px;
}

.video-placeholder small {
    font-size: 12px;
}

.stranger-video-label {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 11px;
}

.my-video-container {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 190px;
    height: 135px;
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
    background: #020617;
}

.my-video-label {
    position: absolute;
    left: 8px;
    bottom: 7px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 11px;
}

.video-area.self-focused .my-video-container {
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.video-area.self-focused .stranger-video-container {
    inset: auto 16px 16px auto;
    z-index: 12;
    width: clamp(120px, 24%, 240px);
    height: auto;
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.video-controls {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 20;
    display: flex;
    gap: 8px;
}

.control-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.2s ease;
}

.control-btn:hover {
    background: #334155;
}

.typing-indicator {
    flex: 0 0 24px;
    height: 24px;
    padding: 4px 18px 0;
    color: #94a3b8;
    font-size: 12px;
    opacity: 0;
}

.typing-indicator.visible {
    opacity: 1;
}

.chat-area {
    min-width: 0;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 15px;
}

.chat-header strong {
    font-size: 16px;
}

.chat-status {
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.next-btn {
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    background: #334155;
    color: white;
    cursor: pointer;
    font-weight: 600;
}

.next-btn:hover {
    background: #475569;
}

.next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.my-message {
    align-self: flex-end;
    background: #2563eb;
    border-bottom-right-radius: 3px;
}

.stranger-message {
    align-self: flex-start;
    background: #334155;
    border-bottom-left-radius: 3px;
}

.system-message {
    align-self: center;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.message-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.message-form input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: none;
    outline: none;
    border-radius: 10px;
    background: #1e293b;
    color: white;
    font-size: 14px;
}

.message-form input::placeholder {
    color: #64748b;
}

.send-btn {
    padding: 0 18px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.send-btn:hover {
    background: #1d4ed8;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.footer {
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

@media (max-width: 800px) {
    .app-container {
        padding: 12px;
        align-items: flex-start;
    }

    .chat-screen {
        height: calc(100dvh - 145px);
        min-height: 470px;
        max-height: 720px;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(190px, 42%) minmax(0, 1fr);
        gap: 10px;
    }

    .chat-screen.text-mode {
        grid-template-rows: minmax(0, 1fr);
    }

    .video-area {
        min-height: 190px;
    }

    .my-video-container {
        width: 125px;
        height: 90px;
        right: 10px;
        bottom: 10px;
    }

    .video-controls {
        left: 10px;
        bottom: 10px;
    }

    .control-btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    .welcome-card {
        padding: 35px 20px;
    }

    .logo-large {
        font-size: 40px;
    }

    .welcome-card h1 {
        font-size: 25px;
    }

    .header {
        padding: 0 15px;
    }

    .logo {
        font-size: 23px;
    }

    .online-status {
        font-size: 12px;
    }

    .chat-header {
        padding: 14px;
        flex-wrap: wrap;
    }

    .chat-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .messages {
        padding: 14px;
    }

    .message-form {
        padding: 10px;
    }

    .send-btn {
        padding: 0 14px;
    }
}

@media (max-width: 420px) {
    .video-area.self-focused .stranger-video-container {
        right: 8px;
        bottom: 8px;
        width: 100px;
    }

    .my-video-container {
        width: 105px;
        height: 75px;
    }

    .video-controls {
        left: 8px;
        bottom: 8px;
        gap: 4px;
    }

    .control-btn {
        padding: 7px 8px;
        font-size: 10px;
    }
}

