/* ==========================================================================
   Schach von Grund auf lernen (lerneule Lernpfad) – Mobile-First (>= 44px)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
    max-width: 100%;
    overflow-x: clip;
    font-family: var(--le-font-sans);
    background: var(--le-bg);
    color: var(--le-ink);
    -webkit-tap-highlight-color: transparent;
}

button,
input {
    font-family: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

.mono {
    font-family: var(--le-font-mono);
    font-variant-numeric: tabular-nums;
}

.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--le-border);
    padding: 8px 12px;
}

.top-bar-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-kicker {
    display: block;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #d97706;
}

.brand-title {
    font-size: 1.04rem;
    font-weight: 900;
    line-height: 1.15;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.progress-pill {
    min-height: 36px;
    padding: 0 11px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
}

.path-layout {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 12px 36px;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.card {
    background: var(--le-surface);
    border: 1px solid var(--le-border);
    border-radius: 20px;
    box-shadow: var(--le-shadow-sm);
}

.path-rail {
    position: sticky;
    top: 70px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rail-head h2 {
    font-size: 0.94rem;
    font-weight: 900;
}

.rail-reset-btn {
    min-height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--le-ink-muted);
}

.rail-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--le-bg-soft);
    overflow: hidden;
}

.rail-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f59e0b, #4338ca);
    transition: width 0.25s ease;
}

.step-nav-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.step-nav-btn {
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    background: var(--le-bg);
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--le-ink);
}

.step-nav-btn.is-active {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
}

.step-nav-btn.is-done .step-dot {
    background: #16a34a;
    color: #ffffff;
}

.step-dot {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--le-border);
    color: var(--le-ink);
    font-size: 0.76rem;
    font-weight: 900;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.step-nav-btn.is-active .step-dot {
    background: #d97706;
    color: #ffffff;
}

.rail-play-link {
    margin-top: 4px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0284c7, #4338ca);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.lesson-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lesson-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--le-border);
}

.step-tag {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.74rem;
    font-weight: 900;
}

.step-tag.test {
    background: #e0e7ff;
    color: #3730a3;
}

.lesson-title {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1.2;
}

.lesson-goal {
    font-size: 0.94rem;
    color: var(--le-ink-muted);
    font-weight: 600;
}

.blocks-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.block-card {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--le-border);
    background: var(--le-surface-alt);
}

.block-card.rule {
    background: #fffbeb;
    border-color: #fcd34d;
}

.block-card.example {
    background: #f0f9ff;
    border-color: #7dd3fc;
}

.block-card.tip {
    background: #f0fdf4;
    border-color: #86efac;
}

.block-title {
    font-size: 0.94rem;
    font-weight: 900;
    margin-bottom: 6px;
}

.block-body {
    font-size: 0.92rem;
    line-height: 1.6;
}

.block-body code {
    font-family: var(--le-font-mono);
    background: rgba(15, 23, 42, 0.08);
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 800;
}

/* ==========================================================================
   INTERAKTIVES SCHACH-LABOR
   ========================================================================== */
.lab-box {
    padding: 16px;
    border-radius: 18px;
    border: 1.5px solid #cbd5e1;
    background: linear-gradient(150deg, #f8fafc 0%, #f0f9ff 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lab-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lab-pill,
.lab-toggle-btn {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    font-size: 0.82rem;
    font-weight: 800;
}

.lab-pill.active {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

.lab-step-badge {
    font-size: 0.78rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
}

.lab-split {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

@media (max-width: 720px) {
    .lab-split {
        grid-template-columns: 1fr;
    }
}

.mini-board-wrap {
    width: min(100%, 340px);
    aspect-ratio: 1 / 1;
    padding: 5px;
    border-radius: 14px;
    background: #2d5336;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    margin: 0 auto;
}

.lab-chess-board {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border-radius: 10px;
    overflow: hidden;
    touch-action: manipulation;
}

.mini-sq {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2%;
}

.mini-sq.light {
    background: #f4f0dc;
    color: #42704c;
}

.mini-sq.dark {
    background: #67a474;
    color: #f4f0dc;
}

.mini-sq.last-move::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(250, 204, 21, 0.36);
    pointer-events: none;
}

.mini-sq.selected {
    box-shadow: inset 0 0 0 3px #0284c7;
    background-image: linear-gradient(rgba(56, 189, 248, 0.28), rgba(56, 189, 248, 0.28));
}

.mini-sq.target-glow {
    box-shadow: inset 0 0 0 3px #f59e0b;
}

.mini-sq.in-check {
    background: radial-gradient(circle, #ef4444 0%, #b91c1c 100%) !important;
}

.mini-coord-r,
.mini-coord-f {
    position: absolute;
    font-size: 9px;
    font-weight: 800;
    opacity: 0.78;
    pointer-events: none;
    line-height: 1;
}

.mini-coord-r { top: 2px; left: 3px; }
.mini-coord-f { bottom: 2px; right: 3px; }

.mini-piece {
    width: 92%;
    height: 92%;
    z-index: 2;
    pointer-events: none;
}

.mini-piece svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mini-dot {
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(2, 132, 199, 0.65);
    border: 2px solid #ffffff;
    z-index: 3;
    pointer-events: none;
}

.mini-cap {
    position: absolute;
    inset: 7%;
    border-radius: 50%;
    border: 3.5px solid rgba(225, 29, 72, 0.8);
    z-index: 3;
    pointer-events: none;
}

.lab-info-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.info-piece-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-piece-svg {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
}

.info-piece-svg svg {
    width: 100%;
    height: 100%;
}

.info-sub {
    font-size: 0.78rem;
    color: var(--le-ink-muted);
}

.info-hint-small {
    font-size: 0.8rem;
    color: #92400e;
    background: #fffbeb;
    padding: 6px 10px;
    border-radius: 8px;
}

.lab-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lab-btn-primary,
.lab-btn-secondary {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 11px;
    font-size: 0.84rem;
    font-weight: 800;
}

.lab-btn-primary {
    background: #0284c7;
    color: #ffffff;
}

.lab-btn-primary:disabled {
    opacity: 0.45;
    cursor: default;
}

.lab-btn-secondary {
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    color: #1e293b;
}

.play-chess-cta {
    min-height: 48px;
    padding: 10px 16px;
    border-radius: 13px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 0.94rem;
    font-weight: 900;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 8px 18px rgba(217, 119, 6, 0.25);
}

/* ==========================================================================
   MINI-CHECKS & TEST
   ========================================================================== */
.check-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
    border-top: 2px dashed var(--le-border);
}

.check-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.check-head h3 {
    font-size: 1.02rem;
    font-weight: 900;
}

.check-counter {
    padding: 4px 10px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 900;
}

.checks-list,
.test-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.q-card {
    padding: 14px;
    border-radius: 16px;
    border: 1.5px solid var(--le-border);
    background: var(--le-surface-alt);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.q-card.is-right {
    background: #f0fdf4;
    border-color: var(--le-green);
}

.q-card.is-wrong {
    background: #fff1f2;
    border-color: var(--le-rose);
}

.q-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.q-prompt {
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.5;
}

.tip-btn {
    min-height: 36px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid var(--le-border-strong);
    background: #ffffff;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.q-tip {
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--le-amber-soft);
    color: #78350f;
    font-size: 0.84rem;
    font-weight: 700;
}

.opts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

.opt-btn {
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1.5px solid var(--le-border-strong);
    background: #ffffff;
    font-size: 0.88rem;
    font-weight: 800;
    text-align: center;
}

.opt-btn.picked {
    background: var(--le-indigo-soft);
    border-color: var(--le-indigo);
    color: #312e81;
}

.opt-btn.correct {
    background: var(--le-green);
    border-color: var(--le-green);
    color: #ffffff;
}

.opt-btn.wrong {
    background: var(--le-rose);
    border-color: var(--le-rose);
    color: #ffffff;
}

.q-feedback {
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.85);
}

.pre-test-note {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--le-amber-soft);
    color: #78350f;
    font-size: 0.86rem;
    font-weight: 700;
}

.result-box {
    padding: 18px;
    border-radius: 18px;
    border: 2px solid #0d9488;
    background: #f0fdfa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-box.fail {
    border-color: var(--le-amber);
    background: #fffbeb;
}

.result-score {
    font-size: 1.25rem;
    font-weight: 900;
}

.review-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.jump-step-btn {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid var(--le-amber);
    color: #78350f;
    font-size: 0.82rem;
    font-weight: 800;
}

.lesson-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--le-border);
}

.nav-btn {
    min-height: 48px;
    padding: 0 18px;
    border-radius: 14px;
    font-size: 0.94rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nav-btn.primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(217, 119, 6, 0.25);
}

.nav-btn.secondary {
    background: var(--le-surface-alt);
    border: 1.5px solid var(--le-border-strong);
    color: var(--le-ink);
}

.nav-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 900px) {
    .path-layout {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px 10px 28px;
        gap: 12px;
    }

    .path-rail,
    .stage-col {
        min-width: 0;
        max-width: 100%;
    }

    .path-rail {
        position: static;
    }

    .step-nav-list {
        flex-direction: row;
        overflow-x: auto;
        max-width: 100%;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .step-nav-btn {
        flex-shrink: 0;
    }

    .lesson-card {
        padding: 15px 13px;
    }
}

@media (max-width: 520px) {
    .opts-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
