      :root {
        color-scheme: dark;
        --left-pane-width: 240px;
        --right-pane-width: 260px;
        --split-main-right: 50%;
        --split-side-right: 50%;
        --split-main-down: 50%;
        --split-side-down: 50%;
        --bg: #0d1117;
        --panel: #161b22;
        --panel-2: #0f1520;
        --surface: #0d1117;
        --button: #21262d;
        --button-primary: #238636;
        --button-primary-border: #2ea043;
        --input: #0d1117;
        --line: #30363d;
        --text: #e6edf3;
        --muted: #8b949e;
        --blue: #58a6ff;
        --yellow: #d29922;
        --green: #3fb950;
        --red: #f85149;
        --active: #1f6feb22;
        --diff-add-text: #aff5b4;
        --diff-add-bg: #033a16;
        --diff-del-text: #ffdcd7;
        --diff-del-bg: #67060c;
        --shadow: none;
      }

      :root[data-theme="light"] {
        color-scheme: light;
        --bg: #f4f0e8;
        --panel: #fffaf0;
        --panel-2: #f8f2e7;
        --surface: #fffdf7;
        --button: #efe6d6;
        --button-primary: #1f7a4d;
        --button-primary-border: #2b9460;
        --input: #fffdf7;
        --line: #d8cab6;
        --text: #262016;
        --muted: #746957;
        --blue: #0b63b6;
        --yellow: #9a6700;
        --green: #1a7f37;
        --red: #cf222e;
        --active: #0b63b618;
        --diff-add-text: #14532d;
        --diff-add-bg: #dafbe1;
        --diff-del-text: #82071e;
        --diff-del-bg: #ffebe9;
        --shadow: 0 18px 40px rgba(72, 52, 24, .08);
      }

      html, body {
        width: 100%;
        height: 100%;
        overflow: hidden;
      }
      * { box-sizing: border-box; }
      [hidden] { display: none !important; }
      body {
        margin: 0;
        background: var(--bg);
        color: var(--text);
        font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      }
      body.is-resizing {
        user-select: none;
      }
      body.is-resizing-col { cursor: col-resize; }
      body.is-resizing-row { cursor: row-resize; }
      body.is-resizing iframe {
        pointer-events: none;
      }

      button, input, textarea { font: inherit; }
      button {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--button);
        color: var(--text);
        padding: 6px 10px;
        cursor: pointer;
      }
      button:hover { border-color: var(--blue); }
      button.primary { background: transparent; border-color: var(--blue); color: var(--blue); font-weight: 600; }
      button.primary:hover { background: var(--active); border-color: var(--blue); }
      button.danger { color: var(--red); }

      .app {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
        height: 100vh;
        width: 100%;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
      }

      .terminal-panel {
        position: relative;
        z-index: 20;
        display: flex;
        flex-direction: column;
        height: var(--terminal-panel-size, min(var(--terminal-height, 360px), calc(100dvh - 64px)));
        width: 100%;
        min-height: 220px;
        min-width: 0;
        overflow: hidden;
        border-top: 1px solid var(--line);
        background: var(--panel-2);
        box-shadow: 0 -12px 32px rgba(0, 0, 0, .24);
      }
      .terminal-resizer {
        position: absolute;
        z-index: 2;
        top: -4px;
        right: 0;
        left: 0;
        height: 8px;
        cursor: row-resize;
      }
      .terminal-toolbar {
        display: flex;
        align-items: stretch;
        flex: 0 0 36px;
        min-width: 0;
        border-bottom: 1px solid var(--line);
        background: var(--panel);
      }
      .terminal-tabs {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: thin;
      }
      .terminal-tab {
        display: flex;
        align-items: stretch;
        flex: 0 0 auto;
        max-width: 240px;
        border-right: 1px solid var(--line);
        color: var(--muted);
      }
      .terminal-tab.active {
        color: var(--text);
        box-shadow: inset 0 -2px var(--blue);
      }
      .terminal-tab.closed { opacity: .7; }
      .terminal-tab-select,
      .terminal-tab-close,
      .terminal-tool-button {
        border: 0;
        border-radius: 0;
        background: transparent;
      }
      .terminal-tab-select {
        max-width: 200px;
        padding: 0 8px 0 12px;
        overflow: hidden;
        color: inherit;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .terminal-tab-close {
        width: 30px;
        padding: 0;
        color: inherit;
        font-size: 18px;
      }
      .terminal-tool-button {
        flex: 0 0 38px;
        padding: 0;
        color: var(--muted);
      }
      .terminal-tool-button:hover,
      .terminal-tool-button.active,
      .terminal-tab-select:hover,
      .terminal-tab-close:hover {
        background: var(--active);
        color: var(--text);
      }
      .terminal-hosts {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        padding: 6px 8px;
        overflow: hidden;
        background: var(--panel-2);
      }
      .terminal-host {
        position: absolute;
        inset: 6px 8px;
        display: none;
        min-width: 0;
        overflow: hidden;
      }
      .terminal-host.active { display: block; }
      .terminal-host .xterm {
        height: 100%;
        max-width: 100%;
      }
      .terminal-host .xterm-screen,
      .terminal-host .xterm-viewport {
        max-width: 100%;
      }
      .terminal-host .xterm-viewport {
        scrollbar-gutter: stable;
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--muted) 8%, transparent) transparent;
      }
      .terminal-host .xterm-viewport::-webkit-scrollbar {
        width: 7px;
      }
      .terminal-host .xterm-viewport::-webkit-scrollbar-track {
        background: transparent;
      }
      .terminal-host .xterm-viewport::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: color-mix(in srgb, var(--muted) 8%, transparent);
        transition: background-color .18s ease;
      }
      .terminal-host.scrollbar-active .xterm-viewport {
        scrollbar-color: color-mix(in srgb, var(--muted) 68%, transparent) transparent;
      }
      .terminal-host.scrollbar-active .xterm-viewport::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--muted) 68%, transparent);
      }
      .terminal-host.selecting .xterm {
        cursor: crosshair;
        touch-action: none;
      }
      .terminal-host .xterm-helper-textarea {
        left: 0;
        width: 1px;
        height: 1px;
        z-index: 0;
      }
      @-moz-document url-prefix() {
        .terminal-host .xterm-helper-textarea {
          width: 16px;
          height: 20px;
          opacity: .01;
          color: transparent;
          caret-color: transparent;
        }
      }
      .terminal-extra-keys {
        display: grid;
        grid-template-columns: repeat(6, minmax(42px, 1fr));
        flex: 0 0 auto;
        gap: 5px;
        padding: 6px 8px max(6px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: var(--panel);
      }
      .terminal-extra-keys button {
        min-width: 0;
        padding: 7px 4px;
        border-radius: 5px;
        font-size: 11px;
        font-weight: 650;
      }
      .terminal-extra-keys button.active {
        border-color: var(--blue);
        background: var(--active);
        color: var(--blue);
      }
      html[data-embed="true"] .terminal-panel { display: none !important; }

      header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        border-bottom: 1px solid var(--line);
        background: var(--panel);
      }
      .brand { font-weight: 750; letter-spacing: .3px; }
      .view-toggle { display: flex; gap: 6px; }
      .view-toggle button.active { border-color: var(--blue); color: var(--blue); }
      .header-icon-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        min-width: 34px;
        height: 32px;
        padding: 0;
        font-size: 14px;
        line-height: 1;
      }
      .header-icon-button svg {
        width: 20px;
        height: 20px;
      }
      .stat { color: var(--muted); }
      .stat strong { color: var(--text); font-weight: 650; }
      .grow { flex: 1; }
      .search { display: flex; gap: 8px; min-width: 360px; }
      .search .header-icon-button { font-size: 22px; }
      .search input {
        transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
      }
      .search input:focus,
      .search input:focus-visible {
        outline: none;
        border-color: var(--blue);
        background: var(--input);
        box-shadow: none;
      }
      input {
        width: 100%;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--input);
        color: var(--text);
        padding: 7px 9px;
      }

      main {
        display: grid;
        grid-template-columns: var(--left-pane-width) 8px minmax(0, 1fr) 8px var(--right-pane-width);
        min-width: 0;
        min-height: 0;
        overflow: hidden;
      }
      aside, section, .review {
        overflow: hidden;
        min-height: 0;
        border-right: 1px solid var(--line);
        background: var(--panel-2);
      }
      .review { border-right: 0; background: var(--panel); }
      section {
        display: flex;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
      }
      .pane-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 9px 12px;
        border-bottom: 1px solid var(--line);
        color: var(--muted);
        font-weight: 650;
        font-size: 13px;
      }
      .pane-title-main {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
      }
      .project-switcher {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        min-width: 0;
        max-width: 180px;
        padding: 3px 10px;
        border-radius: 999px;
        background: var(--button);
        color: var(--text);
        font-size: 12px;
        line-height: 1.2;
      }
      .project-switcher-label {
        display: block;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
      }
      .pane-action {
        flex: 0 0 auto;
        min-width: 26px;
        height: 24px;
        padding: 0 6px;
        border: 0;
        border-radius: 4px;
        background: transparent;
        color: var(--muted);
        line-height: 1;
      }
      .pane-action:hover,
      .pane-action:focus-visible {
        background: var(--button);
        color: var(--text);
      }
      .file-list, .review-body, .search-results { overflow: auto; }
      aside,
      .review {
        display: flex;
        flex-direction: column;
        min-height: 0;
      }
      .file-list,
      .review-body {
        flex: 1 1 auto;
        min-height: 0;
      }
      /* Custom scrollbar for file-list and review-body */
      .file-list::-webkit-scrollbar,
      .review-body::-webkit-scrollbar {
        width: 8px;
        height: 8px;
      }
      .file-list::-webkit-scrollbar-track,
      .review-body::-webkit-scrollbar-track {
        background: var(--panel-2);
        border-radius: 4px;
      }
      .file-list::-webkit-scrollbar-thumb,
      .review-body::-webkit-scrollbar-thumb {
        background: var(--muted);
        border-radius: 4px;
        border: 1px solid var(--panel-2);
      }
      .file-list::-webkit-scrollbar-thumb:hover,
      .review-body::-webkit-scrollbar-thumb:hover {
        background: var(--text);
      }
      .file-list,
      .review-body {
        scrollbar-width: thin;
        scrollbar-color: var(--muted) var(--panel-2);
      }
      .tree { padding: 6px 0; }
      .tree-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 28px;
        align-items: stretch;
      }
      .group-name {
        display: flex;
        align-items: center;
        gap: 7px;
        width: 100%;
        padding: 6px 12px 6px calc(12px + var(--depth, 0) * 1ch);
        border: 0;
        border-radius: 0;
        background: transparent;
        color: var(--muted);
        font-size: 12px;
        text-align: left;
      }
      .group-name:hover { color: var(--text); background: var(--active); }
      .group-name.ignored { color: var(--muted); opacity: .48; }
      .tree-action {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        min-width: 28px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: var(--muted);
        opacity: 0;
      }
      .tree-row:hover .tree-action,
      .tree-action:focus-visible {
        opacity: 1;
      }
      .tree-action:hover {
        background: var(--active);
        color: var(--text);
      }
      .chevron {
        width: 9px;
        height: 9px;
        margin-left: 2px;
        border-right: 2px solid var(--blue);
        border-bottom: 2px solid var(--blue);
        transform: rotate(-45deg);
        transition: transform .12s ease;
      }
      .chevron.open { transform: rotate(45deg); }
      .file {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 6px 12px 6px calc(12px + var(--depth, 0) * 1ch);
        border: 0;
        border-radius: 0;
        background: transparent;
        text-align: left;
      }
      .file.active { background: var(--active); }
      .file.ignored { color: var(--muted); opacity: .48; }
      .file-main {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
      }
      .file-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .mini-stat { color: var(--muted); font-size: 12px; }
      .status-dot {
        display: inline-flex;
        width: 7px;
        height: 7px;
        margin-left: auto;
        border-radius: 999px;
        background: currentColor;
      }
      .status { font-weight: 800; }
      .status.M { color: var(--yellow); }
      .status.A { color: var(--green); }
      .status.D { color: var(--red); }
      .status.U { color: var(--blue); }
      .status.I { color: var(--muted); }
      .status.staged {
        text-decoration: underline;
        text-decoration-style: dotted;
        text-underline-offset: 2px;
      }
      .status.M.staged { color: var(--green); }
      .status.staged.mixed { color: var(--yellow); }

      .file-tabs {
        display: flex;
        gap: 0;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-gutter: stable;
        flex: 0 0 auto;
        min-width: 0;
        padding: 2px 12px;
        border-bottom: 1px solid var(--line);
        background: var(--panel-2);
      }
      .file-tabs::-webkit-scrollbar {
        height: 12px;
      }
      .file-tabs::-webkit-scrollbar-track {
        background: var(--panel-2);
        border-radius: 6px;
      }
      .file-tabs::-webkit-scrollbar-thumb {
        background: var(--muted);
        border-radius: 6px;
        border: 2px solid var(--panel-2);
      }
      .file-tabs::-webkit-scrollbar-thumb:hover {
        background: var(--text);
      }
      .file-tabs {
        scrollbar-width: thin;
        scrollbar-color: var(--muted) var(--panel-2);
      }
      .file-tab {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        gap: 2px;
        max-width: 260px;
        min-width: 0;
        padding: 0;
        border: 1px solid transparent;
        border-bottom: 0;
        border-radius: 6px 6px 0 0;
        background: transparent;
        color: var(--muted);
        font-size: 12px;
        white-space: nowrap;
        cursor: pointer;
        transition: all 0.1s;
      }
      .file-tab:hover { background: var(--button); color: var(--text); }
      .file-tab.active { background: var(--surface); border-color: var(--line); color: var(--text); }
      .file-tab.temporary .file-tab-name { font-style: italic; }
      .file-tab button {
        border: 0;
        border-radius: 0;
        background: transparent;
        color: inherit;
      }
      .file-tab-select {
        display: inline-flex;
        align-items: center;
        flex: 1 1 auto;
        min-width: 32px;
        padding: 5px 8px 5px 0;
      }
      .file-tab-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .file-tab-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 30px;
        width: 30px;
        height: 28px;
        padding: 0;
        border-radius: 4px;
        color: var(--blue);
      }
      .file-tab-menu-button:hover {
        color: var(--text);
        background: var(--active);
      }
      .file-tab-menu-button svg {
        width: 15px;
        height: 15px;
        fill: currentColor;
      }
      .file-tab-close {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 24px;
        width: 24px;
        height: 28px;
        border-radius: 3px;
        opacity: 0.6;
        transition: opacity 0.1s, background 0.1s;
      }
      .file-tab-close:hover { opacity: 1; background: var(--line); }
      .action-menu {
        position: fixed;
        z-index: 1000;
        min-width: 190px;
        max-height: calc(100vh - 12px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 5px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--panel);
        color: var(--text);
        box-shadow: var(--shadow);
      }
      .action-menu-item {
        display: block;
        width: 100%;
        padding: 7px 9px;
        border: 0;
        border-radius: 4px;
        background: transparent;
        color: var(--text);
        text-align: left;
        white-space: nowrap;
      }
      .action-menu-item:hover,
      .action-menu-item:focus-visible {
        background: var(--active);
      }
      .action-menu-item.active {
        color: var(--blue);
        font-weight: 650;
      }
      .action-menu-item.danger {
        color: var(--red);
      }
      .action-menu-item:disabled {
        cursor: not-allowed;
        opacity: .55;
      }
      .action-menu-separator {
        height: 1px;
        margin: 5px 2px;
        background: var(--line);
      }
      .prompt-dialog-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1200;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        background: rgba(5, 8, 12, .58);
        backdrop-filter: blur(4px);
      }
      .prompt-dialog {
        width: min(640px, calc(100vw - 40px));
        max-height: calc(100vh - 40px);
        overflow: auto;
        padding: 18px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: var(--panel);
        box-shadow: var(--shadow);
      }
      .prompt-dialog-title {
        margin: 0 0 8px;
        color: var(--text);
        font-size: 16px;
      }
      .prompt-dialog-message {
        margin: 0 0 14px;
        color: var(--muted);
        overflow-wrap: anywhere;
        white-space: pre-wrap;
      }
      .prompt-dialog-field {
        width: 100%;
        min-width: 0;
      }
      textarea.prompt-dialog-field {
        min-height: 180px;
        resize: vertical;
        line-height: 1.5;
      }
      .prompt-dialog-actions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 16px;
      }

      .auth-dialog-backdrop { z-index: 2000; }
      .auth-dialog { width: min(420px, calc(100vw - 40px)); }
      .auth-dialog .prompt-dialog-actions { margin-top: 12px; }
      .dialog-error {
        min-height: 18px;
        margin: 10px 0 0;
        color: var(--red);
        font-size: 12px;
      }
      .dialog-title-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
      }
      .dialog-title-row .prompt-dialog-title { margin-bottom: 0; }
      .runtime-dialog {
        width: min(920px, calc(100vw - 40px));
        max-height: min(820px, calc(100dvh - 40px));
        overflow-y: auto;
      }
      .runtime-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        margin-top: 8px;
      }
      .runtime-card {
        min-width: 0;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--surface);
      }
      .runtime-card-label {
        margin-bottom: 5px;
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .04em;
      }
      .runtime-card-value {
        overflow: hidden;
        color: var(--text);
        font-size: 18px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .runtime-note {
        margin: 12px 0 16px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.5;
      }
      .runtime-process-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 8px;
      }
      .runtime-process-heading h3 { margin: 0; font-size: 14px; }
      .runtime-process-heading span { color: var(--muted); font-size: 12px; }
      .runtime-process-table-wrap {
        max-height: 310px;
        overflow: auto;
        border: 1px solid var(--line);
        border-radius: 10px;
      }
      .runtime-process-table {
        width: 100%;
        min-width: 700px;
        border-collapse: collapse;
        font-size: 12px;
      }
      .runtime-process-table th,
      .runtime-process-table td {
        padding: 9px 10px;
        border-bottom: 1px solid var(--line);
        text-align: left;
        white-space: nowrap;
      }
      .runtime-process-table th {
        position: sticky;
        top: 0;
        z-index: 1;
        color: var(--muted);
        background: var(--panel);
        font-size: 11px;
        text-transform: uppercase;
      }
      .runtime-process-table tr:last-child td { border-bottom: 0; }
      .runtime-process-command {
        max-width: 330px;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .runtime-process-pid { font-variant-numeric: tabular-nums; }
      .runtime-process-kind {
        display: inline-block;
        padding: 2px 6px;
        border-radius: 999px;
        color: var(--blue);
        background: color-mix(in srgb, var(--blue) 12%, transparent);
      }
      .runtime-process-close {
        width: 28px;
        min-width: 28px;
        height: 28px;
        padding: 0;
        color: var(--red);
      }
      .runtime-process-empty { color: var(--muted); text-align: center !important; }

      .upload-dialog { width: min(560px, calc(100vw - 24px)); }
      .upload-summary.error { color: var(--red); }
      .upload-summary.ok { color: var(--green); }
      .upload-overall-progress,
      .upload-row progress {
        width: 100%;
        accent-color: var(--blue);
      }
      .upload-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: min(48vh, 420px);
        overflow: auto;
        padding: 2px;
      }
      .upload-row {
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
      }
      .upload-row.active { border-color: var(--blue); }
      .upload-row.complete { border-color: var(--green); }
      .upload-row.failed { border-color: var(--red); }
      .upload-row-header {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 5px;
        font-size: 12px;
      }
      .upload-file-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .upload-file-status { flex: 0 0 auto; color: var(--muted); }
      .upload-row.complete .upload-file-status { color: var(--green); }
      .upload-row.failed .upload-file-status { color: var(--red); }

      .pdf-viewer {
        position: relative;
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        background: var(--panel-2);
      }
      .pdf-controls {
        display: flex;
        align-items: center;
        gap: 6px;
        flex: 0 0 auto;
        padding: 7px 10px;
        border-bottom: 1px solid var(--line);
        background: var(--panel);
      }
      .pdf-controls button.active { border-color: var(--blue); color: var(--blue); }
      .pdf-control-spacer { flex: 1 1 auto; }
      .pdf-page-jump {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        color: var(--muted);
        white-space: nowrap;
      }
      .pdf-page-jump input {
        width: 66px;
        padding: 5px 6px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--input);
        color: var(--text);
        text-align: center;
      }
      .pdf-mobile-fullscreen { display: none; }
      .pdf-fullscreen-exit { display: none; }
      .pdf-viewer:fullscreen,
      .pdf-viewer:-webkit-full-screen,
      .pdf-viewer.pdf-fallback-fullscreen {
        width: 100vw;
        height: 100dvh;
        background: var(--panel-2);
      }
      .pdf-viewer.pdf-fallback-fullscreen {
        position: fixed;
        z-index: 1000;
        inset: 0;
      }
      .pdf-page-scroll {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        padding: 16px;
        text-align: center;
        outline: none;
      }
      .pdf-pages {
        display: flex;
        align-items: center;
        flex-direction: column;
        gap: 16px;
        min-width: max-content;
      }
      .pdf-page {
        flex: 0 0 auto;
        line-height: 0;
        background: #fff;
        box-shadow: 0 4px 18px rgba(0, 0, 0, .28);
      }
      .pdf-page canvas {
        display: block;
        max-width: none;
        background: #fff;
      }
      .pdf-page-status {
        position: absolute;
        z-index: 1;
        top: 28px;
        left: 50%;
        transform: translateX(-50%);
        padding: 6px 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        color: var(--muted);
      }
      .layout-resizer {
        position: relative;
        background: transparent;
      }
      .layout-resizer::before {
        content: '';
        position: absolute;
        inset: 0;
      }
      .layout-resizer-vertical {
        cursor: col-resize;
      }
      .layout-resizer-vertical:hover,
      .layout-resizer-vertical:active,
      body.is-resizing .layout-resizer-vertical {
        background: var(--active);
      }
      .viewer-split-area {
        display: flex;
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
      }
      .editor-pane {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
        background: var(--surface);
      }
      .primary-editor-pane {
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
      }
      #viewer {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
      }
      .split-pane-host {
        display: none;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
        border-left: 1px solid var(--line);
        background: var(--surface);
      }
      .viewer-split-area.split-open .split-pane-host {
        display: flex;
        flex-direction: column;
      }
      .viewer-split-area.split-open > .primary-editor-pane,
      .viewer-split-area.split-open > .split-pane-host {
        min-width: 0;
        min-height: 0;
      }
      .viewer-split-area.split-right {
        flex-direction: row;
      }
      .viewer-split-area.split-right > .primary-editor-pane {
        flex: 0 0 calc(var(--split-main-right) - 4px);
      }
      .viewer-split-area.split-right > .split-pane-host {
        flex: 0 0 calc(var(--split-side-right) - 4px);
      }
      .viewer-split-area.split-down {
        flex-direction: column;
      }
      .viewer-split-area.split-down > .split-pane-host {
        border-left: 0;
        border-top: 1px solid var(--line);
      }
      .viewer-split-area.split-down > .primary-editor-pane {
        flex: 0 0 calc(var(--split-main-down) - 4px);
      }
      .viewer-split-area.split-down > .split-pane-host {
        flex: 0 0 calc(var(--split-side-down) - 4px);
      }
      .split-pane-resizer {
        display: none;
        background: transparent;
        flex: 0 0 8px;
        position: relative;
      }
      .split-pane-resizer::before {
        content: '';
        position: absolute;
        inset: 0;
      }
      .viewer-split-area.split-open .split-pane-resizer {
        display: block;
      }
      .split-pane-resizer[hidden] {
        display: none;
      }
      .viewer-split-area.split-right .split-pane-resizer {
        cursor: col-resize;
      }
      .viewer-split-area.split-down .split-pane-resizer {
        cursor: row-resize;
      }
      .split-pane-resizer:hover,
      .split-pane-resizer:active,
      body.is-resizing .split-pane-resizer {
        background: var(--active);
      }
      .split-pane-frame {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        background: var(--surface);
      }
      .split-pane-frame.is-loading {
        background: var(--surface);
      }
      .split-pane-iframe {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        height: 100%;
        border: 0;
        background: var(--surface);
      }
      pre, textarea.editor {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 16px;
        border: 0;
        background: var(--surface);
        color: var(--text);
        overflow: auto;
        font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        line-height: 20px;
        tab-size: 2;
        box-sizing: border-box;
        scrollbar-gutter: stable;
      }
      /* Custom scrollbar for pre elements */
      pre::-webkit-scrollbar {
        width: 12px;
        height: 12px;
      }
      pre::-webkit-scrollbar-track {
        background: var(--panel-2);
        border-radius: 6px;
      }
      pre::-webkit-scrollbar-thumb {
        background: var(--muted);
        border-radius: 6px;
        border: 2px solid var(--panel-2);
      }
      pre::-webkit-scrollbar-thumb:hover {
        background: var(--text);
      }
      pre::-webkit-scrollbar-corner {
        background: var(--panel-2);
      }
      /* Firefox scrollbar */
      pre {
        scrollbar-width: thin;
        scrollbar-color: var(--muted) var(--panel-2);
      }
      textarea.editor {
        resize: none;
        outline: none;
        background: transparent;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 2;
        color: var(--text);
        caret-color: var(--text);
        white-space: pre;
        line-height: 20px;
      }
      textarea.editor.wrap-enabled {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-y: auto;
        overflow-x: hidden;
      }
      textarea.editor.wrap-disabled {
        white-space: pre;
        word-wrap: normal;
        overflow: auto;
      }
      /* Custom scrollbar for editor */
      textarea.editor::-webkit-scrollbar {
        width: 12px;
        height: 12px;
      }
      textarea.editor::-webkit-scrollbar-track {
        background: var(--panel-2);
        border-radius: 6px;
      }
      textarea.editor::-webkit-scrollbar-thumb {
        background: var(--muted);
        border-radius: 6px;
        border: 2px solid var(--panel-2);
      }
      textarea.editor::-webkit-scrollbar-thumb:hover {
        background: var(--text);
      }
      textarea.editor::-webkit-scrollbar-corner {
        background: var(--panel-2);
      }
      /* Firefox scrollbar */
      textarea.editor {
        scrollbar-width: thin;
        scrollbar-color: var(--muted) var(--panel-2);
      }
      .large-text-viewer {
        width: 100%;
        height: 100%;
        min-height: 0;
        resize: none;
        border: 0;
        outline: none;
        padding: 16px;
        box-sizing: border-box;
        background: var(--surface);
        color: var(--text);
        font: 13px/20px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        white-space: pre;
        overflow: auto;
        tab-size: 2;
      }
      .editor-wrapper {
        position: relative;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
        background: var(--surface);
      }
      .editor-wrapper.editor-large-document {
        grid-template-columns: minmax(0, 1fr);
      }
      .editor-wrapper.editor-large-document .editor-line-gutter {
        display: none;
      }
      .editor-wrapper.editor-large-document textarea.editor,
      .editor-wrapper.editor-large-document .editor-highlight {
        white-space: pre;
        word-wrap: normal;
        overflow-x: auto;
        overflow-y: auto;
      }
      .editor-line-gutter {
        position: relative;
        min-width: 50px;
        padding: 16px 12px 16px 16px;
        background: var(--panel-2);
        color: var(--muted);
        text-align: right;
        font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        line-height: 20px;
        overflow: hidden;
        user-select: none;
        border-right: 1px solid var(--line);
        z-index: 3;
        pointer-events: auto;
        cursor: pointer;
      }
      .editor-line-numbers {
        position: relative;
        white-space: pre;
        will-change: transform;
      }
      .editor-line-num {
        display: block;
        cursor: pointer;
        line-height: 20px;
      }
      .editor-line-num:hover {
        color: var(--text);
      }
      .editor-line-gutter:hover {
        background: var(--panel);
      }
      .editor-scroll-area {
        position: relative;
        align-self: stretch;
        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
        background: var(--surface);
      }
      .editor-highlight {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        height: 100%;
        padding: 16px;
        margin: 0;
        border: 0;
        background: transparent;
        color: transparent;
        overflow: auto;
        font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        line-height: 20px;
        pointer-events: none;
        z-index: 1;
        white-space: pre;
        box-sizing: border-box;
        display: none;
      }
      .editor-find-match {
        color: transparent;
        background: color-mix(in srgb, var(--yellow) 20%, transparent);
        border-radius: 3px;
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--yellow) 40%, transparent);
      }
      .editor-find-match.zero-width,
      .editor-find-match.linebreak {
        display: inline-block;
        min-width: 0.55em;
        vertical-align: baseline;
      }
      .editor-find-boundary {
        display: inline-block;
        width: 100%;
        min-width: 0.2em;
        min-height: 1em;
      }
      .editor-find-match.current {
        background: color-mix(in srgb, var(--blue) 26%, transparent);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 70%, transparent);
      }
      .editor-highlight.wrap-enabled {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-y: auto;
        overflow-x: hidden;
      }
      .editor-highlight.wrap-disabled {
        white-space: pre;
        word-wrap: normal;
        overflow: auto;
      }
      .editor-current-line-highlight {
        position: absolute;
        left: 0;
        right: 0;
        height: 20px;
        background: rgba(59, 130, 246, 0.1);
        border-left: 3px solid #3b82f6;
        pointer-events: none;
        z-index: 0;
        transition: top 0.15s ease;
      }
      .editor-block-selection {
        position: absolute;
        inset: 0;
        overflow: hidden;
        pointer-events: none;
        z-index: 4;
      }
      .editor-selection-matches {
        position: absolute;
        inset: 0;
        overflow: hidden;
        pointer-events: none;
        z-index: 3;
      }
      .editor-link-hint {
        position: absolute;
        border-bottom: 1px solid var(--blue);
        pointer-events: none;
        z-index: 5;
      }
      .editor-link-hint[hidden] {
        display: none;
      }
      .editor-block-selection-rect {
        position: absolute;
        background: rgba(59, 130, 246, 0.28);
        border-radius: 2px;
        box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
      }
      .editor-selection-match-rect {
        position: absolute;
        background: rgba(59, 130, 246, 0.22);
        border-radius: 2px;
        box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
      }
      .editor-command-bar {
        position: absolute;
        top: 8px;
        right: 18px;
        z-index: 8;
        display: grid;
        align-items: center;
        gap: 5px;
        max-width: calc(100% - 36px);
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--panel);
        box-shadow: var(--shadow);
      }
      .editor-command-bar-find {
        grid-template-columns: minmax(120px, 180px) auto auto auto auto minmax(140px, 180px) auto auto auto;
      }
      .editor-command-bar-line {
        top: 8px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        grid-template-columns: minmax(120px, 160px) auto auto;
      }
      .editor-command-bar[hidden] { display: none; }
      .editor-command-field {
        min-width: 0;
        padding: 6px 9px;
        border-radius: 4px;
        font-size: 12px;
        color: var(--text);
        background: var(--surface);
        border: 1px solid var(--line);
        outline: none;
        box-shadow: none;
        transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
      }
      .editor-command-field:focus {
        border-color: color-mix(in srgb, var(--blue) 70%, var(--line));
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 16%, transparent);
        background: color-mix(in srgb, var(--surface) 84%, var(--panel));
      }
      .editor-command-bar input.editor-command-field {
        height: 32px;
      }
      .editor-command-bar textarea.editor-command-field {
        min-width: 0;
        height: 32px;
        line-height: 18px;
        resize: none;
        overflow-y: auto;
        overflow-x: hidden;
      }
      .editor-command-bar button {
        height: 32px;
        padding: 4px 7px;
        border-radius: 4px;
        font-size: 12px;
        white-space: nowrap;
        color: var(--text);
        background: var(--surface);
        border: 1px solid var(--line);
        transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
      }
      .editor-command-bar button:hover {
        background: color-mix(in srgb, var(--surface) 82%, var(--panel));
        border-color: color-mix(in srgb, var(--line) 70%, var(--blue));
      }
      .editor-command-regex {
        color: var(--muted);
        background: color-mix(in srgb, var(--surface) 88%, var(--panel));
        border-color: color-mix(in srgb, var(--line) 72%, transparent);
      }
      .editor-command-bar button.active {
        background: var(--blue);
        border-color: var(--blue);
        color: #fff;
      }
      .editor-command-count {
        min-width: 38px;
        color: var(--muted);
        font-size: 12px;
        text-align: center;
      }
      .editor-command-count.invalid {
        color: var(--danger);
      }
      .line-numbers {
        float: left;
        margin: 0 12px 0 0;
        padding-right: 12px;
        border-right: 1px solid var(--line);
        color: var(--muted);
        text-align: right;
        user-select: none;
        cursor: pointer;
      }
      .line-numbers .line-num {
        display: block;
        padding: 0 4px;
        transition: background 0.1s;
        line-height: 20px;
      }
      .line-numbers .line-num:hover {
        background: var(--button);
      }
      .code-viewer {
        position: relative;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
        background: var(--surface);
      }
      .code-viewer-gutter {
        position: relative;
        min-width: 50px;
        padding: 16px 12px 16px 16px;
        background: var(--panel-2);
        color: var(--muted);
        text-align: right;
        font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        line-height: 20px;
        overflow: hidden;
        user-select: none;
        border-right: 1px solid var(--line);
      }
      .code-viewer-gutter:hover {
        background: var(--panel);
      }
      .code-viewer-line-numbers {
        position: relative;
        white-space: pre;
        will-change: transform;
      }
      .code-viewer-scroll {
        min-width: 0;
        min-height: 0;
        overflow: auto;
        scrollbar-gutter: stable;
      }
      .markdown-viewer-scroll {
        min-width: 0;
        min-height: 0;
        overflow: auto;
        scrollbar-gutter: stable;
        background: var(--surface);
      }
      .code-viewer-scroll:focus,
      .markdown-viewer-scroll:focus,
      .image-viewer:focus,
      #viewer > pre:focus {
        outline: none;
      }
      .code-viewer-pre {
        width: max-content;
        height: auto;
        min-width: max-content;
        min-height: 100%;
        overflow: visible;
      }
      .code-viewer-line-num {
        display: block;
        padding: 0 4px;
        cursor: pointer;
        line-height: 20px;
      }
      .code-viewer-line-num:hover {
        color: var(--text);
      }
      .code-content {
        display: block;
        line-height: 20px;
      }
      .code-line {
        display: block;
        white-space: pre;
        line-height: 20px;
      }
      .code-line.highlighted {
        background: rgba(59, 130, 246, 0.15);
        position: relative;
      }
      .code-line.highlighted::before {
        content: '';
        position: absolute;
        left: -12px;
        top: 0;
        bottom: 0;
        width: 3px;
        background: #3b82f6;
      }
      .code-line.full-find-match {
        background: rgba(250, 204, 21, 0.16);
      }
      .code-line.full-find-current {
        background: rgba(59, 130, 246, 0.24);
        box-shadow: inset 3px 0 0 var(--blue);
      }
      .viewer-find-bar {
        position: absolute;
        top: 10px;
        right: 14px;
        z-index: 8;
        display: flex;
        align-items: center;
        gap: 6px;
        width: min(520px, calc(100% - 28px));
        padding: 7px;
        border: 1px solid var(--line);
        border-radius: 9px;
        background: color-mix(in srgb, var(--panel) 94%, transparent);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
        backdrop-filter: blur(8px);
      }
      .viewer-find-bar[hidden] { display: none; }
      .viewer-find-input {
        min-width: 0;
        flex: 1 1 auto;
      }
      .viewer-find-count {
        min-width: 42px;
        color: var(--muted);
        font-size: 12px;
        text-align: center;
      }
      .viewer-find-bar button {
        padding: 5px 8px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--button);
        color: var(--text);
        cursor: pointer;
      }
      .hljs { background: transparent !important; padding: 0 !important; }
      .markdown-body {
        width: min(920px, 100%);
        margin: 0 auto;
        padding: 28px 32px 40px;
        color: var(--text);
        line-height: 1.7;
        overflow-wrap: anywhere;
      }
      .markdown-body > *:first-child { margin-top: 0; }
      .markdown-body > *:last-child { margin-bottom: 0; }
      .markdown-body h1,
      .markdown-body h2,
      .markdown-body h3,
      .markdown-body h4,
      .markdown-body h5,
      .markdown-body h6 {
        margin: 1.5em 0 0.65em;
        line-height: 1.25;
        font-weight: 700;
      }
      .markdown-body h1,
      .markdown-body h2 {
        padding-bottom: 0.3em;
        border-bottom: 1px solid var(--line);
      }
      .markdown-body h1 { font-size: 2em; }
      .markdown-body h2 { font-size: 1.5em; }
      .markdown-body h3 { font-size: 1.25em; }
      .markdown-body h4 { font-size: 1em; }
      .markdown-body h5 { font-size: 0.9em; }
      .markdown-body h6 { font-size: 0.85em; color: var(--muted); }
      .markdown-body p,
      .markdown-body ul,
      .markdown-body ol,
      .markdown-body blockquote,
      .markdown-body table,
      .markdown-body pre {
        margin: 0 0 16px;
      }
      .markdown-body ul,
      .markdown-body ol {
        padding-left: 1.5em;
      }
      .markdown-body li + li {
        margin-top: 0.3em;
      }
      .markdown-body li > ul,
      .markdown-body li > ol {
        margin-top: 0.45em;
        margin-bottom: 0;
      }
      .markdown-body .contains-task-list {
        padding-left: 0;
        list-style: none;
      }
      .markdown-body .task-list-item {
        display: flex;
        align-items: flex-start;
        margin-left: 0;
        padding-left: 0;
        gap: 10px;
      }
      .markdown-body .task-list-item input[type="checkbox"] {
        box-sizing: border-box;
        width: 16px;
        min-width: 16px;
        height: 16px;
        margin: 0.35em 0 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: initial;
        appearance: auto;
        flex: 0 0 auto;
      }
      .markdown-body .task-list-item .task-list-item-text {
        flex: 1 1 auto;
        min-width: 0;
      }
      .markdown-body blockquote {
        margin-left: 0;
        padding: 0 0 0 16px;
        border-left: 4px solid var(--line);
        color: var(--muted);
      }
      .markdown-body code {
        padding: 0.16em 0.38em;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: color-mix(in srgb, var(--panel) 82%, transparent);
        font: 0.95em/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      }
      .markdown-body pre {
        overflow: auto;
        padding: 16px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--panel);
      }
      .markdown-body pre code {
        display: block;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        white-space: pre;
      }
      .markdown-body a {
        color: var(--blue);
        text-decoration: none;
      }
      :root[data-link-open-modifier="true"] #viewer a:hover {
        text-decoration: underline;
        text-underline-offset: 0.14em;
        cursor: pointer;
      }
      .markdown-body hr {
        height: 1px;
        margin: 24px 0;
        border: 0;
        background: var(--line);
      }
      .markdown-body table {
        display: block;
        width: max-content;
        max-width: 100%;
        overflow: auto;
        border-spacing: 0;
        border-collapse: collapse;
      }
      .markdown-body th,
      .markdown-body td {
        padding: 8px 12px;
        border: 1px solid var(--line);
      }
      .markdown-body th {
        background: var(--panel);
        font-weight: 600;
      }
      .markdown-body tr:nth-child(2n) td {
        background: color-mix(in srgb, var(--panel) 68%, transparent);
      }
      .markdown-body img {
        display: block;
        max-width: 100%;
        height: auto;
        border-radius: 10px;
      }
      .markdown-body del {
        color: var(--muted);
      }
      .diff-line { display: block; white-space: pre; }
      .diff-add { color: var(--diff-add-text); background: var(--diff-add-bg); }
      .diff-del { color: var(--diff-del-text); background: var(--diff-del-bg); }
      .diff-hunk { color: #79c0ff; }
      .empty {
        display: grid;
        place-items: center;
        height: 100%;
        color: var(--muted);
      }
      .image-viewer {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
        background: var(--surface);
        position: relative;
        cursor: move;
      }
      .image-viewer img {
        position: absolute;
        max-width: none;
        user-select: none;
        image-rendering: auto;
      }
      .image-controls {
        position: absolute;
        top: 12px;
        right: 12px;
        display: flex;
        gap: 6px;
        z-index: 10;
      }
      .image-controls button {
        background: var(--panel);
        border: 1px solid var(--line);
        padding: 6px 10px;
        font-size: 12px;
      }
      .binary-notice {
        display: grid;
        place-items: center;
        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;
        color: var(--muted);
        text-align: center;
        padding: 20px;
      }
      .binary-notice strong {
        color: var(--text);
        font-size: 16px;
        margin-bottom: 8px;
      }

      .structured-editor {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        background: var(--surface);
      }
      .structured-toolbar {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
        min-height: 38px;
        padding: 6px 10px;
        border-bottom: 1px solid var(--line);
        background: var(--panel);
        color: var(--muted);
        font-size: 12px;
      }
      .structured-toolbar strong {
        color: var(--text);
        font-size: 13px;
      }
      .structured-toolbar button {
        padding: 5px 8px;
        border-radius: 4px;
        font-size: 12px;
      }
      .mxgraph-canvas,
      .mindmap-canvas,
      .xmind-sheets {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
      }
      .mxgraph-canvas {
        position: relative;
        background:
          linear-gradient(var(--line) 1px, transparent 1px),
          linear-gradient(90deg, var(--line) 1px, transparent 1px);
        background-size: 24px 24px;
        background-color: var(--surface);
      }
      .mxgraph-canvas {
        cursor: default;
      }
      .mxgraph-canvas.is-middle-panning,
      .mindmap-canvas.is-middle-panning,
      .xmind-sheets.is-middle-panning {
        cursor: grabbing;
      }
      .mxgraph-canvas svg {
        overflow: visible;
      }
      .mind-node.active {
        border-color: var(--blue);
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.24);
      }
      .mindmap-canvas,
      .xmind-sheets {
        padding: 28px;
        transform-origin: 0 0;
      }
      .mindmap-canvas > .mind-node-branch {
        transform: scale(var(--mind-zoom, 1));
        transform-origin: 0 0;
      }
      .xmind-sheets > .xmind-sheet {
        transform: scale(var(--mind-zoom, 1));
        transform-origin: 0 0;
      }
      .mind-node-branch {
        display: flex;
        align-items: center;
        gap: 34px;
        margin: 10px 0;
        position: relative;
      }
      .mind-node-children {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding-left: 34px;
        border-left: 2px solid rgba(59, 130, 246, .38);
        position: relative;
      }
      .mind-node-branch > .mind-node + .mind-node-children::before,
      .mind-node-children > .mind-node-branch::before {
        content: '';
        position: absolute;
        top: 50%;
        left: -34px;
        width: 34px;
        border-top: 2px solid rgba(59, 130, 246, .38);
      }
      .mind-node-branch > .mind-node + .mind-node-children::before {
        border-top-left-radius: 10px;
      }
      .mind-node {
        flex: 0 0 auto;
        min-width: 88px;
        max-width: min(520px, 70vw);
        padding: 8px 12px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--panel);
        color: var(--text);
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        word-break: break-word;
        line-height: 1.45;
        text-align: left;
      }
      button.mind-node {
        cursor: pointer;
      }
      .xmind-sheet {
        min-width: max-content;
        margin-bottom: 24px;
      }
      .xmind-sheet h3 {
        margin: 0 0 12px;
        color: var(--text);
      }
      .structured-source {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        border: 0;
        border-radius: 0;
        resize: none;
        background: var(--surface);
        color: var(--text);
        padding: 16px;
        font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      }

      .review-body { padding: 14px; }
      .card {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 10px;
        margin-bottom: 12px;
        background: var(--surface);
        box-shadow: var(--shadow);
      }
      .card h3 { margin: 0 0 8px; font-size: 14px; }
      .card p {
        max-width: 100%;
        margin: 6px 0;
        overflow-wrap: anywhere;
        word-break: break-word;
        color: var(--muted);
      }
      .search-results button {
        display: block;
        width: 100%;
        border: 0;
        border-radius: 0;
        padding: 8px 12px;
        background: transparent;
        text-align: left;
      }
      .search-results .where { color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
      .search-results .preview { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .commit-list { padding: 6px 0; }
      .commit-item {
        display: block;
        width: 100%;
        border: 0;
        border-radius: 0;
        padding: 9px 14px;
        background: transparent;
        text-align: left;
      }
      .commit-item.active { background: var(--active); }
      .commit-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
      .commit-meta { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
      .commit-files-title { padding: 10px 14px 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
      .history-file-row { grid-template-columns: minmax(0, 1fr) auto; }
      .history-restore-action {
        width: auto;
        min-width: 72px;
        padding: 0 10px;
        opacity: 1;
        font-size: 12px;
      }

      footer {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
        overflow: hidden;
        padding: 9px 16px;
        border-top: 1px solid var(--line);
        background: var(--panel);
        color: var(--muted);
      }
      .message { color: var(--muted); }
      .message.error { color: var(--red); }
      .message.ok { color: var(--green); }

      :root[data-embed="true"] .app {
        grid-template-rows: 1fr;
        height: 100%;
        min-height: 0;
      }
      :root[data-embed="true"],
      :root[data-embed="true"] body {
        overflow: hidden;
      }
      :root[data-embed="true"] header,
      :root[data-embed="true"] aside,
      :root[data-embed="true"] .review,
      :root[data-embed="true"] footer {
        display: none !important;
      }
      :root[data-embed="true"] .layout-resizer,
      :root[data-embed="true"] .split-pane-resizer {
        display: none !important;
      }
      :root[data-embed="true"] .app {
        grid-template-rows: minmax(0, 1fr) !important;
      }
      :root[data-embed="true"] main {
        display: block;
        height: 100%;
        min-height: 0;
        overflow: hidden;
      }
      :root[data-embed="true"] section {
        height: 100%;
        min-height: 0;
        overflow: hidden;
        border-right: 0;
      }
      :root[data-embed="true"] .viewer-split-area {
        height: 100%;
        min-height: 0;
        overflow: hidden;
      }

      @media (max-width: 900px) {
        :root {
          --terminal-panel-size: min(var(--terminal-height, 52dvh), calc(100dvh - 48px));
        }
        html, body {
          height: 100%;
          overflow: hidden;
        }
        .app {
          height: var(--terminal-viewport-height, 100dvh);
          width: 100%;
          max-width: 100vw;
          min-height: 0;
          overflow: hidden;
        }
        header {
          flex-wrap: wrap;
          gap: 8px;
          padding: 10px;
          width: 100%;
          max-width: 100vw;
          min-width: 0;
        }
        .brand { width: 100%; min-width: 0; }
        .view-toggle { flex: 1 1 100%; }
        .view-toggle button { flex: 0 0 42px; }
        .stat { min-width: 0; font-size: 12px; }
        .runtime-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .grow { display: none; }
        .search,
        .review {
          display: none !important;
        }

        main {
          display: flex;
          flex-direction: column;
          height: 100%;
          width: 100%;
          max-width: 100vw;
          min-width: 0;
          min-height: 0;
          overflow: hidden;
        }
        .layout-resizer,
        .split-pane-resizer {
          display: none !important;
        }
        aside, section, .review {
          width: 100%;
          min-width: 0;
          min-height: 0;
          border-right: 0;
          border-bottom: 1px solid var(--line);
        }
        aside {
          flex: 1 1 auto;
          height: auto;
        }
        section {
          flex: 1 1 auto;
          overflow: hidden;
        }
        .pane-title { padding: 10px 12px; }
        .file-list {
          flex: 1 1 auto;
          height: auto;
          min-height: 0;
          overflow-x: hidden;
          overflow-y: auto;
          overscroll-behavior-y: contain;
          touch-action: pan-y;
          -webkit-overflow-scrolling: touch;
        }
        :root[data-viewer-open="false"] section {
          display: none;
        }
        :root[data-viewer-open="true"] aside {
          flex: 0 0 clamp(140px, 32%, 280px);
        }
        .group-name, .file, .commit-item { padding-right: 12px; padding-left: calc(12px + var(--depth, 0) * 1ch); }
        #viewer {
          flex: 1 1 auto;
          height: auto;
          min-height: 0;
        }
        pre, textarea.editor {
          max-width: 100%;
          padding: 12px;
          font-size: 12px;
        }
        .editor-command-bar {
          left: 8px;
          right: 8px;
          display: flex;
          flex-wrap: wrap;
        }
        .editor-command-bar input.editor-command-field {
          flex: 1 1 120px;
        }
        .editor-command-bar textarea.editor-command-field {
          flex: 1 1 120px;
        }
        .editor-command-bar-line {
          top: 8px;
        }
        .empty { min-height: 220px; }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] .app {
          grid-template-rows: auto minmax(0, 1fr) auto;
          height: var(--terminal-viewport-height, 100dvh);
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header {
          gap: 6px;
          padding: 8px 10px;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header .stat,
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header .search,
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header .grow {
          display: none;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header .brand {
          width: auto;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header .view-toggle {
          flex: 1 1 auto;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] main {
          display: flex;
          flex-direction: column;
          min-height: 0;
          height: 100%;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] aside,
        :root[data-viewer-open="true"][data-mobile-expanded="true"] .review,
        :root[data-viewer-open="true"][data-mobile-expanded="true"] footer {
          display: none;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] section {
          flex: 1 1 auto;
          height: 100%;
          min-height: 0;
          border-bottom: 0;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] .file-tabs {
          padding: 2px 10px;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] #viewer {
          flex: 1 1 auto;
          height: auto;
          min-height: 0;
        }
        footer {
          flex-wrap: wrap;
          gap: 6px;
          padding: 8px 10px;
          font-size: 12px;
        }
        #root {
          min-width: 0;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .terminal-panel {
          position: fixed;
          z-index: 100;
          top: var(--terminal-viewport-top, 0);
          right: auto;
          bottom: auto;
          left: var(--terminal-viewport-left, 0px);
          width: var(--terminal-viewport-width, 100vw);
          height: var(--terminal-viewport-height, 100dvh);
          min-height: 0;
          border-top: 0;
        }
        .terminal-resizer { display: none; }
        .terminal-host .xterm-viewport::-webkit-scrollbar { width: 5px; }
        .terminal-tab { max-width: 190px; }
        .terminal-tab-select { max-width: 150px; }
        .terminal-extra-keys {
          gap: 3px;
          padding: 4px 5px 2px;
        }
        :root[data-terminal-input-focused="true"] .terminal-panel { min-height: 180px; }
        .pdf-controls { flex-wrap: wrap; }
        .pdf-control-spacer { display: none; }
        .pdf-mobile-fullscreen { display: inline-flex; }
        .pdf-viewer:fullscreen .pdf-fullscreen-exit,
        .pdf-viewer:-webkit-full-screen .pdf-fullscreen-exit,
        .pdf-viewer.pdf-fallback-fullscreen .pdf-fullscreen-exit {
          position: absolute;
          z-index: 3;
          top: max(8px, env(safe-area-inset-top));
          right: max(8px, env(safe-area-inset-right));
          display: inline-flex;
          border-color: var(--blue);
          box-shadow: 0 4px 18px rgba(0, 0, 0, .3);
        }
        .pdf-page-scroll { padding: 8px; }
      }

      @media (max-width: 520px) {
        :root {
          --terminal-panel-size: min(var(--terminal-height, 58dvh), calc(100dvh - 36px));
        }
        body { font-size: 13px; }
        button { padding: 7px 9px; }
        header { gap: 7px; }
        .stat { flex: 1 1 calc(50% - 8px); }
        .mini-stat { display: none; }
        .commit-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] #viewer {
          height: auto;
          min-height: 0;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] header {
          padding: 7px 8px;
        }
        :root[data-viewer-open="true"][data-mobile-expanded="true"] .file-tabs {
          padding: 2px 8px;
        }
        .terminal-panel {
          height: var(--terminal-viewport-height, 100dvh);
          min-height: 0;
        }
        :root[data-terminal-input-focused="true"] .terminal-panel { min-height: 180px; }
        .terminal-toolbar { flex-basis: 40px; }
        .terminal-tool-button { flex-basis: 42px; }
        .terminal-tab { max-width: 160px; }
        .terminal-tab-select { max-width: 122px; padding-left: 8px; }
        .terminal-hosts { padding: 4px; }
        .terminal-host { inset: 4px; }
        .terminal-extra-keys {
          grid-template-columns: repeat(6, minmax(36px, 1fr));
          padding-bottom: 2px;
        }
        .terminal-extra-keys button { padding: 8px 2px; font-size: 10px; }
      }
