/* =============================================
   Hundequiz NRW – Stylesheet
   Aesthetic: Warm editorial / Lehrbuch-Charakter
   Dark slate + amber + cream
   ============================================= */

:root {
    --bg:        #1a1a2e;
    --bg2:       #16213e;
    --bg3:       #0f3460;
    --surface:   #1e2a45;
    --surface2:  #253659;
    --border:    #2e4070;
    --amber:     #e8a820;
    --amber-lt:  #f5c84e;
    --cream:     #f5efe0;
    --text:      #dce8f5;
    --text-muted:#8ba0c4;
    --green:     #4caf82;
    --red:       #e05a5a;
    --cat-a:     #e8a820;
    --cat-b:     #4caf82;
    --cat-c:     #5b8dee;
    --radius:    10px;
    --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.65;
    background-image:
        radial-gradient(ellipse at 20% 10%, rgba(14,52,96,0.6) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 90%, rgba(232,168,32,0.08) 0%, transparent 50%);
}

/* ---- Navbar ---- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: rgba(15,20,40,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cream);
    letter-spacing: -0.01em;
}
.nav-brand em { color: var(--amber); font-style: normal; }
.brand-icon { font-size: 1.4rem; }

.nav-links { display: flex; align-items: center; gap: 0.25rem; }

.nav-link {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-cta {
    background: var(--amber);
    color: #1a1200 !important;
    margin-left: 0.5rem;
}
.nav-cta:hover { background: var(--amber-lt); }
.nav-logout { color: var(--text-muted); }
.nav-user {
    margin-left: 1rem;
    padding: 0.3rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}
.nav-user:hover {
    background: var(--amber);
    border-color: var(--amber);
    color: #1a1200;
    transform: translateY(-1px);
}

/* ---- Main ---- */
.main-content {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.main-content.wide { max-width: 1100px; }

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
}
.footer-sub { margin-top: 0.2rem; opacity: 0.6; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.2rem; }

/* ---- Page headings ---- */
.page-title {
    font-family: 'Lora', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 0.4rem;
}
.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.4rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--amber); color: #1a1200; }
.btn-primary:hover { background: var(--amber-lt); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,168,32,0.3); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--amber); color: var(--amber); }
.btn-danger { background: var(--red); color: #fff; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Form elements ---- */
.form-group { margin-bottom: 1.2rem; }
.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    outline: none;
}
.form-input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232,168,32,0.1); }
.form-input::placeholder { color: var(--text-muted); }

/* ---- Alerts ---- */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.alert-error { background: rgba(224,90,90,0.15); border: 1px solid rgba(224,90,90,0.4); color: #f0a0a0; }
.alert-success { background: rgba(76,175,130,0.15); border: 1px solid rgba(76,175,130,0.4); color: #90e0b8; }
.alert-info { background: rgba(91,141,238,0.15); border: 1px solid rgba(91,141,238,0.4); color: #a0c0f8; }

/* ---- Auth pages ---- */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 3rem;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}
.auth-title {
    font-family: 'Lora', serif;
    font-size: 1.7rem;
    margin-bottom: 0.3rem;
    color: var(--cream);
}
.auth-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.auth-footer { margin-top: 1.5rem; text-align: center; font-size: 0.88rem; color: var(--text-muted); }
.auth-footer a { color: var(--amber); text-decoration: none; }

/* ---- Dashboard ---- */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-top: 1.5rem;
}
@media (max-width: 600px) { .dash-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-value { font-size: 2.2rem; font-family: 'Lora', serif; font-weight: 700; color: var(--cream); }
.stat-sub { font-size: 0.82rem; color: var(--text-muted); }

/* ---- Category selector ---- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}
.cat-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg2);
}
.cat-toggle input { display: none; }
.cat-toggle:has(input:checked) { border-color: var(--amber); background: rgba(232,168,32,0.08); }
.cat-toggle:hover { border-color: var(--amber-lt); }
.cat-letter {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 700;
}
.cat-a .cat-letter { background: rgba(232,168,32,0.2); color: var(--cat-a); }
.cat-b .cat-letter { background: rgba(76,175,130,0.2); color: var(--cat-b); }
.cat-c .cat-letter { background: rgba(91,141,238,0.2); color: var(--cat-c); }
.cat-name { font-weight: 600; font-size: 0.88rem; text-align: center; }
.cat-count { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Range slider ---- */
.slider-wrapper { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.slider-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--amber);
    min-width: 50px;
    text-align: center;
}
input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--amber);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(232,168,32,0.2);
}

/* ---- Quiz page ---- */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.quiz-meta { display: flex; gap: 1rem; align-items: center; }
.quiz-progress-text { font-size: 0.88rem; color: var(--text-muted); }
.quiz-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: var(--amber);
    background: rgba(232,168,32,0.1);
    border: 1px solid rgba(232,168,32,0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
}
.quiz-timer.warning { color: var(--red); border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

.progress-bar { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 2rem; }
.progress-fill { height: 100%; background: var(--amber); border-radius: 2px; transition: width 0.5s ease; }

.question-num { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.5rem; }
.question-num span {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}
.cat-tag-a { background: rgba(232,168,32,0.15); color: var(--cat-a); }
.cat-tag-b { background: rgba(76,175,130,0.15); color: var(--cat-b); }
.cat-tag-c { background: rgba(91,141,238,0.15); color: var(--cat-c); }

.question-text {
    font-family: 'Lora', serif;
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--cream);
    margin-bottom: 1.5rem;
}
.question-type-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

/* ---- Answer options ---- */
.answers-list { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.5rem; }

.answer-option {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1.1rem;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.answer-option:hover { border-color: var(--amber); background: rgba(232,168,32,0.05); }
.answer-option.selected { border-color: var(--amber); background: rgba(232,168,32,0.1); }
.answer-option.correct { border-color: var(--green); background: rgba(76,175,130,0.12); }
.answer-option.wrong { border-color: var(--red); background: rgba(224,90,90,0.12); }
.answer-option.correct-missed { border-color: var(--green); background: rgba(76,175,130,0.06); opacity: 0.8; }

.answer-option input { display: none; }

.answer-indicator {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s;
}
.answer-option.selected .answer-indicator { border-color: var(--amber); background: var(--amber); }
.answer-option.correct .answer-indicator { border-color: var(--green); background: var(--green); }
.answer-option.wrong .answer-indicator { border-color: var(--red); background: var(--red); }
.answer-option.correct-missed .answer-indicator { border-color: var(--green); }

/* checkbox style */
.cb-indicator {
    width: 22px; height: 22px;
    border-radius: 5px;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s;
}
.answer-option.selected .cb-indicator { border-color: var(--amber); background: var(--amber); }
.answer-option.correct .cb-indicator { border-color: var(--green); background: var(--green); }
.answer-option.wrong .cb-indicator { border-color: var(--red); background: var(--red); }
.answer-option.correct-missed .cb-indicator { border-color: var(--green); }

.answer-text-label { flex: 1; font-size: 0.95rem; line-height: 1.5; }

.quiz-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }

/* ---- Feedback ---- */
.feedback-box {
    padding: 1rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}
.feedback-box.show { display: block; }
.feedback-correct { background: rgba(76,175,130,0.15); border: 1px solid var(--green); }
.feedback-wrong { background: rgba(224,90,90,0.15); border: 1px solid var(--red); }
.feedback-title { font-weight: 700; margin-bottom: 0.3rem; }
.feedback-correct .feedback-title { color: var(--green); }
.feedback-wrong .feedback-title { color: var(--red); }

/* ---- Results page ---- */
.result-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}
.result-score {
    font-family: 'Lora', serif;
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--amber);
}
.result-score .denom { font-size: 2rem; color: var(--text-muted); }
.result-percent { font-size: 1.5rem; color: var(--cream); margin: 0.5rem 0; }
.result-grade { font-size: 1.1rem; color: var(--text-muted); margin-top: 0.5rem; }
.result-passed { color: var(--green); }
.result-failed { color: var(--red); }

.result-breakdown { margin-top: 2rem; }
.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.breakdown-q { flex: 1; font-size: 0.9rem; line-height: 1.4; padding-right: 1rem; }
.breakdown-badge {
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.badge-correct { background: rgba(76,175,130,0.2); color: var(--green); }
.badge-wrong { background: rgba(224,90,90,0.2); color: var(--red); }

/* ---- Leaderboard ---- */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}
.leaderboard-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.leaderboard-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(46,64,112,0.5);
    font-size: 0.92rem;
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { background: rgba(232,168,32,0.04); }
.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Lora', serif;
}
.rank-1 { background: linear-gradient(135deg,#f5c84e,#e8a820); color: #1a1200; }
.rank-2 { background: linear-gradient(135deg,#c0c8d8,#8090b0); color: #0a1020; }
.rank-3 { background: linear-gradient(135deg,#cd8040,#a06030); color: #fff; }
.rank-other { background: var(--surface2); color: var(--text-muted); }
.current-user-row td { background: rgba(232,168,32,0.06) !important; }

/* ---- Stats page ---- */
.history-list { display: flex; flex-direction: column; gap: 0.6rem; }
.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
}
.history-date { color: var(--text-muted); min-width: 130px; font-family: 'JetBrains Mono',monospace; font-size: 0.78rem; }
.history-cats { display: flex; gap: 0.3rem; }
.history-cat {
    width: 20px; height: 20px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700;
}
.hcat-a { background: rgba(232,168,32,0.2); color: var(--cat-a); }
.hcat-b { background: rgba(76,175,130,0.2); color: var(--cat-b); }
.hcat-c { background: rgba(91,141,238,0.2); color: var(--cat-c); }
.history-score { flex: 1; font-weight: 600; }
.history-time { color: var(--text-muted); font-family: 'JetBrains Mono',monospace; font-size: 0.78rem; }

.mini-chart-wrap { height: 80px; display: flex; align-items: flex-end; gap: 3px; }
.mini-bar {
    flex: 1;
    background: var(--amber);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.mini-bar:hover { opacity: 1; }

/* ---- Misc ---- */
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* Fade-in animation */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ---- Fragen-Bilder ---- */
.question-images {
    margin: 1rem 0 1.2rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.question-images--single {
    display: flex;
    justify-content: center;
}

.question-images--grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.q-img-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.q-img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 4px;
    filter: invert(1) brightness(0.85);  /* Weiß auf Dunkel → Dunkel auf Hell-Dunkel */
    image-rendering: crisp-edges;
}

/* A3 kombiniertes Bild etwas größer */
.question-images--single .q-img {
    max-height: 180px;
    max-width: 100%;
}

/* ---- Matching Questions (Zuordnungsfragen) - Button Style ---- */
.matching-table {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 1rem 0 1.5rem;
}

.matching-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.matching-item {
    flex: 1;
    min-width: 180px;
    padding: 0.8rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    color: var(--text);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.matching-item .matching-id {
    color: var(--amber);
    font-weight: 700;
    flex-shrink: 0;
    align-self: center;
}

.matching-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.matching-option {
    position: relative;
    cursor: pointer;
}

.matching-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.matching-opt-btn {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
}

.matching-option:hover .matching-opt-btn {
    border-color: var(--amber);
    background: rgba(232,168,32,0.05);
}

.matching-option input:checked + .matching-opt-btn {
    background: var(--amber);
    border-color: var(--amber);
    color: #1a1200;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(232,168,32,0.3);
}

/* Responsive: Stack on small screens */
@media (max-width: 600px) {
    .matching-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .matching-item {
        min-width: unset;
    }
    
    .matching-options {
        justify-content: center;
    }
}
/* Responsive: auf kleinen Screens vertikal */
@media (max-width: 600px) {
    .matching-options {
        padding-left: 0;
    }
}

/* Matching Legend (für Fragen mit langen Options) */
.matching-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: rgba(232,168,32,0.05);
    border: 1px solid rgba(232,168,32,0.2);
    border-radius: 6px;
    margin: 0.5rem 0 1rem;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    line-height: 1.4;
}

.legend-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0 0.3rem;
}

.legend-text {
    color: var(--text-muted);
}

/* Kompakte Matching-Items (nur ID, bei Bildfragen) */
.matching-item--compact {
    min-width: 60px;
    max-width: 80px;
    padding: 0.6rem 0.8rem;
    justify-content: center;
    text-align: center;
}

.matching-item--compact .matching-id {
    margin-right: 0;
}

/* ---- Form Styles ---- */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.1rem;
    font-size: 1rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--amber);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(232,168,32,0.1);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg2);
}

input[type="email"].form-control,
input[type="password"].form-control,
input[type="text"].form-control {
    -webkit-appearance: none;
    appearance: none;
}

/* =============================================
   NEW STYLES – Hundequiz Improved
   ============================================= */

/* ---- Mobile Hamburger Menu ---- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 110;
}
.hamburger {
    display: block;
    width: 24px; height: 2px;
    background: var(--text);
    position: relative;
    transition: all 0.3s;
}
.hamburger::before, .hamburger::after {
    content: ''; position: absolute; left: 0;
    width: 24px; height: 2px; background: var(--text);
    transition: all 0.3s;
}
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }
.nav-toggle.open .hamburger { background: transparent; }
.nav-toggle.open .hamburger::before { transform: rotate(45deg); top: 0; }
.nav-toggle.open .hamburger::after { transform: rotate(-45deg); top: 0; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 64px; left: 0; right: 0;
        flex-direction: column;
        background: rgba(15,20,40,0.98);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        gap: 0.5rem;
        box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    }
    .nav-links.open { display: flex; }
    .nav-link { padding: 0.7rem 1rem; }
    .nav-user { margin: 0.5rem 0 0; text-align: center; }
    .cat-grid { grid-template-columns: 1fr; }
}

/* ---- Mode Selection ---- */
.mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0.5rem 0;
}
.mode-option { cursor: pointer; }
.mode-option input[type="radio"] { display: none; }
.mode-card {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
    background: var(--bg2);
}
.mode-option input:checked + .mode-card {
    border-color: var(--amber);
    background: rgba(232,168,32,0.08);
}
.mode-card:hover { border-color: var(--amber-lt); }
.mode-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.mode-name { font-weight: 700; font-size: 0.9rem; }
.mode-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

.mode-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}
.mode-learn { background: rgba(91,141,238,0.15); color: var(--cat-c); }

/* ---- Keyboard Shortcuts Hint ---- */
.keyboard-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    opacity: 0.7;
}
.answer-key-hint {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    background: var(--surface2);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}
@media (max-width: 768px) { .keyboard-hint, .answer-key-hint { display: none; } }

/* ---- Bookmarks ---- */
.question-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.bookmark-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}
.bookmark-btn:hover { border-color: var(--amber); transform: scale(1.1); }
.bookmark-btn.bookmarked { border-color: var(--amber); background: rgba(232,168,32,0.1); }
.bookmark-form { display: inline; }

.bookmark-card {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.bookmark-card:last-child { border-bottom: none; }
.bookmark-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* ---- Learning Mode Feedback ---- */
.feedback-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}
.feedback-icon { font-size: 2rem; }
.feedback-text {
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 700;
}
.feedback-correct .feedback-text { color: var(--green); }
.feedback-wrong .feedback-text { color: var(--red); }

.feedback-answers { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.fb-answer {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.92rem;
}
.fb-marker { font-size: 1.1rem; flex-shrink: 0; }
.fb-correct-selected { background: rgba(76,175,130,0.12); border: 1px solid var(--green); }
.fb-correct-missed { background: rgba(76,175,130,0.08); border: 1px solid rgba(76,175,130,0.4); }
.fb-wrong-selected { background: rgba(224,90,90,0.12); border: 1px solid var(--red); text-decoration: line-through; opacity: 0.8; }

.feedback-match-row {
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}
.match-ok { background: rgba(76,175,130,0.1); border: 1px solid rgba(76,175,130,0.3); }
.match-wrong { background: rgba(224,90,90,0.1); border: 1px solid rgba(224,90,90,0.3); }

/* ---- Utility classes ---- */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }

.card-heading {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--cream);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    display: block;
}

.category-warning {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: rgba(232,168,32,0.1);
    border: 1px solid rgba(232,168,32,0.3);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--amber);
}

.stat-value-sm { font-size: 1.6rem !important; }

.quiz-score-bar { padding: 1rem 1.4rem; font-size: 0.85rem; color: var(--text-muted); }

/* ---- Results page extras ---- */
.result-meta {
    display: flex; gap: 2rem; justify-content: center;
    margin-top: 1.5rem; flex-wrap: wrap;
}
.result-meta-item { text-align: center; }
.result-meta-value {
    font-size: 1.5rem; font-family: 'Lora', serif; color: var(--cream);
}
.result-meta-label { font-size: 0.8rem; color: var(--text-muted); }
.result-cat-badge {
    font-size: 1rem; padding: 0.2rem 0.5rem;
    border-radius: 4px; background: rgba(255,255,255,0.1);
}
.result-actions {
    margin-top: 2rem; display: flex; gap: 1rem;
    justify-content: center; flex-wrap: wrap;
}

.cat-breakdown { display: flex; flex-direction: column; gap: 0.8rem; }
.cat-breakdown-item { margin-bottom: 0.5rem; }

.detail-cat-header {
    margin: 1.2rem 0 0.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    font-weight: 700;
}
.breakdown-num {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.2rem;
}

.correct-answer-block {
    padding: 0.6rem 1rem 0.8rem 1.3rem;
    margin-bottom: 0.5rem;
    border-left: 2px solid var(--green);
    margin-left: 0.5rem;
}
.correct-answer-label {
    font-size: 0.75rem;
    color: var(--green);
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.correct-answer-text {
    font-size: 0.83rem;
    color: var(--text-muted);
}

/* ---- Legal text pages ---- */
.legal-text h2 { margin-top: 2rem; margin-bottom: 0.5rem; font-size: 1.1rem; color: var(--cream); }
.legal-text h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; font-size: 1rem; color: var(--cream); }
.legal-text h4 { margin-top: 1rem; margin-bottom: 0.3rem; font-size: 0.95rem; color: var(--text); }
.legal-text p { margin-bottom: 0.8rem; color: var(--text-muted); line-height: 1.7; }

/* ---- Footer links ---- */
.footer a { color: var(--text-muted); text-decoration: underline; }
.footer a:hover { color: var(--amber); }

/* ---- Cookie Banner ---- */
.cookie-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #1a1a2e;
    border-top: 2px solid var(--amber);
    padding: 1.5rem;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}
.cookie-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; gap: 2rem; align-items: center;
    justify-content: space-between; flex-wrap: wrap;
}
.cookie-text { flex: 1; min-width: 300px; }
.cookie-text h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--amber); }
.cookie-text p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.cookie-actions { flex-shrink: 0; }

/* ---- Admin ---- */
.admin-tabs {
    display: flex; gap: 0.5rem;
    margin: 1.5rem 0;
    border-bottom: 2px solid var(--border);
}
.admin-tab {
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 600;
}
.admin-tab:hover { color: var(--text); border-bottom-color: var(--amber); text-decoration: none; }
.admin-tab.active { color: var(--amber); border-bottom-color: var(--amber); }

.admin-table {
    width: 100%; border-collapse: collapse; margin-top: 1rem;
}
.admin-table th {
    text-align: left; padding: 0.8rem;
    background: var(--bg2); border-bottom: 2px solid var(--border);
    font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
}
.admin-table td {
    padding: 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.admin-table tr:hover { background: var(--bg2); }
.table-responsive { overflow-x: auto; }

.btn-small {
    padding: 0.3rem 0.8rem; font-size: 0.8rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text);
    text-decoration: none; display: inline-block; transition: all 0.15s;
}
.btn-small:hover { background: var(--amber); border-color: var(--amber); color: #1a1200; }

.danger-zone { border-color: var(--red); }

.matching-legend-title {
    font-size: 0.78rem; font-weight: 700;
    color: var(--text-muted); margin-bottom: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.05em;
}
/* ---- Toggle Switch ---- */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg2);
    transition: all 0.2s;
}
.toggle-row:hover { border-color: var(--amber); }
.toggle-row:has(input:checked) {
    border-color: var(--amber);
    background: rgba(232,168,32,0.06);
}
.toggle-switch {
    position: relative;
    width: 48px; height: 26px;
    flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-track {
    position: absolute; inset: 0;
    background: var(--border);
    border-radius: 13px;
    transition: background 0.2s;
}
.toggle-switch input:checked + .toggle-track {
    background: var(--amber);
}
.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: var(--cream);
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-track::after {
    transform: translateX(22px);
}
.toggle-label strong { display: block; font-size: 0.92rem; }
.toggle-label .form-hint { margin: 0.1rem 0 0; }
