/* ========== BASE STYLES ========== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', Georgia, serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(120, 120, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 120, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 255, 255, 0.05) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* ========== ANIMATIONS ========== */
@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, -20px) rotate(1deg); }
    66% { transform: translate(20px, -10px) rotate(-1deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

@keyframes glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateX(-20px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== PROGRESS BAR ========== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(42, 42, 42, 0.3);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

/* ========== STATS PANEL ========== */
.stats-panel {
    position: fixed;
    top: 25px;
    right: 25px;
    background: rgba(30, 30, 45, 0.9);
    backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 16px;
    font-size: 0.9em;
    min-width: 220px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    transition: all 0.3s ease;
}

.stats-panel:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 15px 50px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stats-panel h3 {
    margin: 0 0 15px 0;
    color: #a855f7;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 12px 0;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item:hover {
    padding-left: 5px;
}

.stat-value {
    color: #e0aaff;
    font-weight: 700;
    font-size: 1.1em;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* Mobile stats toggle button */
.stats-toggle {
    display: none;
    position: fixed;
    top: 25px;
    right: 25px;
    background: rgba(30, 30, 45, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: #a855f7;
    font-size: 1.2em;
    cursor: pointer;
    z-index: 101;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.stats-toggle:hover {
    background: rgba(30, 30, 45, 1);
    transform: scale(1.1);
}

/* ========== MAIN CONTENT ========== */
#content {
    max-width: 800px;
    margin: 80px auto 40px;
    padding: 50px;
    background: rgba(30, 30, 45, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
    animation: fadeIn 0.8s ease;
}

h1 {
    text-align: center;
    font-size: 3em;
    font-weight: 300;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #a855f7 0%, #e0aaff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
    letter-spacing: 2px;
    animation: glow 3s ease-in-out infinite;
}

.question {
    font-size: 1.3em;
    margin-bottom: 40px;
    white-space: pre-wrap;
    line-height: 1.8;
    color: #e0e0f0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.6s ease;
}

.question strong {
    color: #e0aaff;
    font-weight: 600;
}

/* ========== CHOICES ========== */
.choices {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 40px;
    align-items: center;
}

.choice-short {
    min-width: 120px !important;
    max-width: 200px !important;
}

.choice-long {
    min-width: 300px !important;
    padding: 20px 40px !important;
}

button {
    padding: 18px 30px;
    font-size: 1.1em;
    font-family: inherit;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    color: #e0e0f0;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    animation: slideUp 0.5s ease backwards;
    width: auto;
    min-width: 200px;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.choices button:nth-child(1) { animation-delay: 0.1s; }
.choices button:nth-child(2) { animation-delay: 0.2s; }
.choices button:nth-child(3) { animation-delay: 0.3s; }
.choices button:nth-child(4) { animation-delay: 0.4s; }

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
    transition: width 0.6s, height 0.6s;
    transform: translate(-50%, -50%);
}

button:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
    border-color: rgba(168, 85, 247, 0.5);
    transform: translateY(-3px);
    box-shadow: 
        0 10px 30px rgba(168, 85, 247, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

button:hover::before {
    width: 300px;
    height: 300px;
}

/* ========== SPECIAL SECTIONS ========== */
.back-link {
    margin-top: 40px;
    text-align: center;
}

.back-link button {
    background: rgba(60, 60, 80, 0.3);
    border-color: rgba(100, 100, 120, 0.3);
    font-size: 0.95em;
    padding: 12px 24px;
}

.back-link button:hover {
    background: rgba(60, 60, 80, 0.5);
    border-color: rgba(100, 100, 120, 0.5);
}

.save-code {
    margin-top: 40px;
    padding: 16px;
    background: rgba(60, 60, 80, 0.2);
    border: 1px solid rgba(100, 100, 120, 0.2);
    border-radius: 12px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.save-code:hover {
    background: rgba(60, 60, 80, 0.3);
    border-color: rgba(168, 85, 247, 0.3);
    transform: translateY(-2px);
}

.save-code::after {
    content: '📋';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.save-code:hover::after {
    opacity: 0.8;
}

.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(185, 28, 28, 0.2) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 30px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
    animation: shake 0.5s ease;
}

.error h2 {
    color: #fca5a5;
    margin-bottom: 10px;
}

#content.hex-screen {
    text-align: center;
    padding: 100px 50px;
    cursor: pointer;
    transition: all 0.5s ease;
}

#content.hex-screen:hover {
    transform: scale(1.02);
}

#content.hex-screen p {
    color: #a0a0b0;
    font-size: 1.2em;
    margin-top: 20px;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

.copyright {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: rgba(160, 160, 180, 0.5);
    text-align: center;
    z-index: 10;
    transition: color 0.3s ease;
}

.copyright:hover {
    color: rgba(160, 160, 180, 0.8);
}

/* ========== CUSTOM SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 30, 45, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #6366f1, #a855f7);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #7c7ff3, #b970f9);
}