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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #FAFAF9;
    min-height: 100vh;
    color: #1F2937;
    line-height: 1.7;
    font-size: 16px;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: #1F2937;
}

.header h1 {
    font-size: 2.25rem;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.header p {
    font-size: 1rem;
    color: #6B7280;
    font-weight: 400;
}

/* Phase Management */
.phase {
    display: none;
}

.phase.active {
    display: block;
}

/* Setup Phase */
.setup-container {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #F3F4F6;
}

.setup-container h2 {
    text-align: center;
    margin-bottom: 32px;
    color: #1F2937;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Deck Filter Section */
.deck-filter-section {
    margin-bottom: 32px;
}

.deck-filter-section h3 {
    margin-bottom: 8px;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
}

.deck-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 480px) {
    .deck-checkboxes {
        grid-template-columns: 1fr;
    }
}

.deck-checkbox {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #F9FAFB;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.deck-checkbox:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
}

.deck-checkbox input[type="checkbox"] {
    display: none;
}

.deck-checkbox .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #D1D5DB;
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.deck-checkbox input[type="checkbox"]:checked + .checkmark {
    background: #3B82F6;
    border-color: #3B82F6;
}

.deck-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.deck-checkbox:has(input[type="checkbox"]:checked) {
    background: #EBF4FF;
    border-color: #3B82F6;
    color: #1E40AF;
}

/* Filters Section */
.filters-section {
    margin-bottom: 32px;
}

.filters-section h3 {
    margin-bottom: 8px;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
}

.filter-help {
    font-size: 0.875rem;
    color: #6B7280;
    margin-bottom: 24px;
    text-align: center;
}

.filter-grid {
    display: grid;
    gap: 16px;
}

.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}

.filter-item:hover {
    border-color: #059669;
    background: #ECFDF5;
}

.filter-item label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    flex: 1;
    cursor: pointer;
}

.filter-slider {
    width: 80px;
    margin: 0 16px;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #E5E7EB;
    outline: none;
}

.filter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #059669;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.filter-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #059669;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.filter-value {
    font-weight: 600;
    color: #059669;
    font-size: 0.875rem;
    min-width: 20px;
    text-align: center;
}

/* Question Count Section */
.question-count-section {
    margin-bottom: 32px;
    text-align: center;
}

.question-count-section label {
    display: block;
    margin-bottom: 16px;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.question-input {
    width: 120px;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: border-color 0.2s ease;
    background: white;
}

.question-input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.available-count {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #6B7280;
}

/* Start Button */
.start-btn {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.start-btn:hover:not(:disabled) {
    background: #047857;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9CA3AF;
}

/* Game Phase */
.game-container {
    color: #1F2937;
}

/* Smaller header when game phase is active */
body.game-active .header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

body.game-active .header {
    margin-bottom: 24px;
}

/* Progress Section */
.progress-section {
    margin-bottom: 32px;
    text-align: center;
}

.progress-info {
    font-size: 0.875rem;
    margin-bottom: 12px;
    font-weight: 500;
    color: #6B7280;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #059669;
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Question Card */
.question-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 48px 40px;
    margin-bottom: 32px;
    box-shadow: 
        0 10px 25px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    transform: translateY(0);
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 20px 40px -3px rgba(0, 0, 0, 0.12),
        0 8px 16px -4px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}


.question-card::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), rgba(16, 185, 129, 0.05));
    border-radius: 20px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.question-card:hover::after {
    opacity: 1;
}

.card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    text-align: center;
}

.question-text {
    font-family: 'Bitter', serif;
    font-size: 1.625rem;
    line-height: 1.5;
    color: #1F2937;
    text-align: left;
    margin-bottom: 40px;
    font-weight: 700;
    letter-spacing: -0.01em;
    position: relative;
    padding-top: 24px;
}

.question-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: #059669;
    border-radius: 2px;
}

.question-meta {
    margin-top: auto;
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.category-tag {
    padding: 4px 12px;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 6px;
    font-size: 0.6875rem;
    color: #047857;
    font-weight: 500;
    font-variant: small-caps;
}

.category-tag.high {
    background: #059669;
    color: white;
    border-color: #059669;
}

/* Navigation */
.navigation {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.nav-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    background: white;
    color: #374151;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.nav-btn:hover:not(:disabled) {
    background: #F9FAFB;
    border-color: #9CA3AF;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #F3F4F6;
    color: #9CA3AF;
}

.nav-btn.primary {
    background: #059669;
    color: white;
    border-color: #059669;
}

.nav-btn.primary:hover:not(:disabled) {
    background: #047857;
    border-color: #047857;
}

/* Game Actions */
.game-actions {
    text-align: center;
}

.action-btn {
    padding: 12px 24px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.action-btn:hover {
    background: #F9FAFB;
    border-color: #9CA3AF;
}

.action-btn.primary {
    background: #059669;
    color: white;
    border-color: #059669;
}

.action-btn.primary:hover {
    background: #047857;
    border-color: #047857;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .setup-container {
        padding: 24px 20px;
    }
    
    .filter-item {
        padding: 14px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .filter-item label {
        flex: 1 1 100%;
        text-align: center;
        margin-bottom: 8px;
    }
    
    .filter-slider {
        flex: 1;
        margin: 0 12px;
        min-width: 80px;
    }
    
    .question-card {
        padding: 32px 24px;
        min-height: 280px;
        border-radius: 16px;
    }
    
    .question-text {
        font-size: 1.25rem;
        margin-bottom: 24px;
        line-height: 1.4;
    }
    
    .navigation {
        flex-direction: column;
        gap: 12px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .filter-slider {
        height: 8px;
    }
    
    .filter-slider::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }
    
    .filter-slider::-moz-range-thumb {
        width: 22px;
        height: 22px;
    }
    
    .nav-btn, .action-btn, .start-btn {
        min-height: 44px;
    }
}