/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus { outline: none; }
*:focus-visible { outline: 2px solid #1a4766; outline-offset: 2px; }

:root {
    --tint: rgb(26, 71, 102);
    --tint-light: rgba(26, 71, 102, 0.2);
    --tint-bg: rgba(26, 71, 102, 0.08);
    --button-green: rgb(43, 145, 67);
    --fabrik-orange: rgb(238, 154, 49);
    --fabrik-red: rgb(220, 70, 70);
    --fabrik-green: rgb(43, 145, 67);

    /* Steuerung der Fertigungsstraße (START/STOP): gedämpftes Grün und Rot
       aus derselben Farbfamilie wie --tint. Bewusst abgesetzt von den
       Werkstückfarben (--color-green/--color-red), die allein den Formen
       gehören. Die Nebenaktion (Zurücksetzen) bleibt ein ruhiger
       Umriss-Button in --tint. */
    --action-green: #17795E;
    --action-red: #B23A32;

    --bg: rgb(245, 245, 245);
    --surface: #fff;
    --surface-2: rgba(0, 0, 0, 0.05);
    --border: rgba(0, 0, 0, 0.1);
    --text: rgb(20, 20, 20);
    --text-secondary: rgb(110, 110, 110);

    --color-red: #FF3B30;
    --color-blue: #007AFF;
    --color-yellow: #FFCC00;
    --color-green: #34C759;
    --color-orange: #FF9500;
    --color-purple: #AF52DE;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.12);
    --shadow-3: 0 4px 12px rgba(0, 0, 0, 0.15);
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Embedded mode (Matheforscher / generic iframe): compact header,
   hide the app title-button (which would open the parental gate). */
body.embedded #header { padding: 8px 12px; min-height: 52px; }
body.embedded .title-button { display: none; }
body.embedded .app-title { font-size: 18px; }
body.embedded .factory-line { padding: 12px; gap: 8px; }
body.embedded .mode-description { font-size: 14px; padding: 6px; }
body.embedded .workpiece-frame { width: 130px; height: 130px; }

button {
    font-family: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- App layout ---------- */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---------- Header ---------- */
#header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--tint-light);
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 64px;
}

.title-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.title-button:hover { background: rgba(0,0,0,0.04); }
.logo-img { height: 28px; width: auto; }
.app-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.header-spacer { flex: 1; }

.difficulty-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-1);
}
.difficulty-stars {
    display: inline-flex;
    gap: 2px;
    font-size: 16px;
    letter-spacing: 1px;
}
.star { color: rgba(120,120,120,0.4); }
.star.filled { color: #FFCC00; }
.chevron { font-size: 10px; color: var(--text-secondary); display: inline-block; transform: scaleY(0.6); margin-left: 2px; }

.game-mode-selector {
    display: flex;
    background: rgba(0,0,0,0.07);
    border-radius: var(--radius-sm);
    padding: 2px;
    box-shadow: var(--shadow-1);
}
.game-mode-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 7px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.game-mode-button.selected {
    background: #fff;
    box-shadow: var(--shadow-1);
}
.game-mode-button .emoji { font-size: 18px; }

/* ---------- Main area ---------- */
#main-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.factory-line {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    overflow-y: auto;
}

/* Row layouts */
.row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.top-row {
    justify-content: space-between;
    flex-wrap: wrap;
}
.bottom-row {
    justify-content: space-between;
    flex-wrap: wrap;
}

.input-area, .output-area {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.workpiece-frame-wrapper {
    position: relative;
    display: inline-block;
}
.workpiece-frame {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}
.start-frame { box-shadow: 0 4px 10px rgba(23,121,94,0.18); }
.end-frame { box-shadow: 0 4px 10px rgba(26,71,102,0.18); }

.overlay-workpiece {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    pointer-events: none;
}

.mode-description {
    flex: 1;
    text-align: center;
    font-size: 22px;
    line-height: 1.3;
    color: var(--text);
    padding: 12px;
    white-space: pre-line;
    min-width: 200px;
}

/* ---------- Machine Grid ---------- */
.machine-grid-wrapper {
    flex-shrink: 0;
    overflow: visible;
}
.machine-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    justify-content: center;
}

.machine-slot {
    aspect-ratio: 1;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
    min-height: 90px;
}
.machine-slot.active {
    box-shadow: 0 0 0 3px var(--tint), var(--shadow-2);
}
.machine-slot.selected {
    box-shadow: 0 0 0 3px var(--color-blue);
}
.machine-slot.dragging {
    opacity: 0.5;
}
.machine-slot.drop-target {
    background: var(--tint-bg);
}

.machine-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.machine-icon {
    width: 60%;
    height: 60%;
    object-fit: contain;
    pointer-events: none;
}
.machine-preview {
    width: 78%;
    aspect-ratio: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-1);
}
.machine-type-label {
    font-size: 11px;
    color: var(--text);
    font-weight: 500;
    text-align: center;
    line-height: 1.1;
    pointer-events: none;
    margin-top: 4px;
}
.machine-config-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.1;
    pointer-events: none;
}

.machine-slot.empty {
    background: rgba(255,255,255,0.6);
    border: 2px dashed rgba(0,0,0,0.15);
    box-shadow: none;
}
.machine-slot.empty .plus-icon {
    font-size: 36px;
    color: rgba(0,0,0,0.25);
    font-weight: 300;
}

.machine-delete-button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--fabrik-red);
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-2);
    z-index: 2;
}
.machine-slot:hover .machine-delete-button,
.machine-slot.selected .machine-delete-button {
    display: flex;
}

@media (max-width: 900px) {
    .machine-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Controls ---------- */
.controls-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}
.start-stop-button {
    padding: 14px 28px;
    background: var(--action-green);
    color: white;
    font-size: 28px;
    font-weight: 700;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(23,121,94,0.30);
    min-width: 150px;
    transition: transform 0.15s, opacity 0.15s, background 0.15s;
}
.start-stop-button.running { background: var(--action-red); box-shadow: 0 4px 10px rgba(178,58,50,0.30); }
.start-stop-button:disabled { opacity: 0.5; transform: scale(0.95); cursor: not-allowed; }

/* Nebenaktion: nur getönt, damit sie hinter START zurücktritt */
.reset-button {
    padding: 10px 18px;
    background: rgba(26,71,102,0.10);
    color: var(--tint);
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    min-width: 150px;
    transition: background 0.15s;
}
.reset-button:hover { background: rgba(26,71,102,0.18); }

/* Liegt wie in iOS (FactoryLineView: ZStack + .offset(y: 60)) als Overlay
   über der unteren Kante der Ergebniskarte — 60 von 160 px unterhalb der
   Rahmenmitte, deshalb prozentual, damit es auf kleinen Rahmen mitskaliert.
   Als Overlay verschiebt der Button beim Erscheinen nichts im Layout. */
.next-task-button {
    position: absolute;
    left: 50%;
    top: 87.5%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    z-index: 6;
    padding: 12px 18px;
    background: var(--tint);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(26,71,102,0.3);
}

/* ---------- Target Area ---------- */
.target-area, .predict-controls-area {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 80px;
}
.target-label {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
}
.target-workpiece-frame {
    width: 160px;
    height: 160px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.target-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.target-action-button {
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 500;
    color: #000;
    width: 110px;
    text-align: center;
}
.target-action-button.retry { background: rgba(43,145,67,0.25); box-shadow: 0 2px 6px rgba(43,145,67,0.2); }
.target-action-button.different { background: rgba(220,70,70,0.18); box-shadow: 0 2px 6px rgba(220,70,70,0.2); }

/* ---------- Result Badge ---------- */
.result-badge {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 5;
    pointer-events: none;
}
.result-badge.success { background: rgba(43,145,67,0.9); display: flex; border: 1.5px solid rgba(0,0,0,0.25); }
.result-badge.failure { background: rgba(220,70,70,0.9); display: flex; border: 1.5px solid rgba(0,0,0,0.25); }

/* ---------- Scan animation ---------- */
.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 6px;
    background: linear-gradient(90deg, transparent, rgba(26,71,102,0.7), transparent);
    box-shadow: 0 0 12px rgba(26,71,102,0.5);
    display: none;
    pointer-events: none;
}
.scan-line.scanning {
    display: block;
    animation: scan-anim 1s linear forwards;
}
@keyframes scan-anim {
    0% { top: 0; }
    50% { top: calc(100% - 6px); }
    100% { top: 0; }
}

/* ---------- Animated workpiece ---------- */
.animated-workpiece {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    left: 0;
    top: 0;
    transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    will-change: transform;
}
.animated-workpiece.no-transition {
    transition: none !important;
}

/* ---------- Bottom Bar ---------- */
.bottom-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 12px;
    flex-wrap: wrap;
}
.counter-area {
    flex: 1;
    min-width: 200px;
}
.counter-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-size: 14px;
}
.bottom-buttons { display: flex; gap: 8px; align-items: center; }

.save-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 50px;
    background: rgba(26,71,102,0.75);
    color: white;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(26,71,102,0.3);
}
.warehouse-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 50px;
    background: rgba(26,71,102,0.85);
    color: white;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(26,71,102,0.3);
}
.warehouse-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.warehouse-icon svg { display: block; }

/* ---------- Popovers ---------- */
#popover-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
}
.popover-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    pointer-events: auto;
}
.popover {
    position: absolute;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    pointer-events: auto;
    max-width: 90vw;
    max-height: 85vh;
    overflow: auto;
    z-index: 201;
    animation: popover-in 0.15s ease-out;
}
@keyframes popover-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.popover-list .popover-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}
.popover-list .popover-row:last-child { border-bottom: none; }
.popover-list .popover-row:hover { background: rgba(0,0,0,0.04); }
.popover-list .popover-row.selected { background: rgba(26,71,102,0.1); }
.popover-list .popover-row .check { margin-left: auto; color: var(--tint); font-size: 18px; }

.popover-section { padding: 16px; }
.popover-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popover-grid {
    display: grid;
    gap: 8px;
}
.popover-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.popover-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.popover-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.popover-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.popover-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }

.shape-option, .color-option, .config-option {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 12px;
    background: white;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.1s, transform 0.1s;
}
.shape-option.selected, .color-option.selected, .config-option.selected {
    border-color: var(--tint);
}
.color-option {
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px transparent, var(--shadow-1);
    aspect-ratio: 1;
}
.color-option.selected {
    box-shadow: 0 0 0 3px var(--tint), var(--shadow-1);
}

.config-option {
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    min-height: 80px;
}
.config-option svg { width: 50px; height: 30px; }

/* ---------- Modal ---------- */
#modal-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 300;
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    pointer-events: auto;
    animation: popover-in 0.2s ease-out;
}
.modal-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}
.modal-header h2 { font-size: 22px; font-weight: 700; }
.modal-close { font-size: 26px; color: var(--text-secondary); padding: 4px 8px; }
.modal-body { padding: 16px 24px 24px; }

/* ---------- Toast ---------- */
#toast-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast {
    pointer-events: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    padding: 20px 26px;
    animation: toast-in 0.3s ease-out;
    max-width: 400px;
}
.toast.success { border-top: 4px solid var(--button-green); }
.toast.error { border-top: 4px solid var(--fabrik-red); }
.toast.info { border-top: 4px solid var(--tint); }
.toast .toast-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.toast .toast-message { font-size: 14px; color: var(--text-secondary); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Settings ---------- */
.settings-modal { width: 700px; max-width: 95vw; }
.settings-section { margin-bottom: 24px; }
.settings-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.settings-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row .label { flex: 1; }
.settings-row .label .title { font-weight: 500; }
.settings-row .label .description { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.toggle {
    position: relative;
    width: 50px;
    height: 30px;
    background: rgba(0,0,0,0.2);
    border-radius: 30px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.toggle.on { background: var(--button-green); }
.toggle.on::after { transform: translateX(20px); }

/* ---------- Parental Gate ---------- */
.parental-gate {
    background: white;
    border-radius: 24px;
    padding: 32px;
    max-width: 420px;
    width: 90vw;
    text-align: center;
}
.parental-gate h2 { margin-bottom: 12px; }
.parental-gate p { color: var(--text-secondary); margin-bottom: 24px; }
.number-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.number-button {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.05);
    border-radius: 16px;
    font-size: 32px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.15s;
}
.number-button.tapped {
    background: var(--button-green);
    color: white;
    border-color: var(--button-green);
}
.number-button.error {
    background: var(--fabrik-red);
    color: white;
    animation: shake 0.5s;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.parental-gate-error { color: var(--fabrik-red); font-size: 14px; min-height: 20px; }

/* ---------- Onboarding ---------- */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.onboarding-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}
.onboarding-card img { height: 60px; margin: 0 auto 16px; }
.onboarding-card h2 { font-size: 24px; margin-bottom: 12px; }
.onboarding-card p { color: var(--text-secondary); line-height: 1.5; margin-bottom: 16px; }
.onboarding-card .hint { font-size: 13px; font-style: italic; }
.onboarding-card .button-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-direction: column;
}
.onboarding-card button {
    padding: 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 16px;
}
.onboarding-card .primary { background: var(--tint); color: white; }
.onboarding-card .secondary { background: rgba(0,0,0,0.05); color: var(--text); }

/* ---------- Video Player ---------- */
.video-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    flex-direction: column;
    gap: 20px;
}
.video-overlay video {
    max-width: 95vw;
    max-height: 80vh;
    border-radius: 12px;
}
.video-close {
    background: white;
    color: black;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
}

/* ---------- Warehouse (iOS-style list layout) ---------- */
.warehouse-modal {
    width: min(960px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: rgb(245, 245, 247);
}
.warehouse-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 5;
}
.wh-header-left { display: flex; justify-content: flex-start; }
.wh-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.wh-header-right { display: flex; justify-content: flex-end; gap: 6px; }
.wh-title {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.wh-title-icon {
    display: inline-flex;
    align-items: center;
    color: var(--tint);
    line-height: 1;
}
.wh-title-icon svg { display: block; }
.wh-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.wh-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tint);
    background: transparent;
    transition: background 0.1s;
    white-space: nowrap;
}
.wh-toolbar-btn:hover:not(:disabled) { background: rgba(0,0,0,0.05); }
.wh-toolbar-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.wh-toolbar-btn .wh-icon { font-size: 16px; }
.wh-toolbar-primary { color: var(--tint); font-weight: 600; }
.wh-toolbar-danger { color: var(--fabrik-red); font-weight: 600; }

.warehouse-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    background: rgb(245, 245, 247);
}

.wh-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.wh-empty-icon {
    color: rgba(0,0,0,0.4);
    margin-bottom: 12px;
    display: inline-block;
}
.wh-empty-icon svg { display: block; margin: 0 auto; }
.wh-empty h3 {
    color: var(--text);
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 600;
}

.wh-list { display: flex; flex-direction: column; gap: 10px; }
.wh-row {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: box-shadow 0.15s, transform 0.15s;
    cursor: pointer;
}
.wh-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.wh-row.selected {
    box-shadow: 0 0 0 2px var(--tint), 0 2px 6px rgba(26,71,102,0.2);
}
.wh-row.dragging { opacity: 0.5; }
.wh-row.drag-over { box-shadow: 0 0 0 2px var(--tint); transform: translateY(-2px); }

.wh-row-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}
.wh-checkbox {
    font-size: 24px;
    line-height: 1;
    padding: 4px;
    background: transparent;
}
.wh-row-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.wh-row-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    min-width: 0;
}

.wh-preview-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    flex-wrap: nowrap;
}
.wh-mini-wp {
    /* 58px statt 48px: renderWorkpiece hält allseitig Platz für gedrehte
       Formen frei, die Form selbst bleibt dadurch gleich groß wie zuvor. */
    width: 58px;
    height: 58px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wh-arrow {
    color: rgba(120,120,120,0.6);
    font-size: 18px;
    flex-shrink: 0;
}
.wh-machines {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.wh-machine-slot {
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.wh-row-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: rgba(0,0,0,0.015);
}

.wh-id-badge {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 13px;
    font-weight: 700;
    color: white;
    background: var(--tint);
    padding: 3px 6px;
    border-radius: 4px;
}
.wh-date {
    font-size: 12px;
    color: var(--text-secondary);
}
.wh-notes-preview {
    font-size: 14px;
    color: var(--text);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wh-mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--tint);
    background: rgba(26,71,102,0.1);
    border-radius: 6px;
    transition: background 0.1s;
}
.wh-mini-btn:hover:not(:disabled) { background: rgba(26,71,102,0.18); }
.wh-mini-btn .wh-mini-icon { font-size: 13px; }
.wh-mini-btn svg { color: currentColor; }
.wh-checkbox svg { display: block; }
.wh-mini-btn.saved {
    color: var(--button-green);
    background: rgba(43,145,67,0.1);
}
.wh-mini-btn.wh-mini-delete {
    color: var(--fabrik-red);
    background: rgba(220,70,70,0.1);
}
.wh-mini-btn.wh-mini-delete:hover { background: rgba(220,70,70,0.18); }

.wh-group-separator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
}
.wh-sep-line {
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.15);
}
.wh-sep-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: rgba(0,0,0,0.06);
    border-radius: 8px;
}

.wh-sort-menu {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 6px;
}
.wh-sort-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    border-radius: 6px;
    font-size: 14px;
    background: transparent;
    transition: background 0.1s;
}
.wh-sort-item:hover { background: rgba(0,0,0,0.05); }
.wh-sort-item.selected { background: rgba(26,71,102,0.08); color: var(--tint); font-weight: 500; }
.wh-sort-item .check { color: var(--tint); font-weight: bold; }

@media (max-width: 768px) {
    .warehouse-header {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .wh-header-left, .wh-header-right { justify-content: center; }
    .wh-header-center { order: -1; }
    .wh-row-top { flex-direction: column; align-items: stretch; }
    .wh-row-actions { flex-direction: row; justify-content: center; }
    .wh-row-bottom { flex-wrap: wrap; }
    .wh-notes-preview { max-width: 100%; flex-basis: 100%; }
}

/* ---------- Misc ---------- */
.divider { height: 1px; background: rgba(0,0,0,0.08); margin: 12px 0; }

/* Drag preview */
.drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.7;
    transform: translate(-50%, -50%);
}

/* ---------- Machine Config Popover ---------- */
.machine-config-popover {
    padding: 14px;
    min-width: 320px;
    max-width: 95vw;
}
.machine-config-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-end;
}
.mc-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border-radius: 6px;
    transition: background 0.1s;
}
.mc-action-btn:hover:not(:disabled) { background: rgba(0,0,0,0.05); }
.mc-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mc-action-btn .mc-icon { font-size: 14px; }
.mc-action-tint { color: var(--tint); }
.mc-action-delete { color: var(--fabrik-red); }
.mc-toolbar-divider {
    width: 1px;
    height: 22px;
    background: rgba(0,0,0,0.12);
    margin: 0 2px;
}
.mc-divider {
    height: 1px;
    background: rgba(0,0,0,0.1);
    margin: 12px 0;
}
.mc-content {
    margin-bottom: 6px;
}
.mc-section-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}
.mc-config-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    width: 80px;
    min-height: 84px;
    background: white;
    border-radius: 6px;
    border: 2px solid transparent;
    font-size: 12px;
    transition: background 0.1s, border-color 0.1s;
}
.mc-config-option:hover { background: rgba(0,0,0,0.03); }
.mc-config-option.selected {
    background: rgba(0,122,255,0.15);
    border-color: var(--color-blue);
}
.mc-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.mc-done-btn {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tint);
    background: transparent;
}
.mc-done-btn:hover { background: rgba(0,0,0,0.05); border-radius: 6px; }

/* ---------- Predict Design Popover (iOS-style, compact & adaptive) ---------- */
.predict-design-popover {
    width: min(540px, 92vw);
    max-height: min(560px, 88vh);
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
}
.pd-layout {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 10px;
    align-items: stretch;
    min-height: 0;
    flex: 1;
}
.pd-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* Segmented tab bar */
.pd-tabs {
    display: flex;
    background: rgba(120,120,128,0.16);
    border-radius: 7px;
    padding: 2px;
    margin-bottom: 8px;
    gap: 2px;
}
.pd-tab {
    flex: 1;
    padding: 5px 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    border-radius: 6px;
    background: transparent;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pd-tab.active {
    background: white;
    box-shadow: var(--shadow-1);
}

.pd-variations {
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    padding: 6px;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}
.pd-grid { display: grid; gap: 4px; }
.pd-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pd-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.pd-variation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 2px;
    background: rgba(0,122,255,0.08);
    border: 2px solid transparent;
    border-radius: 6px;
    transition: background 0.1s, border-color 0.1s, transform 0.1s;
    aspect-ratio: 1;
}
.pd-variation:hover {
    background: rgba(0,122,255,0.18);
    transform: scale(1.03);
}
.pd-variation:active { transform: scale(0.97); }
.pd-shape-box {
    width: 100%;
    aspect-ratio: 1;
    max-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pd-shape-box svg { width: 80%; height: 80%; display: block; }
/* Formen-Varianten brauchen wegen der Rotationsreserve etwas mehr Fläche,
   damit die gedrehte Form gleich groß wirkt wie bei Linien/Löchern. */
.pd-shape-box.with-rotation-pad svg { width: 98%; height: 98%; }
.pd-variation-label {
    font-size: 10px;
    color: var(--text);
    line-height: 1;
}

/* Right column */
.pd-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.pd-preview-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}
.pd-preview-title {
    font-size: 13px;
    font-weight: 600;
}
.pd-done {
    color: var(--tint);
    font-size: 13px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 6px;
}
.pd-done:hover { background: rgba(0,0,0,0.05); }
.pd-preview-frame {
    width: 86px;
    height: 86px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,122,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}
.pd-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.pd-btn {
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--tint);
    background: transparent;
    border: 1px solid rgba(0,122,255,0.4);
    transition: background 0.1s;
}
.pd-btn:hover:not(:disabled) { background: rgba(0,122,255,0.08); }
.pd-btn:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 600px) {
    .predict-design-popover { width: 95vw; padding: 8px; }
    .pd-layout { grid-template-columns: 1fr; }
    .pd-right { flex-direction: row; align-items: center; gap: 10px; }
    .pd-preview-header { flex-direction: column; align-items: center; }
    .pd-preview-frame { width: 70px; height: 70px; }
    .pd-actions { flex-direction: row; margin-top: 0; flex-wrap: wrap; }
    .pd-actions .pd-btn { flex: 1; }
}

/* Optimize feedback */
.optimize-feedback-toast {
    background: white;
    padding: 20px 28px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    font-size: 16px;
}

/* Optimize choice dialog */
.optimize-choice-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.optimize-choice-buttons button {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    font-weight: 600;
}
.optimize-choice-buttons .continue { background: var(--tint); color: white; }
.optimize-choice-buttons .next { background: var(--tint); color: white; opacity: 0.85; }

/* Landscape adjustments */
@media (max-width: 768px) and (orientation: portrait) {
    .machine-grid { grid-template-columns: repeat(4, 1fr); }
    .mode-description { font-size: 16px; }
    .workpiece-frame, .target-workpiece-frame { width: 110px; height: 110px; }
    .app-title { font-size: 22px; }
    .game-mode-button { padding: 6px 8px; font-size: 12px; }
    .start-stop-button { font-size: 22px; padding: 12px 22px; min-width: 120px; }
}

@media (max-width: 600px) {
    #header { padding: 10px 12px; gap: 6px; }
    .header-spacer { display: none; }
    .game-mode-button .label { display: none; }
    .factory-line { padding: 10px; }
    .mode-description { font-size: 14px; padding: 6px; min-width: 120px; }
    .workpiece-frame, .target-workpiece-frame { width: 90px; height: 90px; }
    .machine-slot { min-height: 72px; padding: 4px; }
    .machine-config-label { font-size: 9px; }
    .start-stop-button { font-size: 18px; min-width: 100px; padding: 10px 16px; }
    .reset-button { font-size: 12px; min-width: 100px; padding: 8px 12px; }
    .warehouse-button span, .save-button span:not(.save-arrow) { display: none; }
}

/* ============================================================
   Kartendruck (printCards.js)
   Karten werden in echten cm-Maßen gesetzt, damit der Ausdruck
   maßhaltig ist und die Karten ausgeschnitten werden können.
   ============================================================ */

#print-root { display: none; }

.pc-document {
    background: #fff;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Eine Straße = Übersichtskarte + zugehörige Quadratkarten.
   Der Block darf umbrechen, einzelne Karten dürfen es nie. */
.pc-street {
    break-inside: auto;
    margin: 0 0 6mm 0;
}
.pc-street:last-child { margin-bottom: 0; }

/* inline-block statt flex: bricht im Druck zuverlässig über Seiten um */
.pc-squares {
    display: block;
    font-size: 0; /* schluckt Whitespace zwischen inline-block-Karten */
}

.pc-card {
    box-sizing: border-box;
    display: inline-flex;
    flex-direction: column;
    vertical-align: top;
    margin: 0 2mm 2mm 0;
    padding: 1.2mm;
    background: #fff;
    border: 0.2mm dashed rgba(0, 0, 0, 0.5);
    overflow: hidden;
    font-size: 2.1mm; /* setzt font-size:0 des Grids zurück */
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.pc-card--overview {
    display: flex;
    margin-bottom: 2.5mm;
}

/* Schnittmarken aus: Rahmen bleibt als transparente Linie erhalten,
   damit sich die Kartenmaße nicht verändern */
.pc-no-cutmarks .pc-card { border-color: transparent; }

.pc-card-art {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pc-card-art svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.pc-card-label {
    flex: 0 0 auto;
    font-size: 2.1mm;
    line-height: 1.25;
    text-align: center;
    color: #333;
    padding-top: 0.8mm;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-card-label--overview {
    text-align: left;
    padding-left: 0.5mm;
    font-weight: 600;
}

/* ---------- Bildschirmvorschau ---------- */

.pc-preview-modal {
    display: flex;
    flex-direction: column;
    width: min(94vw, 1100px);
    height: min(92vh, 900px);
}

.pc-preview-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-wrap: wrap;
}
.pc-preview-head h3 { margin: 0; font-size: 20px; }
.pc-preview-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
}

.pc-preview-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

.pc-settings {
    flex: 0 0 260px;
    padding: 16px 18px;
    overflow-y: auto;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pc-field { display: flex; flex-direction: column; gap: 6px; }
.pc-field > label {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.pc-field-value {
    font-weight: 500;
    color: var(--tint);
    font-variant-numeric: tabular-nums;
}
.pc-field input[type="range"] { width: 100%; accent-color: var(--tint); }
.pc-field select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    font-size: 14px;
    background: #fff;
}
.pc-field-hint { font-size: 11px; color: var(--text-secondary); line-height: 1.35; }

.pc-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}
.pc-toggle input { width: 18px; height: 18px; accent-color: var(--tint); }

.pc-preview-stage {
    flex: 1;
    overflow: auto;
    background: rgba(0, 0, 0, 0.08);
    padding: 20px;
    min-width: 0;
}

/* Simuliertes Blatt: exakt so breit wie der bedruckbare Bereich */
.pc-sheet {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    margin: 0 auto;
    transform-origin: top center;
}

.pc-preview-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-wrap: wrap;
}
.pc-preview-note { font-size: 12px; color: var(--text-secondary); flex: 1; min-width: 180px; }
.pc-preview-actions { display: flex; gap: 10px; }
.pc-btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
}
.pc-btn--primary { background: var(--tint); color: #fff; }
.pc-btn--secondary { background: rgba(0, 0, 0, 0.06); color: var(--text); }

.pc-warning {
    font-size: 12px;
    color: var(--fabrik-red);
    line-height: 1.35;
}

@media (max-width: 860px) {
    .pc-preview-body { flex-direction: column; }
    .pc-settings {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        flex-direction: row;
        flex-wrap: wrap;
        gap: 14px 20px;
    }
    .pc-field { flex: 1 1 200px; }
}

/* ---------- Druck ---------- */

@media print {
    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    #app { display: none !important; }
    #print-root {
        display: block !important;
        position: static !important;
    }
    .pc-card {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================
   Erweiterte Lehrkraft-Einstellungen (Handreichung, Info, Regeln)
   ============================================================ */

.settings-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: rgba(26, 71, 102, 0.08);
    border-radius: 12px;
}
.settings-banner-icon { color: var(--tint); flex-shrink: 0; line-height: 0; margin-top: 2px; }
.settings-banner p { font-size: 14px; line-height: 1.45; margin: 0 0 4px; }
.settings-banner a {
    font-size: 14px;
    font-weight: 600;
    color: var(--tint);
    text-decoration: none;
    word-break: break-word;
}
.settings-banner a:hover { text-decoration: underline; }

.settings-subheading {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 6px;
}
.settings-section > .settings-subheading:first-of-type { margin-top: 8px; }

.settings-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.settings-rules {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.settings-rules li {
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.settings-rules li::before {
    content: "•";
    position: absolute;
    left: 6px;
    color: var(--tint);
    font-weight: 700;
}
.settings-rules li strong { color: var(--text); }

.settings-adaptive-info[hidden] { display: none; }

.settings-row.disabled { opacity: 0.5; }
.settings-row.disabled .toggle { cursor: not-allowed; }

/* ============================================================
   Hinweis im Einsparen-Modus
   ============================================================ */

.optimize-hint {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    margin: 10px auto 0;
    max-width: 560px;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.35);
    border-radius: 12px;
}
.optimize-hint-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}
.optimize-hint-head .icon { color: var(--fabrik-orange); line-height: 0; }
.optimize-hint-attempts { font-size: 14px; color: var(--text-secondary); }
.optimize-hint-button {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--fabrik-orange);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}
.optimize-hint-solution { display: flex; flex-direction: column; gap: 8px; }
.optimize-hint-label { font-size: 12px; font-weight: 600; }
.optimize-hint-machines { display: flex; flex-wrap: wrap; gap: 8px; }
.optimize-hint-machine { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.optimize-hint-machine .slot {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}
.optimize-hint-machine .index { font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.optimize-hint-retry {
    align-self: flex-start;
    font-size: 13px;
    color: var(--fabrik-orange);
    font-weight: 600;
    text-decoration: underline;
    background: none;
    padding: 4px 0;
}
