/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Fix for clickability issues */
button, .btn, [onclick], input[type="button"], input[type="submit"] {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 10;
}

/* Ensure modals are properly hidden */
.modal-overlay:not(.show):not([style*="display: flex"]) {
    display: none !important;
    pointer-events: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #219d13 100%);
    min-height: 100vh;
    color: #333;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

/* 🪙 Coin System Styles */
.coin-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    color: #FFD700;
    font-weight: 600;
    font-size: 1rem;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.1);
    transition: all 0.3s ease;
}

.coin-display:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

.coin-icon {
    font-size: 1.2rem;
    animation: coinSpin 3s ease-in-out infinite;
}

@keyframes coinSpin {
    0%, 90%, 100% { transform: rotateY(0deg); }
    45% { transform: rotateY(180deg); }
}

.coin-balance {
    font-family: 'Inter', monospace;
    letter-spacing: 0.5px;
}

.coin-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    margin-top: 10px;
    min-width: 250px;
    text-align: left;
}

.coin-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid rgba(0, 0, 0, 0.9);
}

.coin-display {
    position: relative;
}

.coin-display:hover .coin-tooltip {
    opacity: 1;
}

.tooltip-title {
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 0.3rem;
}

.tooltip-content {
    font-size: 0.85rem;
    line-height: 1.4;
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    animation: pulse 2s infinite;
}

.ai-dot.loading {
    background: #F59E0B;
}

.ai-dot.error {
    background: #EF4444;
    animation: none;
}

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

.nav-btn.ai-setup-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #4CAF50;
    color: white;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn.ai-setup-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}



/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

/* Interactive Editor View specific height handling */
#interactive-create-view {
    height: auto;
    min-height: calc(100vh - 120px);
    overflow-y: auto;
    /* Break out of container constraints for full-screen editor */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: #f8f9fa;
}

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

/* Home View */
.welcome-section {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.gcse-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

.cheese-easter-egg {
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    user-select: none;
}

.cheese-easter-egg:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.welcome-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.welcome-text {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.gcse-subjects-showcase {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin: 2rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.subject-pill {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.subject-pill:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.subject-pill.core {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.subject-pill.optional {
    background: rgba(255, 255, 255, 0.1);
}

.decks-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
}

.decks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.deck-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.deck-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

/* Deck Style Variations */
.deck-card.deck-classic::before {
    background: linear-gradient(90deg, #4a5568, #718096);
}

.deck-card.deck-modern::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.deck-card.deck-vintage::before {
    background: linear-gradient(90deg, #8b4513, #cd853f);
}

.deck-card.deck-neon::before {
    background: linear-gradient(90deg, #00ffff, #0080ff);
}

/* Deck Color Themes */
.deck-card.deck-blue::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.deck-card.deck-green::before {
    background: linear-gradient(90deg, #48bb78, #38a169);
}

.deck-card.deck-purple::before {
    background: linear-gradient(90deg, #9f7aea, #805ad5);
}

.deck-card.deck-red::before {
    background: linear-gradient(90deg, #f56565, #e53e3e);
}

.deck-card.deck-orange::before {
    background: linear-gradient(90deg, #ed8936, #dd6b20);
}

.deck-card.deck-teal::before {
    background: linear-gradient(90deg, #4fd1c7, #38b2ac);
}

.deck-style-indicator {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 0.25rem;
    font-weight: 500;
}

.deck-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.deck-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.deck-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.learning-indicator {
    font-size: 0.9rem;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

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

.deck-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.deck-subject {
    color: #718096;
    font-size: 0.9rem;
    font-weight: 500;
}

.deck-year-group {
    color: #4299e1;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(66, 153, 225, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    display: inline-block;
    width: fit-content;
}

.deck-actions {
    display: flex;
    gap: 0.5rem;
}

.deck-info {
    color: #4a5568;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.deck-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.deck-delete {
    background: #fed7d7;
    color: #c53030;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.deck-delete:hover {
    background: #feb2b2;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #4a5568;
}

/* Buttons */
.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    pointer-events: auto; /* Ensure buttons are clickable */
    position: relative; /* Ensure proper stacking */
    z-index: 10; /* Above most elements */
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-accent {
    background: #48bb78;
    color: white;
}

.btn-accent:hover {
    background: #38a169;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-info {
    background: #3182ce;
    color: white;
}

.btn-info:hover {
    background: #2c5aa0;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Learning Stats Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-overlay.show {
    display: flex; /* Only show when .show class is added */
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-weight: 500;
    color: #4a5568;
}

.stat-value {
    font-weight: 700;
    font-size: 1.25rem;
    color: #667eea;
}

.difficulty-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.difficulty {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: #f7fafc;
    color: #4a5568;
}

.cards-stats {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.card-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s;
}

.card-stat-item:hover {
    background: #f7fafc;
}

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

.card-question {
    font-weight: 500;
    flex: 1;
    margin-right: 1rem;
}

.card-stats-data {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.difficulty-indicator {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.difficulty-easy {
    background: #c6f6d5;
    color: #22543d;
}

.difficulty-normal {
    background: #faf089;
    color: #744210;
}

.difficulty-hard {
    background: #fed7d7;
    color: #742a2a;
}

.learning-insights {
    margin-top: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border-radius: 8px;
    border-left: 4px solid #38b2ac;
}

.learning-insights h4 {
    margin: 0 0 0.5rem 0;
    color: #234e52;
}

.insight-item {
    margin: 0.5rem 0;
    color: #234e52;
}

/* Stats Page Styles */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.stats-header h2 {
    color: #2d3748;
    font-size: 2rem;
    font-weight: 700;
}

.stats-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats-select {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.stats-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Overview Cards */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.chart-container h3 {
    margin: 0 0 1rem 0;
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container canvas {
    max-height: 300px;
}

/* Heatmap Container */
#heatmap-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    max-width: 100%;
    margin-top: 1rem;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 3px;
    background: #f1f5f9;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}

.heatmap-day:hover {
    transform: scale(1.1);
}

.heatmap-day.level-0 { background: #f1f5f9; }
.heatmap-day.level-1 { background: #c6f6d5; }
.heatmap-day.level-2 { background: #9ae6b4; }
.heatmap-day.level-3 { background: #68d391; }
.heatmap-day.level-4 { background: #48bb78; }
.heatmap-day.level-5 { background: #38a169; }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #64748b;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Insights Section */
.insights-section {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid #38b2ac;
}

.insights-section h3 {
    margin: 0 0 1rem 0;
    color: #234e52;
    font-size: 1.3rem;
}

.insight-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.insight-card:last-child {
    margin-bottom: 0;
}

.insight-icon {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.insight-content {
    flex: 1;
}

.insight-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.insight-description {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Responsive Design for Stats */
@media (max-width: 768px) {
    .stats-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .stats-overview {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* AI Generated Decks Section */
.generated-decks-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
    position: relative;
}

/* AI Lock Overlay */
.ai-lock-overlay {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    backdrop-filter: blur(10px);
    border: 2px dashed #cbd5e0;
    border-radius: 16px;
    padding: 3rem 2rem;
    margin: 2rem 0;
    text-align: center;
    transition: all 0.3s ease;
}

.ai-lock-overlay:hover {
    border-color: #a0aec0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.lock-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.lock-icon {
    font-size: 4rem;
    opacity: 0.7;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.lock-info {
    max-width: 500px;
}

.lock-info h4 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.lock-info p {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.progress-indicator {
    margin: 1.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.unlock-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 2rem;
}

.benefit-item {
    background: rgba(102, 126, 234, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    color: #4c51bf;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    border-left: 3px solid #667eea;
}

/* Disabled button styles */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none;
    box-shadow: none;
}

.section-subtitle {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    font-weight: 400;
}

.generation-status {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #0ea5e9;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

.status-content {
    flex: 1;
}

.status-title {
    font-weight: 600;
    color: #0c4a6e;
    margin-bottom: 0.25rem;
}

.status-description {
    color: #075985;
    font-size: 0.9rem;
}

.generated-decks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.generated-deck-card {
    background: linear-gradient(135deg, #fef7ff, #f3e8ff);
    border: 2px solid #a855f7;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generated-deck-card::before {
    content: '🤖';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    opacity: 0.6;
}

.generated-deck-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.2);
    border-color: #9333ea;
}

.generated-deck-header {
    margin-bottom: 1rem;
}

.generated-deck-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #581c87;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.generation-badge {
    background: #a855f7;
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.generated-deck-subject {
    color: #7c3aed;
    font-size: 0.9rem;
    font-weight: 500;
}

.generation-reason {
    background: rgba(168, 85, 247, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 1rem 0;
    border-left: 3px solid #a855f7;
}

.reason-title {
    font-weight: 600;
    color: #6b21a8;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.reason-description {
    color: #7c3aed;
    font-size: 0.8rem;
    line-height: 1.4;
}

.generated-deck-info {
    color: #7c3aed;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.confidence-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.confidence-bar {
    width: 60px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #10b981);
    transition: width 0.3s ease;
}

.generated-deck-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-ai {
    background: #a855f7;
    color: white;
}

.btn-ai:hover {
    background: #9333ea;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* AI Explanation Modal */
.ai-explanation {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.ai-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.step-icon {
    font-size: 1.5rem;
    margin-top: 0.25rem;
}

.step-content h4 {
    margin: 0 0 0.5rem 0;
    color: #2d3748;
    font-size: 1rem;
}

.step-content p {
    margin: 0;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ai-models-info {
    background: #fefcbf;
    border: 1px solid #f6e05e;
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
}

.ai-models-info h4 {
    margin: 0 0 0.5rem 0;
    color: #744210;
    font-size: 0.9rem;
}

.ai-models-info ul {
    margin: 0;
    padding-left: 1.5rem;
}

.ai-models-info li {
    margin-bottom: 0.25rem;
    color: #744210;
    font-size: 0.85rem;
}

.ai-models-info li strong {
    color: #553c09;
}

.privacy-note {
    background: #f0fff4;
    border: 1px solid #68d391;
    border-radius: 8px;
    padding: 1rem;
    color: #22543d;
    font-size: 0.9rem;
    text-align: center;
}

/* Delete Confirmation Modal */
.delete-warning {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
}

.warning-icon {
    font-size: 2rem;
    color: #dc2626;
}

.warning-content h4 {
    margin: 0 0 0.5rem 0;
    color: #991b1b;
    font-size: 1.1rem;
}

.warning-content p {
    margin: 0.25rem 0;
    color: #7f1d1d;
}

#delete-deck-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #991b1b;
    background: rgba(220, 38, 38, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.warning-text {
    font-size: 0.9rem;
    font-style: italic;
}

.confirmation-input {
    margin-bottom: 2rem;
}

.confirmation-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.confirmation-input input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.confirmation-input input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.confirmation-input input.valid {
    border-color: #10b981;
}

.input-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    font-style: italic;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-danger:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Responsive adjustments for generated decks */
@media (max-width: 768px) {
    .generated-decks-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
    
    .generation-status {
        padding: 1rem;
    }
    
    .generated-deck-card {
        padding: 1rem;
    }
    
    .generated-deck-buttons {
        justify-content: center;
    }
    
    .ai-lock-overlay {
        padding: 2rem 1rem;
        margin: 1rem 0;
    }
    
    .lock-icon {
        font-size: 3rem;
    }
    
    .lock-info h4 {
        font-size: 1.25rem;
    }
    
    .unlock-benefits {
        grid-template-columns: 1fr;
    }
    
    .benefit-item {
        text-align: center;
    }
}

/* Create View */
.create-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    color: white;
}

.create-header h2 {
    font-size: 2rem;
    font-weight: 600;
}

.deck-form {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cards-section {
    margin: 2rem 0;
}

.cards-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.card-item:hover {
    border-color: #cbd5e0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-number {
    font-weight: 600;
    color: #667eea;
}

.card-remove {
    background: #fed7d7;
    color: #c53030;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.card-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.card-input-group {
    display: flex;
    flex-direction: column;
}

.card-input-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.card-input-group input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Formatting Toolbar Styles */
.formatting-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    border-right: 1px solid #cbd5e1;
}

.toolbar-group:last-child {
    border-right: none;
}

.format-btn {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.format-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.format-btn:active,
.format-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.color-picker-group label {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
    min-width: fit-content;
}

.apply-text-color,
.apply-highlight-color {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    min-width: auto;
    height: 28px;
    white-space: nowrap;
}

/* Subscript and Superscript button styling */
.format-btn[data-command="subscript"],
.format-btn[data-command="superscript"] {
    font-family: 'Times New Roman', serif;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 38px;
}

.format-btn[data-command="subscript"]:hover,
.format-btn[data-command="superscript"]:hover {
    background: #e0e7ff;
    border-color: #8b5cf6;
}

.format-btn[data-command="subscript"]:active,
.format-btn[data-command="subscript"].active,
.format-btn[data-command="superscript"]:active,
.format-btn[data-command="superscript"].active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

/* Formatting help icon */
.formatting-help {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    cursor: help;
    font-size: 0.8rem;
    color: #6b7280;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

.formatting-help:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #9ca3af;
}

.text-color-picker,
.highlight-color-picker {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

/* Contenteditable Editor Styles */
.card-question-editor,
.card-answer-editor {
    min-height: 60px;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    outline: none;
    background: white;
    position: relative;
}

.card-question-editor:focus,
.card-answer-editor:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.card-question-editor.empty,
.card-answer-editor.empty {
    color: #9ca3af;
}

.card-question-editor .placeholder,
.card-answer-editor .placeholder {
    color: #9ca3af;
    pointer-events: none;
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    user-select: none;
}

/* === EXPLANATION EDITOR STYLES === */
.card-explanation-editor {
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    background: white;
    position: relative;
    font-family: inherit;
    resize: vertical;
}

.card-explanation-editor:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.card-explanation-editor.empty {
    color: #9ca3af;
}

.card-explanation-editor .placeholder {
    color: #9ca3af;
    pointer-events: none;
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    user-select: none;
}

.explanation-help {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    font-style: italic;
}

/* === MULTIPLE ANSWERS STYLES === */
.multiple-answers-container {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.answers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.answers-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.add-answer-btn {
    background: #10b981 !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.add-answer-btn:hover {
    background: #059669 !important;
    transform: translateY(-1px) !important;
}

.alternative-answers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alternative-answer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.alternative-answer-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
}

.alternative-answer-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.remove-answer-btn {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 0.8rem !important;
    min-width: 60px !important;
}

.remove-answer-btn:hover {
    background: #dc2626 !important;
}

/* Answer explanation display in flip card */
.answer-explanation {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.answer-explanation:empty {
    display: none;
}

/* Formatted answer display in study view */
.formatted-answer {
    display: inline;
}

/* Title Cards Section */
.title-cards-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.title-cards-section .section-description {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.title-cards-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.title-card-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.title-card-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.title-card-inputs .title-input {
    flex: 1;
}

.title-card-inputs .content-input {
    flex: 2;
}

.title-card-title-editor,
.title-card-content-editor {
    min-height: 60px;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    outline: none;
    background: white;
    position: relative;
}

.title-card-title-editor {
    font-weight: 600;
    font-size: 1rem;
}

.title-card-content-editor {
    min-height: 100px;
}

.title-card-title-editor:focus,
.title-card-content-editor:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.title-card-title-editor.empty,
.title-card-content-editor.empty {
    color: #9ca3af;
}

.title-card-title-editor .placeholder,
.title-card-content-editor .placeholder {
    color: #9ca3af;
    pointer-events: none;
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    user-select: none;
}

/* Title Card Display in Study Mode */
.title-card-display {
    display: none;
    text-align: center;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.title-card-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.nav-arrow {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 100px;
}

.nav-arrow:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.nav-arrow:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.title-card-counter {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.title-card-content-display {
    position: relative;
    margin: 2rem 0;
    min-height: 300px;
    perspective: 1000px;
    perspective-origin: center center;
}

/* 3D Stacked Cards Container */
.title-cards-stack {
    position: relative;
    width: 100%;
    height: 350px;
    transform-style: preserve-3d;
}

/* Individual Title Card in Stack */
.title-card-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-origin: center center;
    backface-visibility: hidden;
    cursor: pointer;
}

/* Stacking effect - each card positioned behind the previous */
.title-card-layer:nth-child(1) {
    z-index: 10;
    transform: translateZ(0px) translateY(0px);
    opacity: 1;
}

.title-card-layer:nth-child(2) {
    z-index: 9;
    transform: translateZ(-20px) translateY(8px) scale(0.95);
    opacity: 0.9;
    filter: brightness(0.95);
}

.title-card-layer:nth-child(3) {
    z-index: 8;
    transform: translateZ(-40px) translateY(16px) scale(0.90);
    opacity: 0.8;
    filter: brightness(0.90);
}

.title-card-layer:nth-child(4) {
    z-index: 7;
    transform: translateZ(-60px) translateY(24px) scale(0.85);
    opacity: 0.7;
    filter: brightness(0.85);
}

.title-card-layer:nth-child(n+5) {
    z-index: 6;
    transform: translateZ(-80px) translateY(32px) scale(0.80);
    opacity: 0.6;
    filter: brightness(0.80);
}

/* Active card highlight */
.title-card-layer.active {
    z-index: 15 !important;
    transform: translateZ(20px) translateY(-10px) scale(1.02) !important;
    opacity: 1 !important;
    filter: brightness(1) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2) !important;
}

/* Card transition animations */
.title-card-layer.moving-to-back {
    animation: moveToBack 1.2s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

.title-card-layer.moving-to-front {
    animation: moveToFront 1.2s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

/* For "next": current card slides right, moves back, slides left to back */
@keyframes moveToBack {
    0% {
        transform: translateZ(20px) translateY(-10px) translateX(0px) scale(1.02);
        z-index: 15;
        opacity: 1;
    }
    25% {
        transform: translateZ(20px) translateY(-10px) translateX(200px) scale(1.02);
        z-index: 15;
        opacity: 1;
    }
    50% {
        transform: translateZ(-60px) translateY(30px) translateX(200px) scale(0.8);
        z-index: 5;
        opacity: 0.8;
    }
    75% {
        transform: translateZ(-60px) translateY(30px) translateX(-200px) scale(0.8);
        z-index: 5;
        opacity: 0.7;
    }
    100% {
        transform: translateZ(-80px) translateY(32px) translateX(0px) scale(0.8);
        z-index: 6;
        opacity: 0.6;
    }
}

/* For "prev": back card slides left, moves forward, slides right to front */
@keyframes moveToFront {
    0% {
        transform: translateZ(-80px) translateY(32px) translateX(0px) scale(0.8);
        z-index: 6;
        opacity: 0.6;
    }
    25% {
        transform: translateZ(-80px) translateY(32px) translateX(-200px) scale(0.8);
        z-index: 6;
        opacity: 0.7;
    }
    50% {
        transform: translateZ(40px) translateY(-20px) translateX(-200px) scale(1.1);
        z-index: 20;
        opacity: 0.9;
    }
    75% {
        transform: translateZ(40px) translateY(-20px) translateX(200px) scale(1.1);
        z-index: 20;
        opacity: 0.95;
    }
    100% {
        transform: translateZ(20px) translateY(-10px) translateX(0px) scale(1.02);
        z-index: 15;
        opacity: 1;
    }
}

/* Hover effects for stacked cards */
.title-card-layer:not(.active):hover {
    transform: translateZ(-10px) translateY(4px) scale(0.98);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

/* Card content styling */
.title-card-layer .title-card-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.title-card-layer .title-card-text {
    font-size: 1.1rem;
    color: #4b5563;
    line-height: 1.6;
    text-align: left;
    max-width: none;
}

.title-card-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.title-card-text {
    font-size: 1.1rem;
    color: #4b5563;
    line-height: 1.6;
    text-align: left;
    max-width: none;
}

.title-card-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.title-card-actions .btn {
    min-width: 150px;
}

/* AI Generation Section */
.ai-generation-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.1) 0%, rgba(79, 70, 229, 0.1) 100%);
    border: 2px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.ai-generation-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #9333ea, #4f46e5, #06b6d4);
    animation: ai-pulse 3s ease-in-out infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 0.6; transform: scaleX(1); }
    50% { opacity: 1; transform: scaleX(1.05); }
}

.ai-generation-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.ai-option {
    background: rgba(255, 255, 255, 0.5);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(147, 51, 234, 0.2);
    text-align: center;
    transition: all 0.3s ease;
}

.ai-option:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

.btn-ai-subject {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-ai-subject:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.ai-option-desc {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.ai-requirements {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #1e40af;
}

.ai-requirements p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

/* Card Customization Options */
.card-style-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.style-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.style-option.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.style-preview {
    width: 60px;
    height: 40px;
    border-radius: 6px;
    position: relative;
}

.classic-preview {
    background: white;
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modern-preview {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.vintage-preview {
    background: #f7fafc;
    border: 2px solid #8b4513;
    position: relative;
}

.vintage-preview::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 1px solid #cd853f;
}

.neon-preview {
    background: #1a1a1a;
    border: 2px solid #00ffff;
    box-shadow: 0 0 10px #00ffff, inset 0 0 10px rgba(0, 255, 255, 0.1);
}

.color-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    border-color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.color-option.selected {
    border-color: white;
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Enhanced Realistic Card Styles */
.realistic-card {
    background: white;
    border-radius: 12px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    overflow: visible;
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.4s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    aspect-ratio: 3.5 / 2.5; /* Credit card proportions */
    max-width: 500px;
    margin: 0 auto 2rem;
}

.realistic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    border-radius: 12px;
    pointer-events: none;
}

.card-shadow {
    position: absolute;
    top: 8px;
    left: 8px;
    right: -8px;
    bottom: -8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    z-index: -1;
    filter: blur(8px);
    transition: all 0.3s ease;
}

.realistic-card:hover .card-shadow {
    top: 12px;
    left: 12px;
    right: -12px;
    bottom: -12px;
    filter: blur(12px);
}

.card-border {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    pointer-events: none;
}

.card-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.card-corner.top-left {
    top: 12px;
    left: 12px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 4px;
}

.card-corner.top-right {
    top: 12px;
    right: 12px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 4px;
}

.card-corner.bottom-left {
    bottom: 12px;
    left: 12px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 4px;
}

.card-corner.bottom-right {
    bottom: 12px;
    right: 12px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 4px;
}

.card-header-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-content {
    padding: 3rem 2rem 2rem;
    text-align: center;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
}

.question-side p {
    font-size: 1.4rem;
    color: #2d3748;
    line-height: 1.5;
    font-weight: 500;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card-footer {
    position: absolute;
    bottom: 16px;
    right: 16px;
}

.card-number {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Card Style Themes */
.study-card.classic {
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.study-card.modern {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: none;
    border-radius: 16px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

.study-card.vintage {
    background: #faf5f0;
    border: 3px solid #8b4513;
    border-radius: 4px;
    box-shadow: 
        0 4px 8px rgba(139, 69, 19, 0.3),
        inset 0 0 0 2px #cd853f;
    position: relative;
}

.study-card.vintage::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid #deb887;
    pointer-events: none;
}

.study-card.neon {
    background: #1a1a1a;
    border: 2px solid #00ffff;
    border-radius: 12px;
    box-shadow: 
        0 0 20px #00ffff,
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    color: #00ffff;
}

.study-card.neon .question-side p {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

.study-card.neon .card-header-badge {
    background: #00ffff;
    color: #1a1a1a;
    box-shadow: 0 0 10px #00ffff;
}

/* Color Themes */
.study-card.blue { --theme-color: #667eea; --theme-gradient: linear-gradient(135deg, #667eea, #764ba2); }
.study-card.green { --theme-color: #48bb78; --theme-gradient: linear-gradient(135deg, #48bb78, #38a169); }
.study-card.purple { --theme-color: #9f7aea; --theme-gradient: linear-gradient(135deg, #9f7aea, #805ad5); }
.study-card.red { --theme-color: #f56565; --theme-gradient: linear-gradient(135deg, #f56565, #e53e3e); }
.study-card.orange { --theme-color: #ed8936; --theme-gradient: linear-gradient(135deg, #ed8936, #dd6b20); }
.study-card.teal { --theme-color: #4fd1c7; --theme-gradient: linear-gradient(135deg, #4fd1c7, #38b2ac); }

.study-card[class*="blue"] .card-header-badge,
.study-card[class*="green"] .card-header-badge,
.study-card[class*="purple"] .card-header-badge,
.study-card[class*="red"] .card-header-badge,
.study-card[class*="orange"] .card-header-badge,
.study-card[class*="teal"] .card-header-badge {
    background: var(--theme-gradient);
}

.study-card[class*="blue"] .card-number,
.study-card[class*="green"] .card-number,
.study-card[class*="purple"] .card-number,
.study-card[class*="red"] .card-number,
.study-card[class*="orange"] .card-number,
.study-card[class*="teal"] .card-number {
    background: rgba(var(--theme-color), 0.1);
    color: var(--theme-color);
}

/* Difficulty Indicators for Adaptive Learning */
.difficulty-indicator {
    position: absolute;
    top: -12px;
    right: -12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    white-space: nowrap;
    transform: scale(0.95);
    transition: all 0.3s ease;
}

.study-card.new-card .difficulty-indicator {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.study-card.challenging-card .difficulty-indicator {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.study-card.struggling-card .difficulty-indicator {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    animation: pulse-glow 2s infinite;
}

.study-card.mastered-card .difficulty-indicator {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.pulse-animation {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        transform: scale(0.95);
        box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
    }
    50% {
        transform: scale(1.0);
        box-shadow: 0 6px 20px rgba(245, 101, 101, 0.5);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
    }
}

/* Add subtle border indicators for different difficulty levels */
.study-card.struggling-card {
    border: 2px solid rgba(245, 101, 101, 0.3);
    box-shadow: 0 8px 32px rgba(245, 101, 101, 0.1);
}

.study-card.challenging-card {
    border: 2px solid rgba(237, 137, 54, 0.3);
    box-shadow: 0 8px 32px rgba(237, 137, 54, 0.1);
}

.study-card.new-card {
    border: 2px solid rgba(72, 187, 120, 0.3);
    box-shadow: 0 8px 32px rgba(72, 187, 120, 0.1);
}

.study-card.mastered-card {
    border: 2px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.1);
}

/* Study View */
.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    color: white;
}

.study-header h2 {
    font-size: 2rem;
    font-weight: 600;
}

.study-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.separator {
    opacity: 0.5;
}

.study-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.study-card-container {
    max-width: 800px;
    margin: 0 auto;
}

/* === FLIP CARD ANIMATION STYLES === */
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 400px;
    perspective: 1000px;
    margin-bottom: 2rem;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

.flip-card-front .study-card,
.flip-card-back .study-card {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.flip-card-back .study-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.flip-card-back .answer-badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

.flip-card-back .card-content {
    color: white;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.answer-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.answer-side p {
    font-size: 1.4rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: white;
}

.answer-result {
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 1.2rem;
}

.answer-result.correct {
    background: rgba(72, 187, 120, 0.2);
    border: 2px solid rgba(72, 187, 120, 0.4);
    color: #68d391;
}

.answer-result.incorrect {
    background: rgba(245, 101, 101, 0.2);
    border: 2px solid rgba(245, 101, 101, 0.4);
    color: #fc8181;
}

.continue-btn {
    background: white !important;
    color: #667eea !important;
    border: none !important;
    padding: 1rem 2rem !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.continue-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    background: #f7fafc !important;
}

.dont-know-btn {
    background: #e53e3e !important;
    color: white !important;
    border: none !important;
    transition: all 0.3s ease !important;
}

.dont-know-btn:hover {
    background: #c53030 !important;
    transform: translateY(-2px) !important;
}

/* Hide answer section when card is flipped */
.flip-card.flipped ~ .answer-section {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.study-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.card-content {
    padding: 3rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.question-side h3 {
    color: #667eea;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.question-side p {
    font-size: 1.5rem;
    color: #1a202c;
    line-height: 1.4;
}

.answer-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.answer-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.answer-input-group input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.answer-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.answer-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.answer-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.answer-feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.answer-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.correct-answer {
    margin-top: 0.5rem;
    font-weight: 600;
}

/* Study Complete */
.study-complete {
    display: none;
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.study-complete.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.complete-card {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.complete-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.complete-card h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #1a202c;
}

.final-score {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #667eea;
    font-weight: 600;
}

.complete-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Correct Answer Animation - Card falls down */
@keyframes fallDown {
    0% {
        transform: translateY(0) rotateZ(0deg);
        opacity: 1;
    }
    25% {
        transform: translateY(20px) rotateZ(-2deg);
        opacity: 0.9;
    }
    50% {
        transform: translateY(60px) rotateZ(1deg);
        opacity: 0.7;
    }
    75% {
        transform: translateY(120px) rotateZ(-1deg);
        opacity: 0.4;
    }
    100% {
        transform: translateY(200px) rotateZ(0deg) scale(0.8);
        opacity: 0;
    }
}

/* Incorrect Answer Animation - Card slides to side then back */
@keyframes slideToSideAndBack {
    0% {
        transform: translateX(0) rotateZ(0deg);
        opacity: 1;
    }
    15% {
        transform: translateX(-30px) rotateZ(-5deg);
        opacity: 0.9;
    }
    30% {
        transform: translateX(50px) rotateZ(3deg);
        opacity: 0.8;
    }
    45% {
        transform: translateX(150px) rotateZ(-2deg);
        opacity: 0.6;
    }
    60% {
        transform: translateX(300px) rotateZ(5deg);
        opacity: 0.3;
    }
    75% {
        transform: translateX(500px) rotateZ(-3deg);
        opacity: 0.1;
    }
    85% {
        transform: translateX(-100px) rotateZ(0deg);
        opacity: 0;
    }
    100% {
        transform: translateX(0) rotateZ(0deg);
        opacity: 0;
    }
}

/* Next card entrance animation */
@keyframes slideInFromTop {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Card bounce in animation for new cards */
@keyframes bounceIn {
    0% {
        transform: scale(0.3) translateY(-100px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(10px);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9) translateY(-5px);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Animation Classes */
.study-card.fall-correct {
    animation: fallDown 0.8s ease-in forwards;
    z-index: 1;
}

.study-card.slide-incorrect {
    animation: slideToSideAndBack 1.2s ease-in-out forwards;
    z-index: 1;
}

.study-card.slide-out {
    animation: slideOutLeft 0.3s ease forwards;
}

.study-card.slide-in {
    animation: slideInRight 0.3s ease forwards;
}

.study-card.bounce-in {
    animation: bounceIn 0.6s ease-out forwards;
}

.study-card.slide-in-top {
    animation: slideInFromTop 0.5s ease-out forwards;
}

/* Enhanced card container for stacking effect */
.study-card-container {
    position: relative;
    perspective: 1000px;
}

/* Next card preview (hidden behind current card) */
.next-card-preview {
    position: absolute;
    top: 5px;
    left: 5px;
    right: -5px;
    bottom: -5px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: -1;
    opacity: 0.6;
    transform: scale(0.95);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        justify-content: center;
        width: 100%;
    }

    .nav-btn {
        flex: 1;
        text-align: center;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .decks-grid {
        grid-template-columns: 1fr;
    }

    .card-inputs {
        grid-template-columns: 1fr;
    }

    .title-card-display {
        padding: 1rem;
    }

    .title-card-content-display {
        padding: 2rem 1rem;
        min-height: 250px;
    }

    .title-card-title {
        font-size: 1.5rem;
    }

    .title-card-navigation {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .title-card-actions {
        flex-direction: column;
        align-items: center;
    }

    .title-card-actions .btn {
        width: 100%;
        max-width: 250px;
    }

    .answer-input-group {
        flex-direction: column;
    }

    .complete-actions {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .study-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .study-controls {
        justify-content: space-between;
    }

    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .main {
        padding: 1rem 0;
    }

    .deck-form,
    .decks-section,
    .answer-section {
        padding: 1.5rem;
    }

    .card-content {
        padding: 2rem;
    }
}

/* =================== ONBOARDING MODAL STYLES =================== */

.onboarding-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.5s ease-out;
}

.onboarding-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.6s ease-out;
}

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

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

.onboarding-header {
    text-align: center;
    margin-bottom: 40px;
}

.onboarding-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.onboarding-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.onboarding-header p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0;
}

.onboarding-step h3 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.onboarding-step > p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* Subject Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.subject-card {
    background: #f8f9ff;
    border: 2px solid #e0e7ff;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.subject-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.subject-card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.subject-card.selected .subject-desc {
    color: rgba(255, 255, 255, 0.9);
}

.subject-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subject-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.subject-desc {
    font-size: 0.9rem;
    color: #666;
    opacity: 0.8;
    margin-bottom: 10px;
}

.subject-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.subject-badge.core {
    background: #ef4444;
    color: white;
}

.subject-badge.science {
    background: #3b82f6;
    color: white;
}

.subject-badge.optional {
    background: #10b981;
    color: white;
}

.core-subject {
    border-left: 4px solid #ef4444;
}

.science-subject {
    border-left: 4px solid #3b82f6;
}

.optional-subject {
    border-left: 4px solid #10b981;
}

/* Confidence Levels */

.confidence-subject {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.confidence-subject h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.confidence-levels {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.confidence-level {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e0e7ff;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

.confidence-level:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.confidence-level.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Preference Sections */
.preference-section {
    margin-bottom: 30px;
}

.preference-section label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.session-options, .time-options, .style-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.session-option, .time-option, .style-option {
    padding: 12px 20px;
    background: #f8f9ff;
    border: 2px solid #e0e7ff;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 100px;
    text-align: center;
}

.session-option:hover, .time-option:hover, .style-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.session-option.active, .time-option.active, .style-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Goal Options */
.goal-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.goal-option {
    background: #f8f9ff;
    border: 2px solid #e0e7ff;
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.goal-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.goal-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.goal-option.selected .goal-desc {
    color: rgba(255, 255, 255, 0.9);
}

.goal-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.goal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.goal-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* Completion Step */
.completion-content {
    text-align: center;
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.ai-features {
    text-align: left;
    max-width: 400px;
    margin: 30px auto;
    list-style: none;
    padding: 0;
}

.ai-features li {
    padding: 10px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-preview {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    text-align: left;
}

.ai-preview h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.ai-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #555;
}

/* Navigation */
.onboarding-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e0e7ff;
}

.step-indicators {
    display: flex;
    gap: 10px;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e7ff;
    transition: background 0.3s ease;
}

.step-dot.active {
    background: #667eea;
}

.step-dot.completed {
    background: #10b981;
}

/* Responsive Design */
@media (max-width: 768px) {
    .onboarding-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .subject-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .session-options, .time-options, .style-options {
        flex-direction: column;
    }
    
    .session-option, .time-option, .style-option {
        min-width: unset;
    }
    
    .goal-options {
        grid-template-columns: 1fr;
    }
    
    .onboarding-navigation {
        flex-direction: column;
        gap: 20px;
    }
}

/* Advanced AI Notifications and Features */
@keyframes slideInAdvanced {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutAdvanced {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

.advanced-ai-notification {
    font-family: 'Inter', sans-serif;
}

.advanced-ai-notification-content.urgent {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%) !important;
    animation: pulse 2s infinite;
}

.advanced-ai-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.confidence-meter {
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 20px;
    width: 80px;
    overflow: hidden;
    display: inline-block;
    margin: 0 10px;
}

.confidence-fill {
    background: rgba(255, 255, 255, 0.8);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.confidence-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #333;
}

.generation-details {
    margin: 1rem 0;
}

.generation-reason {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.generation-metadata {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1.3;
}

.btn-ai.urgent {
    background: #ff6b6b !important;
    border-color: #ff5252 !important;
    animation: pulse 1.5s infinite;
}

/* 🪙 Coin Animation Styles */
.coin-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: none;
}

.coin-animation.earn {
    animation: coinEarnFloat 3s ease-out forwards;
}

.coin-animation.lose {
    animation: coinLoseFloat 3s ease-out forwards;
}

@keyframes coinEarnFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) translateY(0);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2) translateY(-20px);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1) translateY(-100px);
    }
}

@keyframes coinLoseFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) translateY(0);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2) translateY(20px);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1) translateY(100px);
    }
}

.coin-popup {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #8B4513;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    min-width: 120px;
}

.coin-animation.lose .coin-popup {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.coin-popup .coin-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.coin-popup .coin-amount {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.coin-popup .coin-reason {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Coin Reward/Penalty in Feedback */
.coin-reward {
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    animation: coinGlow 1s ease-in-out infinite alternate;
}

.coin-penalty {
    color: #ff6b6b;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes coinGlow {
    from { text-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 10px rgba(255, 215, 0, 0.5); }
    to { text-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 20px rgba(255, 215, 0, 0.8); }
}

/* 🏆 Achievement System */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-popup.show {
    opacity: 1;
    transform: translateX(0);
}

.achievement-content {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(106, 17, 203, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    min-width: 280px;
    max-width: 350px;
    position: relative;
    overflow: hidden;
}

.achievement-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: achievementShine 2s infinite;
}

@keyframes achievementShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
    100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}

.achievement-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: achievementBounce 1s ease-in-out infinite alternate;
}

@keyframes achievementBounce {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.achievement-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.achievement-message {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    opacity: 0.95;
    line-height: 1.3;
}

.achievement-coins {
    font-size: 1rem;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    background: rgba(255, 215, 0, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Mobile Responsiveness for Coin System */
@media (max-width: 768px) {
    .header-right {
        gap: 0.5rem;
    }
    
    .coin-display {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .coin-icon {
        font-size: 1rem;
    }
    
    .coin-tooltip {
        min-width: 200px;
        font-size: 0.8rem;
        padding: 0.8rem;
    }
    
    .achievement-popup {
        right: 10px;
        left: 10px;
    }
    
    .achievement-content {
        min-width: auto;
        max-width: none;
    }
}

/* 🚀 Power-ups Bar in Study Mode */
.powerups-bar {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-wrap: wrap;
    justify-content: center;
}

.powerup-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 100px;
    justify-content: center;
}

.powerup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.powerup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.powerup-btn .hint-count,
.powerup-btn .skip-count,
.powerup-btn .double-count,
.powerup-btn .shield-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.hint-button {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #8B4513;
}

.skip-button {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.double-button {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
}

.shield-button {
    background: linear-gradient(135deg, #4fd1c7, #38b2ac);
}

/* Double Coins Active State */
.coin-display.double-coins-active {
    animation: doubleCoinsGlow 2s ease-in-out infinite alternate;
}

@keyframes doubleCoinsGlow {
    from { 
        background: rgba(255, 215, 0, 0.2);
        box-shadow: 0 2px 10px rgba(255, 215, 0, 0.1);
    }
    to { 
        background: rgba(255, 215, 0, 0.4);
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
    }
}

/* 💡 Hint Modal */
.hint-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.hint-content {
    background: linear-gradient(135deg, #2C3E50, #34495E);
    color: #F8F9FA;
    padding: 2rem;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 15px 35px rgba(44, 62, 80, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.hint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 0.5rem;
}

.hint-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.hint-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #F8F9FA;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.hint-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hint-text {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-weight: 500;
}

.hint-source {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.hint-disclaimer {
    font-size: 0.8rem;
    color: #F8F9FA;
    background: rgba(255, 215, 0, 0.15);
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    border-left: 3px solid #FFD700;
    font-weight: 500;
}

.hint-actions {
    text-align: center;
}

/* 🛍️ Shop Styles */
.shop-header {
    text-align: center;
    margin-bottom: 2rem;
}

.shop-header h2 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.shop-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.shop-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.shop-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.shop-item.premium {
    border: 2px solid #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
}

.shop-item-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.shop-item-content h3 {
    color: white;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.shop-item-content p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin-bottom: 1rem;
    text-align: center;
}

.shop-item-features {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.shop-item-features span {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    text-align: center;
}

.shop-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.shop-buy-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* 📦 Inventory Section */
.inventory-section {
    margin-bottom: 3rem;
}

.inventory-section h3 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.inventory-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    backdrop-filter: blur(5px);
}

.inventory-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.inventory-name {
    color: white;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.inventory-count {
    background: #FFD700;
    color: #8B4513;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
    min-width: 30px;
}

/* 🤖 API Setup Section */
.api-setup-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 2rem;
    backdrop-filter: blur(5px);
}

.api-setup-section h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.api-setup-section p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.api-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.api-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.api-input-group label {
    color: white;
    font-weight: 500;
    min-width: 200px;
}

.api-input-group input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: monospace;
    min-width: 200px;
}

.api-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.api-note {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 165, 0, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #FFA500;
}

.ai-status {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-icon {
    font-size: 1.2rem;
}

.status-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

/* 💡 Custom Hint Input */
.hint-input-group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.card-hint-input {
    width: 100%;
    min-height: 60px;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: inherit;
    resize: vertical;
}

.card-hint-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.hint-help {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: block;
}

/* Mobile Responsiveness for Shop and Power-ups */
@media (max-width: 768px) {
    .powerups-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .powerup-btn {
        min-width: auto;
        width: 100%;
    }
    
    .shop-grid {
        grid-template-columns: 1fr;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .api-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .api-input-group label {
        min-width: auto;
    }
}

.learning-feedback {
    font-family: 'Inter', sans-serif;
}

.feedback-content h4 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.progress-highlights {
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* =========================== ADOPTION STYLING =========================== */
.deck-card.adopted {
    border: 2px solid #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
}

.adopted-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.adopted-indicator {
    color: #10b981;
    font-weight: 600;
}

.btn.adopted-indicator {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    cursor: not-allowed;
    opacity: 0.8;
}

/* =========================== REMOVED SECTIONS =========================== */
/* Authentication and Leaderboard features have been removed */



/* Authentication and Leaderboard sections removed */



/* Auth Forms */
.auth-form {
    animation: fadeIn 0.3s ease;
}

.auth-form h2 {
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.auth-form p {
    color: #64748b;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:invalid {
    border-color: #ef4444;
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #64748b;
}

.form-options {
    margin-bottom: 2rem;
}

/* Checkbox Container */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-container input:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-container input:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Auth Button */
.auth-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Account Settings Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.account-settings-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Account Settings */
.account-settings {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.settings-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-details h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.user-stats {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.settings-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.settings-tab.active {
    color: #667eea;
    background: white;
    border-bottom-color: #667eea;
}

.settings-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

/* Settings Content */
.settings-content {
    padding: 2rem;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.settings-tab-content h3 {
    color: #1e293b;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.preference-group {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.preference-group:last-child {
    border-bottom: none;
}

.preference-group h4 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Data Stats */
.data-stats {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.stat-label {
    font-weight: 500;
    color: #374151;
}

.stat-value {
    font-weight: 600;
    color: #667eea;
}

/* Data Actions */
.data-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Danger Zone */
.danger-zone {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.danger-zone h4 {
    color: #dc2626;
    margin-bottom: 0.5rem;
}

.danger-zone p {
    color: #7f1d1d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Small buttons */
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* Select styling */
select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* =========================== PROFILE CUSTOMIZATION & LEVEL SYSTEM =========================== */

/* Profile Stats Display */
.profile-stats-display {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    border: 2px solid #e2e8f0;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    position: relative;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-upload {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.profile-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Level Display */
.level-display {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Compact Level Display for Header */
.level-display-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0.25rem 0.6rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.level-display-compact:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.level-badge-small {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.level-badge-small .level-icon {
    font-size: 0.8rem;
    color: #ffd700;
}

.level-badge-small .level-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    min-width: 1.2rem;
    text-align: center;
}

.xp-bar-compact {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.xp-bar-compact .xp-progress {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 0%; /* Start at 0% for animation */
}

.xp-bar-compact .xp-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: shimmer-compact 2s infinite;
}

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

.xp-text-compact {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    min-width: 2.5rem;
    text-align: center;
}

/* Level Info Modal */
.level-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.level-info-content {
    background: white;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideUp 0.3s ease;
}

.level-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.level-info-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

.level-info-body {
    padding: 1.5rem;
}

.level-progress-display {
    text-align: center;
    margin-bottom: 2rem;
}

.level-progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 6px;
    transition: width 0.8s ease;
    position: relative;
}

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

.level-progress-text {
    font-weight: 600;
    color: #374151;
    font-size: 1.1rem;
}

.level-info-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.level-benefits h4 {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1.1rem;
}

.level-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.level-benefits li {
    padding: 0.5rem 0;
    color: #4b5563;
    font-size: 0.9rem;
}

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

/* Responsive adjustments for compact level display */
@media (max-width: 768px) {
    .level-display-compact {
        padding: 0.25rem 0.5rem;
        gap: 0.3rem;
    }
    
    .xp-bar-compact {
        width: 40px;
    }
    
    .xp-text-compact {
        font-size: 0.7rem;
        min-width: 2rem;
    }
    
    .level-badge-small .level-number {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .level-display-compact {
        padding: 0.2rem 0.4rem;
    }
    
    .xp-bar-compact {
        width: 30px;
        height: 3px;
    }
    
    .xp-text-compact {
        font-size: 0.65rem;
        min-width: 1.8rem;
    }
}

.level-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.level-number {
    background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
    color: #92400e;
    font-size: 2rem;
    font-weight: bold;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.level-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
}

.xp-progress {
    width: 100%;
}

.xp-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

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

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

.xp-text {
    font-size: 0.9rem;
    color: #64748b;
    text-align: center;
    font-weight: 500;
}

/* Profile Stats Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

/* Color Picker Grid */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
    border-color: #374151;
    transform: scale(1.1);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    min-height: 100px;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #cbd5e1;
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.achievement-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.achievement-item.unlocked {
    border: 2px solid #10b981;
}

.achievement-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.achievement-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.2;
}

.achievement-progress {
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
    border-radius: 0 0 6px 6px;
}

.achievement-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 0 0 6px 6px;
    transition: width 0.5s ease;
}

/* Profile Actions */
.profile-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f1f5f9;
}

/* Bio Character Counter */
#bio-count {
    color: #64748b;
}

#profile-bio:focus + .form-help #bio-count {
    color: #667eea;
}

/* Level-up Animation */
@keyframes levelUp {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }
}

.level-up-animation {
    animation: levelUp 0.6s ease-in-out;
}

/* XP Gain Animation */
@keyframes xpGain {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.8);
    }
}

.xp-gain-popup {
    position: fixed;
    z-index: 1000;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    pointer-events: none;
    animation: xpGain 2s ease-out forwards;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

/* =========================== LEADERBOARD SYSTEM =========================== */

/* Leaderboard Navigation */
.leaderboard-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    justify-content: center;
}

.leaderboard-tab {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leaderboard-tab:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.leaderboard-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* Current Rank Card */
.current-rank-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.rank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.rank-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.user-rank-display {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.rank-position {
    font-size: 3rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-details {
    flex: 1;
}

.rank-username {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.rank-score {
    font-size: 1.1rem;
    opacity: 0.9;
}

.rank-progress {
    min-width: 200px;
}

.progress-text {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    background: rgba(255, 255, 255, 0.8);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Leaderboard Content */
.leaderboard-content {
    margin-bottom: 2rem;
}

.leaderboard-list {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.leaderboard-list.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.leaderboard-header h3 {
    color: #1e293b;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.leaderboard-header p {
    color: #64748b;
    font-size: 1rem;
}

/* Podium */
.podium {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
}

.podium-place:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.podium-place.first {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    transform: scale(1.1);
    z-index: 3;
    border: 3px solid #f59e0b;
}

.podium-place.second {
    background: linear-gradient(135deg, #c0c0c0 0%, #e5e7eb 100%);
    z-index: 2;
    border: 3px solid #9ca3af;
}

.podium-place.third {
    background: linear-gradient(135deg, #cd7f32 0%, #d97706 100%);
    z-index: 1;
    border: 3px solid #b45309;
}

.podium-avatar {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.podium-place.first .podium-avatar {
    font-size: 3rem;
}

.podium-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.podium-score {
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
}

.podium-place.first .podium-name,
.podium-place.first .podium-score {
    color: #92400e;
}

.podium-place.second .podium-name,
.podium-place.second .podium-score {
    color: #374151;
}

.podium-place.third .podium-name,
.podium-place.third .podium-score {
    color: #78350f;
}

/* Leaderboard Entries */
.leaderboard-entries {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.leaderboard-entry:hover {
    background: #e2e8f0;
    transform: translateX(4px);
    border-left-color: #667eea;
}

.leaderboard-entry.current-user {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left-color: #667eea;
    border: 2px solid #667eea;
}

.entry-rank {
    font-weight: bold;
    font-size: 1.2rem;
    color: #667eea;
    min-width: 40px;
    text-align: center;
}

.entry-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0 1rem;
}

.entry-details {
    flex: 1;
}

.entry-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.entry-subtitle {
    font-size: 0.9rem;
    color: #64748b;
}

.entry-score {
    font-weight: bold;
    font-size: 1.3rem;
    color: #667eea;
    text-align: right;
}

.entry-trend {
    font-size: 0.8rem;
    margin-left: 0.5rem;
    opacity: 0.7;
}

.trend-up {
    color: #10b981;
}

.trend-down {
    color: #ef4444;
}

.trend-same {
    color: #64748b;
}

/* Leaderboard Actions */
.leaderboard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.leaderboard-actions .btn {
    min-width: 150px;
}

/* Loading States */
.leaderboard-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #64748b;
    font-size: 1.1rem;
}

.loading-spinner {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empty State */
.leaderboard-empty {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.leaderboard-empty h4 {
    margin-bottom: 1rem;
    color: #374151;
}

.leaderboard-empty p {
    margin-bottom: 2rem;
}

/* Achievement Badges */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.achievement-badge.gold {
    background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
    color: #92400e;
}

.achievement-badge.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #9ca3af 100%);
    color: #374151;
}

.achievement-badge.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b45309 100%);
    color: #78350f;
}

/* Responsive Design */
@media (max-width: 768px) {
    .account-container {
        padding: 1rem;
    }
    
    .auth-section {
        padding: 1.5rem;
    }
    
    .settings-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .settings-tabs {
        flex-wrap: wrap;
    }
    
    .settings-tab {
        flex: 1;
        min-width: 120px;
    }
    
    .data-actions {
        flex-direction: column;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    /* Profile Mobile */
    .profile-stats-display {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .profile-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .level-badge {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .color-picker-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .color-option {
        width: 35px;
        height: 35px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .profile-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .profile-actions .btn {
        width: 100%;
        max-width: 300px;
    }

    /* Leaderboard Mobile */
    .leaderboard-nav {
        gap: 0.25rem;
    }
    
    .leaderboard-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .current-rank-card {
        padding: 1.5rem;
    }
    
    .user-rank-display {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .rank-position {
        font-size: 2.5rem;
        width: 70px;
        height: 70px;
    }
    
    .podium {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-place {
        min-width: 200px;
        margin-bottom: 1rem;
    }
    
    .podium-place.first {
        order: 1;
        transform: none;
    }
    
    .podium-place.second {
        order: 2;
    }
    
    .podium-place.third {
        order: 3;
    }
    
    .leaderboard-entry {
        padding: 0.75rem;
    }
    
    .entry-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin: 0 0.75rem;
    }
    
    .entry-name {
        font-size: 1rem;
    }
    
    .entry-score {
        font-size: 1.1rem;
    }
    
    .leaderboard-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .leaderboard-actions .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* ========================= TERMS OF SERVICE MODAL ========================= */

.terms-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.terms-content {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.terms-section {
    margin-bottom: 1.5rem;
}

.terms-section h3 {
    color: #374151;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.terms-section p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.terms-section ul {
    color: #6b7280;
    line-height: 1.6;
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.terms-section li {
    margin-bottom: 0.25rem;
}

.terms-footer {
    background: #f9fafb;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #6b7280;
}

.terms-footer p {
    margin: 0.25rem 0;
}

.terms-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

/* ========================= LEVELING SYSTEM STYLES ========================= */

/* Level Display in Header */
.level-display {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-display:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.level-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 20px;
    padding: 4px 8px;
}

.level-icon {
    font-size: 14px;
}

.level-number {
    font-weight: 600;
    color: #ffd700;
    font-size: 14px;
}

.xp-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xp-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.xp-bar {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.xp-progress {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.level-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #333;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    white-space: normal;
}

.level-display:hover .level-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.level-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border: 5px solid transparent;
    border-top-color: #333;
}

/* XP Gain Animation */
.xp-gain-animation {
    position: fixed;
    top: 20%;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
    animation: xpGainFloat 3s ease-out forwards;
}

.xp-popup {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 12px 16px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
    text-align: center;
    font-weight: 600;
}

.xp-amount {
    font-size: 18px;
    margin-bottom: 4px;
}

.xp-reason {
    font-size: 12px;
    opacity: 0.8;
}

@keyframes xpGainFloat {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) scale(1);
        opacity: 1;
    }
    80% {
        transform: translateY(-40px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-60px) scale(0.9);
        opacity: 0;
    }
}

/* Level Up Modal */
.level-up-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 0.5s ease-out;
}

.level-up-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: levelUpBounce 0.6s ease-out;
}

.level-up-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.level-change {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.old-level {
    color: rgba(255, 255, 255, 0.7);
}

.arrow {
    color: #ffd700;
}

.new-level {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.level-up-unlocks {
    margin: 1.5rem 0;
}

.unlock-category {
    margin-bottom: 1rem;
}

.unlock-category h4 {
    color: #ffd700;
    margin-bottom: 0.5rem;
}

.unlock-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.unlock-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.level-up-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

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

@keyframes levelUpBounce {
    0% {
        transform: scale(0.5) rotateY(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotateY(90deg);
    }
    100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
}

/* Level Up Notification (Simple) */
.level-up-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    z-index: 10000;
    animation: bounceIn 0.6s ease-out;
    box-shadow: 0 15px 35px rgba(255, 215, 0, 0.3);
}

.level-up-simple h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.level-up-simple .level-change {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

/* Profile View */
.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-avatar {
    text-align: center;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
}

.profile-info {
    text-align: left;
}

.profile-name {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.profile-level-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.level-badge-large {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: #ffd700;
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.xp-info-large {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.xp-text-large {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.xp-bar-large {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.xp-progress-large {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.profile-content {
    display: grid;
    gap: 2rem;
}

.profile-section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-section h3 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.unlocked-content, .next-unlocks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.unlock-category-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.unlock-category-display h4 {
    color: #ffd700;
    margin-bottom: 0.5rem;
}

.unlock-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.unlock-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.next-unlocks-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.unlock-preview {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.unlock-level {
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.achievement-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    transition: all 0.3s ease;
}

.achievement-card.unlocked {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.achievement-name {
    color: white;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.achievement-xp {
    color: #ffd700;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Customization Modal */
.customization-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 0.3s ease-out;
}

.customization-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.customization-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.customization-header h2 {
    font-size: 2rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.customization-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.customization-section h3 {
    color: #ffd700;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.customization-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.colors-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.customization-option {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.customization-option.unlocked:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.customization-option.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
}

.customization-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.option-preview {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #ccc, #999);
}

.card-style-preview.modern {
    background: linear-gradient(45deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-style-preview.animated {
    background: linear-gradient(45deg, #ff006e, #8338ec);
    animation: pulsePreview 2s ease-in-out infinite;
}

.card-style-preview.gradient {
    background: linear-gradient(45deg, #ff7e5f, #feb47b);
}

.card-style-preview.holographic {
    background: linear-gradient(45deg, #667eea, #764ba2, #ff006e, #ffd700);
    background-size: 400% 400%;
    animation: holographicShimmer 3s ease-in-out infinite;
}

.card-style-preview.legendary {
    background: linear-gradient(45deg, #ffd700, #ff6b35, #667eea, #764ba2);
    background-size: 400% 400%;
    animation: legendaryGlow 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

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

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

@keyframes legendaryGlow {
    0%, 100% { 
        background-position: 0% 50%;
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }
    50% { 
        background-position: 100% 50%;
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.color-option {
    text-align: center;
    padding: 0.75rem;
}

.color-name {
    font-size: 0.8rem;
    color: white;
}

.option-info {
    text-align: center;
}

.option-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.option-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.25rem;
}

.option-locked {
    color: #ff6b6b;
    font-size: 0.8rem;
    font-weight: 600;
}

.next-unlocks {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
}

.next-unlocks h3 {
    color: #ffd700;
    margin-bottom: 1rem;
}

.unlock-previews {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unlock-preview {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.unlock-level {
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.unlock-items {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Level Progress Chart */
.level-progress-chart {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .level-display {
        padding: 6px 8px;
    }
    
    .xp-bar {
        width: 40px;
    }
    
    .profile-summary {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .profile-info {
        text-align: center;
    }
    
    .xp-bar-large {
        width: 150px;
    }
    
    .customization-content {
        padding: 1rem;
    }
    
    .customization-options {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* ========================================
   INTERACTIVE CARD CREATOR STYLES
   ======================================== */

.interactive-editor {
    height: 100vh; /* Full viewport height */
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    padding-top: 80px; /* Account for header height */
}

.editor-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.editor-header h2 {
    margin: 0;
    color: #2d3748;
}

.editor-controls {
    display: flex;
    gap: 1rem;
}

.editor-settings-panel {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.settings-row {
    display: flex;
    gap: 2rem;
    align-items: end;
}

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto; /* Allow scrolling when needed */
    height: calc(100vh - 200px); /* Account for header and other elements */
}

.editor-toolbar {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 2rem;
    overflow-x: auto;
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.toolbar-section h4 {
    margin: 0;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
}

.tool-btn {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.tool-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.tool-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.format-control {
    padding: 0.25rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.editor-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-tabs {
    background: white;
    padding: 0.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.card-tab {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.card-tab.active {
    background: white;
    border-bottom-color: white;
    margin-bottom: -1px;
}

.tab-close {
    background: transparent;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    margin-left: 0.5rem;
}

.tab-close:hover {
    color: #e53e3e;
}

.add-card-tab {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.canvas-container {
    flex: 1;
    display: flex;
    background: white;
    overflow: auto; /* Allow scrolling */
    min-height: 400px; /* Ensure minimum visible height */
}

.canvas-sidebar {
    width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #e2e8f0;
    padding: 1rem;
    overflow-y: auto;
}

.canvas-sidebar h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
}

.side-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.side-tab {
    flex: 1;
    background: #e2e8f0;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.side-tab.active {
    background: #667eea;
    color: white;
}

.layers-panel {
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.layer-item.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.canvas-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top instead of centering */
    padding: 2rem;
    background: #edf2f7;
    overflow: auto; /* Allow scrolling if content is too large */
    min-height: 400px; /* Ensure minimum visible area */
}

.canvas {
    width: 600px;
    height: 400px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.canvas-side {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem;
    display: none;
}

.canvas-side.active {
    display: block;
}

.properties-panel {
    width: 250px;
    background: #f8f9fa;
    border-left: 1px solid #e2e8f0;
    padding: 1rem;
    overflow-y: auto;
}

.properties-panel h4 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
}

/* Interactive Elements */
.interactive-element {
    position: absolute;
    border: 2px dashed transparent;
    cursor: move;
    min-width: 50px;
    min-height: 30px;
}

.interactive-element.selected {
    border-color: #667eea;
}

/* Canvas Tabs */
.canvas-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
}

.canvas-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.canvas-tab:hover {
    color: #3b82f6;
    background-color: #f8fafc;
}

.canvas-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background-color: #f8fafc;
}

/* Canvas Wrapper */
.canvas-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Canvas Container */
.canvas-container-inner {
    position: relative;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#interactive-canvas {
    display: block;
    background: #ffffff;
    cursor: default;
    width: 800px;
    height: 600px;
    border: 1px solid #ccc; /* Add visible border for debugging */
}

/* Layers Panel */
.layers-panel {
    margin-top: 2rem;
}

.layers-panel h4 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 600;
}

.layers-list {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

.layer-item:hover {
    background-color: #f1f5f9;
}

.layer-item.selected {
    background-color: #dbeafe;
    border-left: 3px solid #3b82f6;
}

.layer-icon {
    margin-right: 0.5rem;
}

.layer-name {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
}

.layer-actions {
    display: flex;
    gap: 0.25rem;
}

.layer-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.no-layers {
    padding: 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
}

/* Property Panel Enhancements */
.property-group {
    margin-bottom: 1rem;
}

.property-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.property-row {
    display: flex;
    gap: 0.5rem;
}

.property-group input,
.property-group textarea,
.property-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.property-group input:focus,
.property-group textarea:focus,
.property-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.property-group textarea {
    resize: vertical;
    min-height: 60px;
}

.interactive-element .resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #667eea;
    border: 1px solid white;
    border-radius: 50%;
}

.resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }
.resize-handle.n { top: -4px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-handle.s { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-handle.w { top: 50%; left: -4px; transform: translateY(-50%); cursor: w-resize; }
.resize-handle.e { top: 50%; right: -4px; transform: translateY(-50%); cursor: e-resize; }

.text-element {
    background: rgba(255,255,255,0.9);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: Inter, sans-serif;
    line-height: 1.4;
}

.image-element {
    background: #f0f4ff;
    border: 2px dashed #cbd5e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #4a5568;
}

.image-element img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.shape-element {
    background: #e2e8f0;
    border-radius: 4px;
}

.answer-zone {
    background: rgba(72, 187, 120, 0.1);
    border: 2px dashed #48bb78;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #38a169;
    font-weight: 500;
}

/* Property Panel Controls */
.property-group {
    margin-bottom: 1rem;
}

.property-group label {
    display: block;
    font-size: 0.8rem;
    color: #4a5568;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.property-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.property-slider {
    width: 100%;
    margin: 0.5rem 0;
}

.property-checkbox {
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .canvas-sidebar,
    .properties-panel {
        width: 200px;
    }
    
    .canvas {
        width: 500px;
        height: 350px;
    }
}

@media (max-width: 768px) {
    .editor-toolbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .toolbar-section {
        min-width: auto;
    }
    
    .canvas-container {
        flex-direction: column;
    }
    
    .canvas-sidebar,
    .properties-panel {
        width: 100%;
        height: 150px;
    }
    
    .canvas {
        width: 90%;
        height: 300px;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .colors-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    
    .quick-actions {
        flex-direction: column;
    }
}
