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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --gradient-start: #0f172a;
    --gradient-end: #1e293b;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --modal-bg: rgba(0, 0, 0, 0.8);
}

/* Light mode theme */
body.light-mode {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --gradient-start: #f1f5f9;
    --gradient-end: #e0e7ff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --modal-bg: rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 700px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-color);
    padding: 40px;
    animation: fadeIn 0.5s ease;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

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

header {
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.header-text {
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    white-space: nowrap;
}

h1 .gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px;
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 5px 20px var(--shadow-color);
}

.theme-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

.learn-btn {
    padding: 12px 24px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: 150px;
}

.learn-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

/* Settings Panel */
.settings-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.setting-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.setting-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.mode-buttons,
.timer-buttons {
    display: flex;
    gap: 10px;
}

.mode-btn,
.timer-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover,
.timer-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.mode-btn.active,
.timer-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.start-btn,
.stop-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.stop-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    margin-top: 30px;
}

.stop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}

/* Game Panel */
.stats-bar {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 10px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: bold;
}

.date-display {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: var(--bg-color);
    border-radius: 15px;
}

.date-display h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.date-hint {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.feedback {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.feedback.correct {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border: 2px solid var(--success-color);
}

.feedback.incorrect {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
    border: 2px solid var(--error-color);
}

.day-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.day-btn {
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.day-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
}

.day-btn:active {
    transform: translateY(0);
}

.day-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    animation: pulse 0.5s;
}

.day-btn.incorrect {
    background: var(--error-color);
    border-color: var(--error-color);
    animation: shake 0.5s;
}

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

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

/* Results Panel */
.results-panel {
    text-align: center;
}

.results-panel h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.results-stats {
    background: var(--bg-color);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.result-label {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.result-value {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: bold;
}

/* Learn Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--modal-bg);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.8rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2.5rem;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    color: var(--text-primary);
}

.modal-body h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-body h2 {
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.modal-body h3 {
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.modal-body p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-color);
    border-radius: 10px;
    overflow: hidden;
}

.modal-body th,
.modal-body td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.modal-body th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.modal-body tr:last-child td {
    border-bottom: none;
}

.modal-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.modal-body code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
}

.modal-body ul,
.modal-body ol {
    margin-left: 25px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-body hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 30px 0;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 25px;
        padding-top: 60px; /* Extra space for theme toggle */
    }

    h1 {
        font-size: 1.6rem;
        white-space: normal; /* Allow wrapping on very small screens */
    }

    .day-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-bar {
        flex-direction: column;
        gap: 15px;
    }

    .learn-btn {
        width: 100%;
    }

    .theme-toggle {
        top: 15px;
        right: 15px;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-header {
        padding: 20px;
    }
}


