:root {
    --primary-color: rgb(220, 38, 38);
    --primary-dark: #dc2626;
    --primary-light: rgb(239, 68, 68);
    --secondary-color: #ee7422;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #1a1a1a;
    --surface: #2d2d2d;
    --surface-light: #404040;
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #a1a1a1;
    --border-color: #404040;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accuracy Metric Styles */
.accuracy-metric {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--surface), var(--surface-light));
    border-radius: var(--radius);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.accuracy-metric h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    opacity: 0.9;
}

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

.circular-progress {
    position: relative;
    display: inline-block;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-background {
    stroke: var(--border-color);
}

.progress-ring-fill {
    stroke: var(--error-color);
    transition: stroke-dashoffset 1s ease-in-out;
}

.accuracy-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.accuracy-numbers {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: block;
}

.accuracy-percentage {
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 0.9;
    display: block;
    margin-top: 0.25rem;
}

.accuracy-label {
    font-size: 1.1rem;
    opacity: 0.8;
    font-weight: 400;
}

/* Link styling to override browser defaults */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

a:visited {
    color: var(--primary-color);
}

a:active {
    color: var(--primary-dark);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #2c2c2c 0%, #160c0c 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    margin-bottom: 3rem;
    color: white;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

.brand {
    text-align: left;
}

.auth-section, .user-section {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-email {
    color: white;
    font-weight: 500;
    margin-right: 1rem;
}

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

.subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    font-weight: 300;
}

.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.operation-selector {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 100%;
    max-width: 600px;
}

.operation-selector h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

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

.op-btn {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.op-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.op-icon {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.op-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.practice-area {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
}

.question-card {
    margin-bottom: 2rem;
}

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

.question-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats {
    display: flex;
    gap: 1rem;
}

.score, .streak {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.problem {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 600;
}

.number {
    color: var(--text-primary);
    min-width: 3rem;
    text-align: center;
}

.operator {
    color: var(--primary-color);
    font-size: 2.5rem;
}

.equals {
    color: var(--text-secondary);
}

.answer-input {
    width: 4rem;
    height: 3rem;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    transition: var(--transition);
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.feedback {
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    margin-bottom: 1rem;
}

.feedback.success {
    color: var(--success-color);
}

.feedback.error {
    color: var(--error-color);
}

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

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #06b6d4;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--background);
    border-color: var(--text-secondary);
}

.progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.results-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.results-card h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Authentication Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-switch span {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    transition: var(--transition);
}

.btn-link:hover {
    color: var(--primary-dark);
}

.auth-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: 8px;
    color: var(--error-color);
    font-size: 0.875rem;
    display: none;
}

.auth-error.show {
    display: block;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .operation-selector,
    .practice-area,
    .results-section {
        padding: 1.5rem;
    }
    
    .operation-buttons {
        grid-template-columns: 1fr;
    }
    
    .problem {
        font-size: 1.5rem;
        flex-wrap: wrap;
    }
    
    .answer-input {
        width: 3rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
}
