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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px 0;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Info Box */
.info-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.info-box h2 {
    margin-bottom: 8px;
}

#date-display {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
}

.info-text {
    color: var(--text-muted);
    margin-top: 8px;
}

/* Topics */
.topics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 500px) {
    .topics {
        grid-template-columns: 1fr;
    }
}

.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.topic-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.topic-icon {
    font-size: 1.5rem;
}

.topic-name {
    font-weight: 500;
}

/* Quiz Container */
.quiz-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 10%;
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* Question Card */
.question-card {
    margin-bottom: 24px;
}

.question-topic {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 16px;
}

.question-text {
    font-size: 1.25rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Answers */
.answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-btn {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.answer-btn.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
}

.answer-btn.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.2);
}

.answer-btn.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.2);
}

/* Feedback */
.feedback {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 500;
}

.feedback.correct {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

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

/* Buttons */
.btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-controls {
    display: flex;
    justify-content: flex-end;
}

/* Results */
.results {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    border: 1px solid var(--border);
}

.results h2 {
    margin-bottom: 24px;
}

.score-display {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.score-display.excellent {
    color: var(--success);
}

.score-display.good {
    color: var(--primary);
}

.score-display.okay {
    color: var(--warning);
}

.score-display.needs-work {
    color: var(--error);
}

.score-breakdown {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

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

.score-item .label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.score-item .value {
    font-size: 1.5rem;
    font-weight: 600;
}

.comeback-text {
    color: var(--text-muted);
    margin-top: 16px;
}

/* Tagesverlauf / History */
.today-history {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: left;
}

.today-history h3 {
    margin-bottom: 12px;
    text-align: center;
}

.history-avg {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.history-avg strong {
    color: var(--primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.95rem;
}

.history-num {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 30px;
}

.history-time {
    color: var(--text-muted);
    min-width: 50px;
}

.history-score {
    margin-left: auto;
    font-weight: 500;
}

/* Footer */
footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.footer-info h3 {
    margin-bottom: 12px;
}

.footer-info ul {
    margin: 12px 0;
    padding-left: 24px;
}

.footer-info li {
    margin-bottom: 8px;
    color: var(--text-muted);
}

.source {
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.source a {
    color: var(--primary);
    text-decoration: none;
}

.source a:hover {
    text-decoration: underline;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Math formatting */
.math {
    font-family: 'Times New Roman', serif;
    font-style: italic;
}

sup {
    font-size: 0.7em;
    vertical-align: super;
}

sub {
    font-size: 0.7em;
    vertical-align: sub;
}

/* Buttons Layout */
.results-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

/* Stats Container */
.stats-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.stats-header h2 {
    margin: 0;
}

.stats-content {
    margin-bottom: 24px;
}

.stats-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Stats Summary */
.stats-summary {
    margin-bottom: 32px;
}

.stats-summary h3 {
    text-align: center;
    margin-bottom: 20px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 500px) {
    .stats-overview {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Chart Sections */
.stats-chart-section {
    margin-bottom: 32px;
}

.stats-chart-section h4 {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.chart-container {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    height: 250px;
}

/* Topic Stats */
.stats-topics {
    margin-bottom: 32px;
}

.stats-topics h4 {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.topic-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.topic-stat-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
}

.topic-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 12px;
    margin-bottom: 12px;
}

.topic-stat-name {
    font-weight: 600;
}

.topic-stat-pct {
    font-size: 1.5rem;
    font-weight: 700;
}

.topic-stat-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.topic-stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.topic-stat-details {
    font-size: 0.85rem;
    color: var(--text-muted);
}
