/* ============================================================
   teil1.css — Unified Teil 1 (Überschriften zuordnen) styling
   Used by:
     - student/teil1.php             (practice / reading)
     - includes/exam_steps/step_1.php (exam)
   Premium visual refinement pass — layout architecture & class
   names preserved for JS compatibility.
   ============================================================ */

:root {
    /* Brand */
    --t1-accent:        #2563eb;          /* refined indigo-blue */
    --t1-accent-dk:     #1d4ed8;
    --t1-accent-soft:   #eef4ff;
    --t1-accent-tint:   #f6faff;          /* very light wash */
    --t1-accent-ring:   rgba(37, 99, 235, .22);

    /* Status */
    --t1-success:       #15803d;
    --t1-success-soft:  #dcfce7;
    --t1-success-tint:  #f0fdf4;
    --t1-success-text:  #14532d;
    --t1-success-ring:  rgba(21, 128, 61, .22);

    --t1-danger:        #dc2626;
    --t1-danger-soft:   #fee2e2;
    --t1-danger-tint:   #fef2f2;
    --t1-danger-text:   #7f1d1d;
    --t1-danger-ring:   rgba(220, 38, 38, .22);

    /* Neutrals */
    --t1-ink:           #0f172a;          /* slate-900 */
    --t1-text:          #1e293b;          /* slate-800 */
    --t1-text-muted:    #64748b;          /* slate-500 */
    --t1-text-subtle:   #94a3b8;          /* slate-400 */
    --t1-border:        #e2e8f0;          /* slate-200 */
    --t1-border-soft:   #eef2f7;
    --t1-bg-surface:    #ffffff;
    --t1-bg-canvas:     #f8fafc;
    --t1-bg-tint:       #f1f5f9;          /* subtle pair backdrop */

    /* Geometry */
    --t1-card-radius:   16px;
    --t1-tile-radius:   12px;
    --t1-chip-radius:   999px;

    /* Elevation — layered, subtle */
    --t1-shadow-xs:     0 1px 2px rgba(15, 23, 42, .04),
                        0 1px 1px rgba(15, 23, 42, .03);
    --t1-shadow-sm:     0 2px 4px rgba(15, 23, 42, .04),
                        0 4px 12px rgba(15, 23, 42, .06);
    --t1-shadow-md:     0 4px 10px rgba(15, 23, 42, .06),
                        0 12px 28px rgba(15, 23, 42, .10);
    --t1-shadow-lg:     0 10px 20px rgba(15, 23, 42, .08),
                        0 24px 48px rgba(15, 23, 42, .14);

    /* Motion */
    --t1-ease:          cubic-bezier(.4, 0, .2, 1);
    --t1-dur-fast:      .14s;
    --t1-dur-med:       .22s;
}

/* Force German content to LTR no matter the page direction. */
.t1-form .german-text,
.t1-form .german-text * {
    direction: ltr !important;
    text-align: start;
    unicode-bidi: isolate;
}

/* ── Pair grid ──────────────────────────────────────────── */
.t1-pair-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: .75rem;
}

.t1-pair {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    padding: .55rem;
    background: linear-gradient(180deg, var(--t1-bg-tint) 0%, var(--t1-bg-canvas) 100%);
    border-radius: calc(var(--t1-card-radius) + 4px);
    border: 1px solid var(--t1-border-soft);
    transition: box-shadow var(--t1-dur-med) var(--t1-ease),
                border-color var(--t1-dur-med) var(--t1-ease);
}
.t1-pair:hover {
    border-color: #d8e1ee;
    box-shadow: var(--t1-shadow-sm);
}

@media (max-width: 767.98px) {
    .t1-pair {
        grid-template-columns: 1fr;
        padding: .55rem;
        gap: .7rem;
    }
}

/* ── Text card ──────────────────────────────────────────── */
.t1-text-card {
    background: var(--t1-bg-surface);
    border: 1px solid var(--t1-border);
    border-radius: var(--t1-card-radius);
    box-shadow: var(--t1-shadow-xs);
    overflow: hidden;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow var(--t1-dur-med) var(--t1-ease);
}
.t1-text-card::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--t1-accent) 0%, var(--t1-accent-dk) 100%);
    border-start-start-radius: var(--t1-card-radius);
    border-end-start-radius: var(--t1-card-radius);
}
.t1-text-card:hover { box-shadow: var(--t1-shadow-sm); }
.t1-text-card.is-correct::before {
    background: linear-gradient(180deg, var(--t1-success) 0%, #166534 100%);
}
.t1-text-card.is-wrong::before {
    background: linear-gradient(180deg, var(--t1-danger) 0%, #991b1b 100%);
}

.t1-text-card-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem 1rem .55rem 1.15rem;
    border-bottom: 1px solid var(--t1-border-soft);
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    min-height: 48px;
}
.t1-text-num {
    display: inline-flex;
    width: 1.85rem; height: 1.85rem;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--t1-accent) 0%, var(--t1-accent-dk) 100%);
    color: #fff;
    font-weight: 700;
    font-size: .88rem;
    border-radius: 9px;
    flex-shrink: 0;
    box-shadow: 0 3px 8px var(--t1-accent-ring),
                inset 0 -1px 0 rgba(0, 0, 0, .12);
    letter-spacing: .01em;
}
.t1-text-card.is-correct .t1-text-num {
    background: linear-gradient(135deg, var(--t1-success) 0%, #166534 100%);
    box-shadow: 0 4px 10px var(--t1-success-ring), inset 0 -1px 0 rgba(0,0,0,.12);
}
.t1-text-card.is-wrong .t1-text-num {
    background: linear-gradient(135deg, var(--t1-danger) 0%, #991b1b 100%);
    box-shadow: 0 4px 10px var(--t1-danger-ring), inset 0 -1px 0 rgba(0,0,0,.12);
}

.t1-text-label {
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--t1-text-muted);
}

.t1-text-result {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 700;
    font-size: .78rem;
    padding: .3rem .7rem;
    border-radius: var(--t1-chip-radius);
    text-transform: uppercase;
    letter-spacing: .04em;
    border: 1px solid transparent;
}
.t1-text-result.is-correct {
    background: var(--t1-success-soft);
    color: var(--t1-success-text);
    border-color: #bbf7d0;
}
.t1-text-result.is-wrong {
    background: var(--t1-danger-soft);
    color: var(--t1-danger-text);
    border-color: #fecaca;
}

.t1-text-card-body {
    padding: .8rem 1rem .95rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    flex: 1;
}

/* Reading passage — its own light-paper container so it reads as
   the dedicated "text to read" zone, distinct from summary/answer. */
.t1-text-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--t1-text);
    letter-spacing: .005em;
    background: #fbfaf6;            /* warm off-white "paper" */
    border: 1px solid #ece6d6;
    border-radius: 10px;
    padding: .85rem 1.05rem;
    font-family: Georgia, "Source Serif Pro", "Iowan Old Style", serif;
}
/* Locales that read better in the system sans (Arabic, etc.) opt out. */
body.rtl .t1-text-content { font-family: inherit; }

/* Summary strip — light hint, no left rule (card outer accent is enough) */
.t1-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem .55rem;
    background: #f8fafc;
    border: 1px solid var(--t1-border-soft);
    padding: .5rem .8rem;
    border-radius: 10px;
}
/* Compact uppercase label, matching the answer-zone label style */
.t1-summary-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--t1-text-muted);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    line-height: 1;
}
.t1-summary-label .bi {
    font-size: .85rem;
    opacity: .85;
}
.t1-summary-text {
    font-size: .9rem;
    color: var(--t1-text-muted);
    font-style: italic;
    line-height: 1.55;
}
/* Italic looks visually noisy with Arabic script — drop it for RTL locale */
body.rtl .t1-summary-text { font-style: normal; }

/* ── Mode pill (tonal, matches the system) ─────────────── */
.t1-mode-pill {
    display: inline-flex;
    align-items: center;
    padding: .35rem .8rem;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .01em;
    border-radius: var(--t1-chip-radius);
    border: 1px solid transparent;
}
.t1-mode-pill--basic {
    background: var(--t1-success-tint);
    color: var(--t1-success-text);
    border-color: var(--t1-success-soft);
}
.t1-mode-pill--modified {
    background: var(--t1-accent-tint);
    color: var(--t1-accent-dk);
    border-color: #d6e4ff;
}

/* ── Answered counter (quiet progress chip) ────────────── */
.t1-answered-count {
    display: inline-flex;
    align-items: center;
    font-size: .85rem;
    font-weight: 600;
    color: var(--t1-text-muted);
    padding: .3rem .6rem;
    background: #f8fafc;
    border: 1px solid var(--t1-border-soft);
    border-radius: var(--t1-chip-radius);
    transition: background var(--t1-dur-fast) var(--t1-ease),
                color var(--t1-dur-fast) var(--t1-ease),
                border-color var(--t1-dur-fast) var(--t1-ease);
}
.t1-answered-count.is-complete {
    color: var(--t1-success-text);
    background: var(--t1-success-tint);
    border-color: var(--t1-success-soft);
    animation: t1CounterComplete 1.2s ease-out;
}
@keyframes t1CounterComplete {
    0%   { box-shadow: 0 0 0 0 var(--t1-success-ring); }
    70%  { box-shadow: 0 0 0 8px rgba(21, 128, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0); }
}

/* ── Show Solution — demoted text-style action ─────────── */
.t1-show-solution-link {
    background: transparent;
    border: 1px solid transparent;
    color: var(--t1-text-muted);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(100, 116, 139, .35);
    text-underline-offset: 3px;
    padding: .3rem .55rem;
    border-radius: 8px;
    transition: color var(--t1-dur-fast) var(--t1-ease),
                background var(--t1-dur-fast) var(--t1-ease),
                text-decoration-color var(--t1-dur-fast) var(--t1-ease);
}
.t1-show-solution-link:hover,
.t1-show-solution-link:focus-visible {
    color: var(--t1-ink);
    background: #f1f5f9;
    text-decoration-color: var(--t1-text-muted);
    outline: none;
}

/* ── Answer zone — three zones separated by container shape, not extra rules ── */
.t1-answer-zone {
    margin-top: .15rem;
    padding-top: 0;
    border-top: 0;
}

.t1-answer-zone-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--t1-text-muted);
    margin-bottom: .35rem;
}
.t1-answer-zone-label .bi { color: var(--t1-accent); font-size: .85rem; }

/* Empty / interactive slot */
.t1-slot {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .65rem;
    border: 2px dashed #cbd5e1;
    border-radius: var(--t1-tile-radius);
    background:
        repeating-linear-gradient(45deg,
            #fbfcfe 0 10px,
            #f6f8fb 10px 20px);
    cursor: pointer;
    font-weight: 600;
    color: var(--t1-text-muted);
    transition: border-color var(--t1-dur-fast) var(--t1-ease),
                background var(--t1-dur-fast) var(--t1-ease),
                box-shadow var(--t1-dur-fast) var(--t1-ease),
                color var(--t1-dur-fast) var(--t1-ease),
                transform var(--t1-dur-fast) var(--t1-ease);
    min-height: 48px;
}
.t1-slot:hover,
.t1-slot:focus-visible {
    border-color: var(--t1-accent);
    background: var(--t1-accent-tint);
    color: var(--t1-accent-dk);
    outline: none;
}
.t1-slot.is-active {
    border-style: solid;
    border-color: var(--t1-accent);
    background: var(--t1-accent-soft);
    color: var(--t1-accent-dk);
    box-shadow: 0 0 0 4px var(--t1-accent-ring);
}
.t1-slot.is-dragover {
    border-style: solid;
    border-color: var(--t1-accent);
    background: #dbeafe;
    box-shadow: 0 0 0 4px var(--t1-accent-ring), var(--t1-shadow-sm);
    transform: scale(1.005);
}

/* Filled slot — soft tinted container; the chip lives inside */
.t1-slot.is-filled {
    border-style: solid;
    border-color: #c7dbff;
    background: var(--t1-accent-tint);
    color: var(--t1-accent-dk);
    font-weight: 600;
    box-shadow: none;
    padding: .4rem .5rem;
    min-height: 46px;
}
.t1-slot.is-filled:hover,
.t1-slot.is-filled:focus-visible {
    border-color: var(--t1-accent);
    background: var(--t1-accent-soft);
    color: var(--t1-accent-dk);
}

.t1-slot-placeholder {
    display: inline-flex; align-items: center; gap: .5rem;
    flex: 1; min-width: 0;
    padding-inline-start: .25rem;
}
.t1-slot-placeholder .bi { font-size: 1.05rem; color: var(--t1-accent); }

/* The actual answer chip — matches the review-mode pill scale */
.t1-slot-label {
    display: inline-flex; align-items: center; gap: .5rem;
    min-width: 0;
    padding: .35rem .8rem .35rem .45rem;
    background: linear-gradient(135deg, var(--t1-accent) 0%, var(--t1-accent-dk) 100%);
    color: #fff;
    border-radius: var(--t1-chip-radius);
    box-shadow: 0 3px 10px var(--t1-accent-ring),
                inset 0 1px 0 rgba(255, 255, 255, .15);
    font-weight: 600;
    font-size: .92rem;
    line-height: 1.25;
    /* Cap so a long title never lets the chip span the full slot. */
    max-width: calc(100% - 2.5rem);
}
/* Numeric badge — anchors the chip back to its source heading row. */
.t1-slot-label-num {
    color: #fff;
    background: rgba(255, 255, 255, .22);
    width: 1.55rem; height: 1.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
    /* Keep digits LTR even in RTL contexts. */
    direction: ltr; unicode-bidi: isolate;
}
/* Legacy icon (kept for any caller still emitting it) — same size as badge. */
.t1-slot-label .bi {
    color: rgba(255, 255, 255, .95);
    background: rgba(255, 255, 255, .18);
    width: 1.35rem; height: 1.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: .78rem;
    flex-shrink: 0;
}
.t1-slot-label-text {
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: .005em;
}
/* Middle-dot separator between the number badge and the title text. */
.t1-slot-label-num + .t1-slot-label-text::before {
    content: "·";
    color: rgba(255, 255, 255, .75);
    font-weight: 700;
    margin-inline-end: .35rem;
}

.t1-slot-clear {
    position: relative;
    border: 1px solid #c7dbff;
    background: #ffffff;
    color: var(--t1-danger);
    width: 1.7rem; height: 1.7rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--t1-dur-fast) var(--t1-ease),
                color var(--t1-dur-fast) var(--t1-ease),
                transform var(--t1-dur-fast) var(--t1-ease),
                box-shadow var(--t1-dur-fast) var(--t1-ease),
                border-color var(--t1-dur-fast) var(--t1-ease);
    font-size: .76rem;
    box-shadow: var(--t1-shadow-xs);
    margin-inline-start: auto;
}
/* Effective 44×44 hit-area on touch/coarse pointers (visual size unchanged). */
@media (hover: none), (pointer: coarse) {
    .t1-slot-clear::after {
        content: "";
        position: absolute;
        top: 50%; left: 50%;
        width: 44px; height: 44px;
        transform: translate(-50%, -50%);
    }
    /* On touch devices the grab cursor is misleading — there's no drag.
       Use a tap affordance instead. */
    .t1-heading-tile,
    .t1-heading-tile:active { cursor: pointer; }
    .t1-heading-tile.is-locked { cursor: not-allowed; }
}
.t1-slot-clear:hover,
.t1-slot-clear:focus-visible {
    background: var(--t1-danger);
    color: #fff;
    border-color: var(--t1-danger);
    transform: scale(1.08) rotate(90deg);
    outline: none;
    box-shadow: 0 4px 10px var(--t1-danger-ring);
}
.t1-slot-clear.d-none { display: none !important; }

/* ── Read-only answer display (review mode) ──────────────── */
.t1-answer-display {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .5rem .65rem;
    background: var(--t1-bg-canvas);
    border-radius: var(--t1-tile-radius);
    border: 1px solid var(--t1-border);
    min-height: 46px;
}
.t1-answer-pill,
.t1-answer-correct {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .8rem;
    font-weight: 600;
    font-size: .92rem;
    border-radius: var(--t1-chip-radius);
    line-height: 1.25;
    border: 1px solid transparent;
}
.t1-answer-pill.is-correct,
.t1-answer-correct {
    background: var(--t1-success-soft);
    color: var(--t1-success-text);
    border-color: #86efac;
}
.t1-answer-pill.is-wrong {
    background: var(--t1-danger-soft);
    color: var(--t1-danger-text);
    border-color: #fca5a5;
}
.t1-answer-pill .bi,
.t1-answer-correct .bi { font-size: .92rem; }
.t1-answer-arrow {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--t1-text-muted);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}
.t1-answer-arrow .bi { color: var(--t1-text-subtle); }

/* ── Review extras ─────────────────────────────────────── */
.t1-explanation,
.t1-title-kws {
    margin-top: .15rem;
    padding-top: .7rem;
    border-top: 1px solid var(--t1-border-soft);
}
.t1-explanation {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
}
.t1-explanation-icon {
    color: var(--t1-accent);
    flex-shrink: 0;
    margin-top: .15rem;
    font-size: 1.05rem;
    background: var(--t1-accent-soft);
    width: 1.85rem; height: 1.85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center; justify-content: center;
}
.t1-explanation-label {
    font-weight: 700;
    font-size: .72rem;
    display: block;
    margin-bottom: .25rem;
    color: var(--t1-ink);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.t1-explanation-text {
    font-size: .92rem;
    color: var(--t1-text);
    line-height: 1.6;
}

.t1-title-kws-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 700;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--t1-text-muted);
    margin-bottom: .45rem;
}
.t1-title-kws-marks { display: flex; gap: .4rem; flex-wrap: wrap; }
.t1-title-kws-marks mark {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
    color: #78350f;
    padding: .2rem .55rem;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    border: 1px solid #fcd34d;
}

/* ── Headings panel ─────────────────────────────────────── */
.t1-headings-panel {
    background: var(--t1-accent-tint);
    border: 1px solid #d6e4ff;
    border-radius: var(--t1-card-radius);
    box-shadow: var(--t1-shadow-xs);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: box-shadow var(--t1-dur-med) var(--t1-ease);
}
.t1-headings-panel:hover { box-shadow: var(--t1-shadow-sm); }

.t1-headings-head {
    padding: .55rem .9rem;
    background: linear-gradient(180deg, #f6faff 0%, #e6efff 100%);
    border-bottom: 1px solid #d6e4ff;
    font-weight: 700;
    font-size: .72rem;
    color: var(--t1-ink);
    text-transform: uppercase;
    letter-spacing: .1em;
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 48px;
}
.t1-headings-head .bi {
    color: var(--t1-accent);
    font-size: .95rem;
    background: var(--t1-accent-soft);
    width: 1.7rem; height: 1.7rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center; justify-content: center;
}
.t1-headings-head > span:not(.t1-headings-count):not(.t1-headings-touch-hint) { flex: 1; min-width: 0; }

/* Quiet "tap to assign" affordance — only shown to touch/coarse-pointer
   users, where the drag-and-drop affordance isn't meaningful. */
.t1-headings-touch-hint {
    display: none;
    align-items: center;
    gap: .3rem;
    margin-inline-start: auto;
    margin-inline-end: .35rem;
    font-weight: 600;
    font-size: .68rem;
    color: var(--t1-text-muted);
    text-transform: none;
    letter-spacing: .02em;
    line-height: 1;
}
.t1-headings-touch-hint .bi {
    color: var(--t1-accent);
    background: transparent;
    width: auto; height: auto;
    border-radius: 0;
    font-size: .85rem;
}
@media (hover: none), (pointer: coarse) {
    .t1-headings-touch-hint { display: inline-flex; }
    .t1-headings-head > span:not(.t1-headings-count):not(.t1-headings-touch-hint) { flex: 0 1 auto; }
}
.t1-headings-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.45rem;
    padding: 0 .45rem;
    background: #ffffff;
    color: var(--t1-accent-dk);
    border: 1px solid #c7dbff;
    border-radius: var(--t1-chip-radius);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .03em;
    flex-shrink: 0;
    box-shadow: var(--t1-shadow-xs);
}

.t1-headings-list {
    padding: .45rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin: 0;
    list-style: none;
    flex: 1;
}

/* Heading tile (interactive) */
.t1-heading-tile {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .5rem .65rem;
    background: var(--t1-bg-surface);
    border: 1px solid var(--t1-border);
    border-radius: var(--t1-tile-radius);
    cursor: grab;
    text-align: start;
    width: 100%;
    font: inherit;
    color: var(--t1-text);
    font-size: .92rem;
    line-height: 1.45;
    transition: border-color var(--t1-dur-fast) var(--t1-ease),
                background var(--t1-dur-fast) var(--t1-ease),
                color var(--t1-dur-fast) var(--t1-ease),
                transform var(--t1-dur-fast) var(--t1-ease),
                box-shadow var(--t1-dur-fast) var(--t1-ease),
                opacity var(--t1-dur-med) var(--t1-ease);
    user-select: none;
    position: relative;
    box-shadow: var(--t1-shadow-xs);
    min-height: 50px;
}
.t1-heading-tile:hover,
.t1-heading-tile:focus-visible {
    border-color: var(--t1-accent);
    background: var(--t1-accent-tint);
    outline: none;
    transform: translateY(-1px);
    box-shadow: var(--t1-shadow-sm);
}
.t1-heading-tile:hover .t1-tile-num,
.t1-heading-tile:focus-visible .t1-tile-num {
    background: var(--t1-accent-soft);
    color: var(--t1-accent-dk);
}
.t1-heading-tile:active { cursor: grabbing; transform: translateY(0); }

.t1-heading-tile.is-dragging {
    opacity: .5;
    cursor: grabbing;
    transform: scale(.97);
    box-shadow: var(--t1-shadow-md);
}
.t1-heading-tile.is-picked {
    border-color: var(--t1-accent);
    background: var(--t1-accent-soft);
    box-shadow: 0 0 0 3px var(--t1-accent-ring), var(--t1-shadow-sm);
}

/* Tile assigned to THIS pair's text — supportive highlight (the filled
   answer slot remains the primary "this is your selected answer" signal). */
.t1-heading-tile.is-current {
    border-color: #c7dbff;
    background: var(--t1-accent-tint);
    color: var(--t1-accent-dk);
    font-weight: 600;
    box-shadow: var(--t1-shadow-xs);
    transform: none;
}
.t1-heading-tile.is-current:hover {
    transform: translateY(-1px);
    background: var(--t1-accent-soft);
    box-shadow: var(--t1-shadow-sm);
}
.t1-heading-tile.is-current .t1-tile-num {
    background: var(--t1-accent-soft);
    color: var(--t1-accent-dk);
    box-shadow: none;
}
.t1-heading-tile.is-current .t1-tile-icon-current { display: inline-flex; }
.t1-heading-tile.is-current .t1-tile-state-icon { color: var(--t1-accent-dk); }

/* Tile used in another pair — faded and disabled */
.t1-heading-tile.is-locked {
    opacity: .55;
    cursor: not-allowed;
    background: #f8fafc;
    border-style: dashed;
    border-color: #cbd5e1;
    color: var(--t1-text-muted);
    box-shadow: none;
}
.t1-heading-tile.is-locked:hover,
.t1-heading-tile.is-locked:focus-visible {
    transform: none;
    border-color: #cbd5e1;
    background: #f8fafc;
    box-shadow: none;
}
.t1-heading-tile.is-locked .t1-tile-num {
    background: #e2e8f0;
    color: var(--t1-text-subtle);
}

.t1-tile-num {
    display: inline-flex;
    width: 1.55rem; height: 1.55rem;
    align-items: center; justify-content: center;
    background: #eef2f7;
    color: var(--t1-accent-dk);
    border-radius: 7px;
    font-size: .72rem;
    font-weight: 800;
    flex-shrink: 0;
    transition: background var(--t1-dur-fast) var(--t1-ease),
                color var(--t1-dur-fast) var(--t1-ease),
                box-shadow var(--t1-dur-fast) var(--t1-ease);
    margin-top: .05rem;
    letter-spacing: .01em;
}

.t1-tile-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    hyphens: auto;
    padding-top: .1rem;
}

.t1-tile-state-icon {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem; height: 1.3rem;
    flex-shrink: 0;
    font-size: .9rem;
    margin-top: .05rem;
}
.t1-tile-icon-current,
.t1-tile-icon-locked { display: none; }

/* "Used in text N" indicator on locked tiles */
.t1-tile-owner {
    margin-inline-start: auto;
    align-self: center;
    font-size: .68rem;
    font-weight: 800;
    color: var(--t1-accent-dk);
    background: var(--t1-accent-soft);
    border: 1px solid #c7dbff;
    border-radius: var(--t1-chip-radius);
    padding: .15rem .55rem;
    flex-shrink: 0;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
}
.t1-heading-tile.is-locked .t1-tile-state-icon { display: none; }

/* ── Headings static list (review mode) ─────────────────── */
.t1-headings-static {
    padding: .45rem;
    margin: 0;
    list-style: none;
    flex: 1;
}
.t1-headings-static li {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .65rem;
    font-size: .9rem;
    border-radius: var(--t1-tile-radius);
    line-height: 1.4;
    border: 1px solid transparent;
    background: var(--t1-bg-surface);
}
.t1-headings-static li + li { margin-top: .2rem; }
.t1-headings-static li.is-correct {
    background: var(--t1-success-tint);
    border-color: #86efac;
    color: var(--t1-success-text);
    font-weight: 600;
    box-shadow: 0 1px 0 rgba(21, 128, 61, .08);
}
.t1-headings-static li.is-correct .t1-static-num {
    background: linear-gradient(135deg, var(--t1-success) 0%, #166534 100%);
    color: #fff;
    box-shadow: 0 2px 6px var(--t1-success-ring);
}
.t1-headings-static li.is-selected-wrong {
    background: var(--t1-danger-tint);
    border-color: #fca5a5;
    color: var(--t1-danger-text);
}
.t1-headings-static li.is-selected-wrong .t1-static-num {
    background: linear-gradient(135deg, var(--t1-danger) 0%, #991b1b 100%);
    color: #fff;
    box-shadow: 0 2px 6px var(--t1-danger-ring);
}
.t1-static-num {
    display: inline-flex;
    width: 1.55rem; height: 1.55rem;
    align-items: center; justify-content: center;
    background: #eef2f7;
    color: var(--t1-accent-dk);
    border-radius: 7px;
    font-size: .75rem;
    font-weight: 800;
    flex-shrink: 0;
}
.t1-static-text { flex: 1; min-width: 0; word-break: break-word; }
.t1-static-mark { font-size: 1.05rem; flex-shrink: 0; margin-inline-start: auto; }

/* ── Controls bar ───────────────────────────────────────── */
.t1-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    margin-top: .25rem;
    padding-top: .9rem;
    border-top: 1px solid var(--t1-border);
}
/* Visual separation between the demoted "Show solution" link and the
   right-aligned cluster (counter + nav). A hairline divider only
   appears on wide-enough rows; when the bar wraps, the gap suffices. */
.t1-controls > .ms-auto {
    border-inline-start: 1px solid var(--t1-border);
    padding-inline-start: .85rem;
    margin-inline-start: auto;
}
@media (max-width: 575.98px) {
    .t1-controls > .ms-auto {
        border-inline-start: 0;
        padding-inline-start: 0;
    }
}

/* ── RTL: neutralize Western uppercase/letter-spacing on micro-labels.
   Arabic should not inherit tracking/uppercase treatment designed for Latin. */
body.rtl .t1-text-label,
body.rtl .t1-summary-label,
body.rtl .t1-answer-zone-label,
body.rtl .t1-explanation-label,
body.rtl .t1-title-kws-label,
body.rtl .t1-text-result,
body.rtl .t1-answer-arrow,
body.rtl .t1-headings-head {
    text-transform: none;
    letter-spacing: 0;
}

/* ── RTL support: keep German LTR, flip directional icons ── */
/* Directional arrow in review answer flips with the page */
body.rtl .t1-answer-arrow .bi-arrow-right { transform: scaleX(-1); }
/* Owner pill ("→ N"): isolate as LTR so the arrow + digit stay readable
   in Arabic chrome, and tighten letter-spacing for the script. */
body.rtl .t1-tile-owner {
    letter-spacing: 0;
    direction: ltr;
    unicode-bidi: isolate;
}
/* Static-mark icon stays at end via margin-inline-start: auto (already logical) */
/* Number badges (LTR digits) keep their natural reading order under RTL chrome */
body.rtl .t1-text-num,
body.rtl .t1-tile-num,
body.rtl .t1-static-num,
body.rtl .t1-headings-count { direction: ltr; unicode-bidi: isolate; }

/* ── Tablet ─────────────────────────────────────────────── */
/* Keep the two-column pair layout down to ~768px so tablets don't
   collapse prematurely. Below 768px the single-column rule above takes over. */
@media (max-width: 991.98px) and (min-width: 768px) {
    .t1-pair {
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
        gap: .55rem;
    }
    .t1-text-card-body { padding: .8rem 1rem .9rem; gap: .6rem; }
    .t1-text-content   { font-size: .96rem; line-height: 1.65; }
    .t1-headings-list  { padding: .4rem; }
    .t1-heading-tile   { font-size: .9rem; padding: .5rem .6rem; }
}
@media (max-width: 767.98px) and (min-width: 576px) {
    .t1-text-card-body { padding: .85rem 1.05rem .95rem; }
    .t1-headings-list  { padding: .4rem; }
    .t1-heading-tile   { font-size: .9rem; padding: .5rem .6rem; }
}

/* ── Mobile tweaks ──────────────────────────────────────── */
@media (max-width: 575.98px) {
    :root {
        --t1-card-radius: 14px;
        --t1-tile-radius: 10px;
    }
    .t1-pair-list { gap: .9rem; }
    .t1-pair { padding: .5rem; gap: .65rem; }
    .t1-text-card-body { padding: .8rem .95rem .95rem; gap: .7rem; }
    .t1-text-content { font-size: .96rem; line-height: 1.65; }
    .t1-text-card-head,
    .t1-headings-head { padding: .55rem .85rem; min-height: 46px; }
    .t1-text-num { width: 1.85rem; height: 1.85rem; font-size: .88rem; }
    .t1-heading-tile {
        font-size: .9rem;
        padding: .6rem .65rem;
        min-height: 50px;          /* comfortable tap target */
    }
    .t1-tile-num { width: 1.55rem; height: 1.55rem; font-size: .72rem; }
    .t1-slot { min-height: 50px; padding: .55rem .65rem; }
    .t1-slot.is-filled { min-height: 50px; padding: .4rem .5rem; }
    .t1-slot-clear { width: 2rem; height: 2rem; }   /* easier to tap */
    .t1-summary { padding: .55rem .75rem; }
    .t1-controls { padding-top: .8rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .t1-pair, .t1-text-card, .t1-headings-panel,
    .t1-heading-tile, .t1-slot, .t1-slot-clear {
        transition: none !important;
    }
    .t1-heading-tile:hover,
    .t1-heading-tile.is-current,
    .t1-slot.is-filled:hover,
    .t1-slot.is-dragover { transform: none !important; }
    .t1-answered-count.is-complete { animation: none !important; }
}

/* ============================================================
   Teil 1 — AR/EN translations (additive, scoped to .t1-tr*)
   ============================================================ */
.t1-tr {
    margin: .5rem 0 .25rem;
}
/* Per-title-option translation controls attached directly under each heading tile */
.t1-tile-tr {
    margin-top: .35rem;
    padding-inline-start: 2.15rem; /* align under the tile text, past the number badge */
}
.t1-tile-tr-btns {
    gap: .35rem;
}
.t1-tr-btn--sm {
    padding: .14rem .55rem;
    font-size: .74rem;
}
.t1-tr-panel--sm {
    margin-top: .4rem;
    font-size: .9rem;
    line-height: 1.6;
}
.t1-tr-panel--sm[lang="ar"],
.t1-tr-panel--sm[dir="rtl"] {
    line-height: 1.8;
}
/* Review static list: let the translation controls wrap to a full-width row */
.t1-headings-static li { flex-wrap: wrap; }
.t1-headings-static li .t1-tile-tr {
    flex: 0 0 100%;
    width: 100%;
    padding-inline-start: 2.1rem;
}
.t1-tr-btns {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.t1-tr-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .65rem;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--bs-primary, #0d6efd);
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-primary, #0d6efd);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.t1-tr-btn:hover,
.t1-tr-btn:focus-visible {
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    outline: none;
}
.t1-tr-btn.is-open {
    background: var(--bs-primary, #0d6efd);
    color: #fff;
}
.t1-tr-panel {
    margin-top: .55rem;
    padding: .65rem .8rem;
    font-size: .95rem;
    line-height: 1.7;
    color: var(--bs-body-color, #212529);
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-left: 3px solid var(--bs-primary, #0d6efd);
    border-radius: .4rem;
}
.t1-tr-panel[lang="ar"],
.t1-tr-panel[dir="rtl"] {
    text-align: right;
    border-left: 1px solid var(--bs-border-color, #dee2e6);
    border-right: 3px solid var(--bs-primary, #0d6efd);
    line-height: 1.9;
}

/* Rich learning content (admin CKEditor output) inside the Teil-1 passage
 * body. Plain-text content uses <br> and is unaffected. */
.t1-text-content p { margin: 0 0 0.75em; }
.t1-text-content p:last-child { margin-bottom: 0; }
.t1-text-content ul, .t1-text-content ol { margin: 0 0 0.75em; padding-inline-start: 1.5em; }
.t1-text-content li { margin-bottom: 0.25em; }
.t1-text-content h3, .t1-text-content h4 { margin: 0 0 0.5em; font-weight: 700; line-height: 1.3; }
.t1-text-content h3 { font-size: 1.15em; }
.t1-text-content h4 { font-size: 1.05em; }
.t1-text-content a { color: inherit; text-decoration: underline; }
