/* Ambient: Algorithmen, Themes, Akzente, Vollbild-Labor */

:root {
    --ink-rgb: 26, 24, 22;
    --paper-rgb: 247, 244, 239;
    --amb-panel: #f7f4ef;
    --amb-chrome-bg: rgba(247, 244, 239, 0.78);
    --amb-border: rgba(26, 24, 22, 0.08);
    --amb-border-strong: rgba(26, 24, 22, 0.16);
    --amb-border-active: rgba(26, 24, 22, 0.42);
    --amb-card: rgba(255, 255, 255, 0.45);
    --amb-card-hover: rgba(255, 255, 255, 0.7);
    --amb-card-active: rgba(255, 255, 255, 0.82);
    --amb-shadow: rgba(26, 24, 22, 0.1);
    --amb-inset: rgba(255, 255, 255, 0.4);
    --amb-preview-bg: rgba(26, 24, 22, 0.06);
    --amb-ink: #1a1816;
}

html.theme-dark {
    color-scheme: dark;
    --bg-base: #050805;
    --text-primary: #7dff9a;
    --text-secondary: rgba(125, 255, 154, 0.78);
    --text-muted: rgba(125, 255, 154, 0.48);
    --text-pearl: #9affb0;
    --text-pearl-soft: #4dff78;
    --theme-accent: #39ff14;
    --theme-shadow: rgba(57, 255, 20, 0.22);
    --solar-line: rgba(57, 255, 20, 0.22);
    --planet-ink: #111111;
    --ink-rgb: 125, 255, 154;
    --paper-rgb: 5, 8, 5;
    --amb-panel: #071208;
    --amb-chrome-bg: rgba(5, 10, 6, 0.88);
    --amb-border: rgba(57, 255, 20, 0.18);
    --amb-border-strong: rgba(57, 255, 20, 0.36);
    --amb-border-active: rgba(57, 255, 20, 0.7);
    --amb-card: rgba(57, 255, 20, 0.04);
    --amb-card-hover: rgba(57, 255, 20, 0.08);
    --amb-card-active: rgba(57, 255, 20, 0.14);
    --amb-shadow: rgba(0, 0, 0, 0.55);
    --amb-inset: rgba(57, 255, 20, 0.04);
    --amb-preview-bg: rgba(57, 255, 20, 0.07);
    --amb-ink: #7dff9a;
}

html.theme-dark body {
    background-color: var(--bg-base) !important;
    color: var(--text-primary);
}

.site-chrome {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 4000;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--amb-chrome-bg);
    border: 1px solid var(--amb-border);
    box-shadow: 0 10px 32px var(--amb-shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    font-family: "Inter", sans-serif;
    color: var(--text-primary, #1a1816);
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
}

.site-chrome[hidden] {
    display: none;
}

.site-chrome .lang-btn {
    position: static !important;
    top: auto !important;
    right: auto !important;
    z-index: auto !important;
    margin: 0;
    min-height: 40px;
    padding: 8px 12px !important;
    border: 0 !important;
    border-radius: 999px;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    letter-spacing: 0.12em;
}

.site-chrome .lang-btn:hover {
    background: rgba(var(--ink-rgb), 0.05) !important;
}

.site-chrome .ambient-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1;
}

.site-version {
    margin: 0;
    padding: 6px 0 max(10px, env(safe-area-inset-bottom, 0px));
    text-align: center;
    font-family: "Inter", sans-serif;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: rgba(var(--ink-rgb), 0.26);
    user-select: none;
    pointer-events: none;
}

body.ambient-fullscreen .site-version,
body.ambient-cinema .site-version {
    display: none;
}

.vector-grid {
    display: grid;
    gap: 8px;
}

.vector-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) 2.4rem;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.vector-row-label {
    opacity: 0.78;
}

.vector-row-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    opacity: 0.62;
    font-size: 10px;
}

.vector-slider {
    width: 100%;
    min-width: 0;
    accent-color: rgba(var(--ink-rgb), 0.55);
}

body.ambient-fullscreen .vector-row {
    grid-template-columns: minmax(4.2rem, 0.95fr) minmax(0, 1fr) 2.2rem;
    gap: 6px;
}

.ambient-root {
    position: relative;
    z-index: 4000;
    font-family: "Inter", sans-serif;
    color: var(--text-primary, #1a1816);
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
}

.ambient-root > * {
    pointer-events: auto;
}

.ambient-root.is-cinema {
    position: fixed;
    top: 16px;
    left: 16px;
    right: auto;
    transform: none;
    pointer-events: auto;
}

.ambient-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    border: 1px solid var(--amb-border-strong);
    border-radius: 999px;
    background: var(--amb-chrome-bg);
    color: var(--text-primary, #1a1816);
    cursor: pointer;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.4px;
    box-shadow: 0 8px 24px var(--amb-shadow);
}

.ambient-back[hidden] {
    display: none;
}

.ambient-back-arrow {
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

.ambient-back:hover {
    transform: translateX(-2px);
}

.ambient-root.is-cinema .ambient-controls,
.ambient-root.is-cinema .ambient-drawer,
.ambient-root.is-cinema .ambient-popover {
    display: none;
}

.ambient-drawer {
    display: contents;
}

.ambient-rail-handle {
    display: none;
}

.ambient-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.ambient-root svg {
    pointer-events: none;
}

.ambient-fullscreen,
.ambient-trigger,
.ambient-icon-btn,
.ambient-close {
    appearance: none;
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ambient-back,
.algo-card,
.theme-card,
.appearance-card,
.accent-chip,
.sound-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ambient-fullscreen,
.ambient-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    opacity: 0.72;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.ambient-fullscreen:hover,
.ambient-icon-btn:hover,
.ambient-trigger:hover {
    opacity: 1;
    transform: scale(1.06);
}

.ambient-fullscreen.is-fullscreen {
    color: var(--theme-accent, #c8c0b4);
    opacity: 1;
}

.ambient-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 8px;
    border-radius: 999px;
    opacity: 0.82;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ambient-trigger.is-open {
    opacity: 1;
}

.ambient-trigger-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.ambient-popover {
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: min(80vh, calc(100dvh - 20vh));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    isolation: isolate;
    padding: 20px 20px 18px;
    border-radius: 22px;
    border: 1px solid var(--amb-border);
    background: var(--amb-panel);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 24px 60px var(--amb-shadow), 0 0 0 1px var(--amb-inset) inset;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--ink-rgb), 0.16) transparent;
}

.ambient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.ambient-header-title {
    font-family: "Inter Tight", sans-serif;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    margin: 0;
}

.ambient-header-sub,
.ambient-esc-hint {
    font-size: 11px;
    color: var(--text-muted, rgba(26, 24, 22, 0.52));
    margin: 4px 0 0;
    letter-spacing: 0.01em;
}

.ambient-esc-hint {
    font-weight: 500;
}

.ambient-esc-hint[hidden] {
    display: none;
}

.ambient-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.ambient-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: var(--text-muted, rgba(26, 24, 22, 0.52));
}

.ambient-close:hover {
    color: var(--text-primary, #1a1816);
}

.ambient-rail-handle {
    appearance: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ambient-section + .ambient-section {
    margin-top: 16px;
}

.ambient-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted, rgba(26, 24, 22, 0.52));
    margin-bottom: 8px;
}

.algo-grid,
.theme-grid,
.appearance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.appearance-grid {
    grid-template-columns: repeat(2, 1fr);
}

.algo-card,
.theme-card,
.appearance-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--amb-border);
    background: var(--amb-card);
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.algo-card:hover,
.theme-card:hover,
.appearance-card:hover {
    border-color: var(--amb-border-strong);
    background: var(--amb-card-hover);
}

.algo-card.is-active,
.theme-card.is-active,
.appearance-card.is-active {
    border-color: var(--amb-border-active);
    box-shadow: 0 8px 20px var(--amb-shadow);
    background: var(--amb-card-active);
}

.algo-preview,
.theme-preview,
.appearance-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    isolation: isolate;
    color: var(--amb-ink);
    background: var(--amb-preview-bg);
}

.algo-preview svg {
    width: 92%;
    height: 86%;
    display: block;
}

.appearance-preview--light {
    background: #f5f2ec;
    box-shadow: inset 0 0 0 1px rgba(26, 24, 22, 0.12);
}

.appearance-preview--dark {
    background: #050805;
    box-shadow: inset 0 0 0 1px rgba(57, 255, 20, 0.45);
    background-image:
        linear-gradient(180deg, rgba(57, 255, 20, 0.12), transparent 55%),
        repeating-linear-gradient(0deg, transparent 0 3px, rgba(57, 255, 20, 0.18) 3px 4px);
}

.theme-preview {
    box-shadow: inset 0 0 0 1px var(--amb-border);
}

.algo-card-label,
.theme-card-label,
.accent-chip-label {
    font-size: 11px;
    font-weight: 560;
    letter-spacing: 0.01em;
    padding: 0 2px 2px;
}

.accent-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.accent-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px 6px;
    border-radius: 14px;
    border: 1px solid var(--amb-border);
    background: var(--amb-card);
    color: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.accent-chip:hover {
    border-color: var(--amb-border-strong);
    background: var(--amb-card-hover);
}

.accent-chip.is-active {
    border-color: var(--amb-border-active);
    box-shadow: 0 8px 20px var(--amb-shadow);
    background: var(--amb-card-active);
}

.accent-chip-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--amb-border);
}

.ambient-switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.ambient-switch-row .ambient-label {
    margin: 0;
}

.ambient-switch-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--text-primary, #1a1816);
    cursor: pointer;
}

.sound-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.sound-btn {
    padding: 7px 8px;
    border-radius: 10px;
    border: 1px solid var(--amb-border);
    background: rgba(var(--ink-rgb), 0.03);
    color: var(--text-secondary, rgba(26, 24, 22, 0.76));
    font-size: 11px;
    cursor: pointer;
}

.sound-btn.is-active {
    border-color: var(--amb-border-active);
    color: var(--text-primary, #1a1816);
    font-weight: 600;
}

.ambient-advanced-toggle {
    appearance: none;
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 8px 4px 2px;
    border: 0;
    background: transparent;
    color: var(--text-muted, rgba(26, 24, 22, 0.52));
    cursor: pointer;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
}

.ambient-advanced-toggle:hover {
    color: var(--text-primary, #1a1816);
}

.ambient-advanced-only {
    display: none;
}

.ambient-root.is-advanced .ambient-advanced-only {
    display: block;
}

.ambient-root.is-advanced .ambient-advanced-toggle {
    margin-top: 4px;
    margin-bottom: 4px;
}

html.ambient-fullscreen,
html.ambient-fullscreen body {
    overflow: hidden;
    height: 100%;
}

body.ambient-fullscreen {
    overflow: hidden !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    overscroll-behavior: none;
}

body.ambient-fullscreen header,
body.ambient-fullscreen main,
body.ambient-fullscreen #readability-scrim,
body.ambient-fullscreen .site-chrome,
body.ambient-fullscreen .site-social {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.ambient-page .nav-home,
body.ambient-page #lang-switch {
    z-index: 4001;
    pointer-events: auto;
}

body.ambient-fullscreen .nav-home,
body.ambient-fullscreen #lang-switch {
    z-index: 100001;
}

body.ambient-fullscreen #lang-switch {
    right: auto;
    left: clamp(64px, 8vw, 112px);
}

html.theme-dark body.ambient-page #lang-switch {
    border-color: rgba(245, 242, 236, 0.28);
    color: var(--text-primary);
    background: transparent;
}

html.theme-dark body.ambient-page #lang-switch:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

body.ambient-page.ambient-cinema #lang-switch {
    display: none;
}

body.ambient-fullscreen #p5-background {
    position: fixed !important;
    z-index: 1 !important;
    opacity: 1 !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 100dvh !important;
}

body.ambient-fullscreen {
    --amb-menu-width: min(360px, calc(100vw - 52px));
}

body.ambient-fullscreen .ambient-root,
body > .ambient-root {
    position: fixed;
    pointer-events: auto;
}

body.ambient-fullscreen .ambient-root {
    inset: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 99999 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none;
}

body.ambient-fullscreen .ambient-controls {
    display: none;
}

body.ambient-fullscreen .ambient-drawer {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--amb-menu-width);
    z-index: 1;
    overflow: visible;
    pointer-events: none;
    background: var(--amb-panel);
    box-shadow: -18px 0 50px var(--amb-shadow);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.ambient-fullscreen .ambient-root.is-rail-open .ambient-drawer {
    transform: translateX(0);
    pointer-events: auto;
}

body.ambient-fullscreen .ambient-rail-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: absolute;
    top: 50%;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    z-index: 2;
    width: 42px;
    min-height: 156px;
    padding: 18px 0;
    border: 1px solid var(--amb-border);
    border-right: 0;
    border-radius: 16px 0 0 16px;
    background: var(--amb-panel);
    box-shadow: none;
    pointer-events: auto;
    transition: background 0.2s ease;
}

body.ambient-fullscreen .ambient-rail-handle:hover {
    background: var(--amb-card-hover);
}

body.ambient-fullscreen .ambient-rail-handle svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

body.ambient-fullscreen .ambient-root.is-rail-open .ambient-rail-handle svg {
    transform: rotate(180deg);
}

.ambient-rail-handle-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
}

body.ambient-fullscreen .ambient-popover {
    position: absolute;
    inset: 0;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 16px 20px;
    border: 0;
    border-radius: 0;
    background: var(--amb-panel);
    box-shadow: none;
    pointer-events: auto;
}

body.ambient-fullscreen .ambient-header {
    position: sticky;
    top: -16px;
    z-index: 1;
    margin: -16px -16px 14px;
    padding: 16px 16px 12px;
    background: var(--amb-panel);
}

body.ambient-cinema:not(.ambient-fullscreen) .ambient-root {
    top: max(16px, calc(env(safe-area-inset-top, 0px) + var(--vv-top, 0px))) !important;
    left: max(16px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
}

body.ambient-fullscreen .ambient-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

body.ambient-fullscreen .ambient-section + .ambient-section {
    margin-top: 0;
}

body.ambient-fullscreen .ambient-section:first-child,
body.ambient-fullscreen .ambient-advanced-toggle,
body.ambient-fullscreen .ambient-audio-section {
    grid-column: auto;
}

body.ambient-fullscreen .algo-grid {
    grid-template-columns: repeat(3, 1fr);
}

body.ambient-fullscreen .ambient-root.is-advanced .ambient-body {
    grid-template-columns: 1fr;
}

body.ambient-fullscreen .ambient-advanced-toggle {
    display: block;
    margin-top: 0;
}

body.ambient-fullscreen .ambient-advanced-only {
    display: none;
}

body.ambient-fullscreen .ambient-root.is-advanced .ambient-advanced-only {
    display: block;
}

body.ambient-fullscreen .ambient-hide,
body.ambient-fullscreen .ambient-save-btn {
    display: inline-flex;
}

body.ambient-fullscreen .ambient-audio-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 0;
    padding-top: 4px;
}

body.ambient-fullscreen .sound-grid {
    margin-top: 0;
    width: 100%;
}

body.ambient-fullscreen .algo-preview,
body.ambient-fullscreen .theme-preview,
body.ambient-fullscreen .appearance-preview {
    height: 38px;
}

body.ambient-fullscreen .algo-card,
body.ambient-fullscreen .theme-card,
body.ambient-fullscreen .appearance-card {
    padding: 5px;
    border-radius: 12px;
    gap: 5px;
}

body.ambient-fullscreen .algo-card-label,
body.ambient-fullscreen .theme-card-label {
    font-size: 10px;
    padding: 0 1px 1px;
}

@media (prefers-reduced-motion: reduce) {
    body.ambient-fullscreen .ambient-drawer,
    body.ambient-fullscreen .ambient-rail-handle {
        transition: none;
    }
}

@media (min-width: 1100px) {
    body.ambient-fullscreen {
        --amb-menu-width: min(380px, calc(100vw - 56px));
    }

    body.ambient-fullscreen .ambient-popover {
        padding: 18px 18px 20px;
    }

    body.ambient-fullscreen .ambient-header {
        margin: -18px -18px 14px;
        padding: 18px 18px 12px;
        top: -18px;
    }

    body.ambient-fullscreen .vector-grid {
        gap: 6px 0;
    }
}

@media (max-width: 860px) {
    .site-chrome {
        top: max(8px, env(safe-area-inset-top, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        padding: 3px;
        background: var(--amb-chrome-bg);
    }

    body:not(.ambient-fullscreen) .ambient-advanced-toggle,
    body:not(.ambient-fullscreen) .ambient-advanced-only,
    body:not(.ambient-fullscreen) .ambient-hide,
    body:not(.ambient-fullscreen) .ambient-save-btn {
        display: none !important;
    }

    .ambient-trigger-label {
        display: none;
    }

    .ambient-root {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
        pointer-events: none;
    }

    .ambient-root > * {
        pointer-events: auto;
    }

    .ambient-fullscreen,
    .ambient-icon-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .ambient-trigger {
        min-width: 44px;
        min-height: 44px;
        height: 44px;
        padding: 10px 12px 10px 10px;
    }

    .ambient-popover {
        width: min(360px, calc(100vw - 24px));
        max-height: min(62dvh, calc(100dvh - 140px));
    }

    .site-chrome .ambient-popover {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
    }

    .ambient-root.is-cinema,
    body.ambient-cinema:not(.ambient-fullscreen) .ambient-root {
        top: calc(12px + env(safe-area-inset-top, 0px) + var(--vv-top, 0px));
        bottom: auto;
        left: calc(12px + env(safe-area-inset-left, 0px));
        right: auto;
        transform: none;
        align-items: flex-start;
    }

    body.ambient-fullscreen {
        --amb-menu-width: min(320px, calc(100vw - 48px));
    }

    body.ambient-fullscreen .ambient-root {
        inset: 0 !important;
        width: auto !important;
        max-width: none !important;
        align-items: stretch;
    }

    body.ambient-fullscreen .ambient-body {
        gap: 10px;
    }

    body.ambient-fullscreen .algo-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    body.ambient-fullscreen .ambient-popover {
        width: auto;
        max-height: none;
        padding: 14px 14px 18px;
        border-radius: 0;
    }

    body.ambient-fullscreen .ambient-header {
        margin: -14px -14px 10px;
        padding: 14px 14px 10px;
        top: -14px;
    }

    body.ambient-fullscreen .algo-preview,
    body.ambient-fullscreen .theme-preview,
    body.ambient-fullscreen .appearance-preview {
        height: 36px;
    }

    .ambient-root.is-cinema,
    body.ambient-cinema:not(.ambient-fullscreen) .ambient-root {
        top: max(12px, calc(env(safe-area-inset-top, 0px) + var(--vv-top, 0px))) !important;
        bottom: auto !important;
        left: max(12px, env(safe-area-inset-left, 0px)) !important;
        right: auto !important;
        width: auto !important;
        max-width: none !important;
        height: auto;
        margin: 0 !important;
        transform: none !important;
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .ambient-trigger-label {
        display: none;
    }

    .ambient-trigger {
        padding: 8px;
    }

    body:not(.ambient-fullscreen) .ambient-advanced-toggle,
    body:not(.ambient-fullscreen) .ambient-advanced-only,
    body:not(.ambient-fullscreen) .ambient-hide,
    body:not(.ambient-fullscreen) .ambient-save-btn {
        display: none !important;
    }

    .ambient-trigger-label {
        display: none;
    }

    .ambient-popover {
        width: min(320px, calc(100vw - 24px));
        padding: 16px 16px 14px;
    }

    .ambient-header {
        margin-bottom: 12px;
    }

    .algo-preview,
    .theme-preview,
    .appearance-preview {
        height: 40px;
    }
}

.theme-toggle {
    appearance: none;
    -webkit-appearance: none;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    cursor: pointer;
}

.theme-toggle:hover {
    background: rgba(var(--ink-rgb), 0.05);
}

.project-index {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.project-index__head {
    margin: 0 0 16px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--text-muted);
}

.project-index__row {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    gap: 10px 16px;
    align-items: start;
    padding: 14px 8px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid rgba(26, 24, 22, 0.1);
    border-radius: 0;
    background: transparent;
    text-decoration: none;
    color: inherit;
    text-align: left;
}

.project-index__idx {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding-top: 1px;
}

.project-index__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 16px;
    min-width: 0;
}

.project-index__name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.project-index__icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: var(--c-projekte, #5c62a8);
}

.project-index__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.project-index__name {
    font-weight: 500;
    color: var(--text-primary);
}

.project-index__host {
    justify-self: end;
    color: var(--text-muted);
    font-size: 0.92em;
}

.project-index__desc {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    font-size: 0.92em;
    line-height: 1.55;
}

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

    .project-index__host {
        justify-self: start;
    }
}

a.project-index__row:hover,
a.project-index__row:focus-visible {
    background: rgba(26, 24, 22, 0.045);
}

a.project-index__row:focus-visible {
    outline: 1px solid rgba(26, 24, 22, 0.28);
    outline-offset: 2px;
}

html.theme-dark,
html.theme-dark body {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html.theme-dark body::before {
    content: "";
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 3;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 2px,
            rgba(0, 0, 0, 0.16) 2px,
            rgba(0, 0, 0, 0.16) 3px
        );
    opacity: 0.28;
}

#matrix-rain {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2500;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: plus-lighter;
    transition: opacity 0.55s ease;
}

html.theme-dark #matrix-rain {
    mix-blend-mode: screen;
}

#matrix-rain.is-on {
    opacity: 0.78;
}

#matrix-rain.is-leaving {
    opacity: 0;
    transition: opacity 1.25s ease 0.12s;
}

@media (prefers-reduced-motion: reduce) {
    #matrix-rain {
        display: none;
    }
}

html.theme-dark .title,
html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3,
html.theme-dark .hero-copy-meta,
html.theme-dark .hero-copy-role,
html.theme-dark .hero-text-short,
html.theme-dark .popup-content,
html.theme-dark .popup-close,
html.theme-dark .ueber-intro__headline,
html.theme-dark .ueber-intro__role,
html.theme-dark .ueber-intro__lead,
html.theme-dark .ueber-intro__body,
html.theme-dark .ueber-intro__pi,
html.theme-dark .ueber-section-title,
html.theme-dark .vita-item__period,
html.theme-dark .vita-item__body,
html.theme-dark .go-intro,
html.theme-dark .site-chrome,
html.theme-dark .lang-btn,
html.theme-dark .nav-home,
html.theme-dark .solar-planet-label,
html.theme-dark .solar-planet-subtitle,
html.theme-dark .solar-sun-label {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html.theme-dark .site-chrome {
    border-radius: 4px;
    border-color: rgba(57, 255, 20, 0.28);
    box-shadow: 0 0 24px rgba(57, 255, 20, 0.08);
}

html.theme-dark .theme-toggle,
html.theme-dark .site-chrome .lang-btn {
    border-radius: 4px;
}

html.theme-dark .popup-overlay {
    background: rgba(5, 8, 5, 0.62);
}

html.theme-dark .popup-card {
    background: rgba(5, 10, 6, 0.94);
    border: 1px solid rgba(57, 255, 20, 0.28);
    border-radius: 2px;
    box-shadow: 0 0 40px rgba(57, 255, 20, 0.08);
    color: var(--text-primary);
}

html.theme-dark .popup-close {
    background: transparent;
    border: none;
    box-shadow: none;
    color: #9a9fd4;
}

html.theme-dark .popup-close:hover {
    color: #c4c7ea;
    background: transparent;
}

html.theme-dark .project-index__icon {
    color: #9a9fd4;
}

html.theme-dark .popup-project-card,
html.theme-dark .project-index__row {
    border-bottom-color: rgba(57, 255, 20, 0.16);
}

html.theme-dark a.popup-project-card:hover,
html.theme-dark a.project-index__row:hover,
html.theme-dark a.project-index__row:focus-visible {
    background: rgba(57, 255, 20, 0.06);
}

html.theme-dark a.project-index__row:focus-visible {
    outline-color: rgba(57, 255, 20, 0.55);
}

html.theme-dark .ueber-portrait,
html.theme-dark .vita-item,
html.theme-dark .vita-item:last-child {
    border-color: rgba(57, 255, 20, 0.18);
}

html.theme-dark .profile-seo__links a,
html.theme-dark .social-link {
    border-color: rgba(57, 255, 20, 0.28);
    color: var(--text-secondary);
}

html.theme-dark .social-link:hover,
html.theme-dark .profile-seo__links a:hover {
    color: var(--text-primary);
    border-color: rgba(57, 255, 20, 0.55);
    background: rgba(57, 255, 20, 0.06);
}

html.theme-dark .solar-planet-label,
html.theme-dark .solar-planet-subtitle,
html.theme-dark .solar-planet--venus .solar-planet-label,
html.theme-dark .solar-planet.is-preview .solar-planet-label,
html.theme-dark .solar-planet.is-preview .solar-planet-subtitle,
html.theme-dark .solar-stage-wrap.is-active .solar-planet.is-selected .solar-planet-label,
html.theme-dark .solar-stage-wrap.is-active .solar-planet.is-selected .solar-planet-subtitle,
html.theme-dark .solar-planet.solar-pill-color--red .solar-planet-label,
html.theme-dark .solar-planet.solar-pill-color--red .solar-planet-subtitle,
html.theme-dark .solar-planet.solar-pill-color--blue .solar-planet-label,
html.theme-dark .solar-planet.solar-pill-color--blue .solar-planet-subtitle,
html.theme-dark .solar-planet.solar-pill-color--red.is-preview .solar-planet-label,
html.theme-dark .solar-planet.solar-pill-color--red.is-preview .solar-planet-subtitle,
html.theme-dark .solar-planet.solar-pill-color--blue.is-preview .solar-planet-label,
html.theme-dark .solar-planet.solar-pill-color--blue.is-preview .solar-planet-subtitle,
html.theme-dark .solar-stage-wrap.is-active .solar-planet.solar-pill-color--red.is-selected .solar-planet-label,
html.theme-dark .solar-stage-wrap.is-active .solar-planet.solar-pill-color--red.is-selected .solar-planet-subtitle,
html.theme-dark .solar-stage-wrap.is-active .solar-planet.solar-pill-color--blue.is-selected .solar-planet-label,
html.theme-dark .solar-stage-wrap.is-active .solar-planet.solar-pill-color--blue.is-selected .solar-planet-subtitle {
    color: #111111;
    text-shadow: 0 1px 4px rgba(245, 242, 236, 0.35);
}

html.theme-dark ::selection {
    background: #39ff14;
    color: #050805;
}

html.theme-dark .go-kifu__card {
    background: rgba(5, 10, 6, 0.82);
    border-color: rgba(57, 255, 20, 0.22);
    box-shadow: 0 0 28px rgba(57, 255, 20, 0.06);
}

html.theme-dark .go-kifu__player,
html.theme-dark .go-kifu__title,
html.theme-dark .go-kifu__lead,
html.theme-dark .go-kifu__source,
html.theme-dark .go-kifu__details,
html.theme-dark .go-kifu__status {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
}

html.theme-dark .go-kifu__player--black .go-kifu__stone {
    background: #7dff9a;
}

html.theme-dark .go-kifu__player--white .go-kifu__stone {
    background: #050805;
    border-color: rgba(57, 255, 20, 0.55);
}

html.theme-dark .planet-accent-tag {
    background: rgba(57, 255, 20, 0.08);
    border-color: rgba(57, 255, 20, 0.35);
    color: #7dff9a;
}
