@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Roboto+Mono:wght@300;400;500&display=swap');

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

body {
    font-family: 'Roboto Mono', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%) !important;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* Remove height: 100vh to allow page to extend */
}

/* Ensure background applies at all screen sizes */
html {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%) !important;
}

/* Force dark background on all screen sizes including MacBook 13" */
html, body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%) !important;
    background-attachment: fixed !important;
}

/* Animated Background Particles */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10; /* Further behind to ensure no interference */
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    opacity: 0.6;
}

.particle:nth-child(1) {
    width: 4px;
    height: 4px;
    background: #00f5ff;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 8s;
    box-shadow: 0 0 10px #00f5ff;
}

.particle:nth-child(2) {
    width: 6px;
    height: 6px;
    background: #39ff14;
    left: 20%;
    animation-delay: 2s;
    animation-duration: 10s;
    box-shadow: 0 0 12px #39ff14;
}

.particle:nth-child(3) {
    width: 3px;
    height: 3px;
    background: #00f5ff;
    left: 30%;
    animation-delay: 4s;
    animation-duration: 7s;
    box-shadow: 0 0 8px #00f5ff;
}

.particle:nth-child(4) {
    width: 5px;
    height: 5px;
    background: #39ff14;
    left: 40%;
    animation-delay: 1s;
    animation-duration: 9s;
    box-shadow: 0 0 10px #39ff14;
}

.particle:nth-child(5) {
    width: 4px;
    height: 4px;
    background: #00f5ff;
    left: 50%;
    animation-delay: 3s;
    animation-duration: 11s;
    box-shadow: 0 0 10px #00f5ff;
}

.particle:nth-child(6) {
    width: 7px;
    height: 7px;
    background: #39ff14;
    left: 60%;
    animation-delay: 5s;
    animation-duration: 8s;
    box-shadow: 0 0 14px #39ff14;
}

.particle:nth-child(7) {
    width: 3px;
    height: 3px;
    background: #00f5ff;
    left: 70%;
    animation-delay: 2.5s;
    animation-duration: 12s;
    box-shadow: 0 0 8px #00f5ff;
}

.particle:nth-child(8) {
    width: 5px;
    height: 5px;
    background: #39ff14;
    left: 80%;
    animation-delay: 4.5s;
    animation-duration: 7.5s;
    box-shadow: 0 0 10px #39ff14;
}

.particle:nth-child(9) {
    width: 4px;
    height: 4px;
    background: #00f5ff;
    left: 90%;
    animation-delay: 1.5s;
    animation-duration: 10.5s;
    box-shadow: 0 0 10px #00f5ff;
}

.particle:nth-child(10) {
    width: 6px;
    height: 6px;
    background: #39ff14;
    left: 15%;
    animation-delay: 3.5s;
    animation-duration: 9.5s;
    box-shadow: 0 0 12px #39ff14;
}

@keyframes float {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(50vh) rotate(180deg);
        opacity: 1;
    }
}

/* Main container adjustments */
.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto; /* Auto height for compact layout */
    min-height: auto;
    gap: 2rem;
    padding: 2rem;
    margin-top: 80px;
    align-items: center; /* Vertically center the sections */
}

.header {
    position: fixed; /* Changed from absolute to fixed for better positioning */
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-bottom: 1px solid #00f5ff;
    z-index: 1000; /* Higher z-index to ensure it's always on top */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.5);
}

.header .history-btn {
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    color: #000;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
    display: block; /* Override the display: none */
}

.header .history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 245, 255, 0.5);
    background: linear-gradient(45deg, #39ff14, #00f5ff);
}

.main-content {
    margin-top: 80px;
    /* Remove this line: height: calc(100vh - 120px); */
    min-height: auto; /* Allow natural height */
    margin-bottom: 2rem; /* Add space before games section */
}

.chat-section,
.study-section {
    background: rgba(15, 15, 35, 0.8);
    border-radius: 15px;
    border: 1px solid #00f5ff;
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.2);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    padding: 2rem;
    height: 600px; /* Fixed height for both sections to match */
    min-height: 600px;
    max-height: 600px;
}

.study-section {
    border-color: #39ff14;
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.2);
    gap: 1.5rem; /* Reduced gap for more compact layout */
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    max-height: none; /* Remove max height to allow full expansion */
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 245, 255, 0.2);
    margin-bottom: 1rem;
}

.chat-header h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #00f5ff;
    margin: 0; /* Remove default margin */
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    flex-shrink: 0; /* Prevent avatar from shrinking */
    font-size: 1.2rem; /* Size for the robot emoji */
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 245, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 245, 255, 0.8); }
}

.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    word-wrap: break-word;
}

.ai-message {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), rgba(0, 245, 255, 0.05));
    border: 1px solid rgba(0, 245, 255, 0.3);
    align-self: flex-start;
}

.user-message {
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.1), rgba(57, 255, 20, 0.05));
    border: 1px solid rgba(57, 255, 20, 0.3);
    align-self: flex-end;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #333;
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00f5ff;
    border-radius: 25px;
    padding: 0.8rem 1rem;
    color: #e0e0e0;
    font-family: 'Roboto Mono', monospace;
}

.chat-input input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.btn {
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    border: none;
    border-radius: 25px;
    padding: 0.8rem 1.5rem;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Roboto Mono', monospace;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 245, 255, 0.4);
}

.timer-container {
    text-align: center;
    position: relative;
}

.timer-container .btn {
    display: block;
    margin: 0.5rem auto;
    width: fit-content;
}

.timer-display {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: #00f5ff;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    pointer-events: none;
}

.progress-ring {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    position: absolute;
    top: 0;
    left: 0;
}

.progress-ring circle {
    fill: none;
    stroke-width: 8;
    r: 90; /* Set radius */
    cx: 100; /* Center x */
    cy: 100; /* Center y */
}

.progress-bg {
    stroke: rgba(0, 245, 255, 0.2);
    stroke-dasharray: 565.48; /* 2 * π * r = 2 * π * 90 */
    stroke-dashoffset: 0;
}

.progress-bar {
    stroke: #00f5ff; /* Use solid color instead of gradient for now */
    stroke-linecap: round;
    stroke-dasharray: 565.48; /* Same as background */
    stroke-dashoffset: 565.48; /* Start with full offset (empty) */
    transition: stroke-dashoffset 0.3s ease;
}

/* Add the gradient definition back */
.progress-ring defs linearGradient {
    --gradient-start: #00f5ff;
    --gradient-end: #39ff14;
}

.start-btn, .finish-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    margin: 0 auto;
    display: block;
    min-width: 200px;
}

/* Smaller buttons when session is active (multiple buttons visible) */
.study-section.session-active .start-btn,
.study-section.session-active .finish-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    min-width: 150px;
    margin: 0.5rem auto;
}

/* Button container for active sessions */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
}

.motivation-text {
    text-align: center;
    font-size: 1.1rem;
    color: #39ff14;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
    margin: 1rem 0;
}

/* Game Rewards Section - Full Width Row */
.games-section-wrapper {
    width: 100%;
    padding: 2rem;
    margin-top: 2rem;
}

/* Less vibrant Games Section */
.games-section {
    border: 1px solid rgba(0, 245, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.15);
    padding: 20px;
    background: linear-gradient(to bottom, rgba(17, 24, 39, 0.8), rgba(31, 41, 55, 0.6));
    color: #00f5ff;
    transition: box-shadow 0.3s;
    max-width: 1200px;
    margin: 0 auto; /* Center the games section */
}

.games-section.unlocked {
    opacity: 1;
    pointer-events: all;
    animation: unlock 0.8s ease;
}

@keyframes unlock {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.game-card {
    background: #0f172a;
    border: 1px solid #39ff14;
    border-radius: 10px;
    color: #fff;
    padding: 1rem;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
    cursor: pointer;
}

.game-card.locked {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%) blur(1px);
    border-color: #444;
    background: #181e29;
    color: #888;
}

.game-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 2;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-card.unlocked {
    border-color: rgba(0, 245, 255, 0.6);
    background: rgba(17, 34, 51, 0.8);
    box-shadow: 0 0 5px rgba(0, 245, 255, 0.4);
    color: #00f5ff;
    animation: unlockGlowSubtle 1s ease-in-out;
}

@keyframes unlockGlowSubtle {
    0% { 
        opacity: 0.4;
        filter: grayscale(100%) blur(1px);
        box-shadow: 0 0 0 rgba(0, 245, 255, 0);
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
    }
    100% { 
        opacity: 1;
        filter: none;
        box-shadow: 0 0 5px rgba(0, 245, 255, 0.4);
    }
}

.progress-indicator {
    margin-top: 0.5rem;
}

.progress-bar-mini {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.6rem;
    color: #888;
    text-align: center;
}

.unlock-celebration-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(31, 41, 55, 0.9);
    border: 1px solid rgba(57, 255, 20, 0.6);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    z-index: 1000;
    animation: celebrationBounceSubtle 4s ease-in-out;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.2);
}

@keyframes celebrationBounceSubtle {
    0%, 100% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    10%, 90% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
}

.celebration-content h3 {
    color: rgba(57, 255, 20, 0.9);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.celebration-content p {
    color: #e0e0e0;
    margin-bottom: 0.5rem;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #00f5ff;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Hide the separate history toggle section */
.history-toggle {
    display: none;
}

/* History Section - appears below main content */
.history-section {
    width: 100%;
    background: rgba(15, 15, 35, 0.95);
    border-top: 3px solid #00f5ff;
    box-shadow: 0 -10px 30px rgba(0, 245, 255, 0.2);
    backdrop-filter: blur(20px);
    margin-top: 2rem; /* Reduced margin since games section adds separation */
    padding: 3rem 2rem;
}

.history-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #00f5ff;
}

.history-header h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.5);
    margin: 0;
}

.history-content {
    max-width: 1200px;
    margin: 0 auto;
}

.history-table {
    width: 100%;
    background: rgba(25, 25, 45, 0.9);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid #39ff14;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.2);
}

.history-table th,
.history-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(57, 255, 20, 0.2);
}

.history-table th {
    background: rgba(57, 255, 20, 0.2);
    color: #39ff14;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-table td {
    color: #e0e0e0;
    font-family: 'Roboto Mono', monospace;
}

.history-table tr:hover {
    background: rgba(0, 245, 255, 0.1);
    transition: all 0.3s ease;
}

.chart-container {
    background: rgba(25, 25, 45, 0.9);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid #39ff14;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.2);
    margin-top: 2rem;
}

#sessionChart {
    height: 400px !important;
    width: 100% !important;
}

.no-sessions {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 4rem 2rem;
    font-size: 1.2rem;
}

.error-message {
    color: #ff4444;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 10px;
    border: 1px solid #ff4444;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin: 1rem 0;
    width: 100%;
    max-width: 100%;
}

.stat-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #39ff14;
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.2);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(57, 255, 20, 0.4);
    border-color: #00f5ff;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: #39ff14;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
    display: block;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.75rem;
    color: #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.games-section h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #39ff14;
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

#unlockMessage {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(57, 255, 20, 0.5);
    border-radius: 10px;
    color: rgba(57, 255, 20, 0.9);
    font-weight: 600;
    margin-bottom: 1.2rem;
    text-align: center;
    box-shadow: 0 0 6px rgba(57, 255, 20, 0.2);
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

@keyframes unlockPulse {
    0%, 100% { 
        box-shadow: 0 0 6px rgba(57, 255, 20, 0.2);
    }
    50% { 
        box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
    }
}

/* Add these mobile-specific improvements */
@media (max-width: 600px) {
    /* Force dark theme on all mobile elements */
    body, html {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%) !important;
        color: #e0e0e0 !important;
    }
    
    /* Ensure all containers maintain EXACT desktop styling */
    .container, .main-content, .chat-section, .study-section {
        background: rgba(15, 15, 35, 0.8) !important;
        border: 1px solid #00f5ff !important;
        border-radius: 15px !important;
        box-shadow: 0 0 30px rgba(0, 245, 255, 0.2) !important;
        color: #e0e0e0 !important;
        backdrop-filter: blur(10px) !important;
    }
    
    .study-section {
        border-color: #39ff14 !important;
        box-shadow: 0 0 30px rgba(57, 255, 20, 0.2) !important;
    }
    
    /* Ensure chat input maintains desktop styling */
    .chat-input input {
        background: rgba(0, 0, 0, 0.5) !important;
        border: 1px solid #00f5ff !important;
        border-radius: 25px !important;
        color: #e0e0e0 !important;
    }
    
    .chat-input input:focus {
        outline: none !important;
        box-shadow: 0 0 10px rgba(0, 245, 255, 0.5) !important;
    }
    
    /* Force animated background visibility */
    .animated-background {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: -10 !important;
        pointer-events: none !important;
        overflow: hidden !important;
    }
    
    .particle {
        opacity: 0.6 !important;
        animation: float 6s ease-in-out infinite !important;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        margin: 0.8rem 0;
        width: 100%;
        max-width: 100%;
    }
    
    .stat-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 0.6rem;
        background: rgba(0, 0, 0, 0.5) !important;
        border: 1px solid #39ff14 !important;
        border-radius: 10px !important;
        box-shadow: 0 0 15px rgba(57, 255, 20, 0.2) !important;
    }
    
    .stat-value {
        font-size: 1.2rem;
        color: #39ff14 !important;
        text-shadow: 0 0 10px rgba(57, 255, 20, 0.5) !important;
    }
}

/* Tablet breakpoint to fix stats overlap between 769px and 812px */
@media (max-width: 812px) and (min-width: 769px) {
    .container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .chat-section,
    .study-section {
        width: 100%;
        max-width: none;
        /* Preserve desktop styling */
        background: rgba(15, 15, 35, 0.8) !important;
        border-radius: 15px !important;
        border: 1px solid #00f5ff !important;
        box-shadow: 0 0 30px rgba(0, 245, 255, 0.2) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    .study-section {
        border-color: #39ff14 !important;
        box-shadow: 0 0 30px rgba(57, 255, 20, 0.2) !important;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        margin: 1rem 0;
        justify-content: center;
    }
    
    .stat-card {
        padding: 0.8rem;
        min-width: 100px;
        /* Preserve stat card styling */
        background: rgba(0, 0, 0, 0.5) !important;
        border: 1px solid #39ff14 !important;
        border-radius: 10px !important;
        box-shadow: 0 0 15px rgba(57, 255, 20, 0.2) !important;
    }
    
    .stat-value {
        font-size: 1.3rem;
        color: #39ff14 !important;
        text-shadow: 0 0 10px rgba(57, 255, 20, 0.5) !important;
    }
    
    /* Preserve chat input styling */
    .chat-input input {
        background: rgba(0, 0, 0, 0.5) !important;
        border: 1px solid #00f5ff !important;
        border-radius: 25px !important;
        color: #e0e0e0 !important;
    }
    
    .chat-input input:focus {
        box-shadow: 0 0 10px rgba(0, 245, 255, 0.5) !important;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.8rem 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header .history-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto; /* Stack vertically */
        gap: 1rem;
        padding: 1rem;
        margin-top: 60px;
    }
    
    .chat-section,
    .study-section {
        padding: 1rem;
        height: auto; /* Allow natural height on mobile */
        min-height: auto;
        max-height: none;
        /* Preserve desktop styling */
        background: rgba(15, 15, 35, 0.8) !important;
        border-radius: 15px !important;
        border: 1px solid #00f5ff !important;
        box-shadow: 0 0 30px rgba(0, 245, 255, 0.2) !important;
        backdrop-filter: blur(10px) !important;
        color: #e0e0e0 !important;
    }
    
    .study-section {
        border-color: #39ff14 !important;
        box-shadow: 0 0 30px rgba(57, 255, 20, 0.2) !important;
    }
    
    .chat-messages {
        max-height: 400px; /* Larger height for mobile chat messages */
        min-height: 300px;
    }
    
    .timer-display {
        font-size: 2rem;
    }
    
    .progress-ring {
        width: 180px;
        height: 180px;
    }
    
    /* Keep the SVG circles with original dimensions - don't override them */
    /* The HTML has cx="100" cy="100" r="90" and stroke-dasharray="565.48" which should work */
    
    .stats {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        margin: 1rem 0;
    }
    
    .stat-card {
        padding: 0.8rem;
        /* Preserve stat card styling on mobile */
        background: rgba(0, 0, 0, 0.5) !important;
        border: 1px solid #39ff14 !important;
        border-radius: 10px !important;
        box-shadow: 0 0 15px rgba(57, 255, 20, 0.2) !important;
        transition: all 0.3s ease !important;
    }
    
    .stat-value {
        font-size: 1.2rem;
        color: #39ff14 !important;
        text-shadow: 0 0 10px rgba(57, 255, 20, 0.5) !important;
    }
    
    /* Preserve chat input styling on mobile */
    .chat-input input {
        background: rgba(0, 0, 0, 0.5) !important;
        border: 1px solid #00f5ff !important;
        border-radius: 25px !important;
        color: #e0e0e0 !important;
    }
    
    .chat-input input:focus {
        box-shadow: 0 0 10px rgba(0, 245, 255, 0.5) !important;
    }
    
    .motivation-text {
        font-size: 1rem;
        margin: 0.8rem 0;
    }
    
    .start-btn, .finish-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        min-width: 180px;
    }
    
    /* Even smaller buttons for active sessions on mobile */
    .study-section.session-active .start-btn,
    .study-section.session-active .finish-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        min-width: 140px;
        margin: 0.3rem auto;
    }
    
    /* Games section responsive */
    .games-section-wrapper {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        margin-top: 0.8rem;
    }
    
    .game-card {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Fix history section for mobile */
    .history-section {
        margin-top: 4rem !important; /* Large margin to separate from main content */
        padding: 2rem 1rem !important;
        border-top: 3px solid #00f5ff !important;
        box-shadow: 0 -15px 30px rgba(0, 245, 255, 0.3) !important;
    }
    
    .history-header {
        margin-bottom: 1.5rem !important;
        padding-bottom: 1rem !important;
    }
    
    .history-header h2 {
        font-size: 1.8rem !important;
    }
    
    .history-table {
        font-size: 0.8rem;
    }
    
    .history-table th,
    .history-table td {
        padding: 0.5rem;
    }
    
    .chart-container {
        padding: 1rem !important;
        margin-top: 1rem !important;
    }
    
    #sessionChart {
        height: 250px !important;
    }
    
    /* Add bottom margin to main container for mobile */
    .container.main-content {
        margin-bottom: 3rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Ensure no overflow on mobile and preserve dark theme */
    body {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%) !important;
        color: #e0e0e0 !important;
        overflow-x: hidden;
    }
    
    /* Ensure main container maintains dark theme */
    .container {
        background: rgba(13, 13, 35, 0.9) !important;
        border: 1px solid rgba(0, 255, 255, 0.2) !important;
    }
    
    /* Make sure sections don't expand beyond container */
    .study-section {
        margin-bottom: 2rem !important;
    }
}

/* Add an even smaller breakpoint for very small screens */
@media (max-width: 480px) {
    /* Ensure dark theme is preserved on mobile */
    body {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%) !important;
        color: #e0e0e0 !important;
        overflow-x: hidden;
    }
    
    .header {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .header .history-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.7rem;
    }
    
    .container {
        padding: 0.5rem;
        margin-top: 80px; /* More space for stacked header */
        gap: 0.8rem;
    }
    
    .chat-section,
    .study-section {
        padding: 0.8rem;
    }
    
    /* Let timer display use the original styling from the main CSS */
    
    .progress-ring {
        width: 140px;
        height: 140px;
        margin: 1rem auto 1.5rem;
    }
    
    /* Keep original SVG circle dimensions from HTML - don't override them */
    
    .timer-display {
        font-size: 1.5rem;
    }
    
    .games-section-wrapper {
        padding: 0.5rem;
        margin-top: 0.8rem;
    }
    
    .history-section {
        margin-top: 3rem !important;
        padding: 1.5rem 0.5rem !important;
    }
    
    .history-header h2 {
        font-size: 1.5rem !important;
    }
    
    .history-table {
        font-size: 0.7rem;
    }
    
    .chart-container {
        padding: 0.5rem !important;
    }
    
    #sessionChart {
        height: 200px !important;
    }
}

/* Add these styles at the end of your CSS file: */

/* Custom Modal Styles */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #00f5ff;
    border-radius: 15px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 245, 255, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-title {
    color: #00f5ff;
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-message {
    color: #e0e0e0;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 120px;
}

.modal-btn-cancel {
    background: linear-gradient(45deg, #4a5568, #718096);
    color: white;
    border: 2px solid #a0aec0;
}

.modal-btn-cancel:hover {
    background: linear-gradient(45deg, #2d3748, #4a5568);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 85, 104, 0.4);
}

.modal-btn-confirm {
    background: linear-gradient(45deg, #dc2626, #ef4444);
    color: white;
    border: 2px solid #f87171;
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.3);
}

.modal-btn-confirm:hover {
    background: linear-gradient(45deg, #b91c1c, #dc2626);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4), 0 0 15px rgba(248, 113, 113, 0.5);
}

/* Responsive modal */
@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
        max-width: 350px;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .modal-btn {
        width: 100%;
        min-width: auto;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-message {
        font-size: 0.9rem;
    }
}

/* Palindrome Challenge Game Styles */
.palindrome-game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    padding: 1rem;
    box-sizing: border-box;
}

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

.palindrome-game-container {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #39ff14;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.3);
    animation: slideIn 0.4s ease-out;
    position: relative;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.palindrome-game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.palindrome-title {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    color: #39ff14;
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.8);
    margin: 0 0 0.5rem 0;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(57, 255, 20, 0.8);
    }
    to {
        text-shadow: 0 0 30px rgba(57, 255, 20, 1), 0 0 40px rgba(57, 255, 20, 0.6);
    }
}

.palindrome-subtitle {
    color: #e0e0e0;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    margin: 0;
    opacity: 0.8;
}

.palindrome-input-section {
    margin-bottom: 1.5rem;
}

.palindrome-input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00f5ff;
    border-radius: 15px;
    color: #e0e0e0;
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}

.palindrome-input:focus {
    outline: none;
    border-color: #39ff14;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.4);
    transform: translateY(-2px);
}

.palindrome-input::placeholder {
    color: #888;
    opacity: 0.7;
}

.palindrome-button-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.palindrome-check-btn {
    background: linear-gradient(45deg, #39ff14, #00f5ff);
    border: none;
    border-radius: 25px;
    padding: 1rem 2rem;
    color: #000;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 200px;
}

.palindrome-check-btn:hover {
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    transform: translateY(-3px);
    box-shadow: 0 5px 25px rgba(57, 255, 20, 0.5);
    scale: 1.05;
}

.palindrome-check-btn:active {
    transform: translateY(-1px);
    scale: 0.98;
}

.palindrome-result {
    text-align: center;
    margin-bottom: 2rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.palindrome-result p {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    padding: 1rem;
    border-radius: 10px;
    border: 2px solid transparent;
    background: rgba(0, 0, 0, 0.3);
}

.palindrome-result.success p {
    color: #39ff14;
    border-color: #39ff14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
    animation: successPulse 0.6s ease-out;
}

.palindrome-result.error p {
    color: #ff4757;
    border-color: #ff4757;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
    animation: errorShake 0.6s ease-out;
}

.palindrome-result.warning p {
    color: #ffa502;
    border-color: #ffa502;
    box-shadow: 0 0 15px rgba(255, 165, 2, 0.3);
    animation: warningBounce 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

@keyframes warningBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.palindrome-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.palindrome-control-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.clear-btn {
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    color: #000;
    border: 2px solid transparent;
}

.clear-btn:hover {
    background: linear-gradient(45deg, #39ff14, #00f5ff);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 245, 255, 0.4);
}

.close-btn {
    background: linear-gradient(45deg, #ff4757, #ff6b7a);
    color: white;
    border: 2px solid transparent;
}

.close-btn:hover {
    background: linear-gradient(45deg, #ff6b7a, #ff4757);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

/* Mobile Responsive for Palindrome Game */
@media (max-width: 768px) {
    .palindrome-game-container {
        padding: 1.5rem;
        margin: 1rem;
        max-width: none;
        width: calc(100% - 2rem);
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .palindrome-title {
        font-size: 1.5rem;
    }
    
    .palindrome-subtitle {
        font-size: 0.9rem;
    }
    
    .palindrome-input {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
    
    .palindrome-check-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        min-width: 180px;
    }
    
    .palindrome-result p {
        font-size: 1.1rem;
        padding: 0.8rem;
    }
    
    .palindrome-controls {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .palindrome-control-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Enhanced Palindrome Game Styles */
.palindrome-game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.palindrome-stat {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: #e0e0e0;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(57, 255, 20, 0.3);
    text-align: center;
    min-width: 80px;
}

.palindrome-score-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #39ff14;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.palindrome-timer {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #00f5ff;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
    animation: timerPulse 1s ease-in-out infinite;
}

.palindrome-timer.warning {
    color: #ffa502;
    text-shadow: 0 0 10px rgba(255, 165, 2, 0.5);
    animation: timerWarning 0.5s ease-in-out infinite;
}

.palindrome-timer.danger {
    color: #ff4757;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
    animation: timerDanger 0.3s ease-in-out infinite;
}

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

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

.palindrome-high-score {
    font-family: 'Orbitron', monospace;
    color: #39ff14;
    font-weight: 700;
}

.palindrome-found-list {
    margin: 1.5rem 0;
    text-align: center;
}

.palindrome-found-list h4 {
    color: #39ff14;
    font-family: 'Orbitron', monospace;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.palindrome-found-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(57, 255, 20, 0.2);
}

.found-palindrome-item {
    background: linear-gradient(45deg, rgba(57, 255, 20, 0.2), rgba(0, 245, 255, 0.2));
    color: #e0e0e0;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid rgba(57, 255, 20, 0.4);
    animation: foundItemSlide 0.3s ease-out;
}

@keyframes foundItemSlide {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.palindrome-end-screen {
    text-align: center;
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.palindrome-end-screen h2 {
    font-family: 'Orbitron', monospace;
    color: #39ff14;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.8);
}

.palindrome-final-stats {
    margin-bottom: 2rem;
}

.palindrome-final-score {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    color: #39ff14;
    text-shadow: 0 0 30px rgba(57, 255, 20, 1);
    margin-bottom: 1rem;
    animation: scoreReveal 1s ease-out;
}

@keyframes scoreReveal {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.palindrome-stats-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.palindrome-stats-breakdown div {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 245, 255, 0.3);
    font-family: 'Roboto Mono', monospace;
    color: #e0e0e0;
}

.palindrome-performance-message {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    color: #e0e0e0;
    margin: 1rem 0;
    opacity: 0.9;
}

.palindrome-end-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.palindrome-control-btn.primary {
    background: linear-gradient(45deg, #39ff14, #00f5ff);
    color: #000;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.palindrome-control-btn.primary:hover {
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    transform: translateY(-3px);
    box-shadow: 0 5px 25px rgba(57, 255, 20, 0.5);
}

/* Mobile responsive for enhanced palindrome game */
@media (max-width: 768px) {
    .palindrome-game-stats {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .palindrome-stat {
        min-width: auto;
        width: 100%;
    }
    
    .palindrome-found-container {
        max-height: 80px;
        font-size: 0.8rem;
    }
    
    .palindrome-stats-breakdown {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .palindrome-end-controls {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .palindrome-end-screen {
        padding: 1rem;
        max-height: 75vh;
    }
    
    .palindrome-final-score {
        font-size: 2rem;
    }
    
    .palindrome-control-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Brain Flash Quiz Game Styles */
.quiz-game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

.quiz-game-container {
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e);
    border: 3px solid #00f5ff;
    border-radius: 25px;
    padding: 2rem;
    max-width: 700px;
    width: 95%;
    box-shadow: 0 0 40px rgba(0, 245, 255, 0.4);
    animation: slideIn 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.quiz-game-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #00f5ff, #39ff14, #ff4757, #00f5ff);
    border-radius: 25px;
    z-index: -1;
    animation: borderFlow 3s linear infinite;
}

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

.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 245, 255, 0.3);
}

.quiz-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    color: #00f5ff;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
    margin: 0 0 1rem 0;
    animation: glow 2s ease-in-out infinite alternate;
}

.quiz-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.quiz-timer {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #39ff14;
    background: rgba(57, 255, 20, 0.1);
    border: 2px solid #39ff14;
    border-radius: 15px;
    padding: 0.5rem 1rem;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.8);
    animation: timerPulse 1s ease-in-out infinite;
    min-width: 80px;
    text-align: center;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(57, 255, 20, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(57, 255, 20, 0.8); }
}

.quiz-timer.warning {
    color: #ffa502;
    border-color: #ffa502;
    animation: timerWarning 0.5s ease-in-out infinite;
}

@keyframes timerWarning {
    0%, 100% { background-color: rgba(255, 165, 2, 0.1); }
    50% { background-color: rgba(255, 165, 2, 0.3); }
}

.quiz-timer.danger {
    color: #ff4757;
    border-color: #ff4757;
    animation: timerDanger 0.3s ease-in-out infinite;
}

@keyframes timerDanger {
    0%, 100% { background-color: rgba(255, 71, 87, 0.1); }
    50% { background-color: rgba(255, 71, 87, 0.4); }
}

.quiz-score, .quiz-high-score {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: #e0e0e0;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 245, 255, 0.3);
}

.quiz-content {
    margin-bottom: 2rem;
}

.quiz-question-container {
    text-align: center;
    margin-bottom: 2rem;
}

.quiz-question-number {
    font-family: 'Orbitron', monospace;
    color: #39ff14;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.quiz-question {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    color: #e0e0e0;
    background: rgba(0, 0, 0, 0.6);
    padding: 1.5rem;
    border-radius: 15px;
    border: 2px solid rgba(0, 245, 255, 0.3);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-option {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(26, 26, 46, 0.8));
    border: 2px solid rgba(0, 245, 255, 0.5);
    border-radius: 15px;
    padding: 1rem;
    color: #e0e0e0;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

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

.quiz-option:hover {
    border-color: #00f5ff;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 245, 255, 0.3);
}

.quiz-option:hover::before {
    left: 100%;
}

.quiz-option.correct {
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.2), rgba(57, 255, 20, 0.1));
    border-color: #39ff14;
    color: #39ff14;
    animation: correctAnswer 0.6s ease-out;
}

.quiz-option.incorrect {
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.2), rgba(255, 71, 87, 0.1));
    border-color: #ff4757;
    color: #ff4757;
    animation: incorrectAnswer 0.6s ease-out;
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

.quiz-feedback {
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 1rem;
    border-radius: 10px;
    transition: all 0.5s ease;
    margin-top: 1rem;
}

.quiz-feedback.correct {
    color: #39ff14;
    background: rgba(57, 255, 20, 0.1);
    border: 2px solid #39ff14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.quiz-feedback.incorrect {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
    border: 2px solid #ff4757;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
}

.quiz-end-screen {
    text-align: center;
    padding: 2rem;
}

.quiz-end-title {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    color: #00f5ff;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
}

.quiz-final-score {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
    color: #39ff14;
    text-shadow: 0 0 30px rgba(57, 255, 20, 1);
    margin-bottom: 1rem;
    animation: scoreReveal 1s ease-out;
}

@keyframes scoreReveal {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.quiz-performance {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.quiz-end-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quiz-restart-btn, .quiz-close-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 25px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 150px;
}

.quiz-restart-btn {
    background: linear-gradient(45deg, #39ff14, #00f5ff);
    color: #000;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.quiz-restart-btn:hover {
    background: linear-gradient(45deg, #00f5ff, #39ff14);
    transform: translateY(-3px);
    box-shadow: 0 5px 25px rgba(57, 255, 20, 0.5);
}

.quiz-close-btn {
    background: linear-gradient(45deg, #ff4757, #ff6b7a);
    color: white;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
}

.quiz-close-btn:hover {
    background: linear-gradient(45deg, #ff6b7a, #ff4757);
    transform: translateY(-3px);
    box-shadow: 0 5px 25px rgba(255, 71, 87, 0.5);
}

.quiz-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.quiz-control-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.6);
    color: #e0e0e0;
    border: 1px solid rgba(0, 245, 255, 0.3);
}

.quiz-control-btn:hover {
    border-color: #00f5ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 245, 255, 0.3);
}

.quiz-pause-btn:hover {
    background: rgba(255, 165, 2, 0.2);
    border-color: #ffa502;
}

.quiz-exit-btn:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: #ff4757;
}

/* Mobile Responsive for Quiz Game */
@media (max-width: 768px) {
    .quiz-game-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .quiz-title {
        font-size: 2rem;
    }
    
    .quiz-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .quiz-timer {
        font-size: 1.5rem;
    }
    
    .quiz-question {
        font-size: 1.2rem;
        padding: 1rem;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .quiz-option {
        padding: 0.8rem;
        font-size: 0.9rem;
        min-height: 50px;
    }
    
    .quiz-final-score {
        font-size: 2rem;
    }
    
    .quiz-end-controls {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .quiz-restart-btn, .quiz-close-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Emoji Puzzle Game Styles */
.emoji-game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

.emoji-game-container {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), rgba(57, 255, 20, 0.1));
    border: 2px solid #00f5ff;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 0 50px rgba(0, 245, 255, 0.3),
        inset 0 0 30px rgba(57, 255, 20, 0.1);
    position: relative;
    animation: emojiGameAppear 0.5s ease-out;
}

@keyframes emojiGameAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.emoji-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.emoji-game-header h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    color: #00f5ff;
    margin: 0;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.6);
}

.emoji-game-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.emoji-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #39ff14;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.emoji-stat-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: #39ff14;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.emoji-stat span:last-child {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    color: #ffffff;
    font-weight: bold;
}

.emoji-timer {
    font-size: 1.5rem !important;
    color: #00f5ff !important;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.8);
    transition: all 0.3s ease;
}

.emoji-timer.warning {
    color: #ffeb3b !important;
    text-shadow: 0 0 15px rgba(255, 235, 59, 0.8);
    animation: emojiTimerPulse 1s infinite;
}

.emoji-timer.danger {
    color: #f44336 !important;
    text-shadow: 0 0 20px rgba(244, 67, 54, 0.8);
    animation: emojiTimerPulse 0.5s infinite;
}

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

.emoji-close-btn {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid #f44336;
    color: #f44336;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-close-btn:hover {
    background: rgba(244, 67, 54, 0.4);
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
    transform: scale(1.1);
}

.emoji-game-content {
    text-align: center;
}

.emoji-sequence-display {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #00f5ff;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

.emoji-sequence-display h3 {
    font-family: 'Orbitron', monospace;
    color: #00f5ff;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.emoji-sequence-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    min-height: 80px;
    flex-wrap: wrap;
}

.emoji-sequence-item {
    font-size: 3rem;
    padding: 10px;
    background: rgba(57, 255, 20, 0.1);
    border: 2px solid #39ff14;
    border-radius: 15px;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
    animation: emojiGlow 2s infinite alternate;
    transition: all 0.3s ease;
}

.emoji-sequence-item.highlighting {
    transform: scale(1.2);
    background: rgba(0, 245, 255, 0.3);
    border-color: #00f5ff;
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.6);
}

@keyframes emojiGlow {
    from { box-shadow: 0 0 15px rgba(57, 255, 20, 0.3); }
    to { box-shadow: 0 0 25px rgba(57, 255, 20, 0.6); }
}

.emoji-input-section {
    margin-bottom: 30px;
}

.emoji-input-section h3 {
    font-family: 'Orbitron', monospace;
    color: #39ff14;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.emoji-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 80px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #39ff14;
    border-radius: 10px;
    flex-wrap: wrap;
}

.emoji-input-item {
    font-size: 2.5rem;
    padding: 8px;
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid #00f5ff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
    animation: emojiInputGlow 1.5s infinite alternate;
}

@keyframes emojiInputGlow {
    from { box-shadow: 0 0 10px rgba(0, 245, 255, 0.3); }
    to { box-shadow: 0 0 20px rgba(0, 245, 255, 0.5); }
}

.emoji-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.emoji-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00f5ff;
    border-radius: 15px;
    padding: 15px;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background: rgba(0, 245, 255, 0.2);
    border-color: #39ff14;
    box-shadow: 0 0 25px rgba(0, 245, 255, 0.4);
    transform: scale(1.1);
}

.emoji-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.6);
}

.emoji-btn.correct {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.6);
    animation: emojiCorrect 0.6s ease;
}

.emoji-btn.incorrect {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
    box-shadow: 0 0 25px rgba(244, 67, 54, 0.6);
    animation: emojiIncorrect 0.6s ease;
}

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

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

.emoji-feedback {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 20px 0;
    opacity: 0;
    transition: all 0.3s ease;
}

.emoji-feedback.correct {
    color: #4caf50;
    text-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
}

.emoji-feedback.incorrect {
    color: #f44336;
    text-shadow: 0 0 15px rgba(244, 67, 54, 0.6);
}

.emoji-game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.emoji-control-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00f5ff;
    color: #ffffff;
    border-radius: 12px;
    padding: 12px 24px;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
    min-width: 120px;
}

.emoji-control-btn:hover {
    background: rgba(0, 245, 255, 0.2);
    border-color: #39ff14;
    box-shadow: 0 0 25px rgba(0, 245, 255, 0.4);
    transform: translateY(-3px);
}

.emoji-control-btn.primary {
    background: linear-gradient(45deg, rgba(0, 245, 255, 0.2), rgba(57, 255, 20, 0.2));
    border-color: #39ff14;
}

.emoji-control-btn.primary:hover {
    background: linear-gradient(45deg, rgba(0, 245, 255, 0.3), rgba(57, 255, 20, 0.3));
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.5);
}

.emoji-end-screen {
    text-align: center;
    padding: 30px;
}

.emoji-end-screen h2 {
    font-family: 'Orbitron', monospace;
    color: #00f5ff;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 0 0 25px rgba(0, 245, 255, 0.6);
}

.emoji-final-stats {
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #39ff14;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.emoji-final-score {
    margin-bottom: 20px;
}

.emoji-score-label {
    font-family: 'Roboto Mono', monospace;
    color: #39ff14;
    font-size: 1.2rem;
    display: block;
    margin-bottom: 10px;
}

.emoji-score-value {
    font-family: 'Orbitron', monospace;
    color: #00f5ff;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.8);
}

.emoji-performance-message {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    color: #ffffff;
    line-height: 1.6;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.emoji-end-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Mobile Responsive for Emoji Game */
@media (max-width: 768px) {
    .emoji-game-container {
        padding: 20px;
        margin: 10px;
        max-height: 95vh;
    }
    
    .emoji-game-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .emoji-game-header h2 {
        font-size: 1.5rem;
    }
    
    .emoji-game-stats {
        justify-content: center;
        gap: 10px;
    }
    
    .emoji-stat {
        padding: 8px 12px;
    }
    
    .emoji-selection-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .emoji-btn {
        padding: 10px;
        font-size: 1.5rem;
    }
    
    .emoji-sequence-item {
        font-size: 2rem;
        padding: 8px;
    }
    
    .emoji-input-item {
        font-size: 2rem;
        padding: 6px;
    }
    
    .emoji-end-screen h2 {
        font-size: 2rem;
    }
    
    .emoji-score-value {
        font-size: 2.5rem;
    }
    
    .emoji-game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .emoji-control-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .emoji-selection-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .emoji-sequence-container {
        gap: 8px;
    }
    
    .emoji-sequence-item {
        font-size: 1.8rem;
    }
    
    .emoji-input-item {
        font-size: 1.8rem;
    }
}
