@import url(https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Fira+Code:wght@400;500;600&display=swap);
/* CodeFuchs Main Styles — "Waldlichtung" Theme */

:root {
    /* Fuchs-Palette: Waldtöne mit warmem Akzent */
    --fox-orange: #D4651E;
    --fox-light: #E8943A;
    --fox-glow: #F5C463;
    --forest-deep: #172119;
    --forest-mid: #243528;
    --forest-light: #3A5440;
    --bark: #4A3228;
    --bark-light: #7A6052;
    --moss: #5E9A50;
    --moss-bright: #8EC47F;
    --sky-blue: #5AA3C8;
    --berry: #C84B68;
    --cream: #FAF5EF;
    --cream-warm: #F7EDE0;
    --parchment: #EFE6D8;

    /* Semantic */
    --bg-main: var(--forest-deep);
    --bg-panel: var(--cream);
    --text-dark: #1E160E;
    --text-mid: #544537;
    --text-light: #F0E8DD;
    --editor-bg: #181C24;
    --success: var(--moss);
    --error: var(--berry);

    /* Spacing */
    --gap: 10px;
    --radius: 12px;
    --radius-sm: 8px;

    /* Shadows — layered for depth */
    --shadow-sm: 0 1px 3px rgba(23, 33, 25, 0.14);
    --shadow-md: 0 4px 12px rgba(23, 33, 25, 0.12), 0 1px 3px rgba(23, 33, 25, 0.08);
    --shadow-lg: 0 12px 40px rgba(23, 33, 25, 0.18), 0 4px 12px rgba(23, 33, 25, 0.10);
    --shadow-inset: inset 0 2px 4px rgba(23, 33, 25, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    overflow: hidden;
    /* Subtle texture via radial noise */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(123, 174, 110, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232, 115, 42, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(107, 181, 217, 0.04) 0%, transparent 40%);
}

.container {
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
header {
    background: var(--forest-deep);
    border-bottom: 3px solid var(--fox-orange);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    container-type: inline-size;
}

/* Subtle glow line under header */
header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--fox-glow) 20%,
        var(--fox-orange) 50%,
        var(--fox-glow) 80%,
        transparent 100%
    );
    opacity: 0.6;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

header h1 {
    display: none;
}

.logo-mascot {
    height: 42px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 6px rgba(232, 115, 42, 0.4));
}

.logo-mascot:hover {
    transform: scale(1.08) rotate(3deg);
}

.logo-text {
    height: 38px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.3));
}

/* ═══════════════════════════════════════════
   MOBILE LANDING PAGE
   ═══════════════════════════════════════════ */
.mobile-landing { display: none; }

@media (max-width: 767px) {

    html, body { overflow: auto !important; height: auto !important; background-image: none; }

    .container { display: none !important; }

    .mobile-landing {
        display: block;
        background: var(--forest-deep);
        min-height: 100vh;
        font-family: 'Nunito', sans-serif;
        color: var(--cream);
    }

    /* Header */
    .ml-header {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 18px 24px;
        border-bottom: 2px solid rgba(212, 101, 30, 0.3);
        background: rgba(23, 33, 25, 0.95);
        position: sticky;
        top: 0;
        z-index: 10;
        backdrop-filter: blur(8px);
    }

    .ml-logo {
        height: 28px;
        filter: drop-shadow(0 1px 4px rgba(0,0,0,0.4));
    }

    /* Hero */
    .ml-hero {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 48px 28px 52px;
        overflow: hidden;
    }

    .ml-hero-glow {
        position: absolute;
        top: -60px;
        left: 50%;
        transform: translateX(-50%);
        width: 320px;
        height: 320px;
        background: radial-gradient(circle, rgba(212, 101, 30, 0.22) 0%, transparent 70%);
        pointer-events: none;
    }

    @keyframes ml-bob {
        0%, 100% { transform: translateY(0) rotate(-2deg); }
        50%       { transform: translateY(-10px) rotate(2deg); }
    }

    .ml-fox {
        height: 120px;
        margin-bottom: 24px;
        filter: drop-shadow(0 8px 24px rgba(212, 101, 30, 0.45));
        animation: ml-bob 3.5s ease-in-out infinite;
        position: relative;
        z-index: 1;
    }

    .ml-headline {
        font-size: 2.4rem;
        font-weight: 900;
        line-height: 1.15;
        margin-bottom: 14px;
        color: var(--cream);
        letter-spacing: -0.02em;
        position: relative;
        z-index: 1;
    }

    .ml-headline span {
        color: var(--fox-glow);
        display: block;
    }

    .ml-sub {
        font-size: 1rem;
        line-height: 1.65;
        color: rgba(240, 232, 221, 0.75);
        max-width: 280px;
        margin-bottom: 28px;
        position: relative;
        z-index: 1;
    }

    .ml-badge {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: rgba(255,255,255,0.07);
        border: 1px solid rgba(255,255,255,0.14);
        border-radius: 999px;
        padding: 8px 18px;
        font-size: 0.82rem;
        font-weight: 700;
        color: var(--moss-bright);
        letter-spacing: 0.02em;
        position: relative;
        z-index: 1;
    }

    /* Features */
    .ml-features {
        padding: 0 20px 8px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .ml-feature {
        display: flex;
        align-items: flex-start;
        gap: 16px;
        background: rgba(255,255,255,0.045);
        border: 1px solid rgba(255,255,255,0.09);
        border-radius: 16px;
        padding: 18px 20px;
        transition: background 0.2s;
    }

    .ml-feature:active { background: rgba(255,255,255,0.08); }

    .ml-feature-icon {
        font-size: 2rem;
        line-height: 1;
        flex-shrink: 0;
        margin-top: 2px;
    }

    .ml-feature strong {
        display: block;
        font-size: 1rem;
        font-weight: 800;
        color: var(--fox-glow);
        margin-bottom: 4px;
    }

    .ml-feature p {
        font-size: 0.875rem;
        line-height: 1.55;
        color: rgba(240, 232, 221, 0.72);
        margin: 0;
    }

    /* CTA */
    .ml-cta {
        padding: 40px 24px 32px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 18px;
    }

    .ml-cta-text {
        font-size: 0.95rem;
        line-height: 1.6;
        color: rgba(240, 232, 221, 0.75);
        max-width: 260px;
    }

    .ml-cta-btn {
        display: inline-block;
        background: var(--fox-orange);
        color: #fff;
        font-weight: 800;
        font-size: 1rem;
        font-family: 'Nunito', sans-serif;
        text-decoration: none;
        padding: 14px 32px;
        border-radius: 999px;
        box-shadow: 0 4px 20px rgba(212, 101, 30, 0.45);
        transition: transform 0.15s, box-shadow 0.15s;
        letter-spacing: 0.01em;
    }

    .ml-cta-btn:active {
        transform: scale(0.97);
        box-shadow: 0 2px 10px rgba(212, 101, 30, 0.3);
    }

    /* Footer */
    .ml-footer {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        padding: 20px 24px;
        border-top: 1px solid rgba(255,255,255,0.08);
        font-size: 0.75rem;
        color: rgba(240, 232, 221, 0.35);
        font-weight: 600;
    }

}

/* ═══════════════════════════════════════════
   BURGER-MENÜ (nur Tablet)
   ═══════════════════════════════════════════ */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.burger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--cream-warm, #f0e8dd);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.burger-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}
.burger-overlay.open { display: block; }

.burger-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background: var(--forest-deep, #1a2e1a);
    border-left: 2px solid var(--fox-orange, #e8732a);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 10px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.4);
}
.burger-sidebar.open { transform: translateX(0); }

.burger-close {
    align-self: flex-end;
    background: none;
    border: none;
    color: var(--cream-warm, #f0e8dd);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.burger-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.burger-menu-btn {
    width: 100%;
    justify-content: flex-start;
    font-size: 13px !important;
}

.burger-mode-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}
.burger-mode-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.07);
    color: var(--cream, #f0e8dd);
    font-size: 13px;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
}
.burger-mode-btn.active {
    background: var(--fox-orange);
    border-color: var(--fox-orange);
    color: #fff;
}
.burger-mode-btn:hover:not(.active) {
    border-color: var(--fox-orange);
    background: rgba(232,115,42,0.15);
}

#burger-examples-dropdown {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--forest-light);
    background: var(--forest-mid);
    color: var(--cream);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.2s;
}
#burger-examples-dropdown:hover,
#burger-examples-dropdown:focus {
    border-color: var(--fox-orange);
    outline: none;
}
#burger-examples-dropdown option {
    background: var(--forest-mid);
    color: var(--cream);
}

.burger-view-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.burger-view-toggle .view-btn {
    width: 100%;
    text-align: left;
}

/* Kompakter Header bei mittleren Breiten — verhindert Überlappungen */
@media (min-width: 768px) and (max-width: 1199px) {
    header { gap: 6px; padding: 8px 12px; }
    .header-title { gap: 5px; }
    .logo-mascot { height: 34px; }
    .logo-text { height: 30px; }
    .btn { padding: 5px 10px; font-size: 12px; }
    .controls { gap: 4px; }
    .controls .btn-group { gap: 3px; padding-right: 6px; }

    /* Burger anzeigen, unwichtige Buttons verstecken */
    .burger-btn { display: flex; }
    #mode-toggle,
    #examples-dropdown,
    #projekte-btn,
    #help-btn,
    #tutorial-toggle,
    #tour-btn { display: none !important; }

    /* view-toggle & game-only buttons in header verstecken */
    .header-title .view-toggle,
    #templates-btn,
    #export-btn { display: none !important; }
}

/* Im Game-Mode auf Tablet: View-Toggle bleibt versteckt (Tabs übernehmen), Burger-View-Toggle auch */
@media (min-width: 768px) and (max-width: 1199px) {
    body.game-mode .header-title .view-toggle { display: none !important; }
    body.game-mode #burger-view-toggle { display: none !important; }
}

/* Desktop: Burger immer anzeigen, überladene Buttons verstecken */
@media (min-width: 1200px) {
    .burger-btn { display: flex; }
    #mode-toggle,
    #examples-dropdown,
    #projekte-btn,
    #help-btn,
    #tutorial-toggle,
    #tour-btn { display: none !important; }

    /* Game-Mode zusätzlich: Vorlagen/Export aus Header */
    body.game-mode #templates-btn,
    body.game-mode #export-btn { display: none !important; }

    /* View-Toggle bleibt im Header (Desktop Game-Mode), nicht im Burger */
    body.game-mode #burger-view-toggle { display: none !important; }
}

/* ═══════════════════════════════════════════
   CONTROLS / BUTTONS
   ═══════════════════════════════════════════ */
.controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.btn-group-run {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.btn {
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--moss);
    color: white;
    box-shadow: 0 2px 8px rgba(123, 174, 110, 0.3);
}

.btn-primary:hover {
    background: #6EA362;
    box-shadow: 0 3px 12px rgba(123, 174, 110, 0.4);
}

.btn-secondary {
    background: var(--berry);
    color: white;
    box-shadow: 0 2px 8px rgba(200, 75, 104, 0.3);
}

.btn-secondary:hover {
    background: #B04060;
}

.btn-info {
    background: var(--bark);
    color: var(--cream);
    box-shadow: 0 2px 8px rgba(92, 64, 51, 0.3);
}

.btn-info:hover {
    background: #4E3529;
}

.btn-warning {
    background: var(--fox-orange);
    color: white;
    box-shadow: 0 2px 8px rgba(232, 115, 42, 0.3);
}

.btn-warning:hover {
    background: #D46824;
}

/* templates-btn und export-btn erben .btn + .btn-warning — kein Override nötig */

/* Button-Gruppen mit visuellen Trennern */
.controls .btn-group {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-right: 10px;
}

.controls .btn-group:last-of-type {
    border-right: none;
    padding-right: 0;
}

/* Icon/sekundäre Buttons im Header — einheitliche Höhe */
.btn.btn-icon,
.btn.btn-help {
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--cream);
    border: 1px solid rgba(74, 50, 40, 0.35);
    font-size: 13px;
}

.btn.btn-icon:hover,
.btn.btn-help:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--fox-orange);
    color: #fff;
}

.btn.btn-reset
{
    padding: 3px 5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--cream);
    border: 1px solid rgba(74, 50, 40, 0.35);
    font-size: 12px;
}
.btn.btn-reset:hover {
    background: rgba(206, 6, 6, 0.132);
    border-color: var(--fox-orange);
}

#examples-dropdown {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--forest-light);
    background: var(--forest-mid);
    color: var(--cream);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-width: 160px;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.2s;
}

#examples-dropdown:hover,
#examples-dropdown:focus {
    border-color: var(--fox-orange);
    outline: none;
}

#examples-dropdown option {
    background: var(--forest-mid);
    color: var(--cream);
}

/* ═══════════════════════════════════════════
   MAIN CONTENT GRID
   ═══════════════════════════════════════════ */
.main-content {
    display: grid;
    gap: var(--gap);
    padding: var(--gap);
    height: calc(100vh - 66px);
    overflow: hidden;
}

@media (min-width: 1200px) {
    .main-content {
        grid-template-columns: 2fr 1fr 260px;
        grid-template-rows: 1fr 1fr;
        grid-template-areas:
            "editor output sidebar"
            "editor visual sidebar";
    }
    .editor-pane { grid-area: editor; }
    .output-pane { grid-area: output; }
    .visual-pane { grid-area: visual; }
    .tutorial-pane { grid-area: tutorial; }
    .sidebar { grid-area: sidebar; }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "editor editor"
            "output visual"
            "sidebar sidebar";
    }
    .editor-pane { grid-area: editor; min-height: 300px; }
    .output-pane { grid-area: output; min-height: 250px; }
    .visual-pane { grid-area: visual; min-height: 250px; }
    .tutorial-pane { grid-area: tutorial; min-height: 250px; }
    .sidebar { grid-area: sidebar; max-height: 400px; overflow-y: auto; }
}

@media (max-width: 767px) {
    header {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
    }
    .header-title { justify-content: center; margin-bottom: 8px; }
    .controls { justify-content: center; }
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: calc(100vh - 130px);
        padding: 8px;
        gap: 8px;
    }
    .editor-pane, .output-pane, .visual-pane, .sidebar { display: none; }
    .editor-pane.active, .output-pane.active, .visual-pane.active, .sidebar.active { display: flex; }
}

/* ═══════════════════════════════════════════
   PANELS
   ═══════════════════════════════════════════ */
.panel {
    background: var(--cream);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(92, 64, 51, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 8px 14px;
    background: var(--parchment);
    border-bottom: 1px solid rgba(74, 50, 40, 0.12);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header-btn {
    background: none;
    border: 1px solid rgba(92, 64, 51, 0.12);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s ease;
}

.panel-header-btn:hover {
    background: rgba(232, 115, 42, 0.1);
    border-color: var(--fox-orange);
}

.panel-header h2 {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.panel-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Editor-Pane — kein Extra-Padding, der Editor füllt alles */
.editor-pane {
    min-height: 400px;
}

.editor-pane .panel-content {
    padding: 0;
}

/* ═══════════════════════════════════════════
   OUTPUT PANE
   ═══════════════════════════════════════════ */
#output-content {
    background: var(--editor-bg);
    color: var(--moss-bright);
    padding: 14px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.7;
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    border-radius: 0;
}

.output-placeholder {
    color: var(--bark-light);
    font-style: italic;
    font-family: 'Nunito', sans-serif;
    padding: 20px;
    text-align: center;
    opacity: 0.7;
    font-size: 13px;
}

/* Terminal Input */
.output-input-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: rgba(123, 174, 110, 0.08);
    border-left: 3px solid var(--moss);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 8px 0;
    animation: slideIn 0.25s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.output-prompt {
    color: var(--fox-glow);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.output-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.output-input-prefix {
    color: var(--moss);
    font-weight: 700;
}

.output-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--forest-light);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--moss-bright);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.output-input:focus {
    border-color: var(--fox-orange);
    box-shadow: 0 0 0 3px rgba(232, 115, 42, 0.15);
}

.output-input::placeholder {
    color: rgba(163, 212, 149, 0.4);
}

.output-input-hint {
    color: rgba(163, 212, 149, 0.5);
    font-size: 11px;
    font-style: italic;
}

.output-echo {
    color: var(--sky-blue);
    font-weight: 600;
}

.output-echo::before {
    content: '> ';
    color: var(--moss);
}

@media (max-width: 767px) {
    .output-input-container { padding: 8px; }
    .output-input { font-size: 16px; padding: 10px; }
}

/* ═══════════════════════════════════════════
   CANVAS / VISUAL PANE
   ═══════════════════════════════════════════ */
.visual-pane .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.canvas-controls {
    display: flex;
    gap: 3px;
}

.canvas-btn {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(74, 50, 40, 0.18);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.canvas-btn:hover {
    background: var(--fox-orange);
    color: white;
    border-color: var(--fox-orange);
}

.canvas-btn.active {
    background: var(--fox-orange);
    color: white;
    border-color: var(--fox-orange);
}

/* Fullscreen-Toggle nur im Game-Modus sichtbar */
#canvas-fullscreen-toggle {
    display: none;
}

body.game-mode #canvas-fullscreen-toggle {
    display: flex;
}

#turtle-canvas {
    background: white;
    width: 100%;
    flex: 1;
    min-height: 200px;
    cursor: grab;
    border-radius: 0;
}

#turtle-canvas:active {
    cursor: grabbing;
}

/* ═══════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════ */
.sidebar {
    overflow-y: auto;
}

.sidebar .panel-content {
    padding: 10px;
    gap: 8px;
    overflow-y: auto;
}

.info-section {
    margin-bottom: 8px;
    padding: 10px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(92, 64, 51, 0.08);
    box-shadow: var(--shadow-sm);
}

.info-section h3 {
    margin-bottom: 8px;
    color: var(--fox-orange);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 4px 0;
    border-bottom: 1px solid rgba(74, 50, 40, 0.06);
    font-size: 0.82rem;
    color: var(--text-dark);
}

.info-section li:last-child {
    border-bottom: none;
}

.info-section code {
    background: rgba(232, 115, 42, 0.08);
    color: var(--fox-orange);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    font-weight: 500;
}

#variables-list,
#functions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.variable-item,
.function-item {
    background: var(--cream-warm);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--text-dark);
    border-left: 3px solid var(--fox-light);
}

/* ═══════════════════════════════════════════
   ERROR MODAL
   ═══════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(27, 42, 29, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 28px;
    border-radius: var(--radius);
    max-width: 460px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--berry);
}

.modal-content h2 {
    color: var(--berry);
    margin-bottom: 12px;
    font-weight: 800;
    font-size: 1.2rem;
}

.modal-content p {
    margin-bottom: 18px;
    line-height: 1.6;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.modal-content button {
    width: 100%;
}

/* ═══════════════════════════════════════════
   CUSTOM DIALOG MODAL
   ═══════════════════════════════════════════ */
.custom-dialog-modal .custom-dialog-content {
    max-width: 420px;
    text-align: left;
}

.custom-dialog-content h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.custom-dialog-content #dialog-message {
    margin-bottom: 16px;
    color: var(--text-mid);
    line-height: 1.5;
    white-space: pre-wrap;
}

.dialog-input-container {
    margin-bottom: 16px;
}

.dialog-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid #e0d6cc;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dialog-input:focus {
    outline: none;
    border-color: var(--fox-orange);
    box-shadow: 0 0 0 3px rgba(232, 115, 42, 0.15);
}

.dialog-list-container {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid #e0d6cc;
    border-radius: var(--radius-sm);
}

.dialog-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dialog-list li {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0e8df;
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-list li:last-child {
    border-bottom: none;
}

.dialog-list li:hover {
    background: var(--cream-warm);
}

.dialog-list li.selected {
    background: rgba(232, 115, 42, 0.12);
    border-left: 3px solid var(--fox-orange);
}

.dialog-list-name {
    font-weight: 600;
    color: var(--text-dark);
}

.dialog-list-date {
    font-size: 12px;
    color: var(--text-mid);
}

.dialog-list-delete {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--berry);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.dialog-list li:hover .dialog-list-delete {
    opacity: 1;
}

.dialog-list-delete:hover {
    background: #c04a68;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.dialog-buttons .btn {
    width: auto;
    min-width: 100px;
    padding: 10px 20px;
}

.dialog-buttons .btn-secondary {
    background: #5A6878;
    color: white;
    border: none;
}

.dialog-buttons .btn-secondary:hover {
    background: #4A5868;
}

.btn-danger {
    background: var(--berry);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #c04a68;
}

/* ═══════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════ */
.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner.active {
    display: inline-block;
}

/* ═══════════════════════════════════════════
   SCROLLBARS — thin, unobtrusive
   ═══════════════════════════════════════════ */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(92, 64, 51, 0.2);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(92, 64, 51, 0.35);
}

/* Dark panels get light scrollbars */
#output-content::-webkit-scrollbar-thumb,
.code-editor::-webkit-scrollbar-thumb,
.syntax-highlight::-webkit-scrollbar-thumb {
    background: rgba(163, 212, 149, 0.2);
}

#output-content::-webkit-scrollbar-thumb:hover,
.code-editor::-webkit-scrollbar-thumb:hover,
.syntax-highlight::-webkit-scrollbar-thumb:hover {
    background: rgba(163, 212, 149, 0.35);
}

/* ═══════════════════════════════════════════
   MODE TOGGLE (CodeFuchs / GameFuchs)
   ═══════════════════════════════════════════ */
.mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
    margin-right: 8px;
}

.mode-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Nunito', sans-serif;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.mode-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
    background: var(--fox-orange);
    color: white;
    box-shadow: 0 2px 6px rgba(212, 101, 30, 0.45);
}

/* ═══════════════════════════════════════════
   VIEW TOGGLE (Code / Sprites / Level)
   ═══════════════════════════════════════════ */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
    margin-right: 8px;
}

.view-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Nunito', sans-serif;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.view-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.view-btn.active {
    background: var(--fox-orange);
    color: white;
    box-shadow: 0 2px 6px rgba(212, 101, 30, 0.45);
}

/* ═══════════════════════════════════════════
   GAMEFUCHS THEME — Blaue Variante
   ═══════════════════════════════════════════ */
body.game-mode {
    --fox-orange: #3574E0;
    --fox-light: #5A94F0;
    --fox-glow: #8AB6F8;
    --forest-deep: #0C1320;
    --forest-mid: #182338;
    --forest-light: #2B3E58;
    --bark: #3D4F66;
    --bark-light: #5A6E85;
    --moss: #3574E0;
    --moss-bright: #5A94F0;
    --sky-blue: #30ACE8;
    --berry: #E04040;
    --cream: #EDF2FC;
    --cream-warm: #DDE6F8;
    --parchment: #D2DDEF;

    --bg-main: #0C1320;
    --bg-panel: #EDF2FC;
    --text-dark: #141E30;
    --text-mid: #3D4F66;
    --text-light: #DAE2EE;
    --editor-bg: #0C1320;
    --success: #1EAF50;
    --error: #E04040;

    --shadow-sm: 0 1px 3px rgba(12, 19, 32, 0.14);
    --shadow-md: 0 4px 12px rgba(12, 19, 32, 0.12), 0 1px 3px rgba(12, 19, 32, 0.08);
    --shadow-lg: 0 12px 40px rgba(12, 19, 32, 0.18), 0 4px 12px rgba(12, 19, 32, 0.10);

    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(53, 116, 224, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(48, 172, 232, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(88, 92, 214, 0.04) 0%, transparent 40%);
}

body.game-mode .mode-btn.active {
    background: #3574E0;
    box-shadow: 0 2px 6px rgba(53, 116, 224, 0.45);
}

body.game-mode header {
    border-bottom-color: #3574E0;
}

body.game-mode header::after {
    background: linear-gradient(90deg,
        transparent 0%,
        #8AB6F8 20%,
        #3574E0 50%,
        #8AB6F8 80%,
        transparent 100%
    );
}

body.game-mode .btn-primary {
    background: #3574E0;
    box-shadow: 0 2px 8px rgba(53, 116, 224, 0.3);
}

body.game-mode .btn-primary:hover {
    background: #2660C8;
    box-shadow: 0 3px 12px rgba(53, 116, 224, 0.4);
}

/* Canvas-Platzhalter */
.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
    text-align: center;
    padding: 20px;
}

.canvas-placeholder-icon {
    font-size: 3rem;
}

.canvas-placeholder-text {
    font-size: 0.9rem;
    color: var(--text-mid);
    font-family: 'Nunito', sans-serif;
    line-height: 1.5;
}

.canvas-placeholder-text code {
    background: rgba(232, 115, 42, 0.1);
    color: var(--fox-orange);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
}

.canvas-placeholder.hidden {
    display: none;
}

.visual-pane .panel-content {
    position: relative;
}

/* Game-Canvas */
#game-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #1a1a2e;
    border-radius: var(--radius-sm);
    margin: auto;
}

/* Game Fullscreen Mode */
.game-fullscreen .editor-pane,
.game-fullscreen .output-pane,
.game-fullscreen .sidebar {
    display: none !important;
}

.game-fullscreen .visual-pane {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

.game-fullscreen #game-canvas {
    max-width: 95vw;
    max-height: calc(100vh - 120px);
}

/* ═══════════════════════════════════════════
   PROJEKTE MODAL
   ═══════════════════════════════════════════ */

.projekte-modal .projekte-modal-content {
    background: var(--cream);
    border-radius: var(--radius);
    width: 90%;
    max-width: 540px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border-top: 4px solid var(--fox-orange);
    animation: projekte-slide-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes projekte-slide-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.projekte-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 0;
    background: var(--forest-deep);
    border-bottom: 2px solid rgba(212, 101, 30, 0.25);
}

.projekte-tabs {
    display: flex;
    gap: 4px;
}

.projekte-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: rgba(240, 232, 221, 0.55);
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    padding: 10px 18px 9px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: color 0.18s, border-color 0.18s;
    margin-bottom: -2px;
}

.projekte-tab:hover {
    color: var(--cream);
}

.projekte-tab.active {
    color: var(--fox-glow);
    border-bottom-color: var(--fox-orange);
}

.projekte-close-btn {
    background: none;
    border: none;
    color: rgba(240, 232, 221, 0.5);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.projekte-close-btn:hover {
    color: var(--cream);
    background: rgba(255,255,255,0.08);
}

.projekte-tab-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.projekte-tab-panel.active {
    display: flex;
}

/* Speichern-Tab */
.projekte-save-area {
    padding: 22px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.projekte-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bark-light);
}

.projekte-name-input {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.97rem;
    font-family: inherit;
    border: 2px solid #e0d6cc;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-dark);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.projekte-name-input:focus {
    outline: none;
    border-color: var(--fox-orange);
    box-shadow: 0 0 0 3px rgba(212, 101, 30, 0.14);
}

.projekte-save-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.projekte-btn-save {
    background: var(--moss);
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    transition: background 0.18s, transform 0.1s;
    box-shadow: 0 2px 6px rgba(94, 154, 80, 0.28);
    flex: 1;
    min-width: 120px;
}

.projekte-btn-save:hover { background: #6EA362; }
.projekte-btn-save:active { transform: scale(0.98); }

.projekte-btn-export {
    background: var(--forest-mid);
    color: var(--fox-glow);
    font-weight: 700;
    border: 1.5px solid rgba(212, 101, 30, 0.35);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    transition: background 0.18s, border-color 0.18s, transform 0.1s;
    flex: 1;
    min-width: 150px;
}

.projekte-btn-export:hover {
    background: var(--forest-light);
    border-color: var(--fox-orange);
    color: #fff;
}
.projekte-btn-export:active { transform: scale(0.98); }

/* Laden-Tab */
.projekte-load-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 16px 24px 20px;
    gap: 12px;
}

.projekte-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.projekte-list-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bark-light);
}

.projekte-btn-import {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--forest-mid);
    color: var(--sky-blue);
    font-weight: 700;
    border: 1.5px solid rgba(90, 163, 200, 0.3);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.83rem;
    transition: background 0.18s, border-color 0.18s;
    white-space: nowrap;
}

.projekte-btn-import:hover {
    background: var(--forest-light);
    border-color: var(--sky-blue);
    color: #fff;
}

.projekte-list-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e0d6cc;
    border-radius: var(--radius-sm);
    background: #fff;
    min-height: 160px;
    max-height: 320px;
}

.projekte-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.projekte-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid #f5ede6;
    cursor: pointer;
    transition: background 0.14s;
    gap: 10px;
}

.projekte-list li:last-child { border-bottom: none; }

.projekte-list li:hover { background: rgba(212, 101, 30, 0.06); }

.projekte-list li.selected {
    background: rgba(212, 101, 30, 0.11);
    border-left: 3px solid var(--fox-orange);
    padding-left: 11px;
}

.projekte-list-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.projekte-list-item-name {
    font-weight: 700;
    font-size: 0.93rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.projekte-list-item-date {
    font-size: 0.75rem;
    color: var(--bark-light);
}

.projekte-list-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.projekte-list-load-btn {
    background: var(--moss);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.projekte-list-load-btn:hover { background: #6EA362; }

.projekte-list-delete-btn {
    background: transparent;
    color: var(--berry);
    border: 1.5px solid rgba(200, 75, 104, 0.25);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.projekte-list-delete-btn:hover {
    background: rgba(200, 75, 104, 0.1);
    border-color: var(--berry);
}

.projekte-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    color: var(--bark-light);
    font-size: 0.9rem;
}

.projekte-empty-icon { font-size: 2.4rem; }

.projekte-hint {
    font-size: 0.78rem;
    color: var(--bark-light);
    min-height: 18px;
    margin: 0;
    transition: color 0.2s;
}

.projekte-hint.success { color: var(--moss); font-weight: 600; }
.projekte-hint.error   { color: var(--berry); font-weight: 600; }

/* Editor Styling — Dark forest terminal */

.editor-outer {
    display: flex;
    flex: 1;
    min-height: 0;
}

.line-numbers {
    padding: 14px 8px 14px 12px;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.65;
    color: #6b7280;
    background: var(--editor-bg);
    border-right: 1px solid #374151;
    text-align: right;
    user-select: none;
    white-space: pre;
    overflow: hidden;
}

.editor-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    min-width: 0;
}

.syntax-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    background: var(--editor-bg);
    color: #C9D1D9;
    pointer-events: none;
    z-index: 1;
}

.code-editor {
    position: relative;
    z-index: 2;
    background: transparent;
    caret-color: var(--fox-orange);
    color: transparent;
    width: 100%;
    padding: 14px;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.65;
    border: none;
    outline: none;
    resize: none;
}

/* Syntax token colors — naturalistic palette */
.syntax-highlight .keyword {
    color: var(--fox-orange);
    font-weight: 600;
}

.syntax-highlight .string {
    color: var(--fox-glow);
}

.syntax-highlight .number {
    color: var(--sky-blue);
}

.syntax-highlight .comment {
    color: #6A7D6E;
    font-style: italic;
}

.syntax-highlight .function {
    color: var(--moss-bright);
}

.syntax-highlight .operator {
    color: #C9D1D9;
}

/* Tippfehler - dezente Unterstreichung */
.syntax-highlight .typo {
    text-decoration: underline;
    text-decoration-color: #ef4444;
    text-decoration-style: wavy;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    cursor: help;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 2px;
    padding: 0 1px;
}

/* Fehler-Markierung (Ausführungsfehler) */
.line-numbers .line-error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    font-weight: bold;
    display: inline-block;
    width: 100%;
    margin: 0 -8px;
    padding: 0 8px;
}

/* Lint-Warnung (Live-Fehler) */
.line-numbers .line-warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    font-weight: bold;
    display: inline-block;
    width: 100%;
    margin: 0 -8px;
    padding: 0 8px;
    cursor: help;
}

/* Editor-Header Actions (Undo/Redo) */
.editor-header-actions {
    display: flex;
    gap: 3px;
}

.editor-action-btn {
    background: white;
    border: 1px solid rgba(74, 50, 40, 0.65);
    color: var(--bark);
    width: 28px;
    height: 28px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.editor-action-btn:hover:not(:disabled) {
    background: var(--fox-orange);
    color: white;
    border-color: var(--fox-orange);
    box-shadow: 0 2px 6px rgba(212, 101, 30, 0.25);
}

.editor-action-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.editor-action-btn:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
}

/* Emoji-Picker */
.emoji-picker-wrap {
    position: relative;
    margin-left: 24px;
    margin-right: 24px;
}

#emoji-picker-btn {
    background: transparent;
    box-shadow: none;
}
#emoji-picker-btn:hover {
    background: var(--fox-orange);
    border-color: var(--fox-orange);
}

.emoji-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-panel, #FAF5EF);
    border: 1px solid rgba(92, 64, 51, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    padding: 8px;
    z-index: 100;
}

.emoji-dropdown.open { display: block; }

.emoji-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(92, 64, 51, 0.12);
    padding-bottom: 4px;
}

.emoji-tab {
    background: none;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    padding: 3px 5px;
    opacity: 0.45;
    transition: opacity 0.15s, background 0.15s;
}

.emoji-tab:hover { opacity: 0.8; background: rgba(92,64,51,0.08); }
.emoji-tab.active { opacity: 1; background: rgba(232,115,42,0.18); }

.emoji-dropdown .emoji-grid {
    max-height: 180px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(10, 28px);
    gap: 2px;
}

.emoji-grid button {
    background: rgba(123, 174, 110, 0.08);
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    padding: 3px;
    line-height: 1;
    transition: background 0.1s;
}

.emoji-grid button:hover {
    background: rgba(232, 115, 42, 0.2);
    border-color: rgba(232, 115, 42, 0.4);
}

/* Lint-Indicator im Header */
.editor-pane .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lint-indicator {
    font-size: 12px;
}

.lint-indicator .lint-error {
    color: #D48A15;
    cursor: pointer;
    padding: 2px 6px;
    background: rgba(212, 138, 21, 0.12);
    border-radius: 4px;
    font-weight: 600;
}

.lint-indicator .lint-error:hover {
    background: rgba(212, 138, 21, 0.22);
}

.lint-indicator .lint-ok {
    color: var(--moss);
}

/* Button-Gruppe für Speichern/Laden */
.btn-group {
    display: inline-flex;
    gap: 4px;
}

.btn-group .btn {
    padding: 6px 10px;
    font-size: 13px;
}

.btn-secondary {
    background: #4b5563;
    color: #e5e7eb;
    border: 1px solid #6b7280;
}

.btn-secondary:hover {
    background: #6b7280;
}

/* Help-System — Waldlichtung theme */

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(27, 42, 29, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

.help-modal.active {
    display: flex;
}

.help-content {
    background: var(--cream);
    border-radius: var(--radius);
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid rgba(92, 64, 51, 0.1);
}

.help-header {
    background: var(--forest-deep);
    padding: 20px 24px;
    border-bottom: 3px solid var(--fox-orange);
}

.help-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.help-header h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: var(--cream);
    font-weight: 900;
}

.help-header p {
    color: var(--moss-bright);
    font-size: 0.95rem;
    font-weight: 600;
}

.help-handbuch-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: var(--fox-orange);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-weight: 800;
    font-size: 0.95rem;
    font-family: 'Nunito', sans-serif;
    line-height: 1.2;
    box-shadow: 0 3px 12px rgba(212, 101, 30, 0.4);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.help-handbuch-btn span {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.85;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.help-handbuch-btn:hover {
    background: #c05818;
    box-shadow: 0 4px 16px rgba(212, 101, 30, 0.55);
    transform: translateY(-1px);
}

.help-handbuch-btn:active {
    transform: scale(0.97);
}

.help-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.help-nav {
    background: var(--parchment);
    padding: 14px;
    min-width: 190px;
    border-right: 1px solid rgba(92, 64, 51, 0.08);
    overflow-y: auto;
}

.help-nav-btn {
    display: block;
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 4px;
    border: none;
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    border: 1px solid transparent;
}

.help-nav-btn:hover {
    background: var(--cream-warm);
    border-color: rgba(232, 115, 42, 0.2);
    transform: translateX(3px);
}

.help-nav-btn.active {
    background: var(--fox-orange);
    color: white;
}

.help-sections {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: white;
}

.help-section {
    display: none;
}

.help-section.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

.help-section h3 {
    color: var(--fox-orange);
    font-size: 1.4rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(232, 115, 42, 0.15);
    font-weight: 900;
}

.help-section h4 {
    color: var(--bark);
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 800;
}

.help-section p {
    line-height: 1.7;
    margin-bottom: 12px;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.help-section ul, .help-section ol {
    margin-left: 18px;
    margin-bottom: 12px;
    line-height: 1.7;
}

.help-section li {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.code-example-wrapper {
    position: relative;
    margin: 12px 0;
}

pre.code-example {
    background: var(--editor-bg);
    border-radius: var(--radius-sm);
    padding: 14px;
    padding-right: 40px;
    margin: 0;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #C9D1D9;
    border-left: 3px solid var(--fox-orange);
    overflow-x: auto;
    white-space: pre;
}

.code-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
}

.code-copy-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.code-copy-btn.copied {
    opacity: 1;
}

.code-inline {
    background: rgba(232, 115, 42, 0.08);
    color: var(--fox-orange);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.88em;
    font-weight: 500;
}

.tip-box {
    background: rgba(123, 174, 110, 0.08);
    border-left: 3px solid var(--moss);
    padding: 12px 14px;
    margin: 12px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.tip-box strong {
    color: var(--moss);
}

.warning-box {
    background: rgba(232, 115, 42, 0.06);
    border-left: 3px solid var(--fox-orange);
    padding: 12px 14px;
    margin: 12px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.warning-box strong {
    color: var(--fox-orange);
}

.command-table {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.command-table th,
.command-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(92, 64, 51, 0.08);
}

.command-table th {
    background: var(--parchment);
    color: var(--bark);
    font-weight: 800;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.command-table tr:hover td {
    background: rgba(232, 115, 42, 0.03);
}

.help-footer {
    background: var(--parchment);
    padding: 14px;
    text-align: center;
    border-top: 1px solid rgba(92, 64, 51, 0.08);
}

/* Mobile */
@media (max-width: 767px) {
    .help-content { max-height: 95vh; }
    .help-body { flex-direction: column; }
    .help-nav {
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid rgba(92, 64, 51, 0.08);
        padding: 12px;
    }
    .help-nav-btn { padding: 8px; font-size: 12px; }
    .help-sections { padding: 16px; }
    .help-header h2 { font-size: 1.3rem; }
    .help-section h3 { font-size: 1.2rem; }
    .code-example { font-size: 11px; padding: 10px; }
}

/* Tutorial-System — integrated with Waldlichtung theme */

.tutorial-pane {
    display: none;
    grid-area: tutorial;
}

.tutorial-pane.active {
    display: flex; 
}

/* Mascot */
.tutorial-mascot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(232, 115, 42, 0.06);
    border-radius: var(--radius-sm);
    margin: 10px 10px 0;
    border: 1px solid rgba(232, 115, 42, 0.1);
}

.mascot-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(232, 115, 42, 0.2));
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.mascot-bubble {
    flex: 1;
    background: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(92, 64, 51, 0.1);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.mascot-bubble::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid white;
}

/* Konzept-Erklärung */
.tutorial-concept {
    margin: 8px 10px 0;
    padding: 8px 12px;
    background: rgba(123, 174, 110, 0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(123, 174, 110, 0.15);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mid);
    line-height: 1.5;
}

/* Tutorial Content */
.tutorial-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    overflow-y: auto;
    padding: 10px;
}

.tutorial-level-title {
    font-size: 1rem;
    color: var(--fox-orange);
    margin: 0;
    font-weight: 800;
}

.tutorial-description {
    font-size: 0.9rem;
    color: var(--text-mid);
    margin: 0;
    line-height: 1.5;
}

.tutorial-instructions {
    background: var(--cream-warm);
    border-left: 3px solid var(--fox-light);
    padding: 10px 12px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    line-height: 1.6;
}

.tutorial-instructions code {
    background: rgba(232, 115, 42, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    color: var(--fox-orange);
    font-size: 12px;
}

/* Hint Toggle */
.tutorial-hint-toggle {
    background: white;
    border: 1px solid rgba(92, 64, 51, 0.12);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--bark);
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
    font-family: 'Nunito', sans-serif;
}

.tutorial-hint-toggle:hover {
    background: var(--fox-orange);
    color: white;
    border-color: var(--fox-orange);
}

.tutorial-hint {
    background: rgba(123, 174, 110, 0.08);
    border-left: 3px solid var(--moss);
    padding: 8px 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 12px;
    font-style: italic;
    color: var(--text-mid);
}

.tutorial-hint.hidden {
    display: none;
}

/* Progress */
.tutorial-progress-container {
    background: white;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(92, 64, 51, 0.08);
}

.tutorial-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--parchment);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--moss), var(--fox-orange));
    transition: width 0.5s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    font-weight: 700;
    color: var(--text-mid);
    font-size: 12px;
}

/* Challenges (Probier mal) */
.tutorial-challenges {
    background: rgba(123, 174, 110, 0.08);
    border: 1px solid rgba(123, 174, 110, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.challenges-header {
    font-size: 13px;
    font-weight: 800;
    color: var(--bark);
    margin-bottom: 6px;
}

.challenges-list {
    margin: 0 0 10px 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-mid);
    line-height: 1.8;
}

.challenges-list li {
    list-style: disc;
}

.tutorial-next-btn {
    width: 100%;
    padding: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

/* Actions */
.tutorial-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.tutorial-actions .btn {
    width: 100%;
    padding: 6px;
    font-size: 12px;
    justify-content: center;
}

/* Level Grid */
.tutorial-levels {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(92, 64, 51, 0.08);
}

.tutorial-levels h4 {
    font-size: 0.8rem;
    color: var(--bark);
    margin: 0 0 8px 0;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.level-btn {
    aspect-ratio: 1;
    background: white;
    border: 1px solid rgba(92, 64, 51, 0.12);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mid);
    font-family: 'Nunito', sans-serif;
}

.level-btn:hover {
    transform: scale(1.08);
    border-color: var(--fox-orange);
    box-shadow: 0 2px 8px rgba(232, 115, 42, 0.15);
}

.level-btn.completed {
    background: var(--moss);
    color: white;
    border-color: var(--moss);
}

.level-btn.current {
    background: var(--fox-orange);
    color: white;
    border-color: var(--fox-orange);
    animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(232, 115, 42, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(232, 115, 42, 0);
    }
}

/* ═══════════════════════════════════════════
   Grid-Layouts mit Tutorial
   ═══════════════════════════════════════════ */
@media (min-width: 1200px) {
    .main-content {
        grid-template-columns: 2fr 1fr 260px;
        grid-template-rows: 1fr 1fr;
        grid-template-areas:
            "editor output sidebar"
            "editor visual sidebar";
        transition: grid-template-columns 0.3s ease;
    }

    .editor-pane { grid-area: editor; }
    .output-pane { grid-area: output; }
    .visual-pane { grid-area: visual; }
    .sidebar { grid-area: sidebar; }

    .main-content.tutorial-active {
        grid-template-columns: 1.5fr 1fr 240px 280px;
        grid-template-areas:
            "editor output sidebar tutorial"
            "editor visual sidebar tutorial";
    }

    .tutorial-pane {
        min-width: 260px;
        max-width: 300px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "editor editor"
            "output visual"
            "sidebar sidebar";
    }

    .main-content.tutorial-active {
        height: 100vh;
        grid-template-rows: 40vh 1fr auto auto;
        grid-template-areas:
            "tutorial tutorial"
            "editor editor"
            "output visual"
            "sidebar sidebar";
    }

    .tutorial-pane {
        grid-area: tutorial;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
    }

    .tutorial-pane.active { display: flex; }

    .editor-pane { grid-area: editor; min-height: 300px; }
    .output-pane { grid-area: output; min-height: 250px; }
    .visual-pane { grid-area: visual; min-height: 250px; }
    .sidebar { grid-area: sidebar; max-height: 400px; overflow-y: auto; }

    .level-grid { grid-template-columns: repeat(5, 1fr); }
    .level-btn { font-size: 10px; border-radius: 4px; }
}

@media (max-width: 767px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .tutorial-pane { display: none !important; }
    .main-content.tutorial-active .tutorial-pane.active { display: flex !important; }

    .editor-pane, .output-pane, .visual-pane, .sidebar, .tutorial-pane { display: none; }
    .editor-pane.active, .output-pane.active, .visual-pane.active,
    .sidebar.active, .tutorial-pane.active { display: flex; }

    .level-grid { grid-template-columns: repeat(3, 1fr); }
    .tutorial-actions { grid-template-columns: 1fr; }
    .tutorial-content { gap: 8px; }
}

/* ═══════════════════════════════════════════
   SPRITE EDITOR — Vollbild-Ansicht (Aseprite-Style)
   ═══════════════════════════════════════════ */

/* Sprite-Editor View versteckt standardmäßig die Code-Panels */
body.sprite-editor-mode .editor-pane,
body.sprite-editor-mode .output-pane,
body.sprite-editor-mode .visual-pane,
body.sprite-editor-mode .sidebar,
body.sprite-editor-mode .tutorial-pane {
    display: none !important;
}

body.sprite-editor-mode .sprite-editor-view {
    display: flex !important;
}

@media (min-width: 768px) and (max-width: 1199px) {
    body.sprite-editor-mode .main-content {
        grid-template-rows: 1fr;
        grid-template-columns: 1fr;
    }
}

/* Sprite-Editor Container */
.sprite-editor-view {
    display: none;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    background: var(--editor-bg, #1E1E2A);
    border-radius: var(--radius);
    overflow: hidden;
    gap: 0;
}

/* Layout: Toolbar links, Canvas mitte, Sidebar rechts */
.sprite-editor-layout {
    display: grid;
    grid-template-columns: 52px 1fr 200px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "toolbar topbar topbar"
        "toolbar canvas sidebar"
        "toolbar statusbar statusbar";
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════
   TOP BAR — Palette & Größen-Auswahl
   ═══════════════════════════════════════════ */
.sprite-topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: #252536;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sprite-palette {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    max-width: 400px;
}

.sprite-palette-color {
    width: 22px;
    height: 22px;
    border: 2px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.1s;
}

.sprite-palette-color:hover {
    transform: scale(1.15);
    z-index: 1;
}

.sprite-palette-color.active {
    border-color: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

.sprite-current-color {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.sprite-current-color-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sprite-current-color span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.sprite-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.sprite-size-selector select {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #1a1a28;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

.sprite-size-selector select:focus {
    outline: none;
    border-color: var(--fox-orange, #E8732A);
}

/* ═══════════════════════════════════════════
   LEFT TOOLBAR — Tools
   ═══════════════════════════════════════════ */
.sprite-toolbar {
    grid-area: toolbar;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #1a1a28;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sprite-tool-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
}

.sprite-tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sprite-tool-btn.active {
    background: var(--fox-orange, #E8732A);
    color: #fff;
    box-shadow: 0 2px 8px rgba(232, 115, 42, 0.4);
}

.sprite-toolbar-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 6px 4px;
}

.sprite-history-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.15s;
}

.sprite-history-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sprite-history-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════
   CANVAS AREA — Mitte
   ═══════════════════════════════════════════ */
.sprite-canvas-area {
    grid-area: canvas;
    background: #0f0f15;
    overflow: hidden;
    position: relative;
}

.sprite-canvas-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: crosshair;
}

.sprite-canvas-wrapper.panning {
    cursor: grabbing;
}

body.sprite-panning .sprite-canvas-wrapper {
    cursor: grab;
}

body.sprite-panning.sprite-panning-active .sprite-canvas-wrapper {
    cursor: grabbing;
}

/* Zoom Controls */
.sprite-zoom-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px;
    border-radius: 6px;
}

.sprite-zoom-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sprite-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.sprite-zoom-level {
    min-width: 40px;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 28px;
}

#sprite-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════
   RIGHT SIDEBAR — Sprite-Liste
   ═══════════════════════════════════════════ */
.sprite-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    background: #1a1a28;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.sprite-sidebar-header {
    padding: 10px 12px;
    background: #252536;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sprite-sidebar-header h3 {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 700;
}

/* Sprite-Galerie (Verfügbare Sprites) */
.sprite-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sprite-gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    width: 56px;
}

.sprite-gallery-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.sprite-gallery-thumbnail {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #0a0a0f;
    border-radius: 4px;
}

.sprite-gallery-name {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.sprite-gallery-custom .sprite-gallery-name {
    color: var(--fox-orange, #E8732A);
}

.sprite-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sprite-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.sprite-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.sprite-list-item.selected {
    background: rgba(232, 115, 42, 0.15);
    border-color: var(--fox-orange, #E8732A);
}

.sprite-list-thumbnail {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #0a0a0f;
    border-radius: 4px;
    flex-shrink: 0;
}

.sprite-list-name {
    flex: 1;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sprite-list-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.sprite-list-item:hover .sprite-list-actions {
    opacity: 1;
}

.sprite-list-action {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sprite-list-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sprite-list-action.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.sprite-list-empty {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    text-align: center;
    padding: 20px 10px;
}

/* ═══════════════════════════════════════════
   STATUS BAR — Name-Input & Actions
   ═══════════════════════════════════════════ */
.sprite-statusbar {
    grid-area: statusbar;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #252536;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sprite-name-input {
    flex: 1;
    max-width: 200px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: #1a1a28;
    color: #fff;
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
}

.sprite-name-input:focus {
    outline: none;
    border-color: var(--fox-orange, #E8732A);
}

.sprite-name-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.sprite-btn {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sprite-btn-primary {
    background: var(--fox-orange, #E8732A);
    color: #fff;
}

.sprite-btn-primary:hover {
    background: #d66823;
    transform: translateY(-1px);
}

.sprite-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.sprite-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sprite-btn-close {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.sprite-btn-close:hover {
    background: rgba(239, 68, 68, 0.2);
}

.sprite-status-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-left: auto;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
    .sprite-editor-layout {
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas:
            "toolbar topbar"
            "toolbar sidebar"
            "toolbar canvas"
            "toolbar statusbar";
    }

    .sprite-sidebar {
        max-height: 120px;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .sprite-list {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }

    .sprite-list-item {
        flex-direction: column;
        width: 60px;
        padding: 6px;
    }

    .sprite-list-name {
        font-size: 0.7rem;
        text-align: center;
    }

    .sprite-list-actions {
        position: absolute;
        top: 2px;
        right: 2px;
        opacity: 1;
    }

    .sprite-list-item {
        position: relative;
    }
}

@media (max-width: 600px) {
    .sprite-topbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .sprite-palette {
        order: 2;
        width: 100%;
        max-width: none;
    }

    .sprite-current-color {
        order: 1;
    }

    .sprite-size-selector {
        order: 1;
        margin-left: 0;
    }

    .sprite-statusbar {
        flex-wrap: wrap;
    }

    .sprite-name-input {
        max-width: none;
        width: 100%;
    }

    .sprite-status-info {
        width: 100%;
        text-align: center;
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════
   GAME MODE ANPASSUNG — Blaues Theme
   ═══════════════════════════════════════════ */
body.game-mode .sprite-tool-btn.active {
    background: #3B82F6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

body.game-mode .sprite-palette-color.active {
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

body.game-mode .sprite-list-item.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3B82F6;
}

body.game-mode .sprite-btn-primary {
    background: #3B82F6;
}

body.game-mode .sprite-btn-primary:hover {
    background: #2563EB;
}

body.game-mode .sprite-name-input:focus {
    border-color: #3B82F6;
}

/* ═══════════════════════════════════════════
   BLOCK-PALETTE
   ═══════════════════════════════════════════ */

.block-palette {
    width: 180px;
    min-width: 180px;
    background: var(--parchment);
    border-right: 1px solid rgba(92, 64, 51, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.block-palette.collapsed {
    width: 36px;
    min-width: 36px;
}

.block-palette.collapsed .block-palette-content,
.block-palette.collapsed .block-palette-title {
    display: none;
}

/* Header */
.block-palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--cream-warm);
    border-bottom: 1px solid rgba(92, 64, 51, 0.1);
    flex-shrink: 0;
}

.block-palette-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--bark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.block-palette-toggle {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--bark-light);
    font-size: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-palette-toggle:hover {
    background: rgba(232, 115, 42, 0.15);
    color: var(--fox-orange);
}

/* Content */
.block-palette-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
}

/* Categories */
.block-category {
    margin-bottom: 4px;
}

.block-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-dark);
    transition: background 0.15s;
    user-select: none;
}

.block-category-header:hover {
    background: var(--cream-warm);
}

.block-category-arrow {
    font-size: 8px;
    color: var(--bark-light);
    transition: transform 0.2s;
}

.block-category.collapsed .block-category-content {
    display: none;
}

.block-category.collapsed .block-category-arrow {
    transform: rotate(-90deg);
}

.block-category-content {
    padding: 4px 0 4px 4px;
}

/* Tutorial Highlighting */
.block-category.highlighted .block-category-header {
    background: rgba(232, 115, 42, 0.12);
    border-left: 3px solid var(--fox-orange);
}

.block-category.dimmed {
    opacity: 0.55;
}

/* Block Items */
.block-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    margin: 2px 0;
    background: white;
    border: 1px solid rgba(74, 50, 40, 0.1);
    border-left: 3px solid var(--fox-light);
    border-radius: 4px;
    cursor: grab;
    font-family: 'Fira Code', monospace;
    font-size: 11.5px;
    color: var(--text-dark);
    transition: all 0.15s ease;
    user-select: none;
}

.block-item:hover {
    background: var(--cream-warm);
    border-left-color: var(--fox-orange);
    transform: translateX(2px);
    box-shadow: 2px 2px 6px rgba(74, 50, 40, 0.12);
}

.block-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.block-item.dragging {
    opacity: 0.5;
    box-shadow: 0 4px 12px rgba(232, 115, 42, 0.3);
}

.block-item.inserted {
    background: rgba(123, 174, 110, 0.2);
    border-left-color: var(--moss);
}

.block-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Erweiterte Tooltips */
.block-item[data-tooltip] {
    position: relative;
}

.block-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--editor-bg, #1E1E2A);
    color: var(--cream, #FDF6EE);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'Nunito', sans-serif;
    white-space: pre-line;
    line-height: 1.5;
    min-width: 180px;
    max-width: 250px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.block-item[data-tooltip]:hover::after {
    opacity: 1;
}

/* Editor Drop Target */
.code-editor.drop-target {
    outline: 2px dashed var(--fox-light);
    outline-offset: -2px;
}

.code-editor.drop-hover {
    outline: 2px solid var(--fox-orange);
    outline-offset: -2px;
    background: rgba(232, 115, 42, 0.05);
}

/* ═══════════════════════════════════════════
   GAMEFUCHS THEME
   ═══════════════════════════════════════════ */

body.game-mode .block-palette {
    background: var(--parchment);
}

body.game-mode .block-palette-header {
    background: var(--cream-warm);
}

body.game-mode .block-item {
    border-left-color: var(--fox-light);
}

body.game-mode .block-item:hover {
    border-left-color: var(--fox-orange);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 1199px) {
    .block-palette {
        width: 160px;
        min-width: 160px;
    }

    .block-palette.collapsed {
        width: 32px;
        min-width: 32px;
    }

    .block-item {
        font-size: 10px;
        padding: 4px 6px;
    }
}

@media (max-width: 767px) {
    /* Mobile: Palette als horizontale Leiste oben */
    .block-palette {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 35vh;
        border-right: none;
        border-bottom: 1px solid rgba(92, 64, 51, 0.15);
        flex-direction: column;
    }

    .block-palette.collapsed {
        width: 100%;
        min-width: 100%;
        max-height: 36px;
    }

    .block-palette-header {
        padding: 6px 10px;
    }

    .block-palette-toggle {
        transform: rotate(-90deg);
    }

    .block-palette.collapsed .block-palette-toggle {
        transform: rotate(90deg);
    }

    .block-palette-content {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px;
    }

    .block-category {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
        margin-bottom: 0;
    }

    .block-category-content {
        padding: 4px 0;
    }

    .block-item {
        font-size: 11px;
    }
}

/* ═══════════════════════════════════════════
   EDITOR PANE LAYOUT ADJUSTMENT
   ═══════════════════════════════════════════ */

.editor-pane .panel-content {
    display: flex;
    flex-direction: row;
}

.editor-pane .editor-outer {
    flex: 1;
    min-width: 0;
}

@media (max-width: 767px) {
    .editor-pane .panel-content {
        flex-direction: column;
    }
}

/* Plattform-Rundgang */

.platform-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    /* Kein Background/Blur hier — wird vom Spotlight-Shadow erzeugt,
       damit das hervorgehobene Element scharf bleibt */
}

.platform-tour-overlay.no-spotlight {
    background: rgba(23, 33, 25, 0.9);     
}

.platform-tour-spotlight {
    position: fixed;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(23, 33, 25, 0.7);
    z-index: 2501;
    transition: all 0.4s ease;
    pointer-events: none;
    /* Das Element innerhalb des Spotlights ist NICHT vom Shadow betroffen,
       also bleibt es scharf sichtbar */
}

.platform-tour-tooltip {
    position: fixed;
    z-index: 2502;
    background: var(--cream, #FFF8F0);
    border: 2px solid var(--fox-orange, #E8732A);
    border-radius: 12px;
    padding: 18px 22px;
    max-width: 320px;
    min-width: 260px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: tourFadeIn 0.3s ease;
}

@keyframes tourFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.platform-tour-tooltip.tour-pos-center {
    max-width: 380px;
}

.platform-tour-tooltip h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--fox-orange, #E8732A);
}

.platform-tour-tooltip p {
    margin: 0 0 14px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark, #2D3748);
}

/* Showcase */
.tour-showcase {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.tour-showcase-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(123, 174, 110, 0.1);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark, #2D3748);
}

.tour-showcase-icon {
    font-size: 20px;
}

/* Navigation */
.platform-tour-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.platform-tour-progress {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(92, 64, 51, 0.2);
    transition: all 0.2s ease;
}

.tour-dot.active {
    background: var(--fox-orange, #E8732A);
    transform: scale(1.3);
}

.tour-dot.done {
    background: var(--moss, #7BAE6E);
}

.platform-tour-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.tour-skip-btn {
    background: none;
    border: 1px solid rgba(92, 64, 51, 0.2);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mid, #718096);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s ease;
}

.tour-skip-btn:hover {
    background: rgba(92, 64, 51, 0.05);
}

.tour-next-btn {
    background: var(--fox-orange, #E8732A);
    border: none;
    border-radius: 6px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s ease;
}

.tour-next-btn:hover {
    background: var(--fox-dark, #D4621E);
    transform: translateY(-1px);
}

/* Rundgang-Button im Header */
.tour-restart-btn {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    color: var(--cream);
}

.tour-restart-btn:hover {
    background: var(--fox-orange, #E8732A);
    color: white;
    border-color: var(--fox-orange, #E8732A);
}

/* Mobile: Tour-Tooltip maximal breit */
@media (max-width: 767px) {
    .platform-tour-tooltip {
        max-width: calc(100vw - 30px);
        min-width: auto;
    }
}

/* ═══════════════════════════════════════════
   SPIELFELD-EDITOR — Vollbild-Ansicht
   ═══════════════════════════════════════════ */

/* === Vollbild-Modus: Alle Panels ausblenden === */

body.spielfeld-editor-mode .editor-pane,
body.spielfeld-editor-mode .output-pane,
body.spielfeld-editor-mode .visual-pane,
body.spielfeld-editor-mode .sidebar,
body.spielfeld-editor-mode .tutorial-pane,
body.spielfeld-editor-mode .sprite-editor-view {
    display: none !important;
}

body.spielfeld-editor-mode .spielfeld-editor-view {
    display: flex !important;
}

@media (min-width: 768px) and (max-width: 1199px) {
    body.spielfeld-editor-mode .main-content {
        grid-template-rows: 1fr;
        grid-template-columns: 1fr;
    }
}

/* === Editor View Container === */

.spielfeld-editor-view {
    display: none;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    background: var(--editor-bg, #1E1E2A);
    border-radius: var(--radius, 12px);
    overflow: hidden;
}

.spielfeld-editor-layout {
    display: grid;
    grid-template-columns: 140px 1fr 260px;
    grid-template-rows: 1fr auto;
    grid-template-areas:
        "left canvas right"
        "status status status";
    width: 100%;
    height: 100%;
}

/* === Left Sidebar: Tools + Sprite Grid === */

.se-left-sidebar {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 8px;
    background: #252536;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
}

.se-tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e0;
    font-size: 13px;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.se-tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.se-tool-btn.active {
    background: rgba(255, 215, 0, 0.15);
    border-color: #FFD700;
    color: #FFD700;
}

.se-tool-btn span {
    font-size: 12px;
}

.se-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

/* Sprite Grid */
.se-sprite-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.se-sprite-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
}

.se-sprite-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.se-sprite-item.selected {
    background: rgba(255, 215, 0, 0.15);
    outline: 1px solid rgba(255, 215, 0, 0.4);
}

.se-sprite-item canvas {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    image-rendering: pixelated;
    width: 28px;
    height: 28px;
}

.se-sprite-item span {
    font-size: 11px;
    color: #a0aec0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Center: Canvas Area === */

.se-canvas-area {
    grid-area: canvas;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #16162a;
    overflow: hidden;
    padding: 16px;
}

.se-canvas-wrapper {
    position: relative;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

#spielfeld-editor-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
}

/* === Right Sidebar: Settings + Code Preview === */

.se-right-sidebar {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #252536;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
}

.se-section {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.se-section h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #a0aec0;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
}

/* Größen-Buttons */
.se-size-btn {
    display: block;
    width: 100%;
    padding: 6px 10px;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e0;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.se-size-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.se-size-btn.selected {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
    color: #FFD700;
}

/* Farbpalette */
.se-color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.se-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.se-color-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.se-color-swatch.selected {
    border-color: #FFD700;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

/* Code-Vorschau */
.se-code-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.se-code-preview {
    flex: 1;
    margin: 0;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    color: #a0d0a0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* === Status Bar === */

.se-statusbar {
    grid-area: status;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #252536;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.se-hint {
    font-size: 11px;
    color: #718096;
    font-family: 'Nunito', sans-serif;
}

/* History-Buttons (Undo/Redo) */
.se-history-buttons {
    display: flex;
    gap: 4px;
}

.se-history-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e0;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.se-history-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.se-history-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* === Properties-Panel === */

.se-properties {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.se-properties h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #FFD700;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
}

.se-prop-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.se-prop-row label {
    font-size: 11px;
    color: #a0aec0;
    min-width: 42px;
    font-family: 'Nunito', sans-serif;
}

.se-prop-input {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
    color: #e2e8f0;
    font-size: 12px;
    font-family: 'Fira Code', 'Consolas', monospace;
    outline: none;
}

.se-prop-input:focus {
    border-color: rgba(255, 215, 0, 0.4);
}

.se-prop-input[readonly] {
    opacity: 0.6;
    cursor: default;
}

.se-prop-input[type="number"] {
    width: 56px;
    flex: none;
}

.se-prop-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.se-prop-checkbox input[type="checkbox"] {
    accent-color: #FFD700;
}

.se-prop-checkbox label {
    font-size: 11px;
    color: #a0aec0;
    font-family: 'Nunito', sans-serif;
}

.se-prop-slider {
    flex: 1;
    accent-color: #FFD700;
}

.se-prop-value {
    font-size: 11px;
    color: #FFD700;
    min-width: 28px;
    text-align: right;
    font-family: 'Fira Code', monospace;
}

/* Sprite Mini-Grid im Properties-Panel */
.se-prop-sprite-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.se-prop-sprite-item {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    image-rendering: pixelated;
    transition: border-color 0.15s;
}

.se-prop-sprite-item:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.se-prop-sprite-item.selected {
    border-color: #FFD700;
}

/* Aktions-Buttons im Properties-Panel */
.se-prop-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.se-prop-btn {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e0;
    font-size: 11px;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
}

.se-prop-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.se-prop-btn.danger {
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff8080;
}

.se-prop-btn.danger:hover {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.5);
}

.se-back-btn {
    padding: 6px 16px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.se-back-btn:hover {
    background: rgba(255, 215, 0, 0.2);
}

/* === Vorlagen-Dialog === */

.spielfeld-editor-template-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: seFadeIn 0.2s ease;
}

@keyframes seFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spielfeld-editor-template-modal {
    background: #1e1e3a;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 620px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.spielfeld-editor-template-modal h2 {
    margin: 0 0 20px;
    font-size: 22px;
    color: #FFD700;
    font-family: 'Nunito', sans-serif;
}

.spielfeld-editor-template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    justify-items: center;
}

.spielfeld-editor-template-card:nth-child(4) {
    grid-column: 1 / 2;
    margin-left: auto;
    margin-right: 0;
    width: 100%;
}
.spielfeld-editor-template-card:nth-child(5) {
    grid-column: 2 / 3;
}

.spielfeld-editor-template-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 12px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    width: 100%;
}

.spielfeld-editor-template-card:hover {
    transform: translateY(-3px);
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.08);
}

.template-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.template-title {
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 4px;
    font-family: 'Nunito', sans-serif;
}

.template-desc {
    font-size: 11px;
    color: #a0aec0;
}

.spielfeld-editor-template-close {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #a0aec0;
    padding: 8px 20px;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: color 0.15s, border-color 0.15s;
}

.spielfeld-editor-template-close:hover {
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.3);
}

/* === Rolle-Dropdown & Gameplay-Felder === */

.se-prop-select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
    color: #e2e8f0;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    cursor: pointer;
}

.se-prop-select:focus {
    border-color: rgba(255, 215, 0, 0.4);
}

.se-prop-select option {
    background: #252536;
    color: #e2e8f0;
}

