/* Rose - AmoCraft AI - Main Styles */
/* Color scheme: Blue (#5B9BD5) + Baby Pink (#FFB5C5) */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
}

/* --- Loading Screen --- */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-text {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, #5B9BD5, #FFB5C5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse-load 1.5s ease-in-out infinite;
}

@keyframes pulse-load {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* --- Video Background --- */
.video-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

.bg-video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.bg-video.active {
    opacity: 1;
}

/* --- Content Overlay --- */
.content-overlay {
    position: relative;
    z-index: 1;
    width: 100%; height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 40px;
}

/* --- Transcript --- */
.transcript-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 24px 32px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.transcript-container.visible {
    opacity: 1;
    pointer-events: auto;
}

#transcript {
    font-size: 18px;
    line-height: 1.6;
    color: #fff;
}

/* --- Mic Button (Blue + Baby Pink gradient) --- */
.bottom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.mic-button {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #5B9BD5, #FFB5C5);
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(91, 155, 213, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(91, 155, 213, 0.6);
}

.mic-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.mic-button.is-listening {
    animation: pulse-mic 1.5s ease-in-out infinite;
    background: linear-gradient(135deg, #4A8BC2, #FF9DB5);
}

@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(91, 155, 213, 0.6); }
    50% { box-shadow: 0 0 0 20px rgba(91, 155, 213, 0); }
}

/* --- Camera button --- */
.cam-button {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cam-button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.cam-button.active {
    background: linear-gradient(135deg, #5B9BD5, #7BB8E8);
    box-shadow: 0 0 16px rgba(91, 155, 213, 0.5);
    animation: pulse-cam 2s ease-in-out infinite;
}

@keyframes pulse-cam {
    0%, 100% { box-shadow: 0 0 8px rgba(91, 155, 213, 0.4); }
    50% { box-shadow: 0 0 20px rgba(91, 155, 213, 0.7); }
}

/* --- Emotion camera overlay --- */
.emotion-camera-wrap {
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 160px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(91, 155, 213, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 90;
    display: none;
}

.emotion-camera-wrap.active {
    display: block;
}

.emotion-camera-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.emotion-camera-wrap canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
}

/* --- Chat Control Panel --- */
.chat-control-panel {
    position: fixed;
    top: 20px; left: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
    opacity: 0;
    animation: fadeIn 0.5s ease 2s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.control-btn.primary {
    background: linear-gradient(135deg, #5B9BD5, #FFB5C5);
    box-shadow: 0 2px 12px rgba(91, 155, 213, 0.3);
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(91, 155, 213, 0.5);
}

/* --- Premium button --- */
.control-btn.premium {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.control-btn.premium:hover {
    transform: translateY(-2px);
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.2);
}

.control-btn.premium.is-premium {
    background: linear-gradient(135deg, #f9a825, #ff8f00);
    border: none;
    color: #fff;
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.4);
    cursor: default;
}

.premium-star {
    font-size: 14px;
}

/* --- Speaking indicator --- */
.speaking-indicator {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(91, 155, 213, 0.8);
    backdrop-filter: blur(8px);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    animation: pulse-load 1.5s ease-in-out infinite;
}

/* --- Dance Overlay --- */
.dance-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.dance-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.dance-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- iOS tap-to-start overlay --- */
#ios-tap-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ios-tap-content {
    text-align: center;
    color: #fff;
    pointer-events: none;
}

.ios-tap-icon {
    width: 90px; height: 90px;
    border-radius: 50%;
    margin-bottom: 20px;
    border: 3px solid rgba(91, 155, 213, 0.6);
    animation: pulse-load 1.5s ease-in-out infinite;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.ios-tap-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.ios-tap-subtext {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-top: 8px;
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .bg-video {
        object-fit: cover;
    }

    .mic-button {
        width: 56px; height: 56px;
        min-width: 48px; min-height: 48px;
        font-size: 22px;
    }

    .content-overlay {
        padding-bottom: 0;
    }

    .bottom-bar {
        position: fixed;
        bottom: calc(55vh + 14px);
        left: 50%;
        transform: translateX(-50%);
        padding: 0;
        z-index: 1001;
    }

    .transcript-container {
        max-width: 90%;
        padding: 16px 20px;
    }

    #transcript {
        font-size: 15px;
    }

    .speaking-indicator {
        bottom: auto;
        top: 8px;
        font-size: 12px;
        padding: 6px 14px;
    }

    .chat-control-panel {
        top: 12px; left: 12px;
    }

    .control-btn {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 44px;
    }
}
