/* Linux-Lab – Styles
   Aufbau: Tokens · Basis · Shell (Sidebar/Topbar) · Workspace/Terminal ·
           Inhalte (Markdown, Aufgaben, Quiz) · Übersicht · Spickzettel · Dialoge */

@font-face {
    font-family: "Inter";
    src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    src: url("../vendor/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("../vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("../vendor/fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2");
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- Tokens */

:root {
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --bg: #090d13;
    --bg-side: #0c1118;
    --surface: #111822;
    --surface-2: #17202c;
    --surface-3: #1e2937;
    --border: #1f2a38;
    --border-strong: #2d3b4d;
    --text: #dce5ef;
    --text-dim: #9aa9ba;
    --text-faint: #66768a;

    --accent: #3ddc97;
    --accent-strong: #5cf0ae;
    --accent-ink: #04150d;
    --accent-soft: rgba(61, 220, 151, 0.11);
    --accent-line: rgba(61, 220, 151, 0.32);
    --amber: #f5b942;
    --amber-soft: rgba(245, 185, 66, 0.12);
    --blue: #5cb3ff;
    --blue-soft: rgba(92, 179, 255, 0.11);
    --red: #ff6b7a;
    --red-soft: rgba(255, 107, 122, 0.11);
    --violet: #b79dff;
    --violet-soft: rgba(183, 157, 255, 0.12);

    --code-bg: #0b1017;
    --code-text: #d3dde8;
    --term-bg: #0a0e14;
    --term-chrome: #111823;
    --term-border: #1f2a38;

    --hl-comment: #6b7c90;
    --hl-keyword: #c79bff;
    --hl-string: #9be28f;
    --hl-number: #f5b942;
    --hl-builtin: #5cb3ff;
    --hl-variable: #ff9d7a;
    --hl-meta: #3ddc97;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, 0.7);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 304px;
    --topbar-h: 56px;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f5f6f8;
    --bg-side: #eef0f3;
    --surface: #ffffff;
    --surface-2: #f1f3f6;
    --surface-3: #e7eaef;
    --border: #e0e4ea;
    --border-strong: #c9d0d9;
    --text: #17212c;
    --text-dim: #51606f;
    --text-faint: #8391a0;

    --accent: #0b9a64;
    --accent-strong: #08875a;
    --accent-ink: #ffffff;
    --accent-soft: rgba(11, 154, 100, 0.09);
    --accent-line: rgba(11, 154, 100, 0.32);
    --amber: #b0740a;
    --amber-soft: rgba(197, 132, 14, 0.12);
    --blue: #1b6fd0;
    --blue-soft: rgba(27, 111, 208, 0.08);
    --red: #cf3a4e;
    --red-soft: rgba(207, 58, 78, 0.08);
    --violet: #6a4dd3;
    --violet-soft: rgba(106, 77, 211, 0.08);

    --code-bg: #f3f5f8;
    --code-text: #1c2734;

    --hl-comment: #7d8a98;
    --hl-keyword: #7a3fd0;
    --hl-string: #2a7d32;
    --hl-number: #a85f00;
    --hl-builtin: #1b6fd0;
    --hl-variable: #c0501f;
    --hl-meta: #0b9a64;

    --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 8px 24px -10px rgba(20, 30, 45, 0.14);
    --shadow-lg: 0 24px 64px -16px rgba(20, 30, 45, 0.3);
    color-scheme: light;
}

/* ---------------------------------------------------------------- Basis */

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

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss03";
    overflow: hidden;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

code,
kbd,
pre {
    font-family: var(--mono);
}

kbd {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.78em;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    white-space: nowrap;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection {
    background: var(--accent-line);
}

.icon {
    flex: none;
    display: inline-block;
    vertical-align: -0.18em;
}

.spacer {
    flex: 1;
}

.muted {
    color: var(--text-dim);
    font-size: 13px;
}

[hidden] {
    display: none !important;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 550;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover {
    background: var(--surface-3);
    text-decoration: none;
}
.btn:active {
    transform: translateY(1px);
}
.btn:disabled {
    opacity: 0.6;
    cursor: default;
}
.btn.primary {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: transparent;
    box-shadow: 0 0 0 1px var(--accent-line), 0 6px 18px -8px var(--accent);
}
.btn.primary:hover {
    background: var(--accent-strong);
}
.btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-dim);
}
.btn.ghost:hover,
.btn.ghost.active {
    background: var(--surface-2);
    color: var(--text);
}
.btn.small {
    height: 28px;
    padding: 0 10px;
    font-size: 12.5px;
}
.btn.big {
    height: 46px;
    padding: 0 20px;
    font-size: 15px;
    border-radius: 10px;
}
.btn.danger {
    color: var(--red);
    border-color: color-mix(in srgb, var(--red) 40%, transparent);
    background: var(--red-soft);
}
.btn.done-state {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent-line);
    height: 46px;
    padding: 0 20px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--text-dim);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
    color: var(--text);
    background: var(--surface-2);
}

.linklike {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    color: var(--text-dim);
    background: none;
    border: 0;
    font-size: inherit;
}
.linklike:hover {
    color: var(--accent);
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.bar {
    height: 6px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
}
.bar > i {
    display: block;
    height: 100%;
    min-width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar.thin {
    height: 4px;
}

.ring .ring-bg {
    stroke: var(--surface-3);
}
.ring .ring-fg {
    stroke: var(--accent);
    transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}
.eyebrow .sep {
    color: var(--text-faint);
}

/* ---------------------------------------------------------------- Shell */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-side);
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 18px;
    color: var(--text);
    flex: none;
}
.brand:hover {
    text-decoration: none;
}
.brand-mark {
    display: grid;
    color: var(--accent);
}
.brand-name {
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.brand-name b {
    font-weight: 750;
    color: var(--accent);
}

.mainnav {
    display: grid;
    gap: 2px;
    padding: 6px 10px 10px;
    flex: none;
}
.mainnav a {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 36px;
    padding: 0 10px;
    font-weight: 500;
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    transition: background 0.12s, color 0.12s;
}
.mainnav a:hover {
    color: var(--text);
    background: var(--surface-2);
    text-decoration: none;
}
.mainnav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.sidebar-label {
    padding: 10px 20px 6px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-faint);
    border-top: 1px solid var(--border);
    flex: none;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 10px 14px;
}

.module + .module {
    margin-top: 2px;
}

.module-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.module-head:hover {
    background: var(--surface-2);
}
.module-ring {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
}
.module-ring > span {
    position: absolute;
    font-size: 13px;
    line-height: 1;
}
.module-name {
    display: grid;
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}
.module-name small {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.module-name > span {
    font-size: 13.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.module-head.current .module-name > span {
    color: var(--accent);
}
.module-count {
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}
.chev {
    display: grid;
    color: var(--text-faint);
    transition: transform 0.18s;
}
.module-head.open .chev {
    transform: rotate(90deg);
}

.lesson-list {
    list-style: none;
    margin: 2px 0 8px 22px;
    padding: 0 0 0 12px;
    border-left: 1px solid var(--border);
}
.lesson-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 31px;
    padding: 4px 8px;
    font-size: 13.5px;
    color: var(--text-dim);
    border-radius: 7px;
    transition: background 0.12s, color 0.12s;
}
.lesson-link:hover {
    color: var(--text);
    background: var(--surface-2);
    text-decoration: none;
}
.lesson-link.active {
    color: var(--text);
    font-weight: 600;
    background: var(--surface-3);
}
.lesson-state {
    display: grid;
    place-items: center;
    flex: none;
    width: 16px;
    height: 16px;
    border: 1.500px solid var(--border-strong);
    border-radius: 50%;
}
.lesson-link.partial .lesson-state {
    border-color: var(--amber);
    background: conic-gradient(var(--amber) 50%, transparent 0);
}
.lesson-link.done .lesson-state {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: var(--accent);
}
.lesson-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lesson-no {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
}

.sidebar-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 12px 12px 16px;
    border-top: 1px solid var(--border);
    flex: none;
}
.hud {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 7px;
}
.hud-level {
    display: flex;
    align-items: center;
    gap: 10px;
}
.hud-icon {
    font-size: 22px;
    line-height: 1;
}
.hud-text {
    display: grid;
    line-height: 1.25;
    min-width: 0;
}
.hud-text b {
    font-size: 13.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hud-text span,
.hud-foot {
    font-size: 11.5px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}
.hud-foot {
    display: flex;
    justify-content: space-between;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--topbar-h);
    padding: 0 16px 0 24px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    flex: none;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    font-size: 13.5px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
}
.crumbs a {
    color: var(--text-dim);
}
.crumbs b {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
}
.crumbs .sep {
    display: grid;
    color: var(--text-faint);
}

.searchbtn {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 34px;
    width: 230px;
    padding: 0 8px 0 11px;
    font-size: 13.5px;
    color: var(--text-faint);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, color 0.15s;
}
.searchbtn:hover {
    color: var(--text-dim);
    border-color: var(--border-strong);
}
.searchbtn span {
    flex: 1;
    text-align: left;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    cursor: default;
}
.chip b {
    font-weight: 650;
    color: var(--text);
}
.chip.xp .icon {
    color: var(--amber);
}
.chip.streak .icon {
    color: var(--text-faint);
}
.chip.streak.lit .icon {
    color: #ff8a4c;
}

.term-toggle.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent-line);
}

.only-mobile,
.scrim {
    display: none;
}

/* ---------------------------------------------------------------- Workspace */

.workspace {
    --term-w: 46%;
    --term-h: 42%;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 9px var(--term-w);
    grid-template-rows: minmax(0, 1fr);
}
.workspace[data-layout="bottom"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 9px var(--term-h);
}
.workspace.term-hidden {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}
.workspace.term-hidden .splitter,
.workspace.term-hidden .termpane {
    display: none;
}
.workspace.term-max {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}
.workspace.term-max .content,
.workspace.term-max .splitter {
    display: none;
}
.workspace.sandbox:not(.term-max):not(.term-hidden)[data-layout="right"] {
    grid-template-columns: minmax(300px, 380px) 9px minmax(0, 1fr);
}
.workspace.sandbox:not(.term-max):not(.term-hidden)[data-layout="bottom"] {
    grid-template-rows: auto 9px minmax(0, 1fr);
}
.workspace.dragging {
    user-select: none;
}
.workspace.dragging .termpane {
    pointer-events: none;
}

.content {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
}

#view {
    padding: 36px 40px 80px;
}

.splitter {
    position: relative;
    cursor: col-resize;
    background: var(--bg);
    border-left: 1px solid var(--border);
    touch-action: none;
}
.workspace[data-layout="bottom"] .splitter {
    cursor: row-resize;
    border-left: 0;
    border-top: 1px solid var(--border);
}
.splitter::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 3px;
    height: 36px;
    background: var(--border-strong);
    border-radius: 3px;
    transition: background 0.15s, height 0.15s;
}
.workspace[data-layout="bottom"] .splitter::after {
    width: 36px;
    height: 3px;
}
.splitter:hover::after,
.workspace.dragging .splitter::after {
    background: var(--accent);
    height: 56px;
}
.workspace[data-layout="bottom"] .splitter:hover::after,
.workspace[data-layout="bottom"].dragging .splitter::after {
    height: 3px;
    width: 56px;
}

/* ---------------------------------------------------------------- Terminal */

.termpane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--term-bg);
    color: #d5dee8;
}

.term-head {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 8px 0 14px;
    background: var(--term-chrome);
    border-bottom: 1px solid var(--term-border);
    flex: none;
}
.term-dots {
    display: flex;
    gap: 6px;
}
.term-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2b3747;
}
.term-dots i:nth-child(1) {
    background: #ff6b7a;
}
.term-dots i:nth-child(2) {
    background: #f5b942;
}
.term-dots i:nth-child(3) {
    background: #3ddc97;
}
.term-title {
    font-family: var(--mono);
    font-size: 12.5px;
    color: #8798ab;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.term-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px 2px 8px;
    font-size: 11.5px;
    font-weight: 550;
    color: #8798ab;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    white-space: nowrap;
}
.term-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5d6b7c;
}
.term-status[data-state="ready"] {
    color: #3ddc97;
}
.term-status[data-state="ready"] i {
    background: #3ddc97;
    box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.18);
}
.term-status[data-state="loading"] i {
    background: #f5b942;
    animation: blink 1s ease-in-out infinite;
}
.term-status[data-state="error"] {
    color: #ff6b7a;
}
.term-status[data-state="error"] i {
    background: #ff6b7a;
}
@keyframes blink {
    50% {
        opacity: 0.3;
    }
}
.term-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #8798ab;
    background: transparent;
    border: 0;
    border-radius: 7px;
}
.term-btn:hover {
    color: #e6edf5;
    background: rgba(255, 255, 255, 0.08);
}

.term-body {
    position: relative;
    flex: 1;
    min-height: 0;
}
.term-screen {
    position: absolute;
    inset: 10px 4px 6px 12px;
}
.term-screen .xterm {
    height: 100%;
}
.term-screen .xterm-viewport {
    background: transparent !important;
}

.term-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(600px 300px at 50% 40%, rgba(61, 220, 151, 0.07), transparent 70%), var(--term-bg);
    overflow: auto;
}
.boot-card {
    display: grid;
    justify-items: center;
    gap: 12px;
    max-width: 380px;
    text-align: center;
}
.boot-card h3 {
    font-size: 18px;
    font-weight: 650;
    color: #e6edf5;
}
.boot-card p {
    font-size: 14px;
    color: #8798ab;
    line-height: 1.55;
}
.boot-card .btn {
    margin-top: 6px;
}
.boot-logo {
    font-size: 46px;
    line-height: 1;
}
.boot-logo.pulse {
    animation: bob 1.4s ease-in-out infinite;
}
@keyframes bob {
    50% {
        transform: translateY(-7px);
    }
}
.boot-bar {
    width: 240px;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}
.boot-bar i {
    display: block;
    width: 4%;
    height: 100%;
    background: #3ddc97;
    border-radius: 99px;
    transition: width 0.25s;
}

.loading-screen {
    display: grid;
    place-items: center;
    gap: 14px;
    align-content: center;
    min-height: 60vh;
    color: var(--text-dim);
}

.fatal {
    max-width: 560px;
    margin: 12vh auto 0;
    display: grid;
    gap: 12px;
}

/* ---------------------------------------------------------------- Lektion */

.lesson,
.page-head,
.cheat,
.dashboard {
    margin: 0 auto;
}
.lesson {
    max-width: 780px;
}

.lesson-head {
    display: grid;
    gap: 12px;
    padding-bottom: 26px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
}
.lesson-head h1,
.page-head h1 {
    font-size: clamp(28px, 3.200vw, 38px);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.022em;
    text-wrap: balance;
}
.lesson-num {
    color: var(--text-faint);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.lesson-summary {
    font-size: 17.5px;
    color: var(--text-dim);
    line-height: 1.55;
    text-wrap: pretty;
}
.lesson-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13.5px;
    color: var(--text-dim);
}
.lesson-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Markdown */

.md {
    font-size: 16.5px;
    line-height: 1.72;
    color: var(--text);
}
.md > :first-child {
    margin-top: 0;
}
.md > :last-child {
    margin-bottom: 0;
}
.md p,
.md ul,
.md ol,
.md .codeblock,
.md .table-wrap,
.md blockquote {
    margin: 0 0 1.050em;
}
.md h2 {
    margin: 2.100em 0 0.700em;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
}
.md h3 {
    margin: 1.700em 0 0.550em;
    font-size: 18.5px;
    font-weight: 650;
    line-height: 1.3;
}
.md h4 {
    margin: 1.400em 0 0.400em;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.md ul,
.md ol {
    padding-left: 1.400em;
}
.md li {
    margin: 0.280em 0;
}
.md li::marker {
    color: var(--text-faint);
}
.md strong {
    font-weight: 650;
}
.md a {
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-underline-offset: 3px;
}
.md hr {
    margin: 2.200em 0;
    border: 0;
    border-top: 1px solid var(--border);
}
.md blockquote {
    padding: 2px 0 2px 16px;
    color: var(--text-dim);
    border-left: 3px solid var(--border-strong);
}
.md :not(pre) > code {
    padding: 0.130em 0.400em;
    font-size: 0.860em;
    color: var(--code-text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow-wrap: anywhere;
}

.lesson > .md {
    margin-bottom: 1.050em;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.md table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    line-height: 1.5;
}
.md th,
.md td {
    padding: 9px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.md th {
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--surface-2);
    white-space: nowrap;
}
.md tr:last-child td {
    border-bottom: 0;
}
.md td:first-child code {
    white-space: nowrap;
}

/* Codeblöcke */

.codeblock {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.code-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 6px 0 13px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
.code-lang {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.codeblock.lang-bash .code-lang {
    color: var(--accent);
}
.code-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 550;
    color: var(--text-dim);
    background: transparent;
    border: 0;
    border-radius: 5px;
}
.code-btn:hover {
    color: var(--text);
    background: var(--surface-3);
}
.code-btn.run {
    color: var(--accent);
}
.code-btn.run:hover {
    color: var(--accent-ink);
    background: var(--accent);
}
.codeblock pre {
    margin: 0;
    padding: 13px 15px;
    overflow-x: auto;
    font-size: 13.800px;
    line-height: 1.6;
    color: var(--code-text);
    tab-size: 4;
}
.codeblock.lang-text pre,
.codeblock.lang-console pre {
    color: color-mix(in srgb, var(--code-text) 82%, transparent);
}

.hljs-comment,
.hljs-quote {
    color: var(--hl-comment);
    font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section {
    color: var(--hl-keyword);
}
.hljs-string,
.hljs-regexp,
.hljs-addition {
    color: var(--hl-string);
}
.hljs-number,
.hljs-attr,
.hljs-attribute {
    color: var(--hl-number);
}
.hljs-built_in,
.hljs-title,
.hljs-name,
.hljs-type {
    color: var(--hl-builtin);
}
.hljs-variable,
.hljs-template-variable,
.hljs-subst,
.hljs-params {
    color: var(--hl-variable);
}
.hljs-meta,
.hljs-meta .hljs-keyword {
    color: var(--hl-meta);
    font-weight: 600;
}
.hljs-deletion {
    color: var(--red);
}

/* Hinweis-Kästen */

.callout {
    --c: var(--blue);
    --c-soft: var(--blue-soft);
    margin: 1.500em 0;
    padding: 14px 18px 15px;
    background: var(--c-soft);
    border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
    border-left: 3px solid var(--c);
    border-radius: var(--radius-sm);
}
.callout.tip {
    --c: var(--accent);
    --c-soft: var(--accent-soft);
}
.callout.warn {
    --c: var(--red);
    --c-soft: var(--red-soft);
}
.callout.know {
    --c: var(--violet);
    --c-soft: var(--violet-soft);
}
.callout-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--c);
}
.callout .md {
    font-size: 15.5px;
    line-height: 1.65;
}
.callout .codeblock {
    background: var(--code-bg);
}

/* Aufgaben */

.task,
.quiz {
    position: relative;
    margin: 2em 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.task::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--amber);
    transition: background 0.3s;
}
.task.done::before {
    background: var(--accent);
}
.task-head,
.quiz-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px 0 22px;
}
.task-badge,
.quiz-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--amber);
    background: var(--amber-soft);
    border-radius: 99px;
    white-space: nowrap;
}
.task.done .task-badge {
    color: var(--accent);
    background: var(--accent-soft);
}
.quiz-badge {
    color: var(--violet);
    background: var(--violet-soft);
}
.task-head h3 {
    flex: 1;
    font-size: 16.5px;
    font-weight: 650;
    line-height: 1.3;
}
.xp-chip {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--amber);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.quiz-head .xp-chip {
    margin-left: auto;
}
.task-check {
    display: none;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--accent-ink);
    background: var(--accent);
    border-radius: 50%;
    animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.task.done .task-check {
    display: grid;
}
.task.done .xp-chip {
    display: none;
}
@keyframes pop {
    from {
        transform: scale(0);
    }
}
.task-body {
    padding: 12px 20px 4px 22px;
}
.task-body .md,
.quiz-question .md {
    font-size: 15.5px;
    line-height: 1.65;
}
.task-input {
    width: 100%;
    max-width: 420px;
    height: 40px;
    margin-top: 12px;
    padding: 0 13px;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--text);
    background: var(--code-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}
.task-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.task-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 14px 20px 16px 22px;
}
.task-feedback {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 20px 16px 22px;
    padding: 10px 13px;
    font-size: 14.5px;
    line-height: 1.5;
    border-radius: var(--radius-sm);
    animation: slide-in 0.25s ease-out;
}
.task-feedback .icon {
    margin-top: 2px;
}
.task-feedback.ok {
    color: var(--accent);
    background: var(--accent-soft);
}
.task-feedback.fail {
    color: var(--red);
    background: var(--red-soft);
}
.task-feedback span {
    color: var(--text);
}
@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}
.task-extra {
    padding: 14px 20px 16px 22px;
    border-top: 1px dashed var(--border-strong);
    background: var(--surface-2);
    animation: slide-in 0.25s ease-out;
}
.task-extra-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.task-extra .md {
    font-size: 15px;
    line-height: 1.6;
}

/* Quiz */

.quiz-question {
    padding: 12px 20px 2px 22px;
    font-weight: 550;
}
.quiz-options {
    display: grid;
    gap: 8px;
    padding: 12px 20px 18px 22px;
}
.quiz-opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px 10px 10px;
    font-size: 15px;
    line-height: 1.5;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.quiz-opt:not(:disabled):hover {
    border-color: var(--violet);
    background: var(--violet-soft);
}
.quiz-opt:not(:disabled):active {
    transform: scale(0.995);
}
.quiz-opt:disabled {
    cursor: default;
    color: var(--text-dim);
}
.quiz-key {
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--surface-3);
    border-radius: 6px;
}
.quiz-text code {
    font-size: 0.880em;
    padding: 0.100em 0.350em;
    background: var(--surface-3);
    border-radius: 4px;
}
.quiz-opt.correct {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.quiz-opt.correct .quiz-key {
    color: var(--accent-ink);
    background: var(--accent);
}
.quiz-opt.wrong {
    border-color: var(--red);
    background: var(--red-soft);
}
.quiz-opt.wrong .quiz-key {
    color: #fff;
    background: var(--red);
}
.quiz-explain {
    padding: 14px 20px 16px 22px;
    border-top: 1px dashed var(--border-strong);
    background: var(--surface-2);
}
.quiz-explain .md {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dim);
}

/* Lektions-Abschluss */

.lesson-foot {
    display: grid;
    gap: 16px;
    margin-top: 56px;
}
.finish {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding: 22px 24px;
    background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
}
.finish-text {
    flex: 1 1 260px;
}
.finish h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}
.finish p {
    font-size: 14.5px;
    color: var(--text-dim);
}
.lesson-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.nav-card {
    display: grid;
    gap: 3px;
    padding: 14px 18px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, transform 0.15s;
}
.nav-card:hover {
    text-decoration: none;
    border-color: var(--accent-line);
    transform: translateY(-1px);
}
.nav-card.next {
    text-align: right;
}
.nav-card.highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav-dir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.nav-card.next .nav-dir {
    justify-content: flex-end;
    color: var(--accent);
}
.nav-title {
    font-weight: 600;
}

/* ---------------------------------------------------------------- Übersicht */

.dashboard {
    max-width: 1120px;
    display: grid;
    gap: 44px;
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.250fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
    padding: 44px 48px;
    background:
        radial-gradient(700px 320px at 0% 0%, var(--accent-soft), transparent 65%),
        radial-gradient(500px 300px at 100% 100%, var(--blue-soft), transparent 60%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
}
.hero-text {
    display: grid;
    justify-items: start;
    gap: 16px;
}
.hero h1 {
    font-size: clamp(30px, 3.600vw, 46px);
    font-weight: 780;
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}
.hero h1 em {
    font-style: normal;
    color: var(--accent);
}
.hero p {
    max-width: 54ch;
    font-size: 16.5px;
    color: var(--text-dim);
    line-height: 1.6;
    text-wrap: pretty;
}
.hero .btn.big {
    margin-top: 8px;
}
.btn-sub {
    padding-left: 12px;
    font-weight: 450;
    opacity: 0.8;
    border-left: 1px solid color-mix(in srgb, currentColor 35%, transparent);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hero-art {
    margin: 0;
    padding: 20px 22px;
    font-size: 13.500px;
    line-height: 1.75;
    color: #c9d3de;
    background: #0a0e14;
    border: 1px solid #1f2a38;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    transform: rotate(1.500deg);
    overflow: hidden;
}
.hero-art .p {
    color: #3ddc97;
    font-weight: 600;
}
.hero-art .b {
    color: #5cb3ff;
    font-weight: 600;
}
.hero-art .cursor {
    color: #3ddc97;
    animation: blink 1.100s steps(1) infinite;
}

.stats {
    display: grid;
    grid-template-columns: minmax(280px, 1.500fr) repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.stat {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stat-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    color: var(--blue);
    background: var(--blue-soft);
    border-radius: 11px;
}
.stat.tasks .stat-icon {
    color: var(--amber);
    background: var(--amber-soft);
}
.stat.streak .stat-icon {
    color: #ff8a4c;
    background: rgba(255, 138, 76, 0.12);
}
.stat-main {
    min-width: 0;
}
.stat-value {
    font-size: 26px;
    font-weight: 720;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-value small {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-faint);
    letter-spacing: 0;
}
.stat-label {
    font-size: 13px;
    color: var(--text-dim);
}
.stat.level .stat-value {
    font-size: 20px;
}
.stat.level .stat-label {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent);
}
.stat-sub {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text-faint);
}
.level-ring {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
}
.level-ring > span {
    position: absolute;
    font-size: 26px;
    line-height: 1;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 16px;
}
.section-head h2 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.015em;
}
.section-head span {
    font-size: 13.5px;
    color: var(--text-faint);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.module-card {
    position: relative;
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    gap: 8px;
    padding: 18px 20px 16px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.module-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    border-color: var(--accent-line);
    box-shadow: var(--shadow);
}
.module-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.module-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    font-size: 20px;
    background: var(--surface-2);
    border-radius: 10px;
}
.module-num {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.module-done {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 2px 9px 2px 6px;
    font-size: 11.5px;
    font-weight: 650;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 99px;
}
.module-card h3 {
    font-size: 16.5px;
    font-weight: 680;
    line-height: 1.3;
}
.module-card p {
    font-size: 13.5px;
    color: var(--text-dim);
    line-height: 1.5;
}
.module-meta {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--text-faint);
}
.module-card .bar {
    margin-right: 44px;
}
.module-progress {
    position: absolute;
    right: 20px;
    bottom: 11px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
}

.dash-row {
    display: grid;
    grid-template-columns: minmax(0, 1.400fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.tipcard,
.activity {
    padding: 18px 22px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.tipcard {
    background: linear-gradient(140deg, var(--violet-soft), transparent 60%), var(--surface);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--violet);
}
.activity .card-kicker {
    color: var(--amber);
}
.tipcard-body h3 {
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 680;
}
.tipcard-body .md {
    font-size: 15px;
    line-height: 1.62;
    color: var(--text-dim);
}
.heat {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
}
.heat i {
    aspect-ratio: 1;
    max-height: 18px;
    background: var(--surface-3);
    border-radius: 3px;
}
.heat i[data-l="1"] {
    background: color-mix(in srgb, var(--accent) 30%, var(--surface-3));
}
.heat i[data-l="2"] {
    background: color-mix(in srgb, var(--accent) 55%, var(--surface-3));
}
.heat i[data-l="3"] {
    background: color-mix(in srgb, var(--accent) 78%, var(--surface-3));
}
.heat i[data-l="4"] {
    background: var(--accent);
}
.activity-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--text-faint);
}

.ladder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.rung {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 14px 10px 12px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    opacity: 0.5;
}
.rung.past {
    opacity: 0.85;
}
.rung.current {
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.rung-icon {
    font-size: 24px;
    line-height: 1.2;
    filter: grayscale(1);
}
.rung.past .rung-icon,
.rung.current .rung-icon {
    filter: none;
}
.rung-name {
    font-size: 13px;
    font-weight: 620;
}
.rung-xp {
    font-size: 11.5px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Spickzettel & Sandbox */

.page-head {
    display: grid;
    gap: 10px;
    margin-bottom: 26px;
}
.page-head p {
    max-width: 68ch;
    font-size: 16px;
    color: var(--text-dim);
    line-height: 1.6;
}
.cheat {
    max-width: 1120px;
}
.cheat-tools {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    margin-bottom: 8px;
    background: var(--bg);
    box-shadow: 0 8px 12px -12px rgba(0, 0, 0, 0.5);
}
.cheat-search-wrap {
    position: relative;
    flex: 1;
    max-width: 560px;
}
.cheat-search-wrap .icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none;
}
.cheat-search {
    width: 100%;
    height: 42px;
    padding: 0 14px 0 40px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
}
.cheat-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.cheat-grid {
    columns: 2 420px;
    column-gap: 14px;
}
.cheat-card {
    break-inside: avoid;
    margin-bottom: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.cheat-card h3 {
    padding: 13px 18px;
    font-size: 15px;
    font-weight: 680;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.cheat-row {
    display: grid;
    grid-template-columns: minmax(0, 46%) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 5px 8px 5px 12px;
    border-bottom: 1px solid var(--border);
}
.cheat-row:last-child {
    border-bottom: 0;
}
.cheat-row:hover {
    background: var(--surface-2);
}
.cheat-cmd {
    padding: 5px 7px;
    font-family: var(--mono);
    font-size: 13px;
    text-align: left;
    color: var(--accent);
    background: transparent;
    border: 0;
    border-radius: 5px;
    overflow-wrap: anywhere;
}
.cheat-cmd:hover {
    background: var(--accent-soft);
}
.cheat-desc {
    font-size: 13.5px;
    color: var(--text-dim);
    line-height: 1.4;
}
.cheat-run {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--text-faint);
    background: transparent;
    border: 0;
    border-radius: 6px;
    opacity: 0;
}
.cheat-row:hover .cheat-run,
.cheat-run:focus-visible {
    opacity: 1;
}
.cheat-run:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.empty {
    padding: 40px 0;
    color: var(--text-dim);
    text-align: center;
}

.sandbox-info {
    display: grid;
    gap: 18px;
}
.sandbox-info .page-head {
    margin-bottom: 0;
}
.sandbox-info .page-head h1 {
    font-size: 28px;
}
.sandbox-info .page-head p {
    font-size: 14.5px;
}
.sandbox-info h3 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.sandbox-facts {
    display: grid;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.sandbox-facts > div {
    display: grid;
    gap: 2px;
    padding: 10px 14px;
    font-size: 13.5px;
    background: var(--surface);
}
.sandbox-facts b {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.sandbox-facts code {
    font-size: 0.900em;
    color: var(--accent);
}
.sandbox-ideas {
    display: grid;
    gap: 8px;
}
.idea {
    display: grid;
    gap: 2px;
    padding: 10px 14px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}
.idea:hover {
    border-color: var(--accent-line);
}
.idea span {
    font-size: 13.5px;
    font-weight: 600;
}
.idea code {
    font-size: 12.5px;
    color: var(--accent);
}
.workspace.sandbox #view {
    padding: 28px 24px 40px;
}

/* ---------------------------------------------------------------- Dialoge */

dialog {
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
    max-width: none;
    max-height: none;
}
dialog::backdrop {
    background: rgba(4, 8, 14, 0.62);
    backdrop-filter: blur(3px);
}

.palette {
    width: min(640px, calc(100vw - 32px));
    margin-top: 12vh;
}
.palette-box,
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-faint);
}
.palette-input-wrap input {
    flex: 1;
    height: 54px;
    font: inherit;
    font-size: 16.5px;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: none;
}
.palette-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: min(52vh, 440px);
    overflow-y: auto;
}
.palette-item {
    display: grid;
    grid-template-columns: 70px minmax(0, auto) minmax(0, 1fr);
    align-items: baseline;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.palette-item.sel {
    background: var(--accent-soft);
}
.palette-kind {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.palette-item.sel .palette-kind {
    color: var(--accent);
}
.palette-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.palette-title.mono {
    font-family: var(--mono);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--accent);
}
.palette-sub {
    font-size: 13px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.palette-empty {
    padding: 28px;
    text-align: center;
    color: var(--text-faint);
}
.palette-foot {
    display: flex;
    gap: 18px;
    padding: 9px 16px;
    font-size: 12px;
    color: var(--text-faint);
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.palette-foot kbd {
    margin-right: 4px;
}

.modal {
    width: min(540px, calc(100vw - 32px));
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 16px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-head h2 {
    font-size: 18px;
    font-weight: 700;
}
.modal-body {
    display: grid;
    gap: 24px;
    padding: 22px 24px 26px;
}
.set-group {
    display: grid;
    gap: 10px;
}
.set-group h3 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.set-row {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14.5px;
}
.set-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}
.set-row output {
    width: 46px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
}
.set-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Toasts */

.toasts {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 100;
    display: grid;
    justify-items: center;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 16px 10px 13px;
    font-size: 14px;
    font-weight: 550;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 99px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transition: opacity 0.25s, transform 0.25s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.toast.show {
    opacity: 1;
    transform: none;
}
.toast.xp {
    color: var(--amber);
    border-color: color-mix(in srgb, var(--amber) 45%, transparent);
    font-weight: 700;
}
.toast.success .icon {
    color: var(--accent);
}
.toast.warn .icon {
    color: var(--red);
}
.toast.level {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: transparent;
    font-weight: 650;
}

.confetti {
    position: fixed;
    z-index: 101;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    pointer-events: none;
    animation: confetti 0.75s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes confetti {
    to {
        transform: translate(var(--dx), var(--dy)) rotate(260deg) scale(0.4);
        opacity: 0;
    }
}

/* ---------------------------------------------------------------- Training */

.train-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    color: var(--accent-ink);
    background: var(--accent);
    border-radius: 99px;
    font-variant-numeric: tabular-nums;
}

.training {
    display: grid;
    gap: 28px;
    max-width: 1000px;
    margin: 0 auto;
}

.train-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    align-items: center;
    padding: 30px 32px;
    background:
        radial-gradient(500px 260px at 0% 0%, var(--accent-soft), transparent 70%),
        radial-gradient(400px 240px at 100% 100%, var(--violet-soft), transparent 70%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.train-hero.empty {
    grid-template-columns: auto minmax(0, 1fr) auto;
}
.train-hero.empty h2 {
    font-size: 19px;
    margin-bottom: 6px;
}
.train-hero.empty p {
    color: var(--text-dim);
}
.train-hero-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 16px;
}
.train-start h2 {
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.train-start p {
    color: var(--text-dim);
    margin-bottom: 20px;
    max-width: 52ch;
}
.train-start.idle p {
    margin-bottom: 0;
}
.train-start .btn .btn-sub {
    font-weight: 500;
    opacity: 0.75;
    font-size: 13px;
}
.train-counts {
    display: grid;
    grid-auto-flow: column;
    gap: 10px;
}
.train-count {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 92px;
    padding: 14px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.train-count b {
    font-size: 28px;
    font-weight: 750;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.train-count span {
    font-size: 12px;
    color: var(--text-dim);
}
.train-count.due b {
    color: var(--amber);
}
.train-count.new b {
    color: var(--blue);
}
.train-count.mastered b {
    color: var(--accent);
}

.train-free {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.train-free > div {
    flex: 1;
}
.train-free h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15.5px;
    margin-bottom: 3px;
}
.train-free h3 .icon {
    color: var(--violet);
}

.train-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}
.train-mod {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 4px 12px;
    padding: 12px 14px 14px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, background 0.15s;
}
.train-mod:hover:not(:disabled) {
    border-color: var(--border-strong);
}
.train-mod.on {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent-line);
}
.train-mod.locked {
    opacity: 0.5;
    cursor: default;
}
.train-mod-icon {
    font-size: 22px;
}
.train-mod-name {
    display: grid;
    min-width: 0;
    line-height: 1.3;
}
.train-mod-name b {
    font-size: 13.5px;
    font-weight: 620;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.train-mod-name small {
    font-size: 12px;
    color: var(--text-dim);
}
.train-mod-bar {
    grid-column: 1 / -1;
    height: 4px;
    margin-top: 6px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
}
.train-mod-bar i {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
}

.train-stats {
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.train-stats .card-head {
    margin-bottom: 14px;
}
.boxes {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.box {
    display: grid;
    justify-items: center;
    gap: 2px;
    text-align: center;
}
.box-bar {
    display: flex;
    align-items: flex-end;
    width: 100%;
    max-width: 64px;
    height: 84px;
    margin-bottom: 6px;
    background: var(--surface-2);
    border-radius: 8px;
    overflow: hidden;
}
.box-bar i {
    display: block;
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: var(--text-faint);
    transition: height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.box.b1 .box-bar i { background: var(--red); }
.box.b2 .box-bar i { background: var(--amber); }
.box.b3 .box-bar i { background: var(--blue); }
.box.b4 .box-bar i { background: var(--violet); }
.box.b5 .box-bar i { background: var(--accent); }
.box b {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}
.box span {
    font-size: 12px;
    font-weight: 550;
    color: var(--text-dim);
}
.box small {
    font-size: 11px;
    color: var(--text-faint);
}
.small {
    font-size: 12.5px;
}

.train-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}
.train-setting {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-dim);
}
select {
    height: 34px;
    padding: 0 30px 0 10px;
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238391a0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    appearance: none;
}

.train-how h2 {
    font-size: 17px;
    margin-bottom: 12px;
}
.how-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.how-grid > div {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.how-grid b {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 13.5px;
}
.how-grid p {
    font-size: 13.5px;
    color: var(--text-dim);
}

/* --- Eine Runde --- */

.session {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}
.session-head {
    display: flex;
    align-items: center;
    gap: 14px;
}
.session-bar {
    flex: 1;
    height: 8px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
}
.session-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: 99px;
    transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.session-pos {
    min-width: 54px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.flash {
    display: grid;
    gap: 18px;
    padding: 26px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    animation: flash-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes flash-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.99);
    }
}
.flash.right {
    border-color: var(--accent-line);
}
.flash.wrong {
    border-color: color-mix(in srgb, var(--red) 40%, transparent);
}
.flash-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 12px;
    color: var(--text-faint);
}
.flash-kind {
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--violet);
}
.flash-src {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.flash-tag {
    padding: 1px 8px;
    font-weight: 650;
    color: var(--text-dim);
    background: var(--surface-3);
    border-radius: 99px;
}
.flash-tag.new {
    color: var(--blue);
    background: var(--blue-soft);
}
.flash-q .md {
    font-size: 18px;
    font-weight: 550;
    line-height: 1.5;
}
.flash-q .md p + p {
    margin-top: 8px;
}
.flash-q .md code {
    font-size: 0.88em;
}
.flash-code {
    margin: 14px 0 0;
    padding: 14px 16px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--code-text);
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}
.flash-code .gap {
    padding: 0 6px;
    color: var(--amber);
    background: var(--amber-soft);
    border-radius: 4px;
}

.opts {
    display: grid;
    gap: 10px;
}
.opts.tf {
    grid-template-columns: 1fr 1fr;
}
.opt {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 11px 14px;
    text-align: left;
    font-size: 15px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.opt:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface-3);
}
.opt:active:not(:disabled) {
    transform: scale(0.99);
}
.opt:disabled {
    cursor: default;
}
.opts.tf .opt {
    justify-content: center;
    min-height: 64px;
    font-size: 16px;
    font-weight: 650;
}
.opt-key {
    display: grid;
    place-items: center;
    flex: none;
    width: 26px;
    height: 26px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
}
.opt-box {
    display: grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    color: transparent;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    transition: background 0.12s, border-color 0.12s;
}
.opt.on {
    border-color: var(--blue);
    background: var(--blue-soft);
}
.opt.on .opt-box {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}
.opt-text code {
    font-size: 0.9em;
    padding: 1px 5px;
    background: var(--code-bg);
    border-radius: 4px;
}
.opt.correct {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.opt.correct .opt-key,
.opt.correct .opt-box {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: var(--accent);
}
.opt.wrong {
    border-color: var(--red);
    background: var(--red-soft);
}
.opt.wrong .opt-key,
.opt.wrong .opt-box {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}
.opt.missed {
    border-color: var(--accent);
    border-style: dashed;
}
.opts.done .opt:not(.correct):not(.wrong):not(.missed) {
    opacity: 0.55;
}
.opts-hint {
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-dim);
}

.flash-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    font: inherit;
    font-size: 17px;
    color: var(--text);
    background: var(--surface-2);
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.flash-input.mono {
    font-family: var(--mono);
    font-size: 16px;
}
.flash-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.flash-input.correct,
.flash-input.correct:focus {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: none;
}
.flash-input.wrong,
.flash-input.wrong:focus {
    border-color: var(--red);
    background: var(--red-soft);
    box-shadow: none;
}
.flash-input:disabled {
    opacity: 1;
    color: var(--text);
}

.order {
    display: grid;
    gap: 16px;
}
.order-slots {
    display: grid;
    gap: 8px;
    min-height: 56px;
    margin: 0;
    padding: 12px;
    list-style: none;
    background: var(--surface-2);
    border: 1.5px dashed var(--border-strong);
    border-radius: 12px;
}
.slot-empty {
    padding: 8px 4px;
    font-size: 13.5px;
    color: var(--text-faint);
}
.order-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.order .chip {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: auto;
    min-height: 44px;
    padding: 9px 14px;
    font-size: 14.5px;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    transition: border-color 0.12s, transform 0.08s;
}
.order .chip:hover:not(:disabled) {
    border-color: var(--accent);
}
.order .chip:active:not(:disabled) {
    transform: scale(0.98);
}
.order .chip.placed {
    width: 100%;
}
.order .chip code {
    font-size: 0.92em;
}
.chip-no {
    display: grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--accent-ink);
    background: var(--accent);
    border-radius: 6px;
}
.order .chip.correct {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.order .chip.wrong {
    border-color: var(--red);
    background: var(--red-soft);
}
.order .chip.wrong .chip-no {
    background: var(--red);
    color: #fff;
}

.match {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.match-col {
    display: grid;
    align-content: start;
    gap: 8px;
}
.match-item {
    min-height: 50px;
    padding: 10px 12px;
    font-size: 14px;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.12s, background 0.12s, opacity 0.2s;
}
.match-item:hover:not(:disabled) {
    border-color: var(--border-strong);
}
.match-item code {
    font-size: 0.92em;
}
.match-item.sel {
    border-color: var(--blue);
    background: var(--blue-soft);
    box-shadow: 0 0 0 1px var(--blue);
}
.match-item.paired {
    cursor: default;
    border-color: var(--accent-line);
    background: var(--accent-soft);
    opacity: 0.75;
}
.match-item.paired[data-pair="1"] { border-color: var(--accent); }
.match-item.paired[data-pair="2"] { border-color: var(--blue); background: var(--blue-soft); }
.match-item.paired[data-pair="3"] { border-color: var(--violet); background: var(--violet-soft); }
.match-item.paired[data-pair="4"] { border-color: var(--amber); background: var(--amber-soft); }
.match-item.paired[data-pair="5"] { border-color: #ff8a4c; }
.shake {
    animation: shake 0.35s;
    border-color: var(--red) !important;
}
@keyframes shake {
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.flash-feedback {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 12px;
    animation: flash-in 0.25s ease-out;
}
.flash-feedback.ok {
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
}
.flash-feedback.fail {
    background: var(--red-soft);
    border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
}
.fb-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.fb-head > span:first-child {
    display: grid;
}
.flash-feedback.ok .fb-head {
    color: var(--accent);
}
.flash-feedback.fail .fb-head {
    color: var(--red);
}
.fb-head b {
    font-size: 16px;
}
.fb-box {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
}
.fb-solution {
    font-size: 14.5px;
}
.fb-solution code {
    padding: 2px 7px;
    background: var(--code-bg);
    border-radius: 5px;
}
.fb-order {
    margin: 6px 0 0;
    padding-left: 22px;
}
.fb-explain .md {
    font-size: 14.5px;
    color: var(--text-dim);
}

.flash-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.flash-foot:empty {
    display: none;
}

.session-end {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 40px 28px;
    text-align: center;
    background:
        radial-gradient(500px 260px at 50% 0%, var(--accent-soft), transparent 70%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.end-icon {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    color: var(--amber);
    background: var(--amber-soft);
    border-radius: 50%;
}
.session-end h1 {
    font-size: 28px;
    letter-spacing: -0.02em;
}
.session-end > p {
    max-width: 46ch;
    color: var(--text-dim);
}
.end-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 520px;
    margin-top: 6px;
}
.end-stats div {
    display: grid;
    gap: 2px;
    padding: 12px 6px;
    background: var(--surface-2);
    border-radius: 12px;
}
.end-stats b {
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}
.end-stats span {
    font-size: 12px;
    color: var(--text-dim);
}
.end-level {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    text-align: left;
    background: var(--surface-2);
    border-radius: 12px;
}
.end-level > div {
    flex: 1;
    display: grid;
    gap: 6px;
}
.end-level small {
    font-size: 12px;
    color: var(--text-dim);
}
.end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

/* --- Übersicht: Training & XP --- */

.train-teaser {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, transform 0.15s;
}
.train-teaser:hover {
    text-decoration: none;
    border-color: var(--border-strong);
}
.train-teaser.waiting {
    background: radial-gradient(420px 200px at 0% 50%, var(--violet-soft), transparent 70%), var(--surface);
    border-color: color-mix(in srgb, var(--violet) 35%, var(--border));
}
.train-teaser-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 52px;
    height: 52px;
    color: var(--violet);
    background: var(--violet-soft);
    border-radius: 14px;
}
.train-teaser-text {
    flex: 1;
    display: grid;
    gap: 2px;
}
.train-teaser-text b {
    font-size: 15.5px;
}
.train-teaser-text span {
    font-size: 13.5px;
    color: var(--text-dim);
}

.xp-breakdown {
    margin-top: 16px;
}
.xp-stack {
    display: flex;
    height: 10px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
}
.xp-stack i {
    display: block;
    height: 100%;
}
.xp-stack .tasks { background: var(--accent); }
.xp-stack .quizzes { background: var(--blue); }
.xp-stack .lessons { background: var(--amber); }
.xp-stack .cards { background: var(--violet); }
.xp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--text-dim);
}
.xp-legend span::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 3px;
    vertical-align: 0;
}
.xp-legend .tasks::before { background: var(--accent); }
.xp-legend .quizzes::before { background: var(--blue); }
.xp-legend .lessons::before { background: var(--amber); }
.xp-legend .cards::before { background: var(--violet); }
.xp-legend .max {
    margin-left: auto;
}
.xp-legend .max::before {
    display: none;
}
.xp-rules {
    margin-top: 10px;
    max-width: 90ch;
    line-height: 1.55;
}

/* --- Einstellungen: Sync & Handy --- */

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 550;
}
.sync-status.ok {
    color: var(--accent);
}
.sync-status.local {
    color: var(--amber);
}
.lan-box {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.lan-box p {
    font-size: 13.5px;
    margin-bottom: 8px;
}
.qr {
    flex: none;
    width: 132px;
    height: 132px;
    padding: 6px;
    background: #fff;
    border-radius: 10px;
}
.qr svg {
    display: block;
    width: 100%;
    height: 100%;
}
.lan-url {
    display: inline-block;
    margin: 0 6px 8px 0;
    padding: 4px 8px;
    font-size: 13px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    user-select: all;
}

/* --- Handy-Navigation & Zusatztasten (Standard: ausgeblendet) --- */

.tabbar,
.term-keys,
.only-touch {
    display: none;
}
.term-key {
    flex: none;
    min-width: 42px;
    height: 36px;
    padding: 0 10px;
    font-family: var(--mono);
    font-size: 13.5px;
    color: #d5dee8;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    touch-action: manipulation;
}
.term-key:active,
.term-key.on {
    color: #04150d;
    background: #3ddc97;
    border-color: #3ddc97;
}

@media (pointer: coarse) {
    .term-keys {
        display: flex;
        gap: 6px;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
        overflow-x: auto;
        background: var(--term-chrome);
        border-top: 1px solid var(--term-border);
        flex: none;
        scrollbar-width: none;
    }
    .only-touch {
        display: block;
    }
}

/* ---------------------------------------------------------------- Responsiv */

@media (max-width: 1280px) {
    .searchbtn {
        width: 44px;
        padding: 0;
        justify-content: center;
    }
    .searchbtn span,
    .searchbtn kbd {
        display: none;
    }
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .hero {
        grid-template-columns: 1fr;
        padding: 36px 32px;
    }
    .hero-art {
        display: none;
    }
}

@media (max-width: 1000px) {
    /* Terminal wandert auf kleinen Bildschirmen immer nach unten */
    .workspace:not(.term-hidden):not(.term-max),
    .workspace.sandbox:not(.term-max):not(.term-hidden)[data-layout="right"] {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) 9px var(--term-h);
    }
    .splitter {
        cursor: row-resize;
        border-left: 0;
        border-top: 1px solid var(--border);
    }
    .splitter::after {
        width: 36px;
        height: 3px;
    }
    .term-btn[data-act="layout"] {
        display: none;
    }
    .dash-row {
        grid-template-columns: 1fr;
    }
    #view {
        padding: 28px 24px 64px;
    }
}

@media (max-width: 860px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
    }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        width: min(var(--sidebar-w), 86vw);
        transform: translateX(-102%);
        transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar {
        transform: none;
    }
    body.nav-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 49;
        background: rgba(4, 8, 14, 0.55);
    }
    .only-mobile {
        display: inline-grid;
    }
    .topbar {
        padding: 0 10px;
    }
    .chip.streak,
    .term-toggle span {
        display: none;
    }
    .stats {
        grid-template-columns: 1fr;
    }
    .lesson-nav {
        grid-template-columns: 1fr;
    }
    .md {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------------------------------------------------------------- Handy */

@media (max-width: 760px) {
    :root {
        --tabbar-h: calc(60px + env(safe-area-inset-bottom, 0px));
        --topbar-h: 52px;
    }
    body {
        font-size: 15.5px;
    }
    .main {
        padding-bottom: var(--tabbar-h);
    }
    #view {
        padding: 20px 16px 40px;
    }

    /* Untere Navigation */
    .tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 46;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        height: var(--tabbar-h);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: color-mix(in srgb, var(--bg-side) 94%, transparent);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
    }
    .tabbar a {
        position: relative;
        display: grid;
        justify-items: center;
        align-content: center;
        gap: 3px;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-faint);
        -webkit-tap-highlight-color: transparent;
    }
    .tabbar a:hover {
        text-decoration: none;
    }
    .tabbar a.active {
        color: var(--accent);
    }
    .tabbar a.active::before {
        content: "";
        position: absolute;
        top: 0;
        width: 28px;
        height: 3px;
        background: var(--accent);
        border-radius: 0 0 3px 3px;
    }
    body.nav-open #tab-course {
        color: var(--accent);
    }
    .tabbar .train-badge {
        position: absolute;
        top: 5px;
        left: calc(50% + 6px);
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        font-size: 10.5px;
        line-height: 18px;
        margin: 0;
    }
    body.term-open #tab-term {
        color: var(--accent);
    }

    /* Kopfzeile */
    .topbar {
        gap: 4px;
        padding: 0 8px;
    }
    .crumbs {
        font-size: 13px;
    }
    .crumbs > a,
    .crumbs > .sep,
    .crumbs > span:not(.sep) {
        display: none;
    }
    .term-toggle {
        display: none;
    }
    .chip {
        padding: 0 6px;
    }
    .chip.xp span {
        display: none;
    }
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Terminal als Vollbild über dem Inhalt */
    .workspace:not(.term-hidden):not(.term-max),
    .workspace.sandbox:not(.term-max):not(.term-hidden)[data-layout="right"],
    .workspace.sandbox:not(.term-max):not(.term-hidden)[data-layout="bottom"] {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
    }
    .workspace .splitter {
        display: none !important;
    }
    .workspace:not(.term-hidden) .termpane {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: var(--tabbar-h);
        z-index: 45;
        padding-top: env(safe-area-inset-top, 0px);
    }
    .workspace.term-max .content {
        display: block;
    }
    .term-btn[data-act="layout"],
    .term-btn[data-act="max"],
    .term-dots {
        display: none;
    }
    .term-screen {
        inset: 6px 2px 4px 8px;
    }

    /* Übersicht */
    .hero {
        padding: 26px 20px;
        border-radius: 16px;
    }
    .hero h1 {
        font-size: 27px;
    }
    .hero .btn.big {
        width: 100%;
        height: auto;
        min-height: 54px;
        padding: 10px 16px;
    }
    .hero .btn.big .btn-sub {
        flex: 1;
        min-width: 0;
        max-width: none;
        white-space: nowrap;
    }
    .page-head p {
        font-size: 15.5px;
    }
    .lesson-head .eyebrow {
        flex-wrap: wrap;
        font-size: 11.5px;
    }
    .lesson-head .eyebrow > span {
        white-space: nowrap;
    }
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .stat.level {
        grid-column: 1 / -1;
    }
    .module-grid {
        grid-template-columns: 1fr;
    }
    .train-teaser {
        flex-wrap: wrap;
        padding: 16px;
    }
    .train-teaser .btn {
        width: 100%;
    }
    .xp-legend .max {
        margin-left: 0;
        width: 100%;
    }

    /* Lektion */
    .lesson-head h1 {
        font-size: 26px;
    }
    .task,
    .quiz {
        margin-left: -6px;
        margin-right: -6px;
        padding: 18px 16px;
    }
    .task-actions {
        flex-wrap: wrap;
    }
    .task-actions .btn.primary {
        flex: 1 1 100%;
        height: 44px;
    }
    .finish {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    .finish .btn {
        width: 100%;
    }
    .codeblock pre {
        font-size: 13px;
    }

    /* Training */
    .training {
        gap: 22px;
    }
    .train-hero,
    .train-hero.empty {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 22px 18px;
    }
    .train-start h2 {
        font-size: 21px;
    }
    .train-start .btn.big {
        width: 100%;
    }
    .train-counts {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .train-count {
        min-width: 0;
        padding: 10px 6px;
    }
    .train-count b {
        font-size: 24px;
    }
    .train-free {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }
    .train-modules {
        grid-template-columns: 1fr;
    }
    .boxes {
        gap: 6px;
    }
    .box-bar {
        height: 64px;
    }
    .box span {
        font-size: 10.5px;
    }
    .how-grid {
        grid-template-columns: 1fr;
    }

    /* Eine Runde: Fokus, große Tasten, Aktion unten */
    body.training-run .tabbar {
        display: none;
    }
    body.training-run .main {
        padding-bottom: 0;
    }
    body.training-run .topbar {
        display: none;
    }
    body.training-run #view {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        padding-bottom: 0;
    }
    .session {
        gap: 14px;
        min-height: calc(100dvh - 12px);
    }
    .session-stage {
        flex: 1;
    }
    .flash {
        gap: 16px;
        padding: 20px 16px;
        border-radius: 16px;
    }
    .flash-q .md {
        font-size: 17px;
    }
    .opt {
        min-height: 54px;
        font-size: 15px;
    }
    .match {
        gap: 8px;
    }
    .match-item {
        font-size: 13.5px;
        padding: 10px;
    }
    .flash-foot {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin: 0 -16px;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to bottom, transparent, var(--bg) 26%);
    }
    .flash-foot .btn {
        flex: 1;
        height: 50px;
    }
    .flash-foot .btn.ghost {
        flex: 0 0 auto;
    }
    .fb-box {
        margin-left: 0;
        width: 100%;
    }
    .session-end {
        padding: 30px 18px;
    }
    .end-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .end-actions .btn {
        width: 100%;
    }

    /* Dialoge und Meldungen */
    .modal-box,
    .palette-box {
        width: calc(100vw - 20px) !important;
        max-height: calc(100dvh - 40px);
    }
    .lan-box {
        flex-direction: column;
    }
    .toasts {
        bottom: calc(var(--tabbar-h) + 14px);
        width: calc(100vw - 32px);
    }
    body.training-run .toasts {
        bottom: 90px;
    }
}

/* =============================================================================
   Startseite (öffentlicher Betrieb), Konto, Gastmodus, App-Installation
   ============================================================================= */

body.landing-mode .app,
body.landing-mode .tabbar {
    display: none !important;
}
body.landing-mode {
    overflow: auto;
}

/* „Mit Google anmelden“ – nach den Gestaltungsregeln von Google: weiß, mit G-Logo */
.gbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 48px;
    padding: 0 22px 0 16px;
    font-size: 15.5px;
    font-weight: 600;
    color: #1f1f1f;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 8px 24px -10px rgba(0, 0, 0, 0.45);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.gbtn:hover {
    background: #f6f8fa;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 10px 28px -10px rgba(0, 0, 0, 0.5);
}
.gbtn:active {
    transform: translateY(1px);
}
.gbtn.small {
    height: 30px;
    gap: 8px;
    padding: 0 12px 0 9px;
    font-size: 12.5px;
    border-radius: 8px;
    box-shadow: none;
}
.gbtn.small svg {
    width: 15px;
    height: 15px;
}
.gbtn.wide,
.btn.wide {
    width: 100%;
}

.landing {
    --ld-max: 1160px;
    min-height: 100vh;
    background:
        radial-gradient(900px 520px at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        radial-gradient(700px 480px at -10% 30%, color-mix(in srgb, var(--blue) 10%, transparent), transparent 70%),
        var(--bg);
    color: var(--text);
}
.landing > * {
    width: min(var(--ld-max), calc(100% - 48px));
    margin-inline: auto;
}
.ld-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 0;
}
.ld-nav .brand {
    padding: 0;
}
.ld-navlink {
    color: var(--text-dim);
    font-weight: 550;
    font-size: 14.5px;
}
.ld-navlink:hover {
    color: var(--text);
    text-decoration: none;
}
.ld-navlogin {
    height: 34px;
    padding: 0 14px;
    font-size: 13.5px;
}

.ld-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 56px;
    align-items: center;
    padding: 56px 0 64px;
}
.ld-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 999px;
}
.ld-hero h1 {
    margin: 0 0 18px;
    font-size: clamp(36px, 5.2vw, 60px);
    line-height: 1.04;
    letter-spacing: -0.03em;
    font-weight: 800;
}
.ld-accent {
    background: linear-gradient(100deg, var(--accent) 10%, var(--blue) 95%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.ld-lead {
    margin: 0 0 30px;
    max-width: 34em;
    font-size: 18.5px;
    line-height: 1.6;
    color: var(--text-dim);
}
.ld-lead code {
    font-size: 0.9em;
}
.ld-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.ld-cta.center {
    justify-content: center;
}
.ld-guest {
    height: 48px;
    padding: 0 20px;
    font-size: 15px;
    border-radius: 10px;
}
.ld-note {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    max-width: 36em;
    margin: 20px 0 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-faint);
}
.ld-note .icon {
    flex: none;
    margin-top: 3px;
}

/* Terminal-Vorschau */
.ld-term {
    position: relative;
    border-radius: 14px;
    background: var(--term-bg);
    border: 1px solid var(--term-border);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.02), 0 30px 80px -30px color-mix(in srgb, var(--accent) 35%, transparent);
    overflow: hidden;
    transform: perspective(1400px) rotateY(-5deg) rotateX(2deg);
}
:root[data-theme="light"] .ld-term {
    --term-bg: #0d131b;
    --term-border: #1f2a38;
}
.lt-chrome {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    background: #111823;
    border-bottom: 1px solid #1f2a38;
}
.lt-chrome i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #2d3b4d;
}
.lt-chrome i:nth-child(1) {
    background: #ff6b7a;
}
.lt-chrome i:nth-child(2) {
    background: #f5b942;
}
.lt-chrome i:nth-child(3) {
    background: #3ddc97;
}
.lt-chrome span {
    margin-left: 10px;
    font: 12px var(--mono);
    color: #66768a;
}
.lt-body {
    height: 300px;
    padding: 16px 18px;
    overflow: hidden;
    font: 14px/1.7 var(--mono);
    color: #d3dde8;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.lt-line {
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lt-p {
    color: #3ddc97;
}
.lt-d {
    color: #5cb3ff;
}
.lt-o {
    color: #9aa9ba;
}
.lt-ok {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    padding: 2px 10px;
    color: #3ddc97;
    background: rgba(61, 220, 151, 0.12);
    border-radius: 6px;
    animation: ld-pop 0.35s ease-out;
}
.lt-cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    margin-left: 1px;
    vertical-align: -0.18em;
    background: #3ddc97;
    animation: ld-blink 1s steps(1) infinite;
}
@keyframes ld-blink {
    50% {
        opacity: 0;
    }
}
@keyframes ld-pop {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.97);
    }
}

.ld-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--border);
}
.ld-stats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 20px 22px;
    background: var(--surface);
}
.ld-stats b {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}
.ld-stats span {
    font-size: 13.5px;
    color: var(--text-dim);
}

.ld-section {
    padding: 88px 0 0;
}
.ld-section h2,
.ld-final h2 {
    margin: 0 0 10px;
    font-size: clamp(26px, 3.2vw, 36px);
    letter-spacing: -0.02em;
    font-weight: 750;
}
.ld-sub {
    margin: 0 0 32px;
    max-width: 40em;
    font-size: 16.5px;
    color: var(--text-dim);
}
.ld-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.ld-feature {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s, transform 0.2s;
}
.ld-feature:hover {
    border-color: var(--accent-line);
    transform: translateY(-2px);
}
.ld-ficon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 11px;
}
.ld-feature h3 {
    margin: 0 0 6px;
    font-size: 17px;
}
.ld-feature p {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.ld-path {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ld-path li {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.ld-pnum {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    font: 600 13px var(--mono);
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 8px;
}
.ld-pico {
    font-size: 22px;
}
.ld-path h3 {
    margin: 0;
    font-size: 15px;
}
.ld-path p {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-dim);
}
.ld-pcount {
    font-size: 12.5px;
    color: var(--text-faint);
    white-space: nowrap;
}

.ld-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 28px;
}
.ld-plan {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.ld-plan-main {
    border-color: var(--accent-line);
    background: linear-gradient(180deg, var(--accent-soft), transparent 60%), var(--surface);
}
.ld-plan h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 19px;
}
.ld-plan ul {
    display: grid;
    gap: 10px;
    flex: 1;
    align-content: start;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ld-plan li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 15px;
    line-height: 1.45;
}
.ld-plan li .icon {
    flex: none;
    margin-top: 2px;
    color: var(--accent);
}
.ld-plan li.no {
    color: var(--text-dim);
}
.ld-plan li.no .icon {
    color: var(--text-faint);
}
.ld-plan .btn.wide {
    height: 48px;
    font-size: 15px;
    border-radius: 10px;
}
.ld-fine {
    margin: -4px 0 0;
    font-size: 12.5px;
    color: var(--text-faint);
    text-align: center;
}

.ld-final {
    margin-top: 88px;
    padding: 56px 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: radial-gradient(600px 240px at 50% 0%, var(--accent-soft), transparent 70%), var(--surface);
}
.ld-final h2 {
    margin-bottom: 24px;
}
.ld-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 36px 0 44px;
    font-size: 13px;
    color: var(--text-faint);
}
.ld-foot nav {
    display: flex;
    gap: 18px;
}
.ld-foot a {
    color: var(--text-dim);
}

@media (max-width: 980px) {
    .ld-hero {
        grid-template-columns: 1fr;
        gap: 40px;
        padding-top: 28px;
    }
    .ld-term {
        transform: none;
    }
    .ld-features {
        grid-template-columns: 1fr 1fr;
    }
    .ld-path {
        grid-template-columns: 1fr;
    }
    .ld-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 640px) {
    .landing > * {
        width: calc(100% - 32px);
    }
    .ld-nav {
        padding: 14px 0;
        padding-top: max(14px, env(safe-area-inset-top));
    }
    .ld-navlink {
        display: none;
    }
    .ld-lead {
        font-size: 16.5px;
    }
    .ld-cta .gbtn,
    .ld-cta .ld-guest {
        width: 100%;
    }
    .lt-body {
        height: 240px;
        font-size: 12.5px;
        padding: 12px 14px;
    }
    .ld-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .ld-stats div:last-child {
        grid-column: span 2;
    }
    .ld-stats div {
        padding: 16px;
    }
    .ld-stats b {
        font-size: 24px;
    }
    .ld-features,
    .ld-compare {
        grid-template-columns: 1fr;
    }
    .ld-section {
        padding-top: 60px;
    }
    .ld-path li {
        grid-template-columns: auto 1fr;
        gap: 4px 12px;
        padding: 12px 14px;
    }
    .ld-pico {
        display: none;
    }
    .ld-pcount {
        grid-column: 2;
    }
    .ld-plan {
        padding: 22px;
    }
    .ld-final {
        margin-top: 60px;
        padding: 40px 18px;
    }
    .ld-foot {
        padding-bottom: max(32px, env(safe-area-inset-bottom));
    }
}

/* Konto-Knopf in der Kopfleiste */
.account-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
}
.account-btn[hidden] {
    display: none;
}
.account-btn.avatar {
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    border: 2px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--accent-line);
}
.account-btn.login {
    height: 34px;
    padding: 0 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
}
.account-btn.login:hover {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Gastmodus-Hinweis unter der Kopfleiste */
.guest-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 20px;
    font-size: 13.5px;
    color: var(--amber);
    background: var(--amber-soft);
    border-bottom: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
}
.guest-bar[hidden] {
    display: none;
}
.guest-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.guest-bar .btn.ghost {
    color: var(--text);
}
.guest-bar .icon-btn {
    width: 30px;
    height: 30px;
    color: var(--amber);
}

/* Einstellungen: Konto */
.account-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.account-avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    font-weight: 700;
    color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    border-radius: 50%;
}
.account-who {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.account-who span {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13.5px;
}
.install-ok {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
}
.install-info:empty {
    display: none;
}

@media (max-width: 760px) {
    .guest-bar {
        padding: 6px 8px 6px 14px;
        font-size: 12.5px;
    }
    .guest-bar .btn.ghost span,
    .guest-bar .gbtn span {
        display: none;
    }
    .guest-bar .btn.ghost {
        padding: 0 8px;
    }
    .guest-bar .gbtn.small {
        padding: 0 8px;
    }
    .account-btn.login span {
        display: none;
    }
    .account-btn.login {
        width: 34px;
        padding: 0;
        justify-content: center;
    }
}
