        /* ── Blockly Kontextmenü – zusätzliche Einträge optisch hervorheben ── */
        .blocklyContextMenu .blocklyMenuItemContent .primm-copy-icon {
            margin-right: 6px;
            font-size: 1em;
        }

        /* Trennlinie zwischen Blockly-Standard und unseren Einträgen */
        .blocklyContextMenu .blocklyMenuSeparator {
            margin: 3px 0;
        }

        :root {
            --predict: #9350e3;  /* vorher #9b5de5 – weiße Schrift < 4,5:1 */
            --run: #00b4d8;
            --investigate: #f15bb5;
            --modify: #f3722c;
            --make: #228175;
            --easy: #228175;
            --medium: #f3a712;
            --hard: #e32231;
            --bg: #f7f7fb;
            --card: #fff;
            --text: #222;
            --border: #ddd;
        }

        * {
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Arial, sans-serif;
            margin: 0;
            background: var(--bg);
            color: var(--text);
        }

        #statsBar {
            background: #264653;
            color: #fff;
            display: flex;
            align-items: center;
            gap: 18px;
            padding: 8px 20px;
            font-size: .88em;
            flex-wrap: wrap;
        }

        #statsBar .stat {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        #statsBar .stat span {
            font-weight: bold;
            font-size: 1.1em;
        }

        #progressWrap {
            flex: 1;
            min-width: 120px;
        }

        #progressBar {
            height: 10px;
            border-radius: 5px;
            background: #fff3;
            overflow: hidden;
        }

        #progressFill {
            height: 100%;
            background: #228175;
            transition: width .4s;
        }

        header {
            background: #264653;
            color: #fff;
            padding: 12px 20px;
            border-top: 1px solid rgba(255, 255, 255, .15);
        }

        header h1 {
            margin: 0;
            font-size: 1.25em;
        }

        header p {
            margin: 3px 0 0;
            font-size: .85em;
            opacity: .9;
        }

        #main {
            display: flex;
            gap: 12px;
            padding: 12px;
            max-width: 1500px;
            margin: 0 auto;
        }

        #taskNav {
            display: flex;
            flex-direction: column;
            gap: 6px;
            min-width: 195px;
        }

        #taskNav button {
            text-align: left;
            padding: 9px 11px;
            border: 2px solid var(--border);
            border-radius: 10px;
            background: #fff;
            cursor: pointer;
            font-size: .87em;
        }

        #taskNav button.active {
            border-color: #264653;
            background: #e9f5f2;
            font-weight: bold;
        }

        #taskNav button:hover {
            border-color: #264653;
        }

        #content {
            flex: 1;
            background: var(--card);
            border-radius: 12px;
            padding: 14px 18px;
            box-shadow: 0 1px 6px rgba(0, 0, 0, .08);
        }

        #taskTitle {
            margin: 0 0 4px;
        }

        #competency {
            display: inline-block;
            background: #e0fbfc;
            color: #264653;
            padding: 3px 10px;
            border-radius: 20px;
            font-size: .78em;
            margin-bottom: 8px;
            font-weight: bold;
        }

        #subtaskTabs {
            display: flex;
            gap: 7px;
            margin-bottom: 10px;
            flex-wrap: wrap;
        }

        #subtaskTabs button {
            padding: 7px 13px;
            border: 2px solid var(--border);
            border-radius: 20px;
            background: #fff;
            cursor: pointer;
            font-size: .86em;
            font-weight: bold;
        }

        #subtaskTabs button[data-level="easy"].active {
            background: var(--easy);
            color: #fff;
            border-color: var(--easy);
        }

        #subtaskTabs button[data-level="medium"].active {
            background: var(--medium);
            color: #fff;
            border-color: var(--medium);
        }

        #subtaskTabs button[data-level="hard"].active {
            background: var(--hard);
            color: #fff;
            border-color: var(--hard);
        }

        #subtaskTitle {
            margin: 0 0 8px;
            font-size: 1em;
            color: #333;
        }

        #phaseTabs {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin: 8px 0 14px;
        }

        #phaseTabs button {
            padding: 7px 11px;
            border: none;
            border-radius: 8px 8px 0 0;
            cursor: pointer;
            font-size: .83em;
            background: #eee;
            color: #333;
            border-bottom: 4px solid transparent;
        }

        #phaseTabs button.active {
            color: #fff;
        }

        #phaseTabs button[data-phase="predict"].active {
            background: var(--predict);
            border-color: var(--predict);
        }

        #phaseTabs button[data-phase="run"].active {
            background: var(--run);
            border-color: var(--run);
        }

        #phaseTabs button[data-phase="investigate"].active {
            background: var(--investigate);
            border-color: var(--investigate);
        }

        #phaseTabs button[data-phase="modify"].active {
            background: var(--modify);
            border-color: var(--modify);
        }

        #phaseTabs button[data-phase="make"].active {
            background: var(--make);
            border-color: var(--make);
        }

        #phaseTabs button:disabled {
            opacity: .38;
            cursor: not-allowed;
            background: #f0f0f0;
            color: #999;
        }

        #phaseTabs button:disabled::after {
            content: " 🔒";
        }

        #lockNotice {
            display: none;
            background: #fdecea;
            border: 1px solid #e63946;
            color: #a4161a;
            border-radius: 8px;
            padding: 7px 13px;
            margin-bottom: 9px;
            font-size: .86em;
            font-weight: bold;
        }

        #instructions {
            background: #fafafa;
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 11px 15px;
            margin-bottom: 9px;
            line-height: 1.5;
        }

        #instructions h3 {
            margin-top: 0;
        }

        details.tips {
            background: #fff8e6;
            border: 1px solid #f1d78c;
            border-radius: 10px;
            padding: 7px 13px;
            margin-bottom: 12px;
        }

        details.tips summary {
            cursor: pointer;
            font-weight: bold;
            color: #946200;
        }

        #workArea {
            display: flex;
            flex-wrap: wrap;
            gap: 14px;
        }

        #blocklyDiv {
            flex: 1 1 470px;
            height: 400px;
            border: 1px solid var(--border);
            border-radius: 10px;
            position: relative;
            overflow: hidden;
        }

        #blocklyLockOverlay {
            position: absolute;
            inset: 0;
            z-index: 500;
            background: rgba(255, 255, 255, .45);
            display: none;
            align-items: center;
            justify-content: center;
            cursor: not-allowed;
        }

        #blocklyLockOverlay.active {
            display: flex;
        }

        #blocklyLockOverlay span {
            background: #264653;
            color: #fff;
            padding: 7px 15px;
            border-radius: 20px;
            font-size: .88em;
            font-weight: bold;
        }

        #turtleArea {
            flex: 0 0 415px;
        }

        #canvasContainer {
            position: relative;
            width: 400px;
            height: 400px;
            border: 2px solid #264653;
            border-radius: 8px;
            background: #fff;
            margin-bottom: 9px;
        }

        #canvasContainer canvas {
            position: absolute;
            top: 0;
            left: 0;
        }

        #controls {
            display: flex;
            flex-wrap: wrap;
            gap: 7px;
            align-items: center;
        }

        #controls button {
            padding: 7px 13px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: .88em;
            color: #fff;
        }

        #runBtn {
            background: #228175;
        }

        #runBtn:disabled {
            background: #aaa;
            cursor: not-allowed;
        }

        #resetBtn {
            background: #cf401d;
        }

        #controls label {
            font-size: .78em;
        }

        #errorMsg {
            color: #c0392b;
            font-weight: bold;
            margin-top: 5px;
            min-height: 18px;
        }

        #reflectionBox {
            margin-top: 11px;
        }

        #reflectionBox textarea {
            width: 100%;
            min-height: 68px;
            padding: 7px;
            border-radius: 8px;
            border: 1px solid var(--border);
            font-family: inherit;
        }

        #navButtons {
            display: flex;
            justify-content: space-between;
            margin-top: 16px;
        }

        #navButtons button {
            padding: 9px 16px;
            border: none;
            border-radius: 8px;
            background: #264653;
            color: #fff;
            cursor: pointer;
            font-size: .92em;
        }

        #navButtons button:disabled {
            background: #ccc;
            cursor: not-allowed;
        }

        /* ── Clipboard-Toast ── */
        #clipboardBadge {
            position: fixed;
            bottom: 18px;
            right: 18px;
            background: #264653;
            color: #fff;
            border-radius: 10px;
            padding: 9px 14px;
            font-size: .83em;
            box-shadow: 0 3px 12px rgba(0, 0, 0, .22);
            z-index: 8000;
            display: none;
            align-items: center;
            gap: 10px;
            max-width: 300px;
        }

        #clipboardBadge.show {
            display: flex;
        }

        #clipboardBadge button {
            background: rgba(255, 255, 255, .2);
            border: none;
            color: #fff;
            border-radius: 6px;
            padding: 3px 9px;
            cursor: pointer;
            font-size: .85em;
            white-space: nowrap;
        }

        /* ── MODAL ── */
        #modalOverlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, .55);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }

        #modalOverlay.open {
            display: flex;
        }

        #modal {
            background: #fff;
            border-radius: 16px;
            padding: 28px;
            max-width: 580px;
            width: 100%;
            box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
            max-height: 90vh;
            overflow-y: auto;
        }

        #modal h2 {
            margin-top: 0;
            font-size: 1.2em;
        }

        #modal .mc-option {
            display: block;
            width: 100%;
            text-align: left;
            padding: 10px 14px;
            margin: 6px 0;
            border: 2px solid var(--border);
            border-radius: 10px;
            background: #fff;
            cursor: pointer;
            font-size: .95em;
            transition: background .15s;
        }

        #modal .mc-option:hover {
            background: #f0f8ff;
        }

        #modal .mc-option.correct {
            background: #d4f5e9;
            border-color: #2a9d8f;
            color: #1a6b53;
        }

        #modal .mc-option.wrong {
            background: #fde8e8;
            border-color: #e63946;
            color: #a4161a;
        }

        #modal .mc-option:disabled {
            cursor: default;
        }

        #feedbackBox {
            margin-top: 14px;
            padding: 12px 16px;
            border-radius: 10px;
            font-size: .93em;
            display: none;
            line-height: 1.5;
        }

        #feedbackBox.ok {
            background: #d4f5e9;
            border: 1px solid #2a9d8f;
            color: #1a6b53;
        }

        #feedbackBox.warn {
            background: #fff3cd;
            border: 1px solid #f3a712;
            color: #7a5700;
        }

        #feedbackBox.err {
            background: #fde8e8;
            border: 1px solid #e63946;
            color: #a4161a;
        }

        #textCheckArea {
            margin-top: 12px;
        }

        #textCheckArea textarea {
            width: 100%;
            min-height: 60px;
            padding: 8px;
            border-radius: 8px;
            border: 1px solid var(--border);
            font-family: inherit;
        }

        #textCheckArea .checkBtn {
            margin-top: 7px;
            padding: 8px 16px;
            background: #264653;
            color: #fff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: .9em;
        }

        #modal .modalContinueBtn {
            margin-top: 16px;
            padding: 10px 22px;
            background: #228175;
            color: #fff;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-size: 1em;
            font-weight: bold;
            display: none;
        }

        #codeCheckResult {
            margin-top: 10px;
            padding: 10px 14px;
            border-radius: 10px;
            font-size: .9em;
            display: none;
        }

        footer {
            text-align: center;
            padding: 14px;
            font-size: .78em;
            color: #666;
        }

        @media(max-width:950px) {
            #main {
                flex-direction: column;
            }

            #taskNav {
                flex-direction: row;
                flex-wrap: wrap;
            }

            #turtleArea {
                flex: 1 1 100%;
            }

            #canvasContainer {
                width: 100%;
                height: auto;
                aspect-ratio: 1;
            }
        }
    
