    :root {
      --bg: #ffffff;
      --panel: rgba(255, 255, 255, 0.92);
      --line: rgb(255, 255, 255);
      --line-strong: rgb(13, 8, 1);
      --line-muted: rgba(12, 8, 1, 0.16);
      --text: #201912;
      --muted: #7a6f60;
      --accent: #2f2415;
      --danger: #8a3f3f;
      --shadow: 0 18px 44px rgba(255, 255, 255, 0.1);
      --bg-soft: rgba(255, 255, 255, 0.96);
      --bg-softer: rgba(255, 255, 255, 0.52);
      --panel-soft: rgba(255, 255, 255, 0.82);
      --panel-mid: rgba(255, 255, 255, 0.78);
      --panel-faint: rgba(255, 255, 255, 0.72);
      --panel-fainter: rgba(255, 255, 255, 0.68);
      --panel-ghost: rgba(255, 255, 255, 0.58);
      --panel-active: rgba(255, 255, 255, 0.9);
      --panel-card: rgba(255, 255, 255, 0.48);
      --panel-chip: rgba(255, 255, 255, 0.35);
      --rail-bg: rgba(255, 255, 255, 0.72);
      --overlay-bg: rgba(255, 255, 255, 0.98);
      --placeholder: rgba(32, 25, 18, 0.36);
      --highlight: #ffff00;

      --danger-soft: rgba(138, 63, 63, 0.22);
      --letterbox-border: #000000;
      --radius: 0px;
      --gap: 14px;
      --rail-width: 40px;
      --drawer-width: min(44vw, 460px);
      --editor-size: 30px;
      --editor-font: Georgia, "Times New Roman", serif;
      --font: Georgia, "Times New Roman", serif;
      --ui-font: "Segoe UI", Inter, system-ui, sans-serif;
    }

    * { box-sizing: border-box; }

    html, body {
      height: 100%;
      margin: 0;
      background:
        radial-gradient(circle at top, var(--bg-soft), transparent 36%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
      color: var(--text);
      font-family: var(--font);
    }

    body {
      overflow: hidden;
    }

    .viewport-space-bg {
      position: fixed;
      inset: 0;
      z-index: 0;
      overflow: hidden;
      pointer-events: none;
    }

    .viewport-space-bg .space-stars {
      position: absolute;
      inset: 0;
    }

    .editor-space-bg {
      position: absolute;
      inset: 0;
      z-index: 0;
      overflow: hidden;
      pointer-events: none;
    }

    .editor-panel > :not(.editor-space-bg) {
      position: relative;
      z-index: 1;
    }

    .space-stars {
      position: absolute;
      inset: 0;
      display: none;
      pointer-events: none;
    }

    body.space-game-theme .space-stars {
      display: block;
    }


    .app {
      position: relative;
      z-index: 1;
      height: 100vh;
      display: grid;
      grid-template-columns: minmax(0, 1fr) var(--drawer-width);
      gap: var(--gap);
      padding: var(--gap);
      overflow: hidden;
      transition: grid-template-columns 180ms ease;
    }

    .app.drawer-closed {
      grid-template-columns: minmax(0, 1fr) var(--rail-width);
    }

    .app-brand-logo {
      display: block;
      width: 96px;
      height: auto;
      flex: 0 0 auto;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      min-height: 0;
      min-width: 0;
      backdrop-filter: blur(8px);
    }

    .editor-panel {
      position: relative;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .editor-topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      min-height: 49px;
      border-bottom: 1px solid var(--line);
      font-family: var(--ui-font);
    }

    .doc-title {
      min-width: 0;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--muted);
      letter-spacing: 0.01em;
      font-family: var(--ui-font);
    }

    .editor-topbar-right {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    .editor-topbar-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .editor-topbar-actions button {
      padding: 6px 10px;
      font-size: 12px;
      white-space: nowrap;
    }

    .editor-topbar-actions .editor-icon-btn {
      min-width: 34px;
      padding: 6px 8px;
      font-size: 17px;
      line-height: 1;
    }

    .editor-topbar-actions .segmented {
      gap: 6px;
    }

    .editor-topbar-actions .segmented button {
      padding: 6px 10px;
      font-size: 12px;
    }

    .small-screen-view-label {
      display: none;
      color: var(--muted);
      font: 600 12px var(--ui-font);
      white-space: nowrap;
    }

    .editor-panel:fullscreen {
      --fullscreen-bg: #f6f6f4;
      --fullscreen-scrollbar-thumb: rgba(0, 0, 0, 0.14);
      --fullscreen-scrollbar-thumb-hover: rgba(0, 0, 0, 0.22);
      border-radius: 0;
      max-height: none;
      height: 100%;
      background: var(--fullscreen-bg);
      border-color: transparent;
      box-shadow: none;
    }

    .editor-panel:fullscreen,
    .editor-panel:fullscreen * {
      scrollbar-color: var(--fullscreen-scrollbar-thumb) var(--fullscreen-bg);
    }

    .editor-panel:fullscreen *::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    .editor-panel:fullscreen *::-webkit-scrollbar-track {
      background: var(--fullscreen-bg);
    }

    .editor-panel:fullscreen *::-webkit-scrollbar-thumb {
      border: 2px solid var(--fullscreen-bg);
      border-radius: 999px;
      background: var(--fullscreen-scrollbar-thumb);
      background-clip: padding-box;
    }

    .editor-panel:fullscreen *::-webkit-scrollbar-thumb:hover {
      background: var(--fullscreen-scrollbar-thumb-hover);
      background-clip: padding-box;
    }

    .editor-panel:fullscreen .editor-wrap.letterbox #editor {
      scrollbar-color: var(--fullscreen-scrollbar-thumb) var(--letterbox-editor-bg);
    }

    .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar-track {
      background: var(--letterbox-editor-bg);
    }

    .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar-thumb {
      border: 2px solid var(--letterbox-editor-bg);
      border-radius: 999px;
      background: var(--fullscreen-scrollbar-thumb);
      background-clip: padding-box;
    }

    .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar-thumb:hover {
      background: var(--fullscreen-scrollbar-thumb-hover);
      background-clip: padding-box;
    }

    .format-toolbar {
      display: flex;
      justify-content: center;
      gap: 2px;
      padding: 4px 8px;
      border-bottom: 1px solid var(--line);
      overflow-x: auto;
      background: var(--panel-card);
    }

    .format-toolbar.hidden {
      display: none;
    }

    .format-toolbar button {
      min-width: 30px;
      padding: 5px 7px;
      border-color: transparent;
      background: transparent;
    }

    .format-toolbar button:hover {
      border-color: var(--line-muted);
      background: var(--panel-mid);
    }

    .format-toolbar .format-heading {
      min-width: 38px;
    }

    .format-toolbar .format-highlight {
      color: var(--text);
      background: var(--highlight);
    }

    .format-toolbar button[data-format-html-source],
    .format-toolbar button[data-format-code-block] {
      font-family: Consolas, "Courier New", monospace;
      font-weight: 700;
    }

    .format-toolbar button[data-format-html-source] {
      min-width: auto;
    }

    .format-toolbar button[data-format-code-block] {
      text-transform: uppercase;
    }

    .format-toolbar button[data-format-all-caps] {
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .format-toolbar button[data-format-title-case] {
      font-weight: 700;
      text-transform: none;
      letter-spacing: 0.02em;
    }

    .game-hud {
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 8px 12px;
      border-bottom: 1px solid var(--line);
      background: var(--panel-card);
      color: var(--text);
      font: 600 13px var(--ui-font);
    }

    .game-hud.active {
      display: flex;
    }

    .game-hud-group {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    .game-lives {
      color: #b83232;
      letter-spacing: 2px;
    }

    .game-score {
      font-family: Consolas, "Courier New", monospace;
    }

    .game-hud button {
      padding: 5px 8px;
    }

    .editor-wrap {
      position: relative;
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }

    #editor {
      flex: 1;
      min-height: 0;
      max-width: 860px;
      width: 100%;
      margin: 0 auto;
      overflow: auto;
      padding: 54px 56px 72px;
      outline: none;
      font-size: var(--editor-size);
      font-family: var(--editor-font);
      line-height: 1.72;
      white-space: normal;
      word-wrap: break-word;
      color: var(--text);
      transition: max-width 160ms ease, max-height 160ms ease, padding 160ms ease, border-color 160ms ease;
    }

    .editor-footer {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
      gap: 20px;
      flex-shrink: 0;
      width: 100%;
      max-width: 860px;
      margin: 20px auto 0;
      padding: 12px 16px 18px;
      color: var(--muted);
      font-size: 12px;
      font-family: var(--ui-font);
      letter-spacing: 0.02em;
      flex-wrap: wrap;
    }

    .editor-footer-meta {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    button.editor-footer-meta {
      border: 0;
      background: transparent;
      color: inherit;
      padding: 0;
      font: inherit;
      letter-spacing: inherit;
      cursor: copy;
    }

    button.editor-footer-meta:hover {
      border-color: transparent;
      text-decoration: underline;
    }

    .editor-footer .editor-brand {
      color: var(--text);
      font-weight: 600;
    }

    .network-status {
      flex: 0 0 auto;
      font: 600 12px/1 var(--ui-font);
      color: var(--muted);
    }

    .network-status.offline {
      color: var(--danger);
    }

    .editor-wrap.letterbox {
      --letterbox-editor-height: calc(1.72em * 3 + 2.2rem);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: flex-start;
      padding: clamp(28px, calc(66.666vh - 310px), 300px) 28px 28px;
      background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg) 6%, transparent), transparent),
        var(--bg-softer);
    }

    .editor-wrap.letterbox.space-theme {
      background: transparent;
    }

    .editor-wrap.letterbox #editor {
      --letterbox-editor-bg: #fff0f3;
      flex: 0 0 auto;
      width: 100%;
      max-width: 860px;
      min-height: auto;
      height: var(--letterbox-editor-height);
      max-height: var(--letterbox-editor-height);
      padding: 1.2rem 1.8rem 1.6rem 1.4rem;
      border: 4px solid var(--letterbox-border);
      border-radius: 8px;
      background: var(--letterbox-editor-bg);
      overflow: auto;
      scrollbar-gutter: stable;
      scroll-padding-bottom: 1.72em;
      box-shadow: 0 10px 30px color-mix(in srgb, var(--bg) 8%, transparent);
    }

    .editor-wrap.letterbox #editor::after {
      content: "";
      display: block;
      height: 1.72em;
    }

    .editor-wrap.letterbox:not(.space-theme) #editor {
      scrollbar-color: rgba(0, 0, 0, 0.14) var(--letterbox-editor-bg);
    }

    .editor-wrap.letterbox:not(.space-theme) #editor::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    .editor-wrap.letterbox:not(.space-theme) #editor::-webkit-scrollbar-track {
      background: var(--letterbox-editor-bg);
    }

    .editor-wrap.letterbox:not(.space-theme) #editor::-webkit-scrollbar-thumb {
      border: 2px solid var(--letterbox-editor-bg);
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.14);
      background-clip: padding-box;
    }

    .editor-wrap.letterbox:not(.space-theme) #editor::-webkit-scrollbar-thumb:hover {
      background: rgba(0, 0, 0, 0.22);
      background-clip: padding-box;
    }

    .editor-wrap.letterbox .game-hud {
      width: 100%;
      max-width: 860px;
      margin: 0 auto 8px;
      padding: 0;
      border: 0;
      background: transparent;
    }

    .game-letterbox-footer {
      display: none;
    }

    .editor-wrap.letterbox .editor-footer {
      display: none;
    }

    .editor-wrap.letterbox .game-letterbox-footer {
      display: block;
      width: 100%;
      max-width: 860px;
      margin: 8px auto 0;
      text-align: left;
    }

    .game-letterbox-footer button {
      padding: 0.45rem 0.7rem;
    }

    .editor-wrap.game-warning #editor {
      border-color: #c83434;
      background: #fff0f0;
      box-shadow: 0 0 0 4px rgba(200, 52, 52, 0.16);
    }

    body.space-game-theme {
      --bg: #050712;
      --bg-soft: rgba(16, 23, 45, 0.94);
      --bg-softer: rgba(5, 7, 18, 0.72);
      --panel: rgba(6, 10, 24, 0.72);
      --panel-soft: rgba(18, 28, 58, 0.9);
      --panel-mid: rgba(18, 28, 58, 0.78);
      --panel-faint: rgba(18, 28, 58, 0.72);
      --panel-fainter: rgba(10, 17, 38, 0.82);
      --panel-ghost: rgba(18, 28, 58, 0.68);
      --panel-active: rgba(35, 50, 91, 0.92);
      --panel-card: rgba(8, 14, 31, 0.76);
      --panel-chip: rgba(184, 201, 255, 0.16);
      --rail-bg: rgba(8, 14, 31, 0.82);
      --overlay-bg: rgba(8, 14, 31, 0.96);
      --line: rgba(184, 201, 255, 0.2);
      --line-muted: rgba(184, 201, 255, 0.26);
      --line-strong: rgba(222, 230, 255, 0.76);
      --text: #eef2ff;
      --muted: rgba(222, 230, 255, 0.72);
      --accent: #eef2ff;
      --placeholder: rgba(222, 230, 255, 0.42);
      --letterbox-border: rgba(190, 207, 255, 0.68);
      background: radial-gradient(ellipse at bottom, #10172d 0%, #050712 100%);
      color: #eef2ff;
    }

    body.space-game-theme .panel {
      border-color: transparent;
      background: transparent;
      box-shadow: none;
      backdrop-filter: none;
    }

    body.space-game-theme .side-panel {
      background: transparent;
    }

    body.space-game-theme .editor-topbar,
    body.space-game-theme .game-hud,
    body.space-game-theme .tab-rail,
    body.space-game-theme .side-content {
      border-color: transparent;
      background: transparent;
      color: #eef2ff;
    }

    body.space-game-theme .tab-panel,
    body.space-game-theme .tab-body,
    body.space-game-theme .doc-list,
    body.space-game-theme .doc-item,
    body.space-game-theme .tag-list,
    body.space-game-theme .tag-row,
    body.space-game-theme .stats-card,
    body.space-game-theme .stats-row,
    body.space-game-theme .about-card,
    body.space-game-theme .subsection {
      border-color: transparent;
      background: transparent;
      box-shadow: none;
    }

    body.space-game-theme .doc-title,
    body.space-game-theme .editor-footer {
      color: #ffffff;
    }

    body.space-game-theme .editor-footer .editor-brand {
      color: #ffffff;
    }

    body.space-game-theme .editor-wrap.letterbox #editor {
      --letterbox-editor-bg: rgba(7, 12, 28, 0.62);
      border-color: rgba(190, 207, 255, 0.68);
      background: var(--letterbox-editor-bg);
      color: #eef2ff;
      caret-color: #fff;
      box-shadow: 0 10px 34px rgba(0, 0, 0, 0.58);
    }

    body.space-game-theme .editor-wrap.game-warning #editor {
      border-color: #e25555;
      background: rgba(56, 12, 22, 0.92);
    }

    body.space-game-theme button {
      border-color: transparent;
      background: transparent;
      color: #eef2ff;
    }

    body.space-game-theme button:hover {
      border-color: rgba(222, 230, 255, 0.72);
      background: rgba(18, 28, 58, 0.46);
    }

    body.space-game-theme * {
      scrollbar-color: rgba(184, 201, 255, 0.34) rgba(5, 7, 18, 0.16);
    }

    body.space-game-theme *::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    body.space-game-theme *::-webkit-scrollbar-track {
      background: rgba(5, 7, 18, 0.16);
    }

    body.space-game-theme *::-webkit-scrollbar-thumb {
      border: 2px solid rgba(5, 7, 18, 0.16);
      border-radius: 999px;
      background: rgba(184, 201, 255, 0.34);
      background-clip: padding-box;
    }

    body.space-game-theme *::-webkit-scrollbar-thumb:hover {
      background: rgba(222, 230, 255, 0.52);
      background-clip: padding-box;
    }

    body.space-game-theme .editor-panel:fullscreen,
    body.space-game-theme .editor-panel:fullscreen * {
      scrollbar-color: var(--fullscreen-scrollbar-thumb) var(--fullscreen-bg);
    }

    body.space-game-theme .editor-panel:fullscreen *::-webkit-scrollbar-track {
      background: var(--fullscreen-bg);
    }

    body.space-game-theme .editor-panel:fullscreen *::-webkit-scrollbar-thumb {
      border-color: var(--fullscreen-bg);
      background: var(--fullscreen-scrollbar-thumb);
      background-clip: padding-box;
    }

    body.space-game-theme .editor-panel:fullscreen *::-webkit-scrollbar-thumb:hover {
      background: var(--fullscreen-scrollbar-thumb-hover);
      background-clip: padding-box;
    }

    body.space-game-theme .editor-panel:fullscreen .editor-wrap.letterbox #editor {
      scrollbar-color: rgba(184, 201, 255, 0.34) var(--letterbox-editor-bg);
    }

    body.space-game-theme .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar-track {
      background: var(--letterbox-editor-bg);
    }

    body.space-game-theme .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar-thumb {
      border-color: var(--letterbox-editor-bg);
      background: rgba(184, 201, 255, 0.34);
      background-clip: padding-box;
    }

    body.space-game-theme .editor-panel:fullscreen .editor-wrap.letterbox #editor::-webkit-scrollbar-thumb:hover {
      background: rgba(222, 230, 255, 0.52);
      background-clip: padding-box;
    }

    .game-flash {
      position: fixed;
      left: clamp(20px, 4vw, 48px);
      right: clamp(20px, 4vw, 48px);
      bottom: 0;
      z-index: 40;
      display: none;
      margin: 0;
      padding: 24px 28px;
      border: 1px solid rgba(255, 255, 255, 0.5);
      border-bottom: 0;
      border-radius: 20px 20px 0 0;
      text-align: center;
      font: 700 36px/1.25 "Segoe UI", Inter, Arial, sans-serif;
      letter-spacing: 0.035em;
      box-sizing: border-box;
      text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
      box-shadow: 0 -12px 38px rgba(20, 16, 10, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
      backdrop-filter: blur(12px) saturate(1.25);
    }

    .game-flash.positive {
      background: linear-gradient(100deg, rgba(0, 216, 112, 0.96), rgba(92, 255, 139, 0.97), rgba(190, 255, 92, 0.96));
      color: #072713;
    }

    .game-flash.negative {
      background: linear-gradient(100deg, rgba(205, 20, 55, 0.97), rgba(255, 66, 66, 0.97), rgba(255, 120, 60, 0.96));
      color: #ffffff;
      text-shadow: 0 1px 2px rgba(80, 0, 0, 0.4);
    }

    .game-flash.active {
      display: block;
      animation: game-flash-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
    }

    @keyframes game-flash-in {
      from { opacity: 0; transform: translateY(22px) scale(0.985); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .editor-panel:fullscreen .game-flash {
      position: absolute;
      z-index: 100;
    }

    #editor:empty:before {
      content: "Write...";
      color: var(--placeholder);
    }

    #editor[contenteditable="false"] {
      cursor: default;
    }

    #editor[contenteditable="false"]:empty:before {
      content: "Locked";
    }

    #editor ul, #editor ol {
      padding-left: 28px;
      margin: 0.3em 0;
    }

    #editor h1, #editor h2, #editor h3 {
      line-height: 1.25;
      margin: 0.7em 0 0.35em;
    }

    #editor blockquote {
      margin: 0.6em 0;
      padding-left: 1em;
      border-left: 3px solid var(--line-muted);
      color: var(--muted);
    }

    #editor code {
      padding: 0.08em 0.22em;
      background: var(--panel-chip);
      font-family: Consolas, "Courier New", monospace;
      font-size: 0.88em;
    }

    .editor-wrap.html-source-mode #editor {
      white-space: pre-wrap;
      font-family: Consolas, "Courier New", monospace;
      font-size: 15px;
      line-height: 1.55;
    }

    #editor pre,
    .note-editor pre {
      margin: 0.6em 0;
      padding: 12px 14px;
      background: #f5f5f5;
      border: 0;
      border-left: 8px solid #22c55e;
      font-family: Consolas, "Courier New", monospace;
      font-size: 0.88em;
      line-height: 1.45;
      white-space: pre-wrap;
      overflow-x: auto;
    }

    #editor pre code,
    .note-editor pre code {
      padding: 0;
      background: transparent;
      font-size: inherit;
    }

    #editor span.all-caps {
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    #editor span.title-case {
      text-transform: capitalize;
    }

    #editor a {
      color: inherit;
      text-decoration: underline;
    }

    #editor hr, .note-editor hr {
      border: 0;
      border-top: 1px solid var(--line-muted);
      display: block;
      width: 100%;
      height: 0;
      margin: 1.2em 0;
    }

    .shortcut-hint {
      position: sticky;
      bottom: 0;
      padding: 10px 14px;
      border-top: 1px solid var(--line);
      background: var(--panel);
      color: var(--muted);
      font-size: 11px;
      backdrop-filter: blur(10px);
      font-family: var(--ui-font);
      letter-spacing: 0.01em;
    }

    .side-panel {
      display: grid;
      grid-template-columns: minmax(0, 1fr) var(--rail-width);
      overflow: hidden;
      background: var(--rail-bg);
    }

    .side-content {
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
      border-right: 1px solid var(--line);
      transition: opacity 160ms ease, transform 160ms ease;
    }

    .app.drawer-closed .side-content {
      opacity: 0;
      pointer-events: none;
      transform: translateX(14px);
    }

    .tab-body-wrap {
      flex: 1;
      min-height: 0;
      overflow: auto;
      padding: 6px;
    }

    .tab-panel {
      border: 1px solid var(--line);
      border-radius: 0;
      overflow: hidden;
      background: var(--panel-card);
      min-height: 100%;
      height: 100%;
    }

    .tab-body {
      height: 100%;
      padding: 10px;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .tab-panel[data-tab-id="notes"] .tab-body {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .tab-rail {
      display: flex;
      flex-direction: column;
      min-height: 0;
      background: var(--rail-bg);
    }

    .rail-toggle {
      height: 100%;
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--text);
      padding: 12px 0;
      font-size: 12px;
      font-weight: 600;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      font-family: var(--ui-font);
      writing-mode: vertical-rl;
      text-orientation: mixed;
    }

    .tabs-header {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 8px;
      padding: 8px 8px;
      height: 49px;
      border-bottom: 1px solid var(--line);
      overflow-x: auto;
      overflow-y: hidden;
      font-family: var(--ui-font);
    }

    .tab-chip {
      width: auto;
      padding: 6px 8px;
      border: 1px solid var(--line-muted);
      border-radius: 0;
      background: var(--panel-chip);
      color: var(--muted);
      cursor: pointer;
      user-select: none;
      font-size: 12px;
      line-height: 1.2;
      text-align: center;
      white-space: nowrap;
      font-family: var(--ui-font);
    }

    .tab-chip.active {
      border-color: var(--line-strong);
      color: var(--text);
      background: var(--panel-soft);
    }

    .grid,
    .row,
    .stack {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .stack { flex-direction: column; }

    button,
    input,
    textarea,
    select,
    .fake-input {
      font: inherit;
    }

    button {
      border: 1px solid var(--line-muted);
      background: var(--panel-mid);
      color: var(--text);
      padding: 10px 12px;
      border-radius: 0;
      cursor: pointer;
      font-family: var(--ui-font);
    }

    button:hover { border-color: var(--line-strong); }
    button.primary { border-color: var(--line-strong); color: var(--accent); }
    button.danger { border-color: var(--danger-soft); color: var(--danger); }

    .field,
    .note-editor,
    .promo-box,
    .doc-list,
    .tag-list,
    .about-card,
    .copy-grid,
    .stats-card {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 0;
      background: var(--panel-fainter);
    }

    .field {
      border-color: var(--line-muted);
      padding: 10px 12px;
      color: var(--text);
      font-family: var(--ui-font);
    }

    .field:focus {
      border-color: var(--line-strong);
      outline: none;
    }

    .muted { color: var(--muted); font-size: 12px; font-family: var(--ui-font); }

    .section-label {
      font: 600 12px var(--ui-font);
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: var(--muted);
    }

    .tag-list,
    .doc-list {
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: 280px;
      overflow: auto;
    }

    .files-stack,
    .files-list {
      min-height: 0;
    }

    .files-stack {
      height: 100%;
    }

    .files-list {
      flex: 1;
      max-height: none;
    }

    .notes-import-button {
      flex: 0 0 auto;
    }

    .tag-row,
    .doc-item,
    .stats-row {
      display: flex;
      gap: 8px;
      align-items: center;
      justify-content: space-between;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 0;
      background: var(--panel-ghost);
    }

    .doc-item {
      cursor: default;
      align-items: flex-start;
      background: var(--workflow-colour, var(--panel-ghost));
      position: relative;
      padding-left: 48px;
      min-height: 108px;
    }

    .doc-list .doc-item > .stack button {
      padding: 6px 10px;
      font-size: 12px;
    }

    .doc-item.doc-child {
      margin-left: 18px;
      border-left-color: var(--line-strong);
    }

    .doc-item.drag-over {
      border-color: var(--line-strong);
      background: var(--panel-active);
    }

    .doc-item.dragging {
      opacity: 0.45;
    }

    .doc-item.active {
      border-color: var(--line-strong);
      outline: 2px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
      outline-offset: -2px;
    }

    .doc-item[data-highlight]:not([data-highlight=""]) {
      border-left: 6px solid var(--item-highlight);
    }

    .doc-item.note-list-item[data-highlight]:not([data-highlight=""]) {
      background: var(--item-highlight);
      border-left: 1px solid var(--line);
    }

    .doc-item.note-list-item {
      min-height: 78px;
      background: #faf8ef;
    }

    .doc-item.note-list-item.note-child {
      margin-left: 18px;
    }

    .colour-tag-settings {
      display: grid;
      grid-template-columns: 28px minmax(0, 1fr);
      gap: 8px;
      align-items: center;
    }

    .colour-tag-swatch {
      width: 28px;
      height: 28px;
      border: 1px solid rgba(0, 0, 0, 0.35);
    }

    .item-menu {
      position: relative;
      flex: 0 0 auto;
    }

    .item-menu > summary {
      list-style: none;
      cursor: pointer;
      min-width: 34px;
      padding: 5px 9px;
      border: 0;
      background: transparent;
      color: var(--text);
      font-size: 20px;
      line-height: 1;
      text-align: center;
      user-select: none;
    }

    .item-menu > summary::-webkit-details-marker {
      display: none;
    }

    .item-menu[open] > summary {
      background: transparent;
    }

    .colour-tag-label {
      display: inline-block;
      padding: 1px 6px;
      color: #111;
      background: var(--tag-colour);
      border-radius: 2px;
      font-weight: 600;
    }

    .item-select {
      position: absolute;
      left: 16px;
      bottom: 14px;
      width: 18px;
      height: 18px;
      margin: 0;
    }

    .drag-handle {
      position: absolute;
      left: 11px;
      top: 10px;
      width: 28px;
      padding: 0;
      color: var(--muted);
      cursor: grab;
      touch-action: none;
      font-size: 20px;
      line-height: 1;
      text-align: center;
    }

    .stop-music-btn,
    body.space-game-theme .stop-music-btn {
      border-color: #991b1b;
      background: #c62828;
      color: #fff;
      animation: stop-music-arrive 180ms ease-out;
      font-weight: 700;
      white-space: nowrap;
    }

    .stop-music-btn:hover,
    .stop-music-btn:focus-visible,
    body.space-game-theme .stop-music-btn:hover,
    body.space-game-theme .stop-music-btn:focus-visible {
      border-color: #7f1d1d;
      background: #a91f1f;
      color: #fff;
    }

    @keyframes stop-music-arrive {
      from { opacity: 0; transform: translateX(-8px); }
      to { opacity: 1; transform: translateX(0); }
    }

    @media (prefers-reduced-motion: reduce) {
      .stop-music-btn { animation: none; }
    }

    .management-tools {
      flex: 0 0 auto;
      width: 100%;
      border: 1px solid var(--line);
      padding: 8px;
    }

    .management-tools > summary {
      cursor: pointer;
      font: 600 12px var(--ui-font);
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .management-tools-content {
      margin-top: 10px;
    }

    .save-status {
      flex: 0 0 52px;
      width: 52px;
      font: 11px var(--ui-font);
      color: var(--muted);
      text-align: center;
      white-space: nowrap;
    }

    .item-menu-popover {
      position: absolute;
      z-index: 30;
      top: calc(100% + 5px);
      right: 0;
      width: min(210px, 70vw);
      padding: 8px;
      border: 1px solid var(--line-strong);
      background: var(--panel);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
    }

    .item-menu-popover button,
    .item-menu-popover select {
      width: 100%;
    }

    .doc-main {
      min-width: 0;
      flex: 1;
    }

    .doc-main[draggable="true"] {
      cursor: grab;
    }

    .doc-main[draggable="true"]:active {
      cursor: grabbing;
    }

    .doc-name {
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-family: var(--ui-font);
    }

    .doc-meta {
      margin-top: 4px;
      font-size: 12px;
      color: var(--muted);
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      font-family: var(--ui-font);
    }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border: 1px solid var(--line-muted);
      border-radius: 999px;
      padding: 7px 10px;
      background: var(--panel-faint);
      font-size: 12px;
      font-family: var(--ui-font);
    }

    .selected-tags {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .note-editor {
      min-height: 180px;
      padding: 14px;
      outline: none;
      line-height: 1.6;
      font-family: var(--ui-font);
      font-size: 14px;
    }

    .note-editor > ul,
    .note-editor > ol {
      margin: 8px 0 0;
      padding-left: 0;
      list-style: none;
    }

    .note-editor li {
      position: relative;
      padding-left: 28px;
      cursor: text;
    }

    .note-bullet-handle {
      position: absolute;
      left: 0;
      top: 0;
      display: inline-flex;
      width: 22px;
      height: 22px;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      line-height: 22px;
      cursor: grab;
      user-select: none;
      touch-action: none;
    }

    .note-bullet-handle:active { cursor: grabbing; }
    .note-editor li.note-item-drag-over { outline: 1px solid var(--line-strong); }

    .tab-panel[data-tab-id="notes"] .files-stack {
      flex: 1;
      width: 100%;
      min-height: 0;
      flex-wrap: nowrap;
    }

    .notes-editor-stack {
      flex: 1;
      width: 100%;
      min-height: 0;
      height: 100%;
      flex-wrap: nowrap;
    }

    .notes-editor-stack .note-editor {
      flex: 1;
      min-height: 0 !important;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .note-editor:empty:before {
      content: "Untitled note";
      color: var(--placeholder);
      pointer-events: none;
    }

    .promo-box {
      min-height: 76px;
      padding: 12px;
      color: var(--text);
      outline: none;
      line-height: 1.5;
      font-family: var(--ui-font);
      font-size: 14px;
    }

    .subsection {
      padding-top: 12px;
      border-top: 1px dashed var(--line-muted);
      margin-top: 12px;
    }

    details.compact-tools {
      flex: 0 0 auto;
      display: block;
      width: 100%;
      min-height: 0;
      height: auto;
      padding-top: 0;
      margin-top: 0;
    }

    details.compact-tools > summary {
      padding: 6px 0;
      cursor: pointer;
    }

    .colour-tag-name-list {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      max-height: 210px;
      overflow-y: auto;
      overflow-x: hidden;
      gap: 4px;
      margin-top: 5px !important;
      padding-right: 4px;
      flex-wrap: nowrap;
      width: 100%;
    }

    .colour-tag-name-list .colour-tag-settings {
      gap: 5px;
      width: 100%;
      min-width: 0;
      grid-template-columns: 22px minmax(0, 1fr);
    }

    .colour-tag-name-list .colour-tag-swatch {
      width: 22px;
      height: 22px;
    }

    .colour-tag-name-list .field {
      padding: 5px 8px;
      min-width: 0;
      width: 100%;
    }

    .compact-export-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 5px;
      margin-top: 5px !important;
    }

    .compact-export-grid button {
      width: 100%;
      padding: 6px 8px;
      font-size: 12px;
    }

    .compact-export-grid > :last-child:nth-child(odd) {
      grid-column: 1 / -1;
    }

    details.management-tools {
      display: block;
      min-height: 0;
      height: auto;
      padding: 0;
    }

    details.management-tools > summary {
      padding: 7px 8px;
    }

    .management-tools-content > .field {
      width: 100%;
    }

    .management-tools-content .two-col,
    .management-tools-content .row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 5px;
      width: 100%;
    }

    .management-tools-content .two-col > *,
    .management-tools-content .row > * {
      width: 100%;
      min-width: 0;
    }

    .management-tools-content .two-col > :last-child:nth-child(odd),
    .management-tools-content .row > :last-child:nth-child(odd) {
      grid-column: 1 / -1;
    }

    .management-tools-content button {
      padding: 6px 8px;
      font-size: 12px;
      height: 30px;
    }

    .management-tools-content input.field,
    .management-tools-content select.field {
      height: 30px;
      min-height: 30px;
      padding: 4px 8px;
      font-size: 12px;
      line-height: 1.2;
    }

    .settings-data-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 8px;
      width: 100%;
    }

    .settings-data-grid button {
      width: 100%;
    }

    .action-timer-display {
      display: block;
      box-sizing: border-box;
      width: 100%;
      flex: 0 0 100%;
      font-size: clamp(28px, 18cqw, 120px);
      line-height: 1;
      text-align: center;
      font-variant-numeric: tabular-nums;
      font-family: Consolas, "Courier New", monospace;
      white-space: nowrap;
      color: #1677ff;
    }

    .action-timer-panel {
      width: 100%;
      min-width: 0;
      container-type: inline-size;
    }

    .action-timer-controls {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      width: 100%;
    }

    .action-timer-controls button {
      width: 100%;
    }

    .action-export-grid + .check-row {
      margin-top: 12px;
    }

    .unicode-characters-button {
      display: block;
      box-sizing: border-box;
      width: 100%;
      margin-top: 8px;
      padding: 10px 12px;
      border: 1px solid var(--line-muted);
      color: var(--text);
      background: var(--panel-mid);
      text-align: center;
      text-decoration: none;
      font: inherit;
      font-family: var(--ui-font);
    }

    .unicode-characters-button:hover {
      border-color: var(--line-strong);
    }

    .empty {
      color: var(--muted);
      font-size: 13px;
      padding: 6px 2px;
      font-family: var(--ui-font);
    }

    .copy-grid {
      padding: 10px;
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 8px;
    }

    .copy-grid button {
      padding: 10px 0;
      min-height: 44px;
      font-size: 22px;
      font-family: Georgia, "Times New Roman", "Segoe UI Symbol", "Cambria Math", "DejaVu Sans", "Noto Sans Symbols 2", "Noto Sans Symbols", "Arial Unicode MS", var(--ui-font);
    }

    #emojiGrid button {
      font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", var(--ui-font);
    }

    .copy-grid button.copied-feedback {
      font-size: 12px;
      font-family: var(--ui-font);
    }

    .segmented {
      display: inline-flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .segmented button.active {
      border-color: var(--line-strong);
      background: var(--bg);
    }

    .check-row {
      display: flex;
      gap: 10px;
      align-items: center;
      font: 14px var(--ui-font);
    }

    .tab-panel[data-tab-id="settings"] a,
    .tab-panel[data-tab-id="settings"] a:visited,
    .tab-panel[data-tab-id="settings"] a:hover,
    .tab-panel[data-tab-id="settings"] a:active,
    .tab-panel[data-tab-id="settings"] a:focus {
      color: #000000;
      text-decoration: underline;
    }

    .stats-card,
    .about-card {
      padding: 12px;
    }

    .tab-panel[data-tab-id="stats"] .tab-body {
      font-family: "Segoe UI", Inter, Arial, sans-serif;
    }

    .tab-panel[data-tab-id="stats"] #statsSections {
      gap: 7px;
    }

    .tab-panel[data-tab-id="stats"] .stats-card {
      min-width: 0;
      padding: 8px;
      gap: 7px;
      overflow: hidden;
      border-left: 4px solid var(--accent);
      background: linear-gradient(135deg, var(--panel-faint), var(--panel-card));
      box-shadow: 0 4px 14px rgba(35, 28, 18, 0.07);
    }

    .stats-card-header {
      display: flex;
      gap: 8px;
      align-items: center;
      justify-content: space-between;
      min-width: 0;
    }

    .stats-card-header {
      cursor: grab;
      font-family: var(--ui-font);
    }

    .stats-card-header strong {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 13px;
      letter-spacing: 0.02em;
    }

    .stats-card-header button {
      flex: 0 0 auto;
      padding: 4px 7px;
      min-height: 26px;
      font-size: 11px;
    }

    .stats-card-body {
      gap: 4px;
      min-width: 0;
    }

    .tab-panel[data-tab-id="stats"] .stats-row {
      min-width: 0;
      padding: 6px 8px;
      gap: 8px;
      border: 0;
      border-bottom: 1px solid var(--line);
      background: color-mix(in srgb, var(--panel) 72%, transparent);
      font-family: "Segoe UI", Inter, Arial, sans-serif;
    }

    .tab-panel[data-tab-id="stats"] .stats-row:last-child {
      border-bottom: 0;
    }

    .tab-panel[data-tab-id="stats"] .stats-row > span {
      min-width: 0;
      font-size: 11px;
      line-height: 1.25;
    }

    .tab-panel[data-tab-id="stats"] .stats-row > strong {
      min-width: 0;
      max-width: 58%;
      overflow-wrap: anywhere;
      text-align: right;
      font-size: 13px;
      line-height: 1.2;
      color: var(--text);
      font-variant-numeric: tabular-nums;
    }

    .stats-card.collapsed .stats-card-body {
      display: none;
    }

    .stats-card.drag-over {
      outline: 2px solid var(--accent);
    }

    .about-card h2 {
      margin: 0 0 10px;
      font: 700 26px var(--font);
      text-align: center;
    }

    .about-card p {
      margin: 0;
      font-size: 16px;
      line-height: 1.6;
    }

    .about-card p + p {
      margin-top: 12px;
    }

    .about-card {
      font-family: var(--ui-font);
      background:
        linear-gradient(145deg, color-mix(in srgb, var(--panel-card) 94%, #eaffab), var(--panel));
    }

    .about-card .help-primary-link {
      display: grid;
      gap: 10px;
      margin: 8px 0 24px;
    }

    .about-card .help-primary-link .help-link-button {
      width: 100%;
      text-align: center;
      font-weight: 700;
      background: color-mix(in srgb, var(--panel-mid) 70%, #c9ff37);
    }

    .about-card .help-links .help-support-link {
      background: color-mix(in srgb, var(--panel-mid) 70%, #c9ff37);
      font-weight: 700;
    }

    .about-card .help-topics {
      display: grid;
      gap: 7px;
    }

    .about-card .help-topics details {
      margin: 0;
      border: 1px solid var(--line);
      background: color-mix(in srgb, var(--panel-card) 88%, transparent);
    }

    .about-card .help-topics summary {
      padding: 10px 12px;
      cursor: pointer;
      font-family: var(--font);
      font-size: 17px;
    }

    .about-card .help-topics details[open] {
      border-left: 5px solid #b7ff38;
      background: var(--panel-card);
    }

    .about-card .help-topics details p {
      padding: 0 12px 12px;
      color: var(--muted);
      font-size: 14px;
    }

    .about-card .help-links {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      margin-top: 26px;
      padding-top: 18px;
      border-top: 1px dashed var(--line);
    }

    .about-card .help-links .help-link-button {
      width: 100%;
      text-align: center;
    }

    .about-card .help-link-button {
      display: inline-block;
      width: fit-content;
      border: 1px solid var(--line-strong);
      background: var(--panel-mid);
      color: var(--text);
      padding: 10px 14px;
      font-family: var(--ui-font);
      text-decoration: none;
    }

    .about-card .help-link-button:hover,
    .about-card .help-link-button:focus {
      background: lightgoldenrodyellow;
      color: #201912;
    }

    .about-card .help-legal {
      margin-top: 24px;
      padding-top: 18px;
      border-top: 1px solid var(--line);
      color: var(--muted);
      font-size: 13px;
      line-height: 1.7;
      text-align: center;
    }

    .about-card .help-legal a {
      color: var(--text);
      text-decoration: underline;
    }

    .cloud-sync-panel {
      display: flex;
      flex-direction: column;
      gap: 16px;
      font-family: var(--ui-font);
    }

    .cloud-sync-hero {
      padding: 16px;
      border: 1px solid var(--line-muted);
      background: linear-gradient(160deg, var(--panel-active), var(--panel-faint));
    }

    .cloud-sync-hero h3 {
      margin: 0 0 8px;
      font: 700 20px var(--font);
    }

    .cloud-sync-hero p {
      margin: 0;
      font-size: 14px;
      line-height: 1.55;
      color: var(--muted);
    }

    .cloud-benefits {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      margin-top: 14px;
    }

    .cloud-benefit {
      padding: 10px;
      border: 1px solid var(--line-muted);
      background: var(--panel-ghost);
      font-size: 12px;
      line-height: 1.45;
    }

    .cloud-benefit strong {
      display: block;
      margin-bottom: 4px;
      font-size: 13px;
      color: var(--text);
    }

    .cloud-auth-card,
    .cloud-sync-card,
    .cloud-data-card {
      padding: 16px;
      border: 1px solid var(--line-muted);
      background: var(--panel-fainter);
    }

    .cloud-auth-card h4,
    .cloud-sync-card h4,
    .cloud-data-card h4 {
      margin: 0 0 10px;
      font: 600 13px var(--ui-font);
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: var(--muted);
    }

    .cloud-auth-fields {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .cloud-auth-actions,
    .cloud-sync-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }

    .cloud-auth-actions button,
    .cloud-sync-actions button {
      flex: 1 1 auto;
      min-width: 120px;
    }

    .cloud-auth-actions button.primary,
    .cloud-sync-actions button.primary {
      flex: 1 1 100%;
    }

    button.login-is-loading {
      cursor: wait;
      opacity: 0.82;
    }

    button.login-is-loading::after {
      content: "";
      display: inline-block;
      width: 0.8em;
      height: 0.8em;
      margin-left: 0.6em;
      border: 2px solid currentColor;
      border-right-color: transparent;
      border-radius: 50%;
      vertical-align: -0.1em;
      animation: login-button-spin 0.7s linear infinite;
    }

    @keyframes login-button-spin {
      to { transform: rotate(360deg); }
    }

    @media (prefers-reduced-motion: reduce) {
      button.login-is-loading::after { animation-duration: 1.5s; }
    }

    .cloud-status-line {
      margin-top: 10px;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.5;
    }

    .cloud-price-tag {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-top: 10px;
      padding: 8px 12px;
      border: 1px solid var(--line-strong);
      background: var(--panel-active);
      font-size: 14px;
      font-weight: 600;
    }

    .cloud-data-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .cloud-data-actions button {
      width: 100%;
      text-align: left;
    }

    .cloud-data-actions .muted {
      margin-bottom: 4px;
    }

    @media (max-width: 720px) {
      .cloud-benefits {
        grid-template-columns: 1fr;
      }
    }

    .two-col {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .syfter-overlay {
      position: fixed;
      inset: 0;
      z-index: 2147483000;
      display: none;
      flex-direction: column;
      background: var(--overlay-bg);
      color: var(--text);
    }

    .syfter-overlay.active {
      display: flex;
    }

    .syfter-overlay,
    .syfter-overlay * {
      border: 0;
    }

    .syfter-overlay * {
      scrollbar-color: #000 transparent;
    }

    .syfter-overlay *::-webkit-scrollbar-thumb {
      background: #000;
    }

    .syfter-pane-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 7px 12px;
      font-family: var(--ui-font);
    }

    .syfter-pane-header {
      min-height: 42px;
      border-bottom: 1px dashed rgba(32, 25, 18, 0.14);
      background: #fff;
    }

    .syfter-pane-header button,
    .syfter-picker button {
      padding: 5px 10px;
      font-size: 12px;
      line-height: 1.15;
    }

    .syfter-pane-header button {
      border: 1px solid #000;
    }

    .syfter-pane-header .syfter-icon-btn {
      min-width: 32px;
      padding: 4px 7px;
      font-size: 17px;
      line-height: 1;
    }

    .syfter-title {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: "Helvetica Neue", Arial, sans-serif;
      font-size: 15px;
      font-weight: 400;
    }

    .syfter-pane-actions {
      display: flex;
      gap: 5px;
    }

    .syfter-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      flex: 1;
      min-height: 0;
    }

    .syfter-pane {
      display: flex;
      min-width: 0;
      min-height: 0;
      flex-direction: column;
    }

    .syfter-editor {
      flex: 1;
      min-height: 0;
      overflow: auto;
      outline: none;
      padding: 36px 42px 120px;
      font-size: var(--editor-size);
      font-family: var(--editor-font);
      line-height: 1.72;
      word-wrap: break-word;
    }

    .syfter-editor[contenteditable="false"] {
      opacity: 0.72;
    }

    .syfter-picker {
      flex: 1;
      overflow: auto;
      padding: 18px;
      font-family: var(--ui-font);
    }

    .syfter-picker h3 {
      margin: 4px 0 8px;
      font-size: 17px;
    }

    .syfter-picker-list {
      display: grid;
      gap: 6px;
      margin-bottom: 18px;
    }

    .syfter-picker .syfter-pick {
      width: 100%;
      overflow: hidden;
      font-size: 15px;
      text-align: left;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .syfter-picker .syfter-pick-book {
      font-weight: 700;
    }

    .syfter-picker .syfter-pick-nested {
      padding-left: 26px;
    }

    @media (max-width: 720px) {
      .syfter-grid {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
      }

      .syfter-pane + .syfter-pane {
        border-left: 0;
      }

      .syfter-editor {
        padding: 24px 22px 84px;
      }
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(32, 25, 18, 0.18);
      z-index: 50;
    }

    .modal-backdrop.active {
      display: flex;
    }

    .modal {
      width: min(420px, 100%);
      border: 1px solid var(--line-muted);
      background: var(--overlay-bg);
      padding: 16px;
      font-family: var(--ui-font);
      box-shadow: 0 18px 44px rgba(32, 25, 18, 0.14);
    }

    .modal h2 {
      margin: 0 0 8px;
      font: 700 20px var(--font);
    }

    .syfter-picker-create-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      margin-bottom: 18px;
    }

    .privacy-lock-backdrop {
      z-index: 1000;
      background: var(--overlay-bg);
    }

    .privacy-lock-backdrop .modal {
      width: min(460px, 100%);
    }

    .privacy-divider {
      text-align: center;
      color: var(--muted);
      font: 600 12px var(--ui-font);
    }

    .pin-field {
      -webkit-text-security: disc;
      letter-spacing: 0.35em;
    }

    @media (max-width: 980px) {
      body {
        overflow: auto;
      }

      .app,
      .app.drawer-closed,
      .app.drawer-open {
        display: block;
        height: auto;
        min-height: 100vh;
        padding: 12px;
      }

      .editor-panel {
        min-height: calc(100vh - 24px);
      }

      #syfterBtn,
      #letterboxBtn,
      #lockDocBtn,
      #editorModeGroup,
      .format-toolbar {
        display: none;
      }

      .small-screen-view-label {
        display: inline;
      }

      .editor-topbar {
        padding-right: calc(var(--rail-width) + 8px);
      }

      .side-panel {
        position: fixed;
        inset: 0 0 0 auto;
        display: block;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        border-radius: 0;
        z-index: 20;
        pointer-events: none;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
      }

      .side-content {
        position: absolute;
        inset: 0 var(--rail-width) 0 12px;
        pointer-events: auto;
        background: var(--overlay-bg);
        box-shadow: 0 24px 60px rgba(28, 18, 8, 0.18);
      }

      .app.drawer-closed .side-content {
        opacity: 0;
        pointer-events: none;
        transform: translateX(calc(100% + var(--rail-width)));
      }

      .app.drawer-open .side-content {
        opacity: 1;
        transform: translateX(0);
      }

      .tab-rail {
        position: absolute;
        inset: 0 0 0 auto;
        width: var(--rail-width);
        pointer-events: auto;
      }

      .two-col {
        grid-template-columns: 1fr;
      }

      .copy-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }
