        :root {
            --primary-color: #4A90E2;
            --secondary-color: #50E3C2;
            --background-color: #f4f7f9;
            --panel-background: #ffffff;
            --text-color: #333;
            --border-color: #dfe7ed;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            --border-radius: 8px;
        }

        html,
        body {
            height: 100%;
            margin: 0;
            font-family: 'Noto Sans TC', sans-serif;
            background-color: var(--background-color);
            color: var(--text-color);
            font-size: 16px;
        }

        body {
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .main-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 24px;
            background-color: var(--panel-background);
            border-bottom: 1px solid var(--border-color);
            height: 64px;
            flex-shrink: 0;
        }

        .main-header .logo {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary-color);
        }

        .main-header .action-buttons button,
        .main-header .action-buttons .file-upload-wrapper {
            margin-left: 12px;
        }

        .workspace-container {
            display: flex;
            flex: 1;
            overflow: hidden;
            padding: 16px;
            gap: 16px;
        }

        #blocklyDiv {
            flex: 1;
            min-width: 0;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            height: 100%;
        }

        .side-panel {
            flex: 0 0 380px;
            min-width: 260px;
            max-width: 700px;
            display: flex;
            flex-direction: column;
            background-color: var(--panel-background);
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            overflow: hidden;
        }

        .panel-tabs {
            display: flex;
            border-bottom: 1px solid var(--border-color);
        }

        .tab-button {
            flex: 1;
            padding: 14px 0;
            background: #f8f9fa;
            border: none;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 500;
            color: #6c757d;
            transition: all 0.2s ease-in-out;
            border-bottom: 3px solid transparent;
        }

        .tab-button:hover {
            background: #e9ecef;
        }

        .tab-button.active {
            color: var(--primary-color);
            background: var(--panel-background);
            border-bottom-color: var(--primary-color);
        }

        .panel-content {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
        }

        .panel-content hr {
            border: none;
            border-top: 1px solid var(--border-color);
            margin: 24px 0;
        }

        #studentInterface,
        #teacherInterface,
        #quizInterface {
            display: none;
        }

        #studentInterface.active,
        #teacherInterface.active,
        #quizInterface.active {
            display: block;
        }

        .execution-controls {
            margin-bottom: 24px;
        }

        #green-flag-icon {
            width: 40px;
            height: 40px;
            cursor: pointer;
            transition: transform 0.2s ease-in-out;
        }

        #green-flag-icon:hover {
            transform: scale(1.1);
        }

        #green-flag-icon:active {
            transform: scale(0.95);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            font-weight: 500;
            margin-bottom: 8px;
        }

        .form-control {
            width: 100%;
            padding: 10px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            box-sizing: border-box;
            transition: border-color 0.2s;
        }

        .form-control:focus {
            outline: none;
            border-color: var(--primary-color);
        }

        .teacher-test-case {
            border: 1px solid var(--border-color);
            padding: 16px;
            margin-bottom: 16px;
            border-radius: var(--border-radius);
            background-color: #fdfdfd;
            position: relative;
        }

        .remove-case-btn {
            position: absolute;
            top: 12px;
            right: 12px;
            background: none;
            border: none;
            color: #dc3545;
            font-size: 1.2rem;
            cursor: pointer;
            transition: transform 0.2s;
        }

        .btn {
            padding: 10px 18px;
            font-size: 0.95rem;
            border-radius: 6px;
            border: 1px solid transparent;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            justify-content: center;
        }

        .btn-primary {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-primary:hover {
            background-color: #3a82d2;
        }

        .btn-secondary {
            background-color: #f0f3f6;
            border-color: #d1d9e0;
            color: #333;
        }

        .btn-success {
            background-color: #28a745;
            color: white;
        }

        .btn-danger {
            background-color: #dc3545;
            color: white;
        }

        .file-upload-wrapper {
            position: relative;
            overflow: hidden;
            display: inline-block;
        }

        .file-upload-wrapper input[type=file] {
            position: absolute;
            left: 0;
            top: 0;
            opacity: 0;
            cursor: pointer;
            font-size: 100px;
        }

        .modal-overlay {
            display: none;
            position: fixed;
            z-index: 1000;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.5);
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: var(--panel-background);
            border-radius: var(--border-radius);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            width: 90%;
            max-width: 800px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
        }

        .modal-header {
            padding: 16px 24px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-close-btn {
            background: none;
            border: none;
            font-size: 1.8rem;
            cursor: pointer;
            color: #aaa;
        }

        .modal-body {
            padding: 24px;
            overflow-y: auto;
        }

        .modal-body pre {
            white-space: pre-wrap;
            word-wrap: break-word;
            margin: 0;
            background-color: #f8f9fa;
            padding: 16px;
            border-radius: 6px;
        }

        .var-modal,
        .block-modal {
            display: none;
            position: fixed;
            overflow: hidden;
            z-index: 2000;
            inset: 0;
            background-color: rgba(0, 0, 0, 0.4);
            animation: fadeIn 0.4s;
        }

        .modal-var-content,
        .modal-block-content {
            background-color: #fefefe;
            border-radius: 10px;
            animation: slideIn 0.4s;
            position: absolute;
        }

        .modal-var-content {
            top: 60px;
            left: calc(50% - 200px);
            width: 400px;
        }

        .modal-block-content {
            top: 60px;
            left: calc(50% - 350px);
            width: 700px;
        }

        .model-input {
            height: 40px;
            padding: 5px 10px;
            border-radius: 6px;
            font-size: 1rem;
            margin: 15px 0;
            border: 1px solid var(--border-color);
            outline: none;
            width: 80%;
        }

        .model-button {
            height: 40px;
            width: 120px;
            font-size: 1rem;
            border-radius: 6px;
            border: 1px solid var(--border-color);
            cursor: pointer;
            margin: 0 10px;
        }

        .model-sure-btn {
            background-color: var(--primary-color);
            color: white;
            border: none;
        }

        .model-cancle-btn {
            background-color: #f9f9f9;
            color: black;
        }

        .modal-block-workspace {
            min-height: 200px;
            position: relative;
        }

        .modal-block-workspace .injectionDiv {
            position: absolute;
            inset: 0;
        }

        .modal-block-workspace .blocklySvg {
            background-color: hsla(215, 100%, 95%, 1);
        }

        .modal-block-btns {
            display: flex;
            width: 100%;
            flex-direction: row;
            justify-content: space-around;
        }

        .modal-block-btn {
            width: 10rem;
            padding: 10px;
            margin: 10px 0;
            border: 2px solid #ccc;
            border-radius: 12px;
            text-align: center;
            cursor: pointer;
            transition: border-color 0.2s;
        }

        .modal-block-btn:hover {
            border-color: var(--primary-color);
        }

        .block-btn-img {
            max-height: 48px;
        }

        .block-btn-l1 {
            font-weight: bold;
            color: black;
            font-size: 1.1rem;
        }

        .block-btn-l2 {
            color: gray;
            font-size: 0.9rem;
        }

        @keyframes slideIn {
            from {
                top: -300px;
                opacity: 0
            }

            to {
                top: 60px;
                opacity: 1
            }
        }

        @keyframes fadeIn {
            from {
                opacity: 0
            }

            to {
                opacity: 1
            }
        }

        #quizHeader {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
            font-size: 1.2rem;
        }

        #timer {
            font-weight: bold;
            color: #dc3545;
        }

        #quizScoreDisplay {
            font-weight: bold;
            color: #28a745;
        }

        #questionNav {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 24px;
            padding-bottom: 24px;
            border-bottom: 1px solid var(--border-color);
        }

        .nav-btn {
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            background: #fff;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
        }

        .nav-btn.current {
            border-color: var(--primary-color);
            background: #e9f5ff;
        }

        .nav-btn.submitted {
            background: #d4edda;
            border-color: #c3e6cb;
        }

        #testCaseInputArea {
            display: none !important;
        }

        /* 新增：改進的結果顯示樣式 */
        .result-pass {
            color: #28a745;
            font-weight: bold;
        }

        .result-fail {
            color: #dc3545;
            font-weight: bold;
        }

        .result-output {
            background-color: #f8f9fa;
            padding: 10px;
            border-radius: 4px;
            margin: 5px 0;
            font-family: monospace;
        }

        .execution-log {
            background-color: #272822;
            color: #f8f8f2;
            padding: 10px;
            border-radius: 4px;
            margin: 5px 0;
            font-family: monospace;
            font-size: 0.9em;
            max-height: 200px;
            overflow-y: auto;
        }

        #questionContent_single,
        #quizQuestionContent {
            white-space: pre-wrap;
            /* 關鍵：保留題目中的換行與空白 */
            font-family: Consolas, "Courier New", monospace;
            /* 關鍵：使用等寬字體讓箭頭對齊 */
            line-height: 1.6;
            /* 增加行距，讓閱讀更舒適 */
            background-color: #fafafa;
            /* (選用) 加上淡灰底色區隔題目 */
            padding: 15px;
            /* (選用) 增加內距 */
            border-radius: 6px;
            /* (選用) 圓角 */
            border: 1px solid #eee;
            /* (選用) 邊框 */
        }
            footer {
            font-size: 11px;
            color: #999;
            text-align: center;
            padding: 5px;
            background: #fff;
            border-top: 1px solid #eee;
        }
 /* 底部操作 */
        .proc-modal-footer {
            padding: 12px 20px;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            background: #fafafa;
        }

        .proc-ok-btn {
            background: #FF6680;
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 8px 24px;
            font-size: .95rem;
            cursor: pointer;
            font-weight: bold;
        }

        .proc-ok-btn:hover {
            background: #e8506a;
        }

        .proc-cancel-btn {
            background: #eee;
            color: #555;
            border: none;
            border-radius: 6px;
            padding: 8px 18px;
            font-size: .95rem;
            cursor: pointer;
        }

        .proc-cancel-btn:hover {
            background: #ddd;
        }

        .tag {
            display: inline-block;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: bold;
            margin-right: 5px;
        }

        .tag-robot {
            background: #e3f2fd;
            color: #1565c0;
            border: 1px solid #bbdefb;
        }

        .tag-sensor {
            background: #fff3e0;
            color: #ef6c00;
            border: 1px solid #ffe0b2;
        }

        .tag-color {
            background: #f3e5f5;
            color: #7b1fa2;
            border: 1px solid #e1bee7;
        }

        footer {
            font-size: 11px;
            color: #999;
            text-align: center;
            padding: 5px;
            background: #fff;
            border-top: 1px solid #eee;
        }

        .contact-box {
            background: #e3f2fd;
            padding: 5px;
            border-radius: 6px;
            margin-top: 5px;
            border: 1px solid #90caf9;
            text-align: center;
        }
