* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #fff;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ===== AGE GATE ===== */
.age-gate-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 5, 5, 0.95);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
}
.age-gate {
    background: #1a1a1a; border: 1px solid #333;
    border-radius: 16px; padding: 40px 30px; max-width: 420px;
    text-align: center;
}
.age-gate h2 { color: #e74c3c; font-size: 1.3rem; margin-bottom: 15px; }
.age-gate p { color: #aaa; font-size: 0.9rem; line-height: 1.6; margin-bottom: 25px; }
.age-gate-buttons { display: flex; gap: 10px; flex-direction: column; }
.age-gate-buttons .btn { width: 100%; padding: 12px; font-size: 1rem; }

/* ===== AUTH SECTION ===== */
.auth-section { margin-bottom: 30px; display: flex; justify-content: center; }
.auth-section #googleLoginBtn { min-height: 40px; }
.user-profile {
    display: flex; align-items: center; gap: 10px;
    background: #1a1a1a; border-radius: 24px; padding: 5px 15px 5px 5px;
    border: 1px solid #2a2a2a;
}
.user-avatar { width: 30px; height: 30px; border-radius: 50%; }
.user-name { font-size: 0.85rem; color: #ccc; }
.btn-logout {
    background: none; border: none; color: #666; cursor: pointer;
    font-size: 0.85rem; padding: 2px 6px; border-radius: 50%;
    transition: all 0.2s;
}
.btn-logout:hover { color: #e74c3c; background: #2a2a2a; }

/* ===== ERROR TOAST ===== */
#errorToastContainer {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; gap: 8px;
    pointer-events: none; width: 90%; max-width: 400px;
}
.error-toast {
    background: #e74c3c; color: #fff; padding: 12px 20px;
    border-radius: 10px; font-size: 0.85rem; text-align: center;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 4.7s forwards;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.3);
    pointer-events: auto;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }

/* ===== LANDING PAGE ===== */
.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-content {
    text-align: center;
    max-width: 600px;
    padding: 20px;
}

.logo {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
}

.tagline {
    color: #888;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.mode-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.mode-card {
    width: 170px;
    padding: 30px 20px;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    -webkit-user-select: none; user-select: none;
}

.mode-card:hover {
    border-color: #6366f1;
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
}

.mode-card:active {
    transform: translateY(-2px);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.mode-card h2 {
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.mode-card p {
    font-size: 0.82rem;
    color: #888;
    line-height: 1.4;
}

.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a1a1a;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #888;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== LANDING FOOTER ===== */
.landing-footer {
    margin-top: 30px; font-size: 0.78rem; color: #555;
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.landing-footer a { color: #666; text-decoration: none; transition: color 0.2s; }
.landing-footer a:hover { color: #888; }
.footer-note { color: #e74c3c; }

/* ===== CHAT PAGE ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-small {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mode-badge {
    background: #2a2a2a;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    color: #a855f7;
}

.btn-back {
    background: #1a1a1a;
    border: none;
    color: #888;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #2a2a2a;
    color: #fff;
}

/* ===== VIDEO ===== */
.video-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    background: #1a1a1a;
    padding: 15px;
    border-radius: 12px;
}

.video-wrapper {
    flex: 1;
    position: relative;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.waiting-message {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
}

.waiting-message.active { display: flex; }

.waiting-message p {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #aaa;
}

/* ===== VOICE MODE ===== */
.voice-container {
    background: #1a1a1a;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.voice-waiting p {
    color: #aaa;
    font-size: 0.9rem;
}

.voice-connected {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.voice-orb {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: voicePulse 2s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.voice-orb-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1a1a1a;
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.voice-status {
    color: #6366f1;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== SPINNER ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== CHAT ===== */
.chat-container {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.chat-box {
    height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 5px;
}

.chat-message {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 0.9rem;
}

.chat-message.you {
    background: #6366f1;
    margin-left: auto;
}

.chat-message.stranger { background: #333; }

.chat-message.system {
    background: transparent;
    color: #888;
    text-align: center;
    font-size: 0.85rem;
    font-style: italic;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0f0f0f;
    color: #fff;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #6366f1;
}

.chat-input-container input:disabled { opacity: 0.5; }

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    -webkit-user-select: none; user-select: none;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }

.btn-primary { background: #6366f1; color: #fff; }
.btn-secondary { background: #333; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-report { background: #f39c12; color: #fff; }

.status {
    text-align: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: #888;
}

.online-count {
    background: #1a1a1a;
    padding: 4px 12px;
    border-radius: 12px;
    color: #6366f1;
    font-size: 0.85rem;
}

/* ===== SCROLLBAR ===== */
.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track { background: #1a1a1a; }
.chat-box::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ===== LEGAL PAGES ===== */
.legal-page {
    max-width: 700px; margin: 0 auto; padding: 40px 20px;
}
.legal-page h1 {
    font-size: 2rem; margin-bottom: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.legal-page .effective { color: #666; font-size: 0.85rem; margin-bottom: 30px; }
.legal-page h2 { color: #a855f7; font-size: 1.2rem; margin: 25px 0 10px; }
.legal-page p, .legal-page li { color: #bbb; line-height: 1.7; font-size: 0.9rem; margin-bottom: 10px; }
.legal-page ul { padding-left: 20px; margin-bottom: 15px; }
.legal-page a { color: #6366f1; }
.legal-page .back-link { margin-bottom: 30px; display: inline-block; color: #6366f1; text-decoration: none; font-size: 0.9rem; }

/* ===== MOBILE ===== */
@media (max-width: 600px) {
    .logo { font-size: 2.5rem; }
    .tagline { font-size: 1rem; }
    .mode-cards { flex-direction: column; align-items: center; gap: 12px; }
    .mode-card { width: 100%; max-width: 280px; padding: 20px 16px; }
    .mode-icon { font-size: 2.2rem; }
    .mode-card h2 { font-size: 1.1rem; }

    .container { padding: 10px; }
    header { flex-direction: column; gap: 10px; align-items: flex-start; }
    .header-left { width: 100%; justify-content: space-between; }

    .video-container { flex-direction: column; gap: 10px; padding: 10px; }
    .video-wrapper { aspect-ratio: 4/3; }
    .voice-container { padding: 20px; min-height: 150px; }
    .voice-orb { width: 70px; height: 70px; }
    .voice-orb-inner { width: 40px; height: 40px; }

    .controls { flex-wrap: wrap; gap: 8px; }
    .controls .btn { flex: 1 1 calc(50% - 8px); min-width: 120px; padding: 12px 10px; font-size: 0.85rem; }
    .chat-box { height: 150px; }
    .chat-input-container { gap: 8px; }
    .chat-input-container input { font-size: 16px; } /* prevent iOS zoom */

    .landing-footer { flex-direction: column; gap: 4px; }
    .landing-footer span:not(.footer-note) { display: none; }

    .legal-page { padding: 20px 15px; }
    .legal-page h1 { font-size: 1.5rem; }

    .error-toast { font-size: 0.8rem; padding: 10px 15px; }
    .age-gate { padding: 25px 20px; }
    .age-gate h2 { font-size: 1.1rem; }
}

@media (max-width: 380px) {
    .logo { font-size: 2rem; }
    .mode-card { padding: 15px 12px; }
    .controls .btn { font-size: 0.8rem; padding: 10px 8px; }
}
