        /* --- Modals & Toasts (Office Style) --- */
        .dialog-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.2s, background 0.3s;
        }
        body.dark-mode .dialog-overlay { background: rgba(0,0,0,0.7); }
        .dialog-overlay.active { opacity: 1; pointer-events: all; }

        .word-dialog {
            background: var(--word-page); border: 1px solid var(--word-border); box-shadow: 0 4px 15px rgba(0,0,0,0.15); width: 650px; max-width: 90%; display: flex; flex-direction: column; transition: background 0.3s, border-color 0.3s;
        }
        .word-dialog-header { background: var(--word-page); padding: 12px 20px; font-size: 15px; color: var(--word-text); display: flex; justify-content: space-between; border-bottom: 1px solid var(--word-border); font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; transition: background 0.3s; }
        .word-dialog-close { cursor: pointer; color: #999; font-size: 14px; }
        .word-dialog-close:hover { color: #d32f2f; }
        .word-dialog-body { padding: 25px 30px; font-size: 14px; line-height: 1.6; max-height: 70vh; overflow-y: auto; color: var(--word-text); font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
        .word-dialog-footer { padding: 12px 20px; background: var(--word-workspace); border-top: 1px solid var(--word-border); display: flex; justify-content: flex-end; gap: 10px; transition: background 0.3s; }

        /* 選擇計分模式 — radio 選項垂直排列 */
        .target-speed-options {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin: 16px 0 8px;
        }
        .target-speed-options label {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px 14px;
            border: 1px solid var(--word-border);
            border-radius: 4px;
            cursor: pointer;
            background: var(--word-workspace);
            transition: border-color 0.15s, background 0.15s;
        }
        .target-speed-options label:hover {
            border-color: var(--word-blue);
            background: rgba(43, 87, 154, 0.06);
        }
        body.dark-mode .target-speed-options label:hover {
            background: rgba(122, 165, 235, 0.12);
        }
        .target-speed-options input[type="radio"] {
            margin-top: 4px;
            flex-shrink: 0;
        }
        .target-speed-options label > span {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .target-speed-options .target-speed-lbl {
            font-weight: 600;
            color: var(--word-text);
            display: block;
            line-height: 1.4;
        }
        .target-speed-options .target-speed-hint {
            font-size: 12px;
            color: var(--word-text-light);
            line-height: 1.45;
            display: block;
        }
        
        .toast-msg {
            position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.85); color: white; padding: 12px 24px; border-radius: 6px; font-size: 15px; z-index: 3000; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; font-weight: 500; text-align: center; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }
        body.dark-mode .toast-msg { background: rgba(255,255,255,0.9); color: #111; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
        .toast-msg.show { opacity: 1; transform: translate(-50%, -10px); }

        .music-mode-close-btn {
            display: none;
            border: 0;
            background: transparent;
            color: white;
            padding: 0;
            font-family: var(--ui-font);
        }
        body.music-mode .music-mode-close-btn { display: flex; }
        .music-mode-close-btn:hover { background-color: rgba(255,255,255,0.16); }
        .music-mode-close-btn svg {
            width: 13px;
            height: 13px;
            fill: currentColor;
        }
        .music-mode-close-btn .music-mode-close-btn__x {
            fill: none;
            stroke: currentColor;
            stroke-width: 1.7;
            stroke-linecap: round;
        }

        /* --- App bootstrap loading (MS Word 2016 style) --- */
        .app-loading-overlay {
            position: fixed;
            inset: 0;
            z-index: 3500;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.5);
            backdrop-filter: blur(1px);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s ease;
        }
        body.dark-mode .app-loading-overlay {
            background: rgba(0, 0, 0, 0.5);
        }
        .app-loading-overlay.active {
            opacity: 1;
            pointer-events: all;
        }
        .app-loading-panel {
            width: 380px;
            max-width: calc(100% - 40px);
            background: var(--word-page);
            border: 1px solid var(--word-border);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
            overflow: hidden;
            font-family: var(--ui-font);
        }
        .app-loading-panel__accent {
            height: 4px;
            background: var(--word-blue);
        }
        .app-loading-panel__body {
            padding: 26px 32px 22px;
            text-align: center;
        }
        .app-loading-panel__brand {
            display: inline-block;
            width: 48px;
            height: 48px;
            margin-bottom: 14px;
            object-fit: contain;
        }
        .app-loading-panel__title {
            font-size: 12px;
            color: var(--word-text-light);
            margin-bottom: 4px;
        }
        .app-loading-panel__message {
            font-size: 15px;
            color: var(--word-text);
            font-weight: 600;
            margin-bottom: 14px;
        }
        .app-loading-progress-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .app-loading-progress {
            flex: 1;
            height: 6px;
            background: var(--word-bg);
            border: 1px solid var(--word-border);
            overflow: hidden;
        }
        .app-loading-progress__bar {
            height: 100%;
            width: 0%;
            background: var(--word-blue);
            transition: width 0.2s ease-out;
        }
        .app-loading-panel__percent {
            min-width: 38px;
            font-size: 12px;
            font-weight: 600;
            color: var(--word-text-light);
            text-align: right;
            font-variant-numeric: tabular-nums;
        }
        body.app-boot-loading {
            overflow: hidden;
        }

        /* === Windows XP-styled "minimize" desktop === */
