/* P1-Whoami v2.0 CSS - 4-layer ad system + SSR unlock */
:root {
    --primary-color: #6C63FF;
    --secondary-color: #FF6584;
    --dark-bg: #0A0A0F;
    --light-bg: #1A1A24;
    --card-bg: #252533;
    --text-primary: #FFFFFF;
    --text-secondary: #B8B8CC;
    --accent-ssr: #FFD700;
    --ad-banner-height: 50px;
    --border-radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #15151F 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    padding: 20px 16px calc(var(--ad-banner-height) + 20px); /* Extra space for banner */
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Language Toggle */
.language-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.lang-btn {
    padding: 6px 12px;
    background: var(--light-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 40px;
}

.title {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(90deg, #6C63FF, #FF6584);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Section States */
.active-section {
    display: block !important;
}

.hidden-section {
    display: none !important;
}

/* Quiz Section */
.quiz-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.question-number {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.question-text {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    line-height: 1.4;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.option-btn {
    padding: 16px 20px;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn:hover {
    border-color: rgba(108, 99, 255, 0.3);
    background: rgba(108, 99, 255, 0.05);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background: rgba(108, 99, 255, 0.1);
}

.navigation {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #5B54E6;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #2E2E3D;
}

.btn-complete {
    background: var(--secondary-color);
    color: white;
}

.hidden {
    display: none !important;
}

/* Loading Section */
.loading-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 20px;
}

.loading-animation {
    margin: 40px auto;
    width: 80px;
    height: 80px;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.dot {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.loading-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #6C63FF, #36D1DC);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.loading-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* Native Ad Container */
.native-ad-container {
    background: linear-gradient(135deg, #1E1E2E 0%, #2A2A3E 100%);
    border-radius: var(--border-radius);
    padding: 24px;
    margin: 30px auto;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.native-ad-label {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.native-ad-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: white;
}

.native-ad-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.native-ad-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.native-ad-btn:hover {
    background: #5B54E6;
    transform: translateY(-1px);
}

.loading-timer {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 20px;
    font-family: 'Courier New', monospace;
}

/* Video Ad Section */
.video-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 20px;
}

.video-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
}

.video-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.video-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #1E1E2E 0%, #2A2A3E 100%);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.countdown {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.video-progress {
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.video-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    transition: width 1s linear;
    width: 0%;
}

/* Result Section */
.result-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

#card-canvas, #ssr-card-canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
}

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

.btn-share {
    background: #25D366;
    color: white;
}

.btn-save {
    background: var(--primary-color);
    color: white;
}

.btn-compare {
    background: var(--secondary-color);
    color: white;
}

/* SSR Unlock Prompt */
.ssr-unlock {
    background: linear-gradient(135deg, rgba(255, 214, 0, 0.1) 0%, rgba(255, 107, 132, 0.1) 100%);
    border: 2px solid var(--accent-ssr);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-top: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.ssr-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ssr-icon {
    font-size: 32px;
    animation: pulse 2s infinite;
}

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

.ssr-unlock h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-ssr);
}

.ssr-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.ssr-options {
    display: flex;
    gap: 12px;
}

.btn-ssr-share {
    background: linear-gradient(90deg, #36D1DC, #5B86E5);
    color: white;
    flex: 1;
}

.btn-ssr-ad {
    background: linear-gradient(90deg, #FF6584, #FF8E53);
    color: white;
    flex: 1;
}

/* SSR Result Section */
.ssr-result-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.ssr-reveal {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.ssr-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(90deg, #FFD700, #FF8E53);
    color: #000;
    font-weight: 700;
    font-size: 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

.ssr-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-ssr);
    margin-bottom: 8px;
}

.ssr-congrats {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Ad Banner */
.ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--ad-banner-height);
    background: var(--light-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer */
.footer {
    margin-top: 40px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-text a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 36px;
    }
    
    .quiz-container {
        padding: 20px;
    }
    
    .question-text {
        font-size: 20px;
    }
    
    .option-btn {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .navigation {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .ssr-options {
        flex-direction: column;
    }
    
    #card-canvas, #ssr-card-canvas {
        width: 100% !important;
        height: auto !important;
    }
}

/* Keyboard visibility fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .container {
        padding-bottom: calc(var(--ad-banner-height) + 100px);
    }
    
    .ad-banner {
        position: absolute;
    }
}