/* Binärcode & Bits: Vollbild-Raum mit 1 bis 8 Glühbirnen und schrittweiser Erklärung.
   Gestaltung nach Vorbild von /wasser und den geteilten LmB-Tokens aus css/lmb-app.css. */
:root {
    color-scheme: dark;
    --lmb-bg-dark: #0A0F1A;
    --lmb-bg-surface: #141B2D;
    --lmb-bg-surface-hover: #1A2338;
    --lmb-primary: #6366F1;
    --lmb-primary-hover: #4F46E5;
    --lmb-secondary: #10B981;
    --lmb-accent: #8B5CF6;
    --lmb-text-main: #F8FAFC;
    --lmb-text-muted: #94A3B8;
    --lmb-grad-primary: linear-gradient(135deg, #6366F1, #8B5CF6);
    --lmb-radius-md: 12px;
    --lmb-radius-lg: 24px;
    --lmb-radius-full: 100px;
    --lmb-shadow-glow: 0 0 20px rgba(99, 102, 241, .2);
    --lmb-trans-fast: .2s ease;
    --lmb-trans-smooth: .4s cubic-bezier(.16, 1, .3, 1);
    --panel: rgba(20, 27, 45, .86);
    --line: rgba(248, 250, 252, .1);
    --line-strong: rgba(248, 250, 252, .16);
    --lamp-warm: #FBBF24;
    --lamp-core: #FEF9C3;
    --lamp-halo: rgba(251, 191, 36, .34);
    --room-brightness: 0;
    font-family: Outfit, system-ui, sans-serif;
    color: var(--lmb-text-main);
    background: #04060B;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #04060B;
}

button, a, input, select, summary {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
    background: transparent;
    transition: background var(--lmb-trans-fast), box-shadow var(--lmb-trans-fast), color var(--lmb-trans-fast), transform var(--lmb-trans-fast);
}

button:disabled {
    opacity: .42;
    cursor: default;
}

button:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid #A5B4FC;
    outline-offset: 3px;
}

button:hover:not(:disabled) {
    background-color: rgba(99, 102, 241, .16);
}

[hidden] {
    display: none !important;
}

p {
    line-height: 1.55;
}

a {
    color: inherit;
}

h1, h2, p {
    margin-top: 0;
}

kbd {
    display: inline-block;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #E2E8F0;
    background: rgba(255, 255, 255, .09);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 2000;
    background: var(--lmb-bg-surface);
    border: 1px solid var(--line-strong);
    padding: 12px 16px;
    border-radius: var(--lmb-radius-md);
}

.skip-link:focus {
    top: 12px;
}

/* ---------- Vollbild-Raum (100dvh) ---------- */
.binary-stage {
    position: relative;
    height: 100dvh;
    min-height: 460px;
    overflow: hidden;
    isolation: isolate;
    background: #04060B;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.room-ambience {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 65% at 50% 38%,
            rgba(251, 191, 36, calc(var(--room-brightness) * 0.16)) 0%,
            rgba(217, 119, 6, calc(var(--room-brightness) * 0.06)) 45%,
            rgba(4, 6, 11, 0) 78%),
        radial-gradient(circle at 50% 50%, #090D18 0%, #030509 100%);
    transition: background .35s ease;
}

.room-ceiling-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(180deg, rgba(15, 23, 42, .45), rgba(4, 6, 11, 0));
}

.room-floor-glow {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: -30px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 100%,
        rgba(251, 191, 36, calc(var(--room-brightness) * 0.22)) 0%,
        rgba(99, 102, 241, .04) 55%,
        transparent 80%);
    filter: blur(22px);
    transition: background .35s ease;
}

.glass {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 16px 48px rgba(2, 5, 12, .55);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* ---------- Kopfleiste ---------- */
.topbar {
    position: absolute;
    z-index: 6;
    inset: 24px 28px auto;
    display: flex;
    gap: 13px;
    align-items: center;
    pointer-events: none;
}

.topbar > * {
    pointer-events: auto;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: rgba(10, 15, 26, .65);
}

.brand img {
    object-fit: contain;
}

.title {
    filter: drop-shadow(0 2px 10px rgba(2, 5, 12, .85));
}

.title h1 .eyebrow {
    display: block;
}

.glossary-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 12px;
}

.glossary-terms .lmb-glossar-begriff {
    min-height: 44px;
    color: #C7D2FE;
}

.metrics .lmb-glossar-begriff {
    min-height: 28px;
    color: #CBD5E1;
}

body .lmb-glossar-begriff:hover,
body .lmb-glossar-begriff:focus-visible {
    color: #F8FAFC;
}

body .lmb-glossar-karte {
    background: #151E30;
    color: #F8FAFC;
    border-color: rgba(165, 180, 252, .3);
}

body .lmb-glossar-kurz {
    color: #CBD5E1;
}

body .lmb-glossar-formel {
    background: rgba(255, 255, 255, .06);
}

body .lmb-glossar-mehr {
    color: #C7D2FE;
}

.eyebrow {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .14em;
    color: #A5B4FC;
}

h1 {
    margin: 3px 0 0;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.03em;
}

/* Bei nur 1 Lampe tritt die Kopfleiste dezent zurück, damit der dunkle Raum wirkt */
.binary-stage[data-lamps="1"]:not(:has(.inspector:not([hidden]))) .topbar {
    opacity: .55;
    transition: opacity var(--lmb-trans-fast);
}

.binary-stage[data-lamps="1"] .topbar:hover,
.binary-stage[data-lamps="1"] .topbar:focus-within {
    opacity: 1;
}

.binary-stage[data-lamps="1"]:not(:has(.inspector:not([hidden]))) .scene-signature {
    opacity: 0;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.top-actions button {
    min-height: 44px;
}

.pill-btn {
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--lmb-radius-full);
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.pill-btn[aria-expanded="true"] {
    background: rgba(99, 102, 241, .28);
    border-color: rgba(129, 140, 248, .55);
    color: #fff;
}

.icon-btn {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: none;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    border-radius: var(--lmb-radius-md);
}

/* ---------- Dezente Zustands-Pille oben (ab 2 Lampen) ---------- */
.state-pill {
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    min-height: 42px;
    padding: 7px 16px;
    border-radius: var(--lmb-radius-full);
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: #E2E8F0;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748B;
    transition: background var(--lmb-trans-fast), box-shadow var(--lmb-trans-fast);
}

.binary-stage:not([data-lit="0"]) .status-dot {
    background: var(--lamp-warm);
    box-shadow: 0 0 10px var(--lamp-warm);
}

.pill-sep {
    color: rgba(148, 163, 184, .45);
}

.pill-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #FEF08A;
    background: rgba(251, 191, 36, .12);
    border: 1px solid rgba(251, 191, 36, .28);
    padding: 2px 8px;
    border-radius: 8px;
}

.binary-stage[data-lit="0"] .pill-code {
    color: #94A3B8;
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .1);
}

/* ---------- Lampen-Bühne im schwarzen Raum ---------- */
.lamp-arena {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 88px 28px 128px;
    transition: padding-right var(--lmb-trans-smooth);
}

@media (min-width: 1024px) {
    .binary-stage:has(.inspector:not([hidden])) .lamp-arena {
        padding-right: 376px;
    }
}

.lamp-row {
    --bulb-w: 118px;
    --cord-h: 92px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(12px, 2.6vw, 38px);
    max-width: 1180px;
    width: 100%;
}

.binary-stage[data-lamps="2"] .lamp-row {
    --bulb-w: 106px;
    --cord-h: 84px;
}

.binary-stage[data-lamps="3"] .lamp-row,
.binary-stage[data-lamps="4"] .lamp-row {
    --bulb-w: 92px;
    --cord-h: 72px;
    gap: clamp(10px, 2.2vw, 28px);
}

.binary-stage[data-lamps="5"] .lamp-row,
.binary-stage[data-lamps="6"] .lamp-row {
    --bulb-w: 76px;
    --cord-h: 60px;
    gap: clamp(8px, 1.5vw, 20px);
}

.binary-stage[data-lamps="7"] .lamp-row,
.binary-stage[data-lamps="8"] .lamp-row {
    --bulb-w: 66px;
    --cord-h: 52px;
    gap: clamp(6px, 1.1vw, 15px);
}

/* Einzelne Glühbirnen-Einheit */
.lamp-unit {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px 14px;
    border-radius: var(--lmb-radius-lg);
    background: transparent;
    color: var(--lmb-text-main);
    min-width: 44px;
    user-select: none;
}

.lamp-unit:hover:not(:disabled) {
    background: transparent;
}

/* Weicher, kantenfreier Lichtschein der einzelnen Lampe im dunklen Raum */
.lamp-cone {
    position: absolute;
    top: calc(var(--cord-h) + var(--bulb-w) * 0.65);
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(var(--bulb-w) * 3.4);
    height: calc(var(--bulb-w) * 3.4);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%,
        rgba(254, 240, 138, .36) 0%,
        rgba(251, 191, 36, .16) 32%,
        rgba(245, 158, 11, .05) 54%,
        transparent 70%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
    z-index: -1;
}

.lamp-unit[data-bit="1"] .lamp-cone {
    opacity: 1;
}

/* Stromkabel von der Decke */
.lamp-cord {
    width: 3px;
    height: var(--cord-h);
    background: linear-gradient(180deg, rgba(148, 163, 184, .35), #64748B);
    border-radius: 2px;
    transition: height var(--lmb-trans-smooth), background var(--lmb-trans-fast);
}

.lamp-unit[data-bit="1"] .lamp-cord {
    background: linear-gradient(180deg, rgba(203, 213, 225, .5), #CBD5E1);
}

/* Glühbirnen-SVG */
.lamp-svg {
    display: block;
    width: var(--bulb-w);
    height: calc(var(--bulb-w) * 1.32);
    overflow: visible;
    filter: drop-shadow(0 6px 18px rgba(15, 23, 42, .85));
    transition: width var(--lmb-trans-smooth), height var(--lmb-trans-smooth), filter .25s ease, transform .2s ease;
}

.lamp-unit:hover .lamp-svg {
    transform: translateY(-2px);
}

.lamp-unit:active .lamp-svg {
    transform: translateY(1px) scale(.98);
}

/* Fassung (Sockel oben an der Hängelampe) */
.bulb-socket {
    fill: #475569;
    stroke: #94A3B8;
    stroke-width: 1.5;
}

.bulb-socket-ring {
    fill: #334155;
}

/* Glaskörper (auch im ausgeschalteten Zustand klar im dunklen Raum erkennbar) */
.bulb-glass {
    fill: rgba(51, 65, 85, .52);
    stroke: rgba(203, 213, 225, .72);
    stroke-width: 2.2;
    transition: fill .25s ease, stroke .25s ease;
}

.bulb-reflection {
    fill: none;
    stroke: rgba(255, 255, 255, .32);
    stroke-width: 2.2;
    stroke-linecap: round;
}

/* Glühdraht im Inneren */
.bulb-support {
    stroke: #64748B;
    stroke-width: 1.6;
    fill: none;
}

.bulb-filament {
    stroke: #94A3B8;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: stroke .2s ease, filter .2s ease;
}

/* Zustand EIN (Bit = 1) */
.lamp-unit[data-bit="1"] .lamp-svg {
    filter:
        drop-shadow(0 0 18px rgba(251, 191, 36, .75))
        drop-shadow(0 0 46px rgba(245, 158, 11, .45));
}

.lamp-unit[data-bit="1"] .bulb-glass {
    fill: rgba(254, 240, 138, .92);
    stroke: #FEF9C3;
}

.lamp-unit[data-bit="1"] .bulb-reflection {
    stroke: rgba(255, 255, 255, .75);
}

.lamp-unit[data-bit="1"] .bulb-support {
    stroke: #B45309;
}

.lamp-unit[data-bit="1"] .bulb-filament {
    stroke: #FFFFFF;
    stroke-width: 2.8;
}

/* Binärziffer (0 / 1) unter der Lampe */
.lamp-bit {
    margin-top: 10px;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: rgba(30, 41, 59, .88);
    border: 1px solid rgba(148, 163, 184, .4);
    color: #CBD5E1;
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.lamp-unit[data-bit="1"] .lamp-bit {
    background: rgba(251, 191, 36, .18);
    border-color: rgba(251, 191, 36, .75);
    color: #FEF9C3;
    box-shadow: 0 0 18px rgba(251, 191, 36, .32);
}

/* Stellenwert (1, 2, 4, 8 ... 128) unter der Binärziffer */
.lamp-weight {
    margin-top: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    opacity: 0;
    transform: translateY(-4px);
    max-height: 0;
    overflow: hidden;
    transition: opacity .25s ease, transform .25s ease, max-height .25s ease;
}

.binary-stage[data-weights="true"] .lamp-weight {
    opacity: 1;
    transform: translateY(0);
    max-height: 44px;
}

.lamp-weight-val {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #94A3B8;
}

.lamp-unit[data-bit="1"] .lamp-weight-val {
    color: #FDE68A;
}

.lamp-weight-pow {
    font-size: 10px;
    color: #64748B;
    font-variant-numeric: tabular-nums;
}

/* ---------- Erklärkarte rechts (nach Vorbild von /wasser .inspector) ---------- */
.inspector {
    position: absolute;
    z-index: 6;
    right: 26px;
    top: 94px;
    width: 344px;
    max-height: calc(100dvh - 215px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 20px;
    border-radius: var(--lmb-radius-lg);
}

.card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -8px -9px 0 0;
    gap: 8px;
}

.card-heading .eyebrow {
    font-size: 9px;
}

.inspector h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.03em;
    margin: 2px 0 10px;
}

.inspector p {
    font-size: 13px;
    color: #CBD5E1;
    margin-bottom: 16px;
}

.primary, .secondary {
    min-height: 44px;
    border-radius: var(--lmb-radius-md);
    padding: 10px 14px;
    width: 100%;
    font-size: 12.5px;
    text-align: center;
    line-height: 1.4;
}

.primary {
    background: var(--lmb-grad-primary);
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: var(--lmb-shadow-glow);
}

.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    box-shadow: 0 8px 25px rgba(99, 102, 241, .4);
}

.secondary {
    border: 1px solid var(--line-strong);
    background: rgba(26, 35, 56, .7);
    color: var(--lmb-text-main);
    font-weight: 500;
}

.secondary:hover:not(:disabled) {
    background: rgba(99, 102, 241, .2);
    border-color: rgba(99, 102, 241, .5);
}

.text-btn {
    min-height: 44px;
    font-size: 12px;
    color: #A5B4FC;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Kennzahlen-Raster wie in /wasser */
.metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px 12px;
}

.metrics > div {
    border-left: 2px solid rgba(251, 191, 36, .65);
    padding-left: 10px;
    min-width: 0;
}

.metrics > div:nth-child(2) {
    border-left-color: rgba(99, 102, 241, .6);
}

.metrics > div:nth-child(3) {
    border-left-color: rgba(16, 185, 129, .55);
}

.metrics > div:nth-child(4) {
    border-left-color: rgba(139, 92, 246, .55);
}

.metrics span, .metrics small {
    display: block;
    font-size: 10px;
    color: var(--lmb-text-muted);
}

.metrics strong {
    font-size: 20px;
    letter-spacing: -.03em;
    font-weight: 700;
    display: block;
    margin: 4px 0 2px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lab-heading {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 18px 0 7px;
    color: var(--lmb-text-muted);
}

.lab-heading span:last-child {
    color: #A5B4FC;
    letter-spacing: .02em;
    text-transform: none;
    font-size: 11px;
}

.calc-section, .media-section {
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 2px;
}

.calc-breakdown {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px !important;
    color: #FEF08A !important;
    background: rgba(10, 15, 26, .6);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 11px;
    margin: 0 0 11px !important;
    overflow-wrap: anywhere;
}

.tone-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 15, 26, .55);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}

.tone-swatch {
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 9px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4);
    transition: background .2s ease;
}

.tone-info {
    min-width: 0;
}

.tone-info strong {
    display: block;
    font-size: 12.5px;
    color: var(--lmb-text-main);
    margin-bottom: 2px;
}

.tone-info span {
    display: block;
    font-size: 11px;
    color: #CBD5E1;
    line-height: 1.4;
}

details {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 6px;
}

summary {
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 10px 0;
    min-height: 40px;
    color: #E2E8F0;
}

details p {
    font-size: 12px !important;
    line-height: 1.65;
    margin: 5px 0 10px !important;
}

/* ---------- Untere Werkzeugleiste (wie in /wasser) ---------- */
.tool-area {
    position: absolute;
    z-index: 5;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

#tool-hint {
    font-size: 12px;
    color: #CBD5E1;
    margin: 0 0 11px;
    text-shadow: 0 1px 8px rgba(2, 5, 12, .95);
}

.toolbox {
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: var(--lmb-radius-lg);
    gap: 4px;
}

.toolbox button {
    min-width: 78px;
    min-height: 64px;
    border-radius: var(--lmb-radius-md);
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: #CBD5E1;
    padding: 0 8px;
}

.toolbox button.highlight:not(:disabled) {
    color: #F8FAFC;
    background: rgba(99, 102, 241, .2);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .42);
}

.toolbox button.active {
    color: #fff;
    background: rgba(99, 102, 241, .3);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .65), var(--lmb-shadow-glow);
}

.tool-icon {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tool-divider {
    height: 29px;
    width: 1px;
    background: var(--line-strong);
    margin: 0 4px;
}

.scene-signature {
    position: absolute;
    bottom: 30px;
    right: 30px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .16em;
    color: rgba(203, 213, 225, .42);
    pointer-events: none;
}

.toast {
    position: absolute;
    z-index: 7;
    left: 50%;
    top: 84px;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(480px, calc(100% - 30px));
    padding: 10px 18px;
    background: rgba(20, 27, 45, .95);
    border: 1px solid rgba(99, 102, 241, .42);
    border-radius: var(--lmb-radius-md);
    box-shadow: var(--lmb-shadow-glow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    text-align: center;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s;
}

.toast.visible {
    opacity: 1;
}

/* ---------- Dialoge ---------- */
.island-dialog {
    color: var(--lmb-text-main);
    background: var(--lmb-bg-surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--lmb-radius-lg);
    width: min(540px, calc(100% - 28px));
    max-height: 85dvh;
    overscroll-behavior: contain;
    padding: 24px;
    box-shadow: 0 24px 90px rgba(0, 0, 0, .65);
}

.island-dialog::backdrop {
    background: rgba(4, 6, 11, .74);
    backdrop-filter: blur(7px);
}

.dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.dialog-heading h2 {
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.025em;
    margin: 0;
}

.island-dialog p {
    font-size: 13px;
    color: #CBD5E1;
}

.preset-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 18px 0;
}

.preset-list button {
    padding: 11px 13px;
    min-height: 54px;
    border: 1px solid var(--line-strong);
    border-radius: var(--lmb-radius-md);
    background: rgba(26, 35, 56, .6);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.preset-list button strong {
    font-size: 12.5px;
    color: var(--lmb-text-main);
}

.preset-list button span {
    font-size: 11px;
    color: var(--lmb-text-muted);
}

.preset-list button:hover {
    background: rgba(99, 102, 241, .2);
    border-color: rgba(99, 102, 241, .5);
}

.model-note {
    font-size: 11.5px !important;
    color: var(--lmb-text-muted) !important;
    border-left: 2px solid rgba(139, 92, 246, .45);
    padding-left: 11px;
}

.island-dialog > .secondary {
    margin-top: 16px;
}

.menu-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 18px;
    font-size: 12px;
}

.menu-links a {
    color: var(--lmb-text-muted);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.menu-links a:hover {
    color: var(--lmb-text-main);
    text-decoration: underline;
}

.lmb-footer {
    margin: 0;
    background: var(--lmb-bg-surface);
}

.license-load-notice {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 12px;
    background: var(--lmb-bg-surface-hover);
    border: 1px solid var(--line-strong);
    z-index: 99999;
    border-radius: var(--lmb-radius-md);
}

/* ---------- Responsive Anpassungen ---------- */
@media (max-width: 1023px) {
    .scene-signature {
        display: none;
    }
    .state-pill {
        top: 84px;
    }
    .inspector {
        top: auto;
        bottom: 118px;
        right: 18px;
        left: 18px;
        width: auto;
        max-width: 460px;
        margin-left: auto;
        max-height: 44dvh;
    }
    .binary-stage:has(.inspector:not([hidden])) .lamp-arena {
        align-items: flex-start;
        padding-top: 128px;
    }
}

@media (max-width: 720px) {
    .lamp-row {
        flex-wrap: wrap;
        row-gap: 10px;
    }
    .binary-stage[data-lamps="5"] .lamp-row,
    .binary-stage[data-lamps="6"] .lamp-row,
    .binary-stage[data-lamps="7"] .lamp-row,
    .binary-stage[data-lamps="8"] .lamp-row {
        --bulb-w: 54px;
        --cord-h: 28px;
        gap: 6px;
    }
    .binary-stage[data-lamps="5"] .lamp-unit,
    .binary-stage[data-lamps="6"] .lamp-unit,
    .binary-stage[data-lamps="7"] .lamp-unit,
    .binary-stage[data-lamps="8"] .lamp-unit {
        width: calc(25% - 6px);
        max-width: 82px;
        padding: 4px 2px 8px;
    }
}

@media (max-width: 600px) {
    .topbar {
        inset: max(14px, env(safe-area-inset-top)) 14px auto;
        gap: 9px;
    }
    .brand {
        width: 38px;
        height: 38px;
    }
    .brand img {
        width: 29px;
        height: 29px;
    }
    .title .eyebrow {
        font-size: 7px;
        letter-spacing: .08em;
    }
    h1 {
        font-size: 20px;
    }
    .top-actions {
        gap: 5px;
    }
    .top-actions .icon-btn {
        width: 40px;
        height: 44px;
        font-size: 19px;
    }
    .pill-btn {
        font-size: 11px;
        padding: 0 11px;
    }
    .state-pill {
        top: 72px;
        font-size: 11px;
        padding: 5px 12px;
        gap: 6px;
        max-width: calc(100% - 24px);
    }
    .pill-code {
        font-size: 11px;
    }
    .lamp-arena {
        padding: 112px 12px 116px;
    }
    .lamp-row {
        --bulb-w: 88px;
        --cord-h: 48px;
    }
    .binary-stage[data-lamps="2"] .lamp-row {
        --bulb-w: 78px;
        --cord-h: 42px;
    }
    .binary-stage[data-lamps="3"] .lamp-row,
    .binary-stage[data-lamps="4"] .lamp-row {
        --bulb-w: 62px;
        --cord-h: 34px;
        gap: 8px;
    }
    .lamp-bit {
        min-width: 36px;
        height: 36px;
        font-size: 18px;
        padding: 0 8px;
    }
    .tool-area {
        bottom: max(14px, env(safe-area-inset-bottom));
        width: max-content;
        max-width: calc(100% - 16px);
    }
    .toolbox {
        border-radius: 19px;
        gap: 0;
        padding: 4px;
    }
    .toolbox button {
        min-width: 0;
        width: calc((100vw - 34px) / 5);
        max-width: 74px;
        min-height: 58px;
        font-size: 9.5px;
        padding: 0 2px;
    }
    .tool-divider {
        margin: 0 1px;
    }
    .tool-icon {
        width: 22px;
        height: 22px;
    }
    #tool-hint {
        font-size: 10px;
        margin-bottom: 8px;
    }
    .inspector {
        left: 12px;
        right: 12px;
        bottom: 108px;
        max-height: 42dvh;
        padding: 15px;
        border-radius: 18px;
    }
    .inspector h2 {
        font-size: 20px;
    }
    .preset-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    .brand {
        display: none;
    }
    .topbar {
        gap: 4px;
    }
    h1 {
        font-size: 18px;
    }
    .binary-stage[data-lamps="3"] .lamp-row,
    .binary-stage[data-lamps="4"] .lamp-row {
        --bulb-w: 52px;
        gap: 5px;
    }
    .binary-stage[data-lamps="5"] .lamp-row,
    .binary-stage[data-lamps="6"] .lamp-row,
    .binary-stage[data-lamps="7"] .lamp-row,
    .binary-stage[data-lamps="8"] .lamp-row {
        --bulb-w: 44px;
        --cord-h: 20px;
        gap: 4px;
    }
    .lamp-bit {
        min-width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
