/* test.lehrerland.de - Styling (Lexend lokal, CSP font-src 'self') */

@font-face {
    font-family: 'Lexend';
    src: url('/fonts/lexend/Lexend.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --form-field-bg: #fff9e6;
    --form-field-bg-focus: #fffef8;
    --form-field-bg-disabled: #f3ead8;
}

/* Pastellgelbe Formularfelder (Spezifität 0) */
:where(textarea, select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not([type="range"]):not([type="color"])) {
    background-color: var(--form-field-bg);
}

body {
    font-family: 'Lexend', system-ui, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Navbar */
.navbar {
    background: #4A90E2;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-menu {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
}

.btn-menu:hover {
    background: rgba(255,255,255,0.3);
}

.user-menu {
    position: fixed;
    top: 60px;
    right: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ── Login (Lavalampe gelb-blau) ─────────────────────────────────────── */
body.login-page {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    /* Statischer Verlauf statt der animierten Aurora-Bänder. Die früheren Bänder
       nutzten filter: blur(60px) + mix-blend-mode: screen + will-change auf 4
       großen, fixierten Ebenen — mix-blend-mode zwingt den Browser, diese Ebenen
       bei JEDEM Repaint (Cursor-Blinken, Tastendruck) neu mit dem Hintergrund zu
       verrechnen. Das machte das Tippen im Login langsam. Radiale/lineare
       Verläufe werden dagegen EINMAL gerendert und kosten danach nichts mehr. */
    background:
        radial-gradient(60% 55% at 22% 18%, rgba(250, 204, 21, 0.40) 0%, rgba(250, 204, 21, 0) 60%),
        radial-gradient(55% 50% at 82% 80%, rgba(96, 165, 250, 0.45) 0%, rgba(96, 165, 250, 0) 60%),
        linear-gradient(135deg, #0b2545 0%, #1e3a8a 45%, #2563eb 100%);
    background-attachment: fixed;
    position: relative;
}

/* Aurora-Ebenen komplett deaktiviert (Performance, siehe body.login-page). Das
   HTML-Markup in index.php darf bleiben — es wird hier unsichtbar geschaltet. */
.aurora-bg {
    display: none !important;
}

/* Diagonale, weich verlaufende Bänder. Jedes Band ist ein langgezogenes
   linear-gradient, weichgeblurrt und langsam in seiner Achse animiert.
   Mix-blend-mode: screen sorgt für das leuchtende Übereinanderlegen. */
.aurora-band {
    position: absolute;
    left: -25%;
    width: 150%;
    height: 55vh;
    filter: blur(60px);
    opacity: 0.55;
    mix-blend-mode: screen;
    will-change: transform, opacity;
    transform-origin: center center;
}

.aurora-band--1 {
    top: -10vh;
    height: 60vh;
    background: linear-gradient(110deg,
        rgba(253, 224, 71, 0)   0%,
        rgba(250, 204, 21, 0.85) 30%,
        rgba(245, 158, 11, 0.75) 55%,
        rgba(250, 204, 21, 0)   100%);
    transform: rotate(-12deg);
    animation: aurora-drift-1 26s ease-in-out infinite alternate;
}
.aurora-band--2 {
    top: 18vh;
    height: 50vh;
    background: linear-gradient(110deg,
        rgba(59, 130, 246, 0)   0%,
        rgba(96, 165, 250, 0.8) 25%,
        rgba(37, 99, 235, 0.85) 55%,
        rgba(29, 78, 216, 0)    100%);
    transform: rotate(-8deg);
    opacity: 0.65;
    animation: aurora-drift-2 30s ease-in-out infinite alternate;
}
.aurora-band--3 {
    top: 42vh;
    height: 45vh;
    background: linear-gradient(110deg,
        rgba(254, 240, 138, 0)  0%,
        rgba(253, 224, 71, 0.75) 25%,
        rgba(250, 204, 21, 0.7) 60%,
        rgba(245, 158, 11, 0)   100%);
    transform: rotate(-6deg);
    opacity: 0.5;
    animation: aurora-drift-3 34s ease-in-out infinite alternate;
}
.aurora-band--4 {
    bottom: -8vh;
    height: 55vh;
    background: linear-gradient(110deg,
        rgba(30, 64, 175, 0)    0%,
        rgba(37, 99, 235, 0.85) 30%,
        rgba(96, 165, 250, 0.75) 60%,
        rgba(147, 197, 253, 0)  100%);
    transform: rotate(-10deg);
    opacity: 0.7;
    animation: aurora-drift-4 28s ease-in-out infinite alternate;
}

/* Performance: Aurora STATISCH lassen. Vier dauerhaft animierte Bänder mit
   filter: blur(60px) + mix-blend-mode: screen hielten den Compositor permanent
   beschäftigt und machten u. a. das Tippen im Login langsam ("Zeitlupe"). Ohne
   Animation wird der Hintergrund nur einmal gerendert — danach keine Repaint-
   Kosten mehr. Gleiche Spezifität wie die Band-Regeln, steht aber danach → setzt
   sich durch und schaltet alle vier Animationen ab. */
.aurora-band { animation: none; }

@keyframes aurora-drift-1 {
    0%   { transform: translate(-6vw, 0)   rotate(-12deg) scaleX(1);   opacity: 0.5; }
    50%  { transform: translate(4vw, 2vh)  rotate(-10deg) scaleX(1.1); opacity: 0.65; }
    100% { transform: translate(8vw, -1vh) rotate(-14deg) scaleX(0.95); opacity: 0.55; }
}
@keyframes aurora-drift-2 {
    0%   { transform: translate(4vw, 0)    rotate(-8deg)  scaleX(1);   opacity: 0.6; }
    50%  { transform: translate(-6vw, -2vh) rotate(-6deg)  scaleX(1.15); opacity: 0.75; }
    100% { transform: translate(-10vw, 3vh) rotate(-10deg) scaleX(1);   opacity: 0.65; }
}
@keyframes aurora-drift-3 {
    0%   { transform: translate(0, 0)     rotate(-6deg) scaleX(1);   opacity: 0.45; }
    50%  { transform: translate(6vw, 3vh) rotate(-4deg) scaleX(1.2); opacity: 0.6; }
    100% { transform: translate(-4vw, -2vh) rotate(-8deg) scaleX(0.95); opacity: 0.5; }
}
@keyframes aurora-drift-4 {
    0%   { transform: translate(-4vw, 0)   rotate(-10deg) scaleX(1);   opacity: 0.65; }
    50%  { transform: translate(6vw, -3vh) rotate(-8deg)  scaleX(1.1); opacity: 0.8; }
    100% { transform: translate(10vw, 2vh) rotate(-12deg) scaleX(1);   opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
    .aurora-band { animation: none !important; }
}

.login-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: transparent;
}

.login-box {
    position: relative;
    /* Solider, fast deckender Hintergrund statt live backdrop-filter:
       backdrop-filter zwang den Browser, bei JEDEM Tastendruck den (zusätzlich
       60px-geblurrten, animierten) Aurora-Hintergrund neu zu blurren — das machte
       das Tippen im Login am PC zur Zeitlupe. Solides Weiß = keine Re-Blur-Kosten
       pro Repaint. (Gleiche Optimierung wie bei der Dashboard-Topbar.) */
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 18px;
    padding: 2.4rem 2rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 25px 60px rgba(8, 21, 56, 0.45),
        0 8px 24px rgba(8, 21, 56, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}
.login-brand__mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #facc15 0%, #f59e0b 60%, #2563eb 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 0.5px;
    box-shadow:
        0 8px 20px rgba(37, 99, 235, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.login-box h1 {
    text-align: center;
    margin: 0 0 0.4rem;
    color: #0f172a;
    font-size: 1.55rem;
    letter-spacing: -0.2px;
}

.login-box p {
    text-align: center;
    color: #475569;
    margin: 0 0 1.6rem;
}

.login-box .form-group label {
    color: #1e293b;
    font-weight: 600;
}

.login-box .form-control {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #cbd5e1;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.login-box .form-control:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.login-box .btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.login-box .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.45);
}
.login-box .btn-primary:active {
    transform: translateY(0);
}

/* Card */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--form-field-bg);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    background-color: var(--form-field-bg-focus);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-primary {
    background: #4A90E2;
    color: white;
}

.btn-primary:hover {
    background: #357ABD;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-block {
    width: 100%;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Exam Grid */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.exam-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    background: #fafafa;
    transition: transform 0.2s, box-shadow 0.2s;
}

.exam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.exam-card h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.exam-card p {
    color: #666;
    margin-bottom: 1rem;
}

.exam-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-default {
    background: #6c757d;
    color: white;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* Exam */
.timer {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
}

.exam-header {
    margin-bottom: 2rem;
}

.exam-info {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    color: #666;
}

.question-block {
    background: white;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 2rem;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.question-layout {
    display: grid;
    /* Bildspalte bewusst schmal halten (Bild ist Beiwerk, die Aufgabe steht im
       Fokus): nie breiter als 300 px, skaliert mit der Fensterbreite nach unten. */
    grid-template-columns: clamp(170px, 26%, 300px) 1fr;
    gap: 0;
    min-height: 300px;
}

.question-layout.no-image {
    grid-template-columns: 1fr;
}

.question-image-area {
    background: #f8f9fa;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    border-right: 1px solid #dee2e6;
    min-height: 300px;
    overflow: hidden;
}

.question-image-area img {
    width: 100%;
    height: 100%;
    /* contain statt fill: Bild wird nicht mehr auf die Spaltenhöhe gestreckt
       (keine Verzerrung) und passt vollständig in die schmale Spalte. */
    object-fit: contain;
    border-radius: 0;
    display: block;
}

.question-image-placeholder {
    color: #adb5bd;
    font-size: 3rem;
    text-align: center;
}

.question-content-area {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.question-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f3f5;
}

.question-number {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.question-points {
    display: inline-block;
    background: #4A90E2;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.question-text {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #212529;
    font-weight: 500;
}

.question-input-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mc-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mc-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mc-option:hover {
    border-color: #4A90E2;
    background: #f0f7ff;
}

.mc-option input {
    margin-right: 1rem;
}

.mc-option span {
    flex: 1;
}

.exam-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #dee2e6;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
}

button.close {
    background: transparent;
    border: none;
    font: inherit;
    line-height: 1;
}

/* Match (Zuordnung) */
.match-container {
    margin: 1rem 0;
}

.match-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.match-left h4,
.match-right h4 {
    margin-bottom: 1rem;
    color: #333;
}

.match-item {
    background: #4A90E2;
    color: white;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: move;
    user-select: none;
}

.match-item:hover {
    background: #357ABD;
}

.match-target {
    margin-bottom: 0.5rem;
}

.match-target-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.match-drop-zone {
    min-height: 50px;
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-drop-zone.dragover {
    border-color: #4A90E2;
    background: #f0f7ff;
}

.match-placeholder {
    color: #999;
    font-style: italic;
}

.match-item-dropped {
    background: #28a745;
    color: white;
    padding: 0.75rem;
    border-radius: 4px;
    width: 100%;
}

/* Fill Blank (Lückentext) */
.fill-blank-container {
    margin: 1rem 0;
}

.blank-item {
    margin-bottom: 1rem;
}

.blank-hint {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.blank-input {
    max-width: 300px;
}

/* Fließtext mit Inline-Lücken */
.fill-blank-text {
    line-height: 2.7;
    font-size: 1.08rem;
    color: #1f2937;
}

.fill-blank-inline {
    display: inline-block;
    width: 14rem;
    max-width: 85vw;
    margin: 0 0.25rem;
    padding: 0.3rem 0.7rem;
    vertical-align: baseline;
    border: 2px solid #4A90E2;
    border-radius: 6px;
    background: #fffef5;
    font-size: 1rem;
    line-height: 1.3;
}

.fill-blank-inline:focus {
    outline: none;
    border-color: #2f6fbf;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.18);
    background: #fff;
}

select.fill-blank-inline {
    width: auto;
    background: #fff;
}

/* Bildbeschriftung (image_label) – Schüler-Ansicht.
   Bild responsiv mit festem Seitenverhältnis; Felder per Prozent-Koordinaten
   absolut darüber → überall (iPad/Desktop/Handy) gleiche relative Lage. */
.image-label-container {
    margin: 1rem 0;
}
.image-label-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}
.image-label-stage > img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.image-label-field {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.image-label-input {
    width: 100%;
    height: 100%;
    min-height: 1.6rem;
    box-sizing: border-box;
    padding: 0.1rem 0.35rem;
    border: 2px solid #0ea5e9;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    font-size: 0.95rem;
    line-height: 1.2;
    text-align: center;
    max-width: none;
}
.image-label-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22);
    background: #fff;
}
select.image-label-input {
    background: #fff;
}

/* Grid Color (Raster färben) */
.grid-color-container {
    margin: 1rem 0;
}

.grid-color {
    display: grid;
    grid-template-columns: repeat(auto-fit, 50px);
    gap: 4px;
    max-width: fit-content;
}

.grid-cell {
    width: 50px;
    height: 50px;
    border: 2px solid #333;
    cursor: pointer;
    transition: transform 0.1s;
}

.grid-cell:hover {
    transform: scale(1.1);
}

.grid-cell.black {
    background: #000;
}

.grid-cell.white {
    background: #fff;
}

.grid-legend {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
}

.grid-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grid-legend .grid-cell {
    width: 30px;
    height: 30px;
    cursor: default;
}

.grid-legend .grid-cell:hover {
    transform: none;
}

/* Binary Visual (Binärdarstellung) */
.binary-visual-container {
    margin: 1rem 0;
}

.binary-grid {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.binary-bit-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.binary-bit-value {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.binary-bit {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    background: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.binary-bit:hover {
    border-color: #4A90E2;
}

.binary-bit.active {
    background: #4A90E2;
    color: white;
    border-color: #357ABD;
}

.binary-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

/* Table Fill (Tabelle ausfüllen) */
.table-fill-container {
    margin: 1rem 0;
    overflow-x: auto;
}

.table-fill {
    width: 100%;
    border-collapse: collapse;
}

.table-fill th,
.table-fill td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #dee2e6;
}

.table-fill th {
    background: #f8f9fa;
    font-weight: 600;
}

.table-cell-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: var(--form-field-bg);
}

.table-cell-input:focus {
    outline: none;
    border-color: #4A90E2;
    background-color: var(--form-field-bg-focus);
}

/* Huffman Tree */
.huffman-container {
    margin: 1rem 0;
}

.huffman-instruction {
    margin-bottom: 1rem;
    color: #666;
    font-style: italic;
}

.huffman-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.huffman-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.huffman-freq {
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
}

.huffman-code-input {
    width: 100%;
    font-family: 'Courier New', monospace;
}

/* Results Page */
.result-summary {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 2rem;
}

.result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.score-circle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
}

.score-percentage {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.score-grade {
    font-size: 1.5rem;
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.score-grade strong {
    font-size: 2.5rem;
    color: #4A90E2;
    margin-left: 0.5rem;
}

.result-details {
    margin-top: 2rem;
}

.result-question {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #4A90E2;
}

.result-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.result-question-number {
    font-weight: bold;
    color: #4A90E2;
}

.result-question-points {
    font-weight: bold;
    color: #333;
}

.result-question-text {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.result-mc-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-mc-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
}

.result-mc-option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.result-mc-option.wrong.selected {
    border-color: #dc3545;
    background: #f8d7da;
}

.result-mc-option.selected {
    font-weight: bold;
}

.result-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.result-badge.correct {
    background: #28a745;
    color: white;
}

.result-badge.wrong {
    background: #dc3545;
    color: white;
}

.result-text-answer,
.result-other-answer {
    margin-top: 1rem;
}

.result-label {
    font-weight: 600;
    color: #666;
    margin-bottom: 0.5rem;
}

.result-text-content {
    padding: 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.result-info {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* ============================================
   EXAM MODE - Modern iPad-Optimized Design
   ============================================ */

:root {
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --secondary: #5BA3D0;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --background: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border: #E2E8F0;
}

.exam-body {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* CSP: Prüfungs-JSON im DOM ohne <script>-Inline; visuell ausgeblendet */
.exam-page-data-json {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    resize: none;
}

.exam-image-fallback {
    color: #999;
    text-align: center;
    padding: 2rem;
}

/* Sticky Kopfbereich: hält Navbar + Fortschritt + Aufgaben-Navigation beim
   Scrollen oben fest, damit auf dem iPad jederzeit weitergeklickt werden kann,
   auch wenn die Aufgabe selbst länger als der Bildschirm ist. */
.exam-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Exam Navbar */
.exam-navbar {
    background: rgba(255, 255, 255, 0.98);
}

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

.exam-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.exam-nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.exam-timer {
    background: var(--primary);
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* <5 Min Restzeit: gelb, dezent */
.exam-timer.timer-warning {
    background: #f59e0b;
    color: #1e293b;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

/* <1 Min Restzeit: rot, blinkt */
.exam-timer.timer-critical {
    background: var(--error);
    color: #fff;
    box-shadow: 0 2px 14px rgba(220, 38, 38, 0.55);
    animation: timer-blink 0.8s infinite;
}

/* Zeit abgelaufen: dauerhaft rot */
.exam-timer.timer-expired {
    background: #7f1d1d;
    color: #fff;
    animation: none;
}

@keyframes timer-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.55; transform: scale(1.04); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Vollbild-Overlays (Zeit abgelaufen / Tab-Wechsel-Warnung) ──────────── */
.exam-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: exam-overlay-fade 0.15s ease;
}
@keyframes exam-overlay-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.exam-overlay-card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    padding: 2rem 2.25rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    color: #0f172a;
}
.exam-overlay-card--warn { border-top: 6px solid #f59e0b; }
.exam-overlay--timeup .exam-overlay-card { border-top: 6px solid var(--error); }
/* Sperr-Overlay kann länger sichtbar bleiben → kein (auf iPad teurer) blur,
   stattdessen solider, deutlich abdunkelnder Hintergrund. */
.exam-overlay--blocked {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(15, 23, 42, 0.92);
}
.exam-overlay-card--blocked { border-top: 6px solid #2563eb; }

.exam-overlay-icon {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}
.exam-overlay-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.exam-overlay-text {
    font-size: 1rem;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.exam-overlay-count {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    font-variant-numeric: tabular-nums;
}
.exam-overlay-btn {
    display: inline-block;
    min-width: 160px;
    min-height: 48px; /* iPad touch target */
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.08s ease;
}
.exam-overlay-btn:hover { background: #1e40af; }
.exam-overlay-btn:active { transform: translateY(1px); }
.exam-overlay-spinner {
    width: 36px;
    height: 36px;
    margin: 0.5rem auto 0;
    border-radius: 50%;
    border: 4px solid #e5e7eb;
    border-top-color: var(--error);
    animation: exam-spinner-rot 0.8s linear infinite;
}
@keyframes exam-spinner-rot {
    to { transform: rotate(360deg); }
}

.btn-exit {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-exit:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Progress Bar */
.progress-container {
    background: white;
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: relative;
    z-index: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Question Navigation Pills */
.question-nav-container {
    background: white;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.question-nav {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0.5rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Kompakte Vor/Zurück-Pfeile direkt am Aufgabenzähler (zusätzlich zu den
   großen Buttons unten an der Karte). Touch-freundlich (40 px). */
.qnav-arrow {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--primary);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.qnav-arrow:hover {
    background: var(--primary-dark);
    transform: scale(1.08);
}

.question-pill {
    min-width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-pill:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.question-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.15);
}

.question-pill.answered:not(.active) {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Themen-Trenner: Fortschrittspunkt ist KEINE Aufgabe und daher dauerhaft rot
   (auch nicht "beantwortbar" – wird nie grün). Aktiv bleibt der normale Highlight. */
.question-pill--section:not(.active) {
    background: var(--error, #dc3545);
    border-color: var(--error, #dc3545);
    color: white;
}

/* Themen-Trenner-Slide: großes Banner statt Aufgabe */
.question-slide--section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(240px, 42vh, 460px);
}
.section-divider {
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 18px;
    padding: 3rem 1.5rem;
    box-shadow: 0 12px 40px rgba(8,15,36,0.18);
}
.section-divider-tag {
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 1rem;
}
.section-divider-title {
    color: #fff;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
}

/* ── Vorschau-/Test-Modus (preview.php) ─────────────────────────────────────── */
.preview-banner {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 2px solid #f59e0b;
    text-align: center;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}
.exam-overlay--preview { background: rgba(8,15,36,0.55); }
.exam-overlay-card--preview { max-width: 440px; text-align: center; }
.preview-result-grade { font-size: 1.6rem; margin: 0.5rem 0 0.25rem; }
.preview-result-points { color: #475569; margin-bottom: 0.75rem; }
.preview-result-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.9rem; }
.preview-result-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid #e2e8f0; }
.preview-result-note { font-size: 0.78rem; color: #64748b; margin: 0.75rem 0; }
.preview-result-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 0.75rem; }
a.exam-overlay-btn { text-decoration: none; text-align: center; line-height: 1.5; }
.exam-overlay-btn--secondary { background: #64748b; }
.exam-overlay-btn--secondary:hover { background: #475569; }

/* Themen-Trenner in der Auswertung (results.php) */
.result-section-divider {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 0.5rem;
    text-align: center;
}
.result-section-divider .result-section-tag {
    display: block;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 0.4rem;
}
.result-section-divider h3 {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
}

/* Exam Container */
.exam-container {
    max-width: 1400px;
    margin: 0.5rem auto;
    padding: 0 1rem 0.5rem;
}

.exam-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Question Block - Modern Style.
   Keine festen min-height auf Slide/Layout mehr — sonst pumpt sich die Frage
   bei wenig Inhalt unnötig auf und schiebt Submit-Button unter den Fold.
   Die Eingabefläche darunter (.question-input-area) hat eine eigene min-height,
   sodass ALLE Fragetypen optisch gleich groß wirken. */
.question-slide {
    /* min-height entfernt – siehe Kommentar oben */
}

.question-block {
    background: white;
    box-shadow: none;
    border: none;
    border-radius: 0;
}

.question-layout {
    /* min-height entfernt – siehe Kommentar oben */
}

.question-image-area {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-right: none;
}

.question-header {
    border-bottom: 2px solid #f1f3f5;
}

.question-points {
    background: var(--primary);
}

/* Karten-Höhe: Die Karte wächst frei mit ihrem Inhalt — lange Aufgaben werden
   damit IMMER vollständig angezeigt; gescrollt wird die ganze Seite (nicht mehr
   eine kleine interne Box). Erreichbar bleibt die Navigation trotzdem jederzeit,
   weil der Kopfbereich (.exam-topbar) sticky oben hängt und zusätzlich oben am
   Zähler Vor/Zurück-Pfeile sitzen. min-height sorgt nur für eine sanfte
   Mindestgröße bei sehr kurzen Aufgaben (z. B. 5 MC-Optionen). */
.exam-body .question-content-area {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    min-height: clamp(220px, 32vh, 320px);
}

/* Bild-Spalte (Aufgaben mit Bild): an den oberen Rand setzen und Höhe deckeln,
   damit ein langer Antwortbereich rechts das Bild im Grid nicht mitstreckt
   (object-fit: fill würde das Bild sonst vertikal verzerren). */
.exam-body .question-image-area {
    align-self: start;
    min-height: 0;
    /* Niedriger gedeckelt + transparenter Hintergrund, damit das (unverzerrte,
       contain-skalierte) Bild kompakt bleibt und die Aufgabe rechts dominiert. */
    height: clamp(180px, 30vh, 320px);
    background: transparent;
    padding: 0.5rem;
}

/* Header wächst natürlich mit Fragetext — keine eigene Höhenbegrenzung,
   sonst entsteht ein doppelter Scrollbar (Header + Antwortbox). */
.exam-body .question-header {
    flex: 0 0 auto;
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
}

.exam-body .question-input-area {
    display: flex;
    flex-direction: column;
    /* Wächst frei mit dem Inhalt — kein internes Scrollen mehr. Die ganze
       Seite scrollt, sodass auch viele Optionen / lange Zuordnungen komplett
       sichtbar sind. flex:1 füllt nur die Mindesthöhe bei kurzen Aufgaben. */
    flex: 1 1 auto;
    padding-right: 2px;
}

/* Freitext: füllt mindestens die Antwort-Box, darf aber für längere Antworten
   mitwachsen. Kein festes height mehr (Seite scrollt statt interner Box). */
.exam-body .question-input-area textarea.exam-text-answer {
    flex: 1 1 auto;
    width: 100%;
    min-height: 16rem;
    box-sizing: border-box;
    resize: none;
    line-height: 1.5;
}

/* ===== Aufsatz (essay) ===== */
.essay-answer-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.exam-body .question-input-area textarea.exam-essay-answer {
    min-height: 24rem;       /* deutlich größere Schreibfläche als Freitext */
    resize: vertical;        /* der Schüler darf das Feld vergrößern */
    font-size: 1.02rem;
    line-height: 1.6;
}
.essay-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: #64748b;
}
.essay-wordcount { font-variant-numeric: tabular-nums; }
.essay-wordcount--under { color: #b45309; }   /* unter Mindestlänge */
.essay-wordcount--over  { color: #dc2626; }   /* über Maximallänge */
.essay-wordlimit { color: #94a3b8; }

/* Schwebende Speicher-Status-Anzeige (nur bei Arbeiten mit Aufsatz). */
.exam-save-status {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 1500;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    background: #e2e8f0;
    color: #334155;
    pointer-events: none;
}
.exam-save-status.is-saving { background: #fef9c3; color: #854d0e; }
.exam-save-status.is-saved  { background: #dcfce7; color: #166534; }
.exam-save-status.is-error  { background: #fee2e2; color: #991b1b; }

/* MC-Optionen kompakter im Schüler-Prüfungssystem — sonst sind 5 Optionen
   schon ~330 px hoch und sprengen den iPad-Viewport. */
.exam-body .mc-options {
    gap: 0.35rem;
}

.exam-body .mc-option {
    padding: 0.45rem 0.75rem;
    border-width: 1px;
    border-radius: 6px;
}

.exam-body .mc-option input {
    margin-right: 0.75rem;
}

/* Exam Navigation Buttons */
.exam-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 1.25rem;
    background: linear-gradient(to bottom, transparent, #f8f9fa);
    gap: 1rem;
}

.btn-nav {
    padding: 0.55rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav-prev, .btn-nav-next {
    background: var(--primary);
    color: white;
    min-width: 150px;
    justify-content: center;
}

.btn-nav-prev:hover, .btn-nav-next:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* Submit Section – sitzt als Flex-Item in .exam-navigation, nimmt dort
   den Platz von btnNext ein (rechts neben „Vorherige"), damit der grüne
   Button nicht unter die weiße Karte rutscht. */
.exam-submit {
    display: none;
    text-align: center;
}

.btn-submit {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.6rem 1.9rem;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

/* Notifications */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid var(--success);
    color: var(--success);
}

.notification-error {
    border-left: 4px solid var(--error);
    color: var(--error);
}

/* iPad Optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .exam-container {
        max-width: 100%;
        padding: 0 1rem 0.5rem;
        margin: 0.5rem auto;
    }

    .question-layout {
        /* Bildspalte auch auf dem iPad schmal halten (max. 260 px),
           damit die Aufgabe rechts deutlich mehr Platz bekommt. */
        grid-template-columns: clamp(150px, 24%, 260px) 1fr;
    }

    .question-nav {
        padding: 0 1rem;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .exam-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .exam-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .match-columns {
        grid-template-columns: 1fr;
    }

    .binary-grid {
        flex-wrap: wrap;
    }

    .huffman-inputs {
        grid-template-columns: 1fr;
    }

    .question-layout {
        grid-template-columns: 1fr !important;
    }

    .question-image-area {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        min-height: 200px;
    }

    .exam-nav-content {
        padding: 0.5rem 1rem;
    }

    .exam-title {
        font-size: 1rem;
    }

    .exam-timer {
        font-size: 0.9rem;
        padding: 0.35rem 0.9rem;
    }

    .exam-container {
        margin: 0.5rem auto;
        padding: 0 1rem 0.5rem;
    }

    .question-nav {
        padding: 0 1rem;
    }

    .notification {
        right: 10px;
        left: 10px;
    }
}

/* Phone-only: Navigation als Spalte stapeln. iPad Portrait (768 px) wird
   hiervon nicht mehr erfasst, dort bleiben die Buttons nebeneinander. */
@media (max-width: 600px) {
    .exam-navigation {
        flex-direction: column;
        gap: 0.6rem;
    }

    .btn-nav {
        width: 100%;
        justify-content: center;
    }

    .exam-submit,
    .btn-submit {
        width: 100%;
    }
}

/* ============================================
   STUDENT DASHBOARD (index.php eingeloggt)
   ============================================ */

.student-dashboard {
    --dash-bg: #f1f5fb;
    --dash-surface: #ffffff;
    --dash-ink: #0f172a;
    --dash-muted: #64748b;
    --dash-blue: #2563eb;
    --dash-blue-dark: #1d4ed8;
    --dash-yellow: #facc15;
    --dash-yellow-dark: #ca8a04;
    --dash-accent: var(--dash-blue);
    --dash-accent-2: var(--dash-yellow);
    --dash-border: rgba(15, 23, 42, 0.08);
    --dash-radius: 1rem;
    --dash-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 18px rgba(15, 23, 42, 0.06);
    --dash-font: 'Lexend', system-ui, sans-serif;
    --dash-display: 'Lexend', system-ui, sans-serif;
    font-family: var(--dash-font);
    color: var(--dash-ink);
    /* Statisches Hintergrund-Pattern (kein backdrop-filter, kein animiertes Element)
       – auf iPad fast kostenlos zu rendern, da nur gradient + solid color. */
    background-color: var(--dash-bg);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(250, 204, 21, 0.10) 0%, transparent 38%),
        radial-gradient(circle at 100% 100%, rgba(37, 99, 235, 0.10) 0%, transparent 42%);
    background-attachment: fixed;
    min-height: 100vh;
}

.student-dashboard .dashboard-topbar__title,
.student-dashboard .dashboard-brand__title,
.student-dashboard .dashboard-hero__title,
.student-dashboard .dashboard-panel__title,
.student-dashboard .dashboard-exam-card__title,
.student-dashboard .dashboard-modal__box h2 {
    font-family: var(--dash-display);
}

/* Top bar – solides Weiß statt teurer backdrop-filter (besser für iPad-GPU) */
.dashboard-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #ffffff;
    border-bottom: 1px solid var(--dash-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 2px 0 rgba(37, 99, 235, 0.04);
}
.dashboard-topbar::after {
    /* dezenter 2px-Akzent gelb→blau, rein dekorativ */
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, var(--dash-yellow) 0%, var(--dash-blue) 100%);
}

.dashboard-topbar__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.dashboard-brand__mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, var(--dash-yellow) 0%, var(--dash-blue) 100%);
    color: #fff;
    font-family: var(--dash-display);
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.dashboard-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.dashboard-brand__title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.dashboard-brand__tagline {
    font-size: 0.75rem;
    color: var(--dash-muted);
    font-weight: 500;
}

.dashboard-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.dashboard-topbar__hello {
    font-size: 0.9rem;
    color: var(--dash-muted);
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.35rem;
}

.dashboard-header-form {
    margin: 0;
    display: inline-flex;
}

.dashboard-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.95rem;
    border-radius: 0.65rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.1;
    cursor: pointer;
    border: 1px solid transparent;
    /* Nur transform + box-shadow animieren – beides GPU-billig */
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.dashboard-header-btn:active {
    transform: translateY(1px);
}
.dashboard-header-btn:focus-visible {
    outline: 2px solid var(--dash-blue);
    outline-offset: 2px;
}

.dashboard-header-btn--yellow {
    background: linear-gradient(135deg, #fde047 0%, var(--dash-yellow) 100%);
    color: #713f12;
    border-color: rgba(202, 138, 4, 0.35);
    box-shadow: 0 2px 6px rgba(202, 138, 4, 0.18);
}
.dashboard-header-btn--yellow:hover {
    box-shadow: 0 4px 12px rgba(202, 138, 4, 0.28);
    transform: translateY(-1px);
}

.dashboard-header-btn--blue {
    background: linear-gradient(135deg, #3b82f6 0%, var(--dash-blue-dark) 100%);
    color: #ffffff;
    border-color: rgba(29, 78, 216, 0.45);
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.22);
}
.dashboard-header-btn--blue:hover {
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
    transform: translateY(-1px);
}

/* Auf Smartphones nur Icons zeigen, damit der Header nicht überläuft */
@media (max-width: 620px) {
    .dashboard-topbar__hello { display: none; }
    .dashboard-header-btn__label { display: none; }
    .dashboard-header-btn { padding: 0.55rem 0.7rem; font-size: 1rem; }
}

.btn-dashboard-primary {
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: 0.7rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    background: linear-gradient(135deg, var(--dash-blue) 0%, var(--dash-blue-dark) 100%);
    color: #fff;
    transition: transform 0.12s ease, box-shadow 0.15s ease;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.20);
}

.btn-dashboard-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.32);
}

.btn-dashboard-secondary {
    padding: 0.7rem 1.25rem;
    border: 1px solid rgba(202, 138, 4, 0.35);
    border-radius: 0.7rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: #fffbeb;
    color: #713f12;
    transition: background 0.12s ease, transform 0.12s ease;
    font-family: inherit;
}

.btn-dashboard-secondary:hover {
    background: #fef3c7;
    transform: translateY(-1px);
}

/* Kompakter „Ergebnis ansehen"-Link in der Tabelle der abgeschlossenen Arbeiten */
.btn-result-view {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    font-size: 0.88rem;
    white-space: nowrap;
    text-decoration: none;
}

.btn-dashboard-danger {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    transition: background 0.15s ease;
    font-family: inherit;
    width: 100%;
}

.btn-dashboard-danger:hover {
    background: #fee2e2;
}

/* Main */
.dashboard-main {
    padding-bottom: 3rem;
}

.dashboard-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
}

.dashboard-flash {
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
}

/* Hero */
.dashboard-hero {
    margin-bottom: 2rem;
}

.dashboard-hero__content {
    position: relative;
    background: var(--dash-surface);
    border-radius: 1.25rem;
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--dash-border);
    box-shadow: var(--dash-shadow);
    overflow: hidden;
}
/* Dezenter, statischer Akzent-Strich links – kein Filter, kein Repaint */
.dashboard-hero__content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--dash-yellow) 0%, var(--dash-blue) 100%);
}

.dashboard-hero__eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dash-blue-dark);
    margin-bottom: 0.5rem;
}

.dashboard-hero__title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.dashboard-hero__lead {
    color: var(--dash-muted);
    font-size: 1rem;
    line-height: 1.5;
    max-width: 36rem;
    margin-bottom: 1.5rem;
}

.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dashboard-stat {
    flex: 1 1 140px;
    background: #fffbeb; /* zarter Gelb-Ton */
    border: 1px solid rgba(202, 138, 4, 0.18);
    border-radius: 0.85rem;
    padding: 1rem 1.15rem;
    min-width: 0;
}

.dashboard-stat--muted {
    background: #eff6ff; /* zarter Blau-Ton */
    border-color: rgba(37, 99, 235, 0.18);
}

.dashboard-stat__value {
    display: block;
    font-family: var(--dash-display);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--dash-yellow-dark);
    line-height: 1.1;
}

.dashboard-stat--muted .dashboard-stat__value {
    color: var(--dash-blue-dark);
}

.dashboard-stat__label {
    font-size: 0.8rem;
    color: var(--dash-muted);
    font-weight: 500;
}

/* Panels */
.dashboard-panel {
    background: var(--dash-surface);
    border-radius: 1.25rem;
    border: 1px solid var(--dash-border);
    box-shadow: var(--dash-shadow);
    padding: 1.5rem 1.25rem 1.75rem;
    margin-bottom: 1.5rem;
}

.dashboard-panel__head {
    margin-bottom: 1.25rem;
}

.dashboard-panel__title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.dashboard-panel__hint {
    font-size: 0.875rem;
    color: var(--dash-muted);
    line-height: 1.45;
}

.dashboard-panel--table {
    padding-bottom: 1.25rem;
}

/* Empty */
.dashboard-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--dash-muted);
}

.dashboard-empty--compact {
    padding: 1.5rem 1rem;
}

.dashboard-empty__icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    filter: grayscale(0.2);
}

.dashboard-empty__text {
    max-width: 26rem;
    margin: 0 auto;
    line-height: 1.5;
}

/* Exam grid */
.dashboard-exam-grid {
    gap: 1.25rem;
}

.dashboard-exam-card {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--dash-border);
    border-radius: 1rem;
    padding: 1.35rem 1.25rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    /* Nur transform animieren – günstig für GPU, keine Layer-Repaints */
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.dashboard-exam-card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--dash-yellow) 0%, var(--dash-blue) 100%);
    border-radius: 1rem 1rem 0 0;
}

.dashboard-exam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.dashboard-exam-card.exam-card--practice {
    padding-top: 0;
    overflow: hidden;
}
.dashboard-exam-card.exam-card--practice::before { display: none; }

.exam-card__ribbon {
    background: linear-gradient(90deg, var(--dash-yellow) 0%, var(--dash-blue) 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.55rem 1rem;
    margin: 0 0 1.1rem 0;
    text-align: center;
}

.dashboard-exam-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.dashboard-exam-card__desc {
    color: var(--dash-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1 1 auto;
    margin-bottom: 1rem;
}

.dashboard-exam-meta {
    list-style: none;
    margin: 0 0 1.15rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.dashboard-exam-meta li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.dashboard-exam-meta li:last-child {
    border-bottom: none;
}

.dashboard-exam-meta__label {
    color: var(--dash-muted);
    font-weight: 500;
}

.dashboard-exam-meta__val {
    font-weight: 600;
    text-align: right;
}

.dashboard-exam-card__footer {
    margin-top: auto;
    padding-top: 0.25rem;
}

.dashboard-exam-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge-grade {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
}

.dashboard-exam-card__form {
    margin: 0;
}

/* Table */
.dashboard-table-wrap {
    overflow-x: auto;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

.dashboard-table {
    border-collapse: separate;
    border-spacing: 0;
}

.dashboard-table th {
    background: #f1f5f9;
    color: var(--dash-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--dash-border);
}

.dashboard-table th:first-child {
    border-radius: 0.5rem 0 0 0;
}

.dashboard-table th:last-child {
    border-radius: 0 0.5rem 0 0;
}

.dashboard-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--dash-border);
    font-size: 0.9rem;
}

.dashboard-table tbody tr:hover td {
    background: #f8fafc;
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 640px) {
    .dashboard-table thead {
        display: none;
    }

    .dashboard-table tr {
        display: block;
        margin-bottom: 1rem;
        background: #f8fafc;
        border-radius: 0.75rem;
        border: 1px solid var(--dash-border);
        overflow: hidden;
    }

    .dashboard-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 0.65rem 1rem;
        border-bottom: 1px solid var(--dash-border);
    }

    .dashboard-table td:last-child {
        border-bottom: none;
    }

    .dashboard-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--dash-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
}

/* Modal overrides on dashboard */
.dashboard-modal .dashboard-modal__box {
    border: 1px solid var(--dash-border);
    border-radius: 1.15rem;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.dashboard-modal__box h2 {
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

.dashboard-modal__lead {
    color: var(--dash-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    margin: -0.4rem 0 1rem 0;
}

/* ── Passwort-Feld mit Augen-Toggle ─────────────────────────────────────── */
.pw-input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}
.pw-input-wrap .pw-input,
.pw-input-wrap input[type="password"],
.pw-input-wrap input[type="text"] {
    flex: 1 1 auto;
    padding-right: 2.6rem;
}
.pw-toggle-btn {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    color: #475569;
    transition: background 0.12s, border-color 0.12s;
}
.pw-toggle-btn:hover {
    background: rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.08);
}
.pw-toggle-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

/* ── Pflicht-Passwortwechsel-Seite ──────────────────────────────────────── */
.student-force-pw {
    background: linear-gradient(135deg, #eff6ff 0%, #faf5ff 100%);
    min-height: 100vh;
}
.force-pw-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.25rem;
}
.force-pw-card {
    background: #ffffff;
    border-radius: 1.5rem;
    border: 1px solid rgba(30, 41, 59, 0.08);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.12);
    padding: 2rem 1.75rem 1.5rem;
    max-width: 460px;
    width: 100%;
    text-align: left;
}
.force-pw-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}
.force-pw-card h1 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    color: #0f172a;
}
.force-pw-lead {
    color: #475569;
    line-height: 1.5;
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
}
.force-pw-form .form-group { margin-bottom: 1rem; }
.force-pw-form .form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #0f172a;
    margin-bottom: 0.4rem;
}
.force-pw-form button[type="submit"] {
    margin-top: 0.25rem;
}
.force-pw-logout {
    margin-top: 1rem;
    text-align: center;
}
.force-pw-logout-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}
.force-pw-logout-btn:hover { color: #1e293b; }

/* Etwas mehr Polish für das Schüler-Dashboard (Karten-Hover, Note-Badge) */
.student-dashboard .dashboard-stat {
    transition: transform 0.12s ease;
}
.student-dashboard .dashboard-stat:hover {
    transform: translateY(-1px);
}
.student-dashboard .badge.badge-grade {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 6px rgba(185, 28, 28, 0.25);
}

/* Note-Pill in der Tabelle „Abgeschlossene Klassenarbeiten" – rot + weiß */
.student-dashboard .grade-pill {
    display: inline-block;
    min-width: 2.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    box-shadow: 0 2px 6px rgba(185, 28, 28, 0.22);
}
.student-dashboard .badge.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

/* ════════════════════════════════════════════════════════════════════════
   iPad-Optimierung & Prüfungs-Härtung (Stand 2026-06-15)
   Schüler arbeiten überwiegend am iPad. Ziele:
   - kein Kopieren/Einfügen-Callout auf Aufgabeninhalten (Prüfungsintegrität)
   - kein automatisches Hineinzoomen beim Fokussieren von Eingabefeldern
   - große, gut tippbare Touch-Ziele
   ════════════════════════════════════════════════════════════════════════ */

/* Kein iOS-Auswahl-/Kopier-Callout auf Aufgabeninhalten; Eingabefelder bleiben
   aber bedien- und editierbar. */
.exam-body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.exam-body input,
.exam-body textarea,
.exam-body select {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

/* Schrift >= 16px verhindert das automatische Hineinzoomen von iOS Safari beim
   Fokussieren eines Eingabefelds. */
.exam-body textarea.exam-text-answer,
.exam-body .blank-input,
.exam-body .fill-blank-inline,
.exam-body .table-cell-input,
.exam-body .huffman-code-input {
    font-size: 16px;
}

/* Größere Touch-Ziele für Auswahl-Aufgaben. */
.exam-body .mc-option,
.exam-body .false-statement-option {
    min-height: 46px;
    align-items: center;
}
.exam-body .mc-option input[type="radio"],
.exam-body .mc-option input[type="checkbox"],
.exam-body .false-statement-option input[type="checkbox"] {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Zuordnungs-Aufgabe: Tippen statt Ziehen. */
.match-hint {
    color: #555;
    font-size: 0.95rem;
    margin: 0 0 0.75rem;
}
.match-item {
    cursor: pointer;
    min-height: 46px;
    display: flex;
    align-items: center;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.match-item--selected {
    background: #357ABD;
    outline: 3px solid #f5a623;
    outline-offset: 1px;
    box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.28);
}
.match-item--used {
    opacity: 0.45;
}
.match-drop-zone {
    min-height: 58px;
    cursor: pointer;
}
.match-drop-zone--filled {
    border-style: solid;
    border-color: #28a745;
    background: #f3fbf5;
}

/* Touch-Ziele für Raster/Binär nicht zu klein. */
.exam-body .binary-bit {
    min-width: 44px;
    min-height: 48px;
}

/* Navigationsbuttons unten gut erreichbar (Daumen) auf dem iPad. */
.exam-body .btn-nav,
.exam-body .btn-submit {
    min-height: 48px;
}

/* ===== Aufsatz-Feedback (essay) – geteilt von admin.php & results.php ===== */
.essay-feedback { font-size: 0.95rem; }
.essay-fb-label { font-weight: 600; margin: 0.6rem 0 0.3rem; color: #334155; }
.essay-text-body {
    line-height: 1.7;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
}
.essay-mark { padding: 0 1px; border-radius: 3px; border-bottom: 2px solid; }
.essay-mark--rs { background: #fee2e2; border-color: #dc2626; }
.essay-mark--gr { background: #dbeafe; border-color: #2563eb; }
.essay-mark--zs { background: #fef9c3; border-color: #ca8a04; }
.essay-mark--au { background: #ede9fe; border-color: #7c3aed; }
/* Segment, das von mehreren Korrekturen gedeckt ist (Überlappung/Verschachtelung):
   Farbe = spezifischste Korrektur, doppelter Rahmen als Hinweis auf mehrere Fehler. */
.essay-mark--overlap { border-bottom-style: double; border-bottom-width: 4px; }
.essay-counts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
.essay-count { font-size: 0.8rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: #e2e8f0; color: #334155; }
.essay-count--rs { background: #fee2e2; color: #991b1b; }
.essay-count--gr { background: #dbeafe; color: #1e40af; }
.essay-count--zs { background: #fef9c3; color: #854d0e; }
.essay-count--au { background: #ede9fe; color: #5b21b6; }
.essay-comment { margin: 0.4rem 0; color: #334155; }
.essay-points-split { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.essay-points-chip { font-size: 0.85rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: #f1f5f9; color: #334155; }
.essay-points-chip--total { background: #ccfbf1; color: #0f766e; }
.essay-corrections ol { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.essay-corr { margin-bottom: 0.5rem; }
.essay-corr-type { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.1rem 0.4rem; border-radius: 4px; background: #e2e8f0; color: #475569; }
.essay-corr--rs .essay-corr-type { background: #fee2e2; color: #991b1b; }
.essay-corr--gr .essay-corr-type { background: #dbeafe; color: #1e40af; }
.essay-corr--zs .essay-corr-type { background: #fef9c3; color: #854d0e; }
.essay-corr--au .essay-corr-type { background: #ede9fe; color: #5b21b6; }
.essay-corr-quote { text-decoration: line-through; color: #b91c1c; }
.essay-corr-fix { color: #15803d; font-weight: 600; }
.essay-corr-expl { font-size: 0.85rem; color: #64748b; margin-top: 0.1rem; }
.essay-fb-hint { color: #64748b; font-style: italic; margin-top: 0.5rem; }

/* Lern-Auswertung am Ende des Aufsatz-Feedbacks */
.essay-summary { margin: 0.8rem 0 0; padding: 0.7rem 0.9rem; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; }
.essay-summary .essay-fb-label { margin-bottom: 0.3rem; }
.essay-summary-tips ul { margin: 0.2rem 0 0.5rem; padding-left: 1.2rem; }
.essay-summary-tips li { margin: 0.15rem 0; }
.essay-summary-words { margin-top: 0.3rem; }
.essay-learn-word { display: inline-block; margin: 0.15rem 0.25rem 0.15rem 0; padding: 0.1rem 0.55rem; background: #fef9c3; border: 1px solid #fde047; border-radius: 999px; font-weight: 600; color: #854d0e; }

/* Persönliche Rückmeldung der Lehrkraft an den Schüler (grader_notes) */
.essay-teacher-note { margin-top: 0.8rem; padding: 0.7rem 0.9rem; background: #eff6ff; border-left: 4px solid #3b82f6; border-radius: 0 8px 8px 0; }
.essay-teacher-note__label { font-weight: 700; color: #1e40af; margin-bottom: 0.3rem; font-size: 0.9rem; }
.essay-teacher-note__text { color: #1e293b; line-height: 1.5; }
