        :root {
            /* Palette */
            --bg-body: #f0f2f5; 
            --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            --text-main: #2d3436; 
            --text-sec: #636e72;
            --accent: #FDB827;
            --card-bg: #ffffff;
            --btn-bg: #2d3436; 
            --btn-text: #ffffff;
            --border-color: #dfe6e9;
            --shadow: 0 10px 20px rgba(0,0,0,0.08);
            
            --tuner-bg: #f1f2f6; 
            --tuner-needle: #ff7675; 
            --tuner-ok: #00b894;
            
            --chart-header: #f1f2f6;
            --chart-row-even: #ffffff;
            --chart-row-odd: #fafafa;
            --chart-hover: #fff3cd;
        }

        [data-theme="dark"] {
            --bg-body: #121212; 
            --bg-gradient: linear-gradient(135deg, #1e1e1e 0%, #121212 100%);
            --text-main: #dfe6e9; 
            --text-sec: #b2bec3;
            --accent: #D4AF37;
            --card-bg: #2d3436;
            --btn-bg: #D4AF37; 
            --btn-text: #1e1e1e;
            --border-color: #444;
            --shadow: 0 10px 20px rgba(0,0,0,0.4);
            
            --tuner-bg: #222; 
            --tuner-needle: #ff7675; 
            --tuner-ok: #00b894;

            --chart-header: #353b48;
            --chart-row-even: #2d3436;
            --chart-row-odd: #252a2c;
            --chart-hover: #443c20;
        }

        * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        
        body {
            font-family: 'Segoe UI', 'Roboto', sans-serif;
            background: var(--bg-gradient); color: var(--text-main);
            display: flex; flex-direction: column; align-items: center;
            padding: 20px; margin: 0; min-height: 100vh;
            transition: background 0.3s, color 0.3s;
            overflow-x: hidden;
        }
        
        .brand-header { text-align: center; margin-bottom: 15px; }
        .brand-link { 
            font-size: 2.5rem; font-weight: 800; text-decoration: none; 
            color: var(--text-main); letter-spacing: -1px; 
            background: linear-gradient(45deg, var(--text-main), var(--accent));
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
        }
        .main-title { margin: 5px 0; font-size: 1.5rem; color: var(--text-main); font-weight: 700; text-align: center; }
        .instruction { margin: 5px 0 20px 0; font-size: 0.9rem; color: var(--accent); font-weight: 600; text-align: center; }
        
        .controls-wrapper { display: flex; flex-direction: column; gap: 15px; width: 100%; max-width: 900px; margin-bottom: 25px; align-items: center; }

        .practice-panel { width: 100%; max-width: 1400px; margin: 0 auto 25px; padding: 22px 26px; border: 1px solid var(--border-color); border-radius: 20px; background: var(--card-bg); box-shadow: var(--shadow); }
        .practice-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
        .practice-eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 1.5px; }
        .practice-heading h2 { margin: 0; font-size: 1.35rem; }
        .practice-description { margin: 6px 0 0; color: var(--text-sec); }
        .practice-score { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--border-color); border-radius: 20px; color: var(--text-sec); font-size: 0.85rem; font-weight: 700; }
        .practice-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
        .practice-controls label { font-weight: 700; }
        .practice-controls select { max-width: 100%; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 20px; background: var(--bg-body); color: var(--text-main); font-size: 0.95rem; }
        .practice-controls [hidden] { display: none !important; }
        .practice-question { min-height: 1.5em; margin: 22px 0 14px; text-align: center; font-size: 1.15rem; }
        .practice-choices { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
        .practice-answer { min-width: 100px; justify-content: center; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }
        .practice-answer:disabled { cursor: default; opacity: 0.72; }
        .practice-answer:hover:not(:disabled), .practice-answer:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
        .practice-feedback { min-height: 1.5em; margin: 13px 0 0; color: var(--text-sec); text-align: center; }
        .practice-feedback.is-correct { color: #00a878; font-weight: 700; }
        .practice-feedback.is-incorrect { color: #e74c3c; font-weight: 700; }
        .teaching-panel { width: 100%; max-width: 1400px; margin: 0 auto 24px; padding: 18px 22px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--card-bg); box-shadow: var(--shadow); }
        .teaching-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
        .teaching-heading-copy { flex: 1 1 280px; min-width: 0; text-align: left; }
        .teaching-heading-actions { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 8px; }
        .teaching-panel-heading h2 { margin: 0; font-size: 1.15rem; }
        .teaching-panel-heading p:last-child { margin: 5px 0 0; color: var(--text-sec); font-size: 0.9rem; }
        .teaching-mode-control, .teaching-option { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; font-weight: 700; cursor: pointer; }
        .teaching-mode-control { flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--border-color); border-radius: 22px; background: var(--bg-body); }
        .teaching-mode-control input, .teaching-option input { width: 18px; height: 18px; accent-color: var(--accent); }
        .teaching-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
        .teaching-controls > label:first-child { font-weight: 700; }
        .teaching-controls select { min-height: 40px; padding: 7px 12px; border: 1px solid var(--border-color); border-radius: 20px; background: var(--bg-body); color: var(--text-main); }
        .teaching-option { padding: 5px 9px; border: 1px solid var(--border-color); border-radius: 10px; font-size: 0.9rem; }
        .teaching-controls button { min-height: 40px; padding: 8px 14px; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }
        .teaching-controls button:disabled { cursor: not-allowed; opacity: 0.5; }
        .teaching-status { min-height: 1.4em; margin: 12px 0 0; color: var(--text-sec); font-size: 0.88rem; }
        .teaching-keyboard-hint { margin: 10px 0 0; color: var(--text-sec); font-size: 0.82rem; }
        .teaching-mode-hint { position: fixed; z-index: 6000; top: max(14px, env(safe-area-inset-top)); left: 50%; width: max-content; max-width: calc(100vw - 28px); padding: 12px 18px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--card-bg); color: var(--text-main); box-shadow: var(--shadow); font-size: 0.9rem; font-weight: 700; text-align: center; opacity: 0; transform: translate(-50%, -8px); transition: opacity 220ms ease, transform 220ms ease; pointer-events: none; }
        .teaching-mode-hint[hidden] { display: none; }
        .teaching-mode-hint.is-visible { opacity: 1; transform: translate(-50%, 0); }
        .lesson-block { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-color); }
        .lesson-heading-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
        .lesson-heading-row > div { margin-right: auto; }
        .lesson-heading-row h3 { margin: 0; }
        .lesson-heading-row .practice-eyebrow { margin-bottom: 2px; }
        .lesson-heading-row label { font-weight: 700; }
        .lesson-heading-row select { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 18px; background: var(--bg-body); color: var(--text-main); }
        .lesson-description { margin: 5px 0 0; color: var(--text-sec); }
        .lesson-content { margin-top: 18px; padding: 18px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-body); text-align: left; }
        .lesson-content h4 { margin: 0; font-size: 1rem; }
        .lesson-summary { margin: 7px 0 0; color: var(--accent); font-weight: 700; }
        .lesson-text { margin: 12px 0 18px; color: var(--text-sec); line-height: 1.7; }
        .lesson-steps-title { margin-top: 0 !important; }
        .lesson-steps { margin: 8px 0 0; padding-left: 22px; color: var(--text-main); line-height: 1.75; }
        .lesson-context { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border-color); color: var(--text-sec); font-size: 0.9rem; }
        .lesson-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }

        .main-controls { 
            background: var(--card-bg); padding: 12px 20px; border-radius: 50px; 
            box-shadow: var(--shadow); border: 1px solid var(--border-color);
            display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; width: auto;
        }
        .main-controls select { flex: 0 0 auto; width: auto; padding: 10px 15px; font-size: 15px; border: 1px solid var(--border-color); border-radius: 20px; cursor: pointer; background: var(--bg-body); color: var(--text-main); outline: none; font-weight: 600; }

        .tools-bar { background: var(--card-bg); padding: 10px 20px; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border-color); display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; align-items: center; }

        .view-preferences { width: 100%; max-width: 900px; border: 1px solid var(--border-color); border-radius: 14px; background: var(--card-bg); box-shadow: var(--shadow); }
        .view-preferences h3 { margin: 0; padding: 12px 16px; color: var(--text-main); font-size: 0.95rem; font-weight: 700; }
        .view-preferences h3 i { margin-right: 7px; color: var(--accent); }
        .view-preferences-content { padding: 0 16px 14px; }
        .view-preferences-content > p { margin: 0 0 10px; color: var(--text-sec); font-size: 0.9rem; }
        .section-visibility-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 12px; }
        .section-visibility-option { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 5px 9px; border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-main); text-align: left; cursor: pointer; }
        .section-visibility-option input { width: 18px; height: 18px; accent-color: var(--accent); }
        .section-dismiss-button { flex: 0 0 36px; width: 36px; height: 36px; min-height: 36px; margin-left: auto; padding: 0; justify-content: center; border: 1px solid var(--border-color); border-radius: 50%; background: var(--bg-body); color: var(--text-sec); font-size: 1.35rem; line-height: 1; }
        .section-dismiss-button:hover { border-color: var(--accent); color: var(--text-main); }
        .section-restore-hint { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; width: min(100%, 1100px); margin: 0 auto 18px; padding: 12px 16px; box-sizing: border-box; border: 1px dashed var(--border-color); border-radius: 12px; background: var(--card-bg); color: var(--text-sec); font-size: 0.88rem; text-align: center; }
        .section-restore-hint button { min-height: 38px; padding: 7px 12px; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }
        .view-preferences-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--text-sec); font-size: 0.85rem; }
        .view-preferences-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
        .view-preferences-footer button { padding: 8px 12px; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }
        .section-dependency-notice { padding: 12px; border: 1px solid var(--accent); border-radius: 10px; color: var(--text-main); text-align: center; }
        .section-dependency-notice button { margin: 8px auto 0; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }
        [data-customizable-section].is-user-hidden { display: none !important; }

        .fretboard-toolbar { display: flex; gap: 15px; width: 100%; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 10px; padding: 10px; background: var(--card-bg); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
        .position-group { display: flex; gap: 5px; flex-wrap: nowrap; overflow-x: auto; align-items: center; scrollbar-width: none; }
        
        .toggle-wrapper { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; padding-left: 15px; border-left: 1px solid var(--border-color); }
        .switch { position: relative; display: inline-block; width: 44px; height: 24px; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
        .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
        input:checked + .slider { background-color: var(--accent); }
        input:checked + .slider:before { transform: translateX(20px); }

        button { padding: 10px 18px; font-size: 14px; border: none; border-radius: 50px; cursor: pointer; transition: all 0.2s; font-weight: 600; display: flex; align-items: center; gap: 6px; }
        .pos-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); min-width: 60px; padding: 8px 12px; font-size: 13px; justify-content: center; }
        .pos-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
        button.primary { background-color: var(--btn-bg); color: var(--btn-text); }
        button.primary:hover { transform: translateY(-2px); opacity: 0.9; }
        .theme-toggle { background: transparent; color: var(--text-main); padding: 8px; width: 40px; height: 40px; justify-content: center; border: 1px solid var(--border-color); border-radius: 50%; }

        .metro-group { display: flex; align-items: center; gap: 10px; }
        .live-input-group { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; padding-left: 16px; border-left: 1px solid var(--border-color); color: var(--text-main); }
        .live-keyboard-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
        .live-keyboard-toggle input { width: 18px; height: 18px; accent-color: #00a896; }
        .live-key-hint { color: var(--text-sec); font: 0.76rem/1.4 monospace; }
        .live-mode-hint { flex: 1 0 100%; color: var(--text-sec); font-size: 0.75rem; text-align: center; }
        #midiConnectButton, #midiInputSelect { min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }
        #midiInputSelect { max-width: 180px; border-radius: 10px; }
        #liveInputStatus { min-width: 120px; color: var(--text-sec); font-size: 0.78rem; }
        .metro-light { width: 14px; height: 14px; border-radius: 50%; background-color: #b2bec3; }
        .metro-light.flash { background-color: #ff7675; box-shadow: 0 0 12px #ff7675; transform: scale(1.3); }
        .metro-beat-visual { color: var(--text-sec); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.08em; opacity: 0.55; transition: color 90ms ease, opacity 90ms ease, transform 90ms ease; }
        .metro-beat-visual.is-beating { color: #ff7675; opacity: 1; transform: scale(1.16); }
        #bpmInput { width: 70px; padding: 8px 5px; text-align: center; font-size: 16px; font-weight: bold; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); }

        .canvas-container { display: flex; flex-direction: column; gap: 25px; width: 100%; max-width: 1400px; align-items: center; }
        .top-row { display: flex; gap: 25px; width: 100%; flex-wrap: wrap; }
        .canvas-wrapper { background: var(--card-bg); padding: 15px; border-radius: 20px; box-shadow: var(--shadow); text-align: center; width: 100%; overflow: hidden; position: relative; border: 1px solid var(--border-color); }
        .canvas-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
        .canvas-wrapper h3 { margin: 0; font-size: 1.1rem; color: var(--text-main); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
        .section-fullscreen-button {
            display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center;
            min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-color);
            background: var(--bg-body); color: var(--text-main); font-size: 0.8rem;
        }
        .section-fullscreen-button i { color: var(--accent); }
        .diagram-hint { display: none; }
        canvas { width: 100% !important; height: auto !important; max-width: 100%; touch-action: none; border-radius: 10px; }
        .diagram-scroll { width: 100%; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
        .instrument-scroll { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
        .instrument-hint { display: none; margin: -5px 0 10px; color: var(--text-sec); font-size: 0.85rem; }
        .col-circle { flex: 1 1 350px; } .col-theory { flex: 2 1 600px; }
        #tooltip { position: fixed; display: none; background: rgba(45, 52, 54, 0.95); color: white; padding: 6px 12px; border-radius: 6px; font-size: 12px; pointer-events: none; z-index: 9999; transform: translate(15px, 15px); backdrop-filter: blur(4px); }
        #tunerModal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 2000; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
        .tuner-box { background: var(--card-bg); padding: 30px; border-radius: 30px; width: 90%; max-width: 400px; text-align: center; position: relative; }
        .tuner-gauge { width: 100%; max-width: 280px; height: 140px; margin: 0 auto; border-top-left-radius: 140px; border-top-right-radius: 140px; background: var(--tuner-bg); position: relative; overflow: hidden; }
        .tuner-needle { width: 4px; height: 130px; background: var(--text-main); position: absolute; bottom: 0; left: 50%; transform-origin: bottom center; transition: transform 0.1s ease-out; }
        .close-tuner { position: absolute; top: 20px; right: 25px; padding: 0; border: 0; background: transparent; font-size: 28px; cursor: pointer; color: var(--text-sec); }
        .site-footer { margin-top: 40px; width: 100%; text-align: center; padding: 25px; color: var(--text-sec); font-size: 0.9rem; }
        .site-footer a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
        .site-footer a:hover { color: var(--text-main); }
        body.playback-dock-visible { padding-bottom: 125px; }
        .playback-dock {
            position: fixed; z-index: 4500; left: 50%; bottom: env(safe-area-inset-bottom, 0px);
            width: min(980px, calc(100% - 24px)); max-height: 112px; transform: translateX(-50%);
            box-sizing: border-box; padding: 10px 14px 12px; overflow: hidden;
            border: 1px solid var(--border-color); border-bottom: 0; border-radius: 16px 16px 0 0;
            background: var(--card-bg); color: var(--text-main); box-shadow: 0 -8px 28px rgba(0,0,0,0.16);
        }
        .playback-dock[hidden] { display: none; }
        .playback-dock-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
        .playback-dock-copy { display: flex; min-width: 0; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
        .playback-dock-eyebrow { color: var(--text-sec); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.08em; }
        #playbackCurrent { font-size: 0.95rem; }
        .playback-dock-details { color: var(--text-sec); font-size: 0.8rem; }
        .playback-dock-dismiss { flex: 0 0 auto; width: 34px; height: 34px; padding: 0; justify-content: center; border: 1px solid var(--border-color); background: var(--bg-body); color: var(--text-main); font-size: 1.3rem; }
        .playback-sequence { display: flex; gap: 6px; margin: 8px 0 0; padding: 0 0 3px; overflow-x: auto; list-style: none; scrollbar-width: thin; }
        .playback-sequence li { flex: 0 0 auto; padding: 4px 9px; border: 1px solid var(--border-color); border-radius: 20px; background: var(--bg-body); color: var(--text-main); font: 600 0.78rem/1.3 monospace; }
        body.mobile-section-expanded { overflow: hidden; }
        .canvas-wrapper.mobile-expanded,
        .canvas-wrapper:fullscreen,
        .canvas-wrapper:-webkit-full-screen {
            position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column;
            width: 100vw !important; height: 100vh !important; height: 100dvh !important;
            box-sizing: border-box; max-width: none; max-height: none; margin: 0; padding: 10px;
            padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
            overflow: hidden; border: 0; border-radius: 0; background: var(--bg-body); text-align: center;
        }
        .canvas-wrapper.mobile-expanded .canvas-panel-heading,
        .canvas-wrapper:fullscreen .canvas-panel-heading,
        .canvas-wrapper:-webkit-full-screen .canvas-panel-heading { flex: 0 0 auto; }
        .canvas-wrapper.mobile-expanded .diagram-scroll,
        .canvas-wrapper:fullscreen .diagram-scroll,
        .canvas-wrapper:-webkit-full-screen .diagram-scroll {
            display: flex; flex: 1 1 auto; align-items: center; justify-content: center;
            min-width: 0; min-height: 0; max-height: none; height: auto; overflow: hidden;
            border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-body);
        }
        .canvas-wrapper.mobile-expanded .diagram-scroll canvas,
        .canvas-wrapper:fullscreen .diagram-scroll canvas,
        .canvas-wrapper:-webkit-full-screen .diagram-scroll canvas {
            flex: 0 1 auto;
            width: var(--fullscreen-canvas-width, auto) !important;
            height: var(--fullscreen-canvas-height, auto) !important;
            max-width: 100%; max-height: 100%; min-width: 0; min-height: 0;
            object-fit: contain;
        }
        @media (max-width: 640px), (pointer: coarse) and (max-height: 600px) {
            body { padding: 12px; }
            body.playback-dock-visible { padding-bottom: 140px; }
            .playback-dock { width: calc(100% - 12px); max-height: 126px; padding: 9px 10px 11px; }
            .brand-link { font-size: 2rem; }
            .instruction { max-width: 34rem; font-size: 0.82rem; line-height: 1.5; }
            .controls-wrapper { gap: 10px; margin-bottom: 16px; }
            .main-controls { width: 100%; padding: 12px; border-radius: 18px; }
            .main-controls select { flex: 1 1 42%; min-width: 0; }
            .main-controls button { min-height: 44px; }
            .section-dismiss-button { width: 40px; height: 40px; min-height: 40px; flex-basis: 40px; }
            .section-restore-hint { flex-direction: column; align-items: stretch; margin-bottom: 14px; padding: 12px; }
            .section-restore-hint button { min-height: 44px; justify-content: center; }
            .tools-bar { width: 100%; gap: 12px; padding: 12px; }
            .metro-group { flex-wrap: wrap; justify-content: center; }
            .live-input-group { width: 100%; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--border-color); }
            .live-input-group > * { min-height: 44px; }
            .live-key-hint { flex: 1 0 100%; min-height: auto; text-align: center; }
            .live-mode-hint { min-height: auto; }
            #midiConnectButton { justify-content: center; }
            .practice-panel { padding: 18px 14px; border-radius: 16px; }
            .teaching-panel { padding: 16px 14px; }
            .teaching-panel-heading { align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 10px; }
            .teaching-heading-copy { flex-basis: 100%; }
            .teaching-heading-actions { width: 100%; justify-content: flex-start; }
            .teaching-mode-control { min-height: 44px; }
            .teaching-controls { align-items: stretch; }
            .teaching-controls > label:first-child { flex: 1 0 100%; }
            .teaching-controls select { flex: 1 1 100%; min-height: 44px; }
            .teaching-option { flex: 1 1 100%; min-height: 44px; }
            .teaching-controls button { flex: 1 1 calc(50% - 10px); min-height: 44px; justify-content: center; }
            .practice-heading { flex-direction: column; gap: 12px; }
            .practice-score { align-self: flex-start; }
            .practice-controls { justify-content: flex-start; }
            .practice-controls label { flex: 1 0 100%; }
            .practice-controls select { flex: 1 1 100%; min-height: 44px; }
            .practice-controls button { min-height: 44px; }
            .section-visibility-controls { grid-template-columns: 1fr; }
            .view-preferences-footer { align-items: flex-start; flex-direction: column; }
            .view-preferences-actions { width: 100%; flex-direction: column; align-items: stretch; }
            .view-preferences-footer button { min-height: 44px; }
            .section-dependency-notice button { min-height: 44px; }
            .practice-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .practice-answer { min-width: 0; min-height: 44px; }
            .lesson-heading-row > div { flex: 1 0 100%; }
            .lesson-heading-row select { flex: 1 1 100%; min-height: 44px; }
            .lesson-content { padding: 14px; }
            .lesson-actions { display: grid; grid-template-columns: 1fr; }
            .lesson-actions button { justify-content: center; min-height: 44px; }
            .canvas-container, .top-row { gap: 14px; }
            .canvas-wrapper { padding: 12px; border-radius: 16px; }
            .canvas-panel-heading { margin-bottom: 10px; }
            .section-fullscreen-button { min-height: 42px; }
            .diagram-hint { display: block; margin: -3px 0 8px; color: var(--text-sec); font-size: 0.78rem; line-height: 1.4; text-align: left; }
            .diagram-scroll { max-height: none; overflow: visible; border: 0; border-radius: 0; background: transparent; touch-action: pan-x pan-y; }
            .diagram-scroll canvas { width: 100% !important; max-width: 100%; touch-action: pan-x pan-y; }
            .instrument-scroll { overflow-x: auto; overflow-y: hidden; }
            .instrument-scroll canvas { width: 1400px !important; max-width: none; }
            .instrument-hint { display: block; }
            .instrument-scroll { touch-action: pan-x pan-y; }
            .fretboard-toolbar { justify-content: flex-start; }
            .position-group { max-width: 100%; }
            .toggle-wrapper { padding-left: 0; border-left: 0; }
            .canvas-wrapper.mobile-expanded,
            .canvas-wrapper:fullscreen,
            .canvas-wrapper:-webkit-full-screen {
                position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column;
                width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-width: none; max-height: none;
                box-sizing: border-box; margin: 0; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
                overflow: hidden; border: 0; border-radius: 0; background: var(--bg-body); text-align: center;
            }
            .canvas-wrapper.mobile-expanded .canvas-panel-heading,
            .canvas-wrapper:fullscreen .canvas-panel-heading,
            .canvas-wrapper:-webkit-full-screen .canvas-panel-heading { flex: 0 0 auto; }
            .canvas-wrapper.mobile-expanded .diagram-scroll,
            .canvas-wrapper:fullscreen .diagram-scroll,
            .canvas-wrapper:-webkit-full-screen .diagram-scroll {
                flex: 1 1 auto; min-width: 0; min-height: 0; max-height: none; height: auto;
                display: flex; align-items: center; justify-content: center; overflow: hidden;
                border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-body);
            }
            .canvas-wrapper.mobile-expanded .diagram-scroll canvas,
            .canvas-wrapper:fullscreen .diagram-scroll canvas,
            .canvas-wrapper:-webkit-full-screen .diagram-scroll canvas {
                flex: 0 1 auto;
                width: var(--fullscreen-canvas-width, auto) !important;
                height: var(--fullscreen-canvas-height, auto) !important;
                max-width: 100%; max-height: 100%; min-width: 0; min-height: 0;
                object-fit: contain;
            }
            .canvas-wrapper.mobile-expanded .instrument-hint,
            .canvas-wrapper:fullscreen .instrument-hint,
            .canvas-wrapper:-webkit-full-screen .instrument-hint { flex: 0 0 auto; }
            body.mobile-section-expanded .site-footer { display: none; }
        }
        @media (min-width: 1000px) {
            .canvas-container { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
            .canvas-wrapper { width: 100%; }
            .col-circle, .col-theory { height: auto; }
            .desktop-fullscreen-unavailable { display: none; }
        }

        /* Keep primary controls in one compact, keyboard-accessible toolbar. */
        .brand-header { margin-bottom: 4px !important; }
        .brand-link { font-size: 2rem; }
        .main-title { margin: 0 0 6px !important; font-size: 1.15rem !important; }
        .instruction { margin: 2px 0 10px; font-size: 0.78rem; }
        .app-toolbar { position: sticky; top: 8px; z-index: 1200; width: 100%; max-width: 1400px; margin: 0 auto 22px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--card-bg); box-shadow: var(--shadow); }
        .toolbar-tabs { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px; }
        .toolbar-tab { min-height: 40px; padding: 8px 15px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-sec); white-space: nowrap; }
        .toolbar-tab i { color: var(--accent); }
        .toolbar-tab:hover, .toolbar-tab[aria-selected="true"] { border-color: var(--border-color); background: var(--bg-body); color: var(--text-main); }
        .toolbar-panel { max-height: min(62vh, 480px); overflow: auto; padding: 10px 16px 15px; border-top: 1px solid var(--border-color); }
        .toolbar-panel[hidden] { display: none !important; }
        .toolbar-panel-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; margin: 0 0 10px; text-align: left; }
        .toolbar-panel-heading strong { color: var(--text-main); font-size: 0.96rem; }
        .toolbar-panel-heading span { color: var(--text-sec); font-size: 0.8rem; }
        .toolbar-panel .main-controls, .toolbar-panel .tools-bar { width: 100%; max-width: none; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
        .toolbar-panel .main-controls { justify-content: flex-start; }
        .toolbar-panel .tools-bar { justify-content: flex-start; gap: 10px 14px; }
        .toolbar-field { display: inline-flex; align-items: center; gap: 8px; color: var(--text-sec); font-size: 0.83rem; font-weight: 700; }
        .toolbar-field select { min-width: 125px; }
        .toolbar-action-button, #tunerToggle, #midiConnectButton, #downloadPdfButton { min-height: 40px; padding: 8px 13px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-body); color: var(--text-main); }
        #themeToggle { width: auto; height: 40px; border-radius: 10px; }
        .bpm-label { color: var(--text-sec); font-size: 0.82rem; font-weight: 700; }
        .toolbar-status { color: var(--text-sec); font-size: 0.78rem; }
        .view-toolbar-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px 18px; }
        .view-toolbar-row .view-preferences { flex: 1 1 390px; width: auto; max-width: none; box-shadow: none; }
        .octave-view-toggle { min-height: 42px; padding: 6px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-body); }
        .octave-view-toggle .switch { flex: 0 0 auto; }
        .shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; text-align: left; }
        .shortcut-grid > div { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-body); }
        .shortcut-grid b { font-size: 0.8rem; }
        .shortcut-grid span { color: var(--text-sec); font-size: 0.76rem; line-height: 1.45; }
        @media (max-width: 640px), (pointer: coarse) and (max-height: 600px) {
            .brand-link { font-size: 1.7rem; }
            .app-toolbar { top: 4px; margin-bottom: 14px; border-radius: 13px; }
            .toolbar-tabs { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
            .toolbar-tab { flex: 0 0 auto; min-height: 42px; padding: 8px 12px; }
            .toolbar-panel { max-height: min(68vh, 560px); padding: 10px 11px 13px; }
            .toolbar-panel .main-controls, .toolbar-panel .tools-bar { justify-content: flex-start; }
            .toolbar-field { flex: 1 1 100%; justify-content: space-between; }
            .toolbar-field select { flex: 1 1 auto; min-height: 42px; }
            .toolbar-panel .main-controls > button, .toolbar-panel .tools-bar > button { min-height: 44px; }
            .view-toolbar-row { flex-direction: column; }
            .view-toolbar-row .view-preferences { flex: 1 1 auto; width: 100%; }
            .shortcut-grid { grid-template-columns: 1fr; }
        }
