/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Disable text selection on interactive elements */
.title,
.subtitle,
.welcome-card,
.question-card h3,
.answer-btn,
.result-card h2,
.result-card p,
.result-traits,
.btn,
.back-link,
.question-counter,
.chem-decoration,
.character-avatar,
.dashboard-link,
.footer {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: #e8e8e8;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1f0f 50%, #1a1a1a 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 195, 74, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 152, 0, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(76, 175, 80, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 10% 20%, rgba(139, 195, 74, 0.4), transparent),
        radial-gradient(1px 1px at 90% 80%, rgba(255, 152, 0, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(76, 175, 80, 0.3), transparent);
    background-size: 300% 300%;
    pointer-events: none;
    z-index: -1;
    animation: chemSparkle 5s ease-in-out infinite;
}

@keyframes chemSparkle {
    0%, 100% { background-position: 0% 0%; opacity: 0.6; }
    50% { background-position: 100% 100%; opacity: 1; }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 40px 0;
    background: rgba(30, 30, 30, 0.85);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    margin-bottom: 30px;
    border: 2px solid rgba(139, 195, 74, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 50px rgba(139, 195, 74, 0.2);
}

.back-link {
    display: inline-block;
    color: rgba(139, 195, 74, 0.9);
    text-decoration: none;
    font-size: 1rem;
    margin-bottom: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    border: 1px solid rgba(139, 195, 74, 0.3);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.back-link:focus,
.back-link:active {
    outline: none;
}

.back-link:hover {
    background: rgba(139, 195, 74, 0.2);
    transform: translateX(-5px);
}

.hero-content {
    position: relative;
}

.title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3.5rem;
    font-weight: 400;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #8bc34a, #ff9800, #4caf50);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: chemGradient 4s ease infinite;
    text-shadow: 0 0 20px rgba(139, 195, 74, 0.5);
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(139, 195, 74, 0.4));
}

@keyframes chemGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 20px;
}

.chem-decoration {
    font-size: 2.5rem;
    margin-top: 20px;
    animation: bubble 3s ease-in-out infinite;
}

@keyframes bubble {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-10px) scale(1.1); opacity: 1; }
}

/* Screen management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

/* Welcome screen */
.welcome-card {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(139, 195, 74, 0.1);
    border: 2px solid rgba(139, 195, 74, 0.3);
}

.welcome-card h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    color: #8bc34a;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(139, 195, 74, 0.5);
}

.welcome-card p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.85);
}

/* Quiz screen */
.quiz-container {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(139, 195, 74, 0.1);
    border: 2px solid rgba(139, 195, 74, 0.3);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8bc34a, #ff9800, #4caf50);
    background-size: 200% 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 0%;
    animation: progressShimmer 2s linear infinite;
    box-shadow: 0 0 10px rgba(139, 195, 74, 0.6);
}

@keyframes progressShimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.question-counter {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(139, 195, 74, 0.9);
    margin-bottom: 30px;
    font-weight: 600;
}

.question-card h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 1.4rem;
    color: #8bc34a;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(139, 195, 74, 0.3);
}

.answers {
    display: grid;
    gap: 15px;
}

.answer-btn {
    background: rgba(40, 40, 40, 0.7);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(139, 195, 74, 0.3);
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.answer-btn:focus,
.answer-btn:active {
    outline: none;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 195, 74, 0.3), transparent);
    transition: left 0.5s ease;
}

.answer-btn:hover {
    border-color: #8bc34a;
    background: rgba(60, 60, 60, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 195, 74, 0.4);
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn.selected {
    border-color: #8bc34a;
    background: linear-gradient(135deg, rgba(139, 195, 74, 0.3), rgba(76, 175, 80, 0.3));
    color: #fff;
    font-weight: 500;
    box-shadow: 0 0 20px rgba(139, 195, 74, 0.6), inset 0 0 20px rgba(139, 195, 74, 0.2);
}

/* Result screen */
.result-card {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    padding: 25px 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(139, 195, 74, 0.1);
    border: 2px solid rgba(139, 195, 74, 0.3);
}

.result-image {
    margin-bottom: 15px;
}

.character-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border: 3px solid;
    position: relative;
    animation: glow 2s ease-in-out infinite alternate;
}

.character-avatar.protagonist {
    background: linear-gradient(135deg, #1e3a1e, #2d5a2d, #4caf50);
    border-color: #8bc34a;
    color: #8bc34a;
    box-shadow: 0 0 30px rgba(139, 195, 74, 0.8);
}

.character-avatar.antagonist {
    background: linear-gradient(135deg, #3a1e1e, #5a2d2d, #af4c4c);
    border-color: #ff5252;
    color: #ff5252;
    box-shadow: 0 0 30px rgba(255, 82, 82, 0.8);
}

.character-avatar.neutral {
    background: linear-gradient(135deg, #3a3a1e, #5a5a2d, #afaf4c);
    border-color: #ff9800;
    color: #ff9800;
    box-shadow: 0 0 30px rgba(255, 152, 0, 0.8);
}

.character-avatar.lawful {
    background: linear-gradient(135deg, #1e2a3a, #2d3f5a, #4c6faf);
    border-color: #2196f3;
    color: #2196f3;
    box-shadow: 0 0 30px rgba(33, 150, 243, 0.8);
}

@keyframes glow {
    0% { 
        box-shadow: 0 0 20px currentColor;
        transform: scale(1);
    }
    100% { 
        box-shadow: 0 0 40px currentColor, 0 0 60px currentColor;
        transform: scale(1.05);
    }
}

.result-card h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: #8bc34a;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(139, 195, 74, 0.5);
}

.result-card h2 small {
    display: block;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: normal;
    margin-top: 5px;
    letter-spacing: 1px;
}

.result-card p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 15px;
    line-height: 1.6;
}

.result-traits {
    background: rgba(40, 40, 40, 0.6);
    backdrop-filter: blur(5px);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: left;
    border: 2px solid rgba(139, 195, 74, 0.3);
    box-shadow: inset 0 0 20px rgba(139, 195, 74, 0.1);
}

.result-traits h4 {
    font-family: 'Bebas Neue', sans-serif;
    color: #8bc34a;
    margin-bottom: 8px;
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(139, 195, 74, 0.4);
}

.result-traits ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 5px;
}

.result-traits li {
    padding: 3px 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

.result-traits li:before {
    content: "⚗️ ";
    margin-right: 5px;
}

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

/* Buttons */
.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:focus,
.btn:active {
    outline: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #8bc34a, #ff9800, #4caf50);
    background-size: 200% 200%;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    animation: buttonGradient 3s ease infinite;
    box-shadow: 0 4px 15px rgba(139, 195, 74, 0.4);
}

@keyframes buttonGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 195, 74, 0.6);
}

.btn-secondary {
    background: rgba(40, 40, 40, 0.7);
    backdrop-filter: blur(5px);
    color: #8bc34a;
    border: 2px solid #8bc34a;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #8bc34a, #4caf50);
    color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 195, 74, 0.5);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.dashboard-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 25px;
    background: linear-gradient(135deg, #8bc34a, #4caf50);
    color: #1a1a1a;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 195, 74, 0.3);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.dashboard-link:focus,
.dashboard-link:active {
    outline: none;
}

.dashboard-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 195, 74, 0.5);
    background: linear-gradient(135deg, #4caf50, #8bc34a);
}

.dashboard-link:visited {
    color: #1a1a1a;
}

/* Share confirmation popup */
.share-confirmation {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #8bc34a, #4caf50);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 195, 74, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.share-confirmation.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.share-confirmation-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-check {
    font-size: 1.5rem;
    font-weight: bold;
    background: white;
    color: #4caf50;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkPop 0.3s ease;
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.share-confirmation-content p {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .welcome-card,
    .quiz-container,
    .result-card {
        padding: 25px;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
    }
    
    .character-avatar {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .welcome-card,
    .quiz-container,
    .result-card {
        padding: 20px;
    }
    
    .character-avatar {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}
