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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

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

h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.stats {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255,255,255,0.95);
    padding: 15px 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.mode-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
}

.mode-btn {
    padding: 12px 30px;
    font-size: 1.1em;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.table-selector h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.focus-tag {
    text-align: center;
    color: #ff6b6b;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.table-btn {
    padding: 20px;
    font-size: 1.3em;
    font-weight: bold;
    border: 3px solid #e0e0e0;
    background: white;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.table-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.table-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.table-btn.focus {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.table-btn.focus.selected {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.table-btn.focus::after {
    content: "⭐";
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.2em;
}

.start-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.3em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.practice-area, .challenge-area {
    text-align: center;
}

.question-card, .challenge-card {
    background: #f8f9ff;
    padding: 40px;
    border-radius: 20px;
    margin-bottom: 30px;
}

.timer {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
}

.timer.warning {
    color: #ff6b6b;
    animation: pulse 1s infinite;
}

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

.question {
    font-size: 3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 30px;
}

#answer-input, #challenge-answer {
    width: 200px;
    padding: 15px;
    font-size: 1.5em;
    text-align: center;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

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

.submit-btn {
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: bold;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.feedback {
    margin-top: 20px;
    font-size: 1.3em;
    font-weight: bold;
    min-height: 40px;
}

.feedback.correct {
    color: #51cf66;
}

.feedback.incorrect {
    color: #ff6b6b;
}

.progress-info {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #51cf66 0%, #37b24d 100%);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: #666;
    font-size: 1.1em;
}

.challenge-stats {
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
}

.back-btn, #challenge-back {
    padding: 12px 25px;
    font-size: 1em;
    background: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover, #challenge-back:hover {
    background: #d0d0d0;
}

.hidden {
    display: none !important;
}

/* Update notification */
.update-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

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

.update-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.update-message {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

.update-btn {
    padding: 10px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.update-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.dismiss-btn {
    padding: 10px 20px;
    background: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.dismiss-btn:hover {
    background: #d0d0d0;
}

/* App version display */
.app-version {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.6);
    font-family: monospace;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    pointer-events: none;
    user-select: none;
}

/* Responsive design */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8em;
    }

    .tables-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .question {
        font-size: 2em;
    }

    main {
        padding: 25px;
    }
}
