:root {
  color-scheme: dark;
  --surface-canvas: #020704;
  --surface-sidebar: #061109;
  --surface-raised: #081a0d;
  --surface-overlay: #0f2e17;
  --surface-selected: rgba(0, 255, 102, 0.12);
  --text-primary: #a8ffc4;
  --text-secondary: #58b978;
  --text-disabled: #2f6d44;
  --border-subtle: #123a20;
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #00ff66;
  --accent-strong: #b7ffd0;
  --accent-soft: var(--surface-selected);
  --warn: #ff6767;
  --warn-soft: rgba(255, 103, 103, 0.11);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --glow: 0 0 18px rgba(0, 255, 102, 0.28);
  --screen-grid: rgba(0, 255, 102, 0);
  --scanline: rgba(0, 255, 102, 0.035);
  --text-glow: 0 0 10px rgba(0, 255, 102, 0.2);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-editor-serif: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-editor-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-editor-mono: "SFMono-Regular", "Cascadia Mono", "IBM Plex Mono", Consolas, "Liberation Mono", monospace;
  --mono: var(--font-editor-mono);
  --composer-font: var(--font-editor-serif);
  --sans: var(--font-ui);
  --serif: var(--font-editor-serif);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --control-compact: 32px;
  --control-comfortable: 40px;
  --control-touch: 48px;
  --motion-instant: 80ms;
  --motion-fast: 140ms;
  --motion-standard: 180ms;
  --motion-overlay: 240ms;
}

body[data-theme="frontier"] {
  color-scheme: light;
  --surface-canvas: #ebe6d8;
  --surface-sidebar: #ded8c8;
  --surface-raised: #f3eee2;
  --surface-overlay: #f7f2e7;
  --surface-selected: rgba(184, 112, 31, 0.14);
  --text-primary: #20211d;
  --text-secondary: #5d5f56;
  --text-disabled: #696b62;
  --border-subtle: rgba(95, 86, 70, 0.28);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: #cfc7b6;
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #272822;
  --accent-strong: #171814;
  --accent-soft: rgba(32, 33, 29, 0.08);
  --selection: #b8701f;
  --selection-soft: rgba(184, 112, 31, 0.14);
  --warn: #9f3d2c;
  --warn-soft: rgba(159, 61, 44, 0.12);
  --shadow: 0 20px 52px rgba(71, 62, 45, 0.16);
  --glow: 0 0 0 3px rgba(184, 112, 31, 0.14);
  --screen-grid: rgba(41, 42, 36, 0);
  --scanline: transparent;
  --text-glow: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, var(--screen-grid) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(0deg, var(--screen-grid) 1px, transparent 1px) 0 0 / 42px 42px,
    repeating-linear-gradient(0deg, var(--scanline) 0 1px, transparent 1px 5px),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
  text-shadow: var(--text-glow);
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 238px 318px minmax(360px, 1fr) 306px;
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  transition:
    grid-template-columns var(--motion-standard) ease,
    opacity 460ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 560ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 560ms ease;
}

body[data-auth-state="covered"] .app,
body[data-auth-state="opening"] .app {
  filter: blur(5px) saturate(0.72);
  opacity: 0;
  transform: translateY(14px) scale(0.995);
}

body[data-auth-state="revealing"] .app,
body[data-auth-state="ready"] .app {
  filter: none;
  opacity: 1;
  transform: none;
}

.compact-toolbar {
  align-items: center;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  display: none;
  gap: 8px;
  min-width: 0;
  padding: 4px 8px;
  position: relative;
  z-index: 12;
}

.compact-nav-button,
.compact-surface-nav button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  justify-content: center;
  min-height: 40px;
}

.compact-back {
  color: var(--text);
  flex: 0 0 40px;
  font-size: 29px;
  line-height: 1;
}

.compact-location {
  display: grid;
  line-height: 1.05;
  min-width: 0;
}

.compact-location span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: none;
}

.compact-location strong {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-surface-nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.compact-surface-nav button {
  padding: 0 9px;
}

.compact-surface-nav button.active {
  background: var(--accent-soft);
  border-color: var(--line);
  color: var(--text);
}

.app-identity {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: inline-flex;
  flex: 0 0 auto;
  height: 39px;
  justify-content: center;
  width: 34px;
}

.brand-mark svg {
  color: #000;
  display: block;
  fill: none;
  height: 39px;
  stroke: currentColor;
  width: 34px;
}

.app-identity strong,
.app-identity > div span {
  display: block;
  line-height: 1.1;
}

.app-identity strong {
  font-size: 15px;
  text-transform: none;
}

.app-identity div span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-identity .sync-status {
  align-items: center;
  color: var(--text-secondary, var(--muted));
  display: inline-flex;
  font-size: 10px;
  font-weight: 720;
  gap: 5px;
  letter-spacing: 0.04em;
  margin-top: 6px;
  text-transform: uppercase;
}

.app-identity .sync-status span {
  color: inherit;
  display: inline-block;
  font: inherit;
  margin: 0;
  overflow: visible;
  text-overflow: clip;
}

.app-identity .sync-status-dot {
  background: currentColor;
  border-radius: 50%;
  flex: 0 0 auto;
  height: 6px;
  width: 6px;
}

.sync-status[data-state="saved"] {
  color: var(--selection, var(--accent));
}

.sync-status[data-state="offline"] {
  color: var(--text-disabled, var(--muted));
}

.sync-status[data-state="queued"] {
  color: #9b6a20;
}

.sync-status[data-state="conflict"],
.sync-status[data-state="failed"],
.sync-status[data-state="blocked"] {
  color: #b4473b;
}

.sync-status[data-state="connecting"] .sync-status-dot,
.sync-status[data-state="syncing"] .sync-status-dot {
  animation: sync-status-pulse 1s ease-in-out infinite alternate;
}

@keyframes sync-status-pulse {
  from { opacity: 0.34; transform: scale(0.78); }
  to { opacity: 1; transform: scale(1); }
}

.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  align-items: center;
  border-radius: 4px;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 34px;
  transition:
    background var(--motion-fast) ease,
    color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.ghost-button {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0 12px;
}

.ghost-button:hover,
.icon-button:hover {
  background: var(--panel-soft);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.primary-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #001306;
  padding: 0 14px;
  text-shadow: none;
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.danger-button {
  background: var(--warn-soft);
  color: var(--warn);
  padding: 0 12px;
}

.danger-button:hover {
  background: var(--warn);
  color: #ffffff;
}

.icon-button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 22px;
  height: 36px;
  line-height: 1;
  width: 36px;
}

.library-pane,
.sheet-pane,
.inspector-pane {
  min-height: 0;
  overflow: auto;
}

.library-pane {
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.sheet-pane {
  background: rgba(6, 17, 9, 0.94);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  padding: 14px;
}

.editor-pane {
  background: rgba(2, 7, 4, 0.84);
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.inspector-pane {
  background: var(--bg);
  border-left: 1px solid var(--line);
  padding: 14px;
}

.project-card {
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px;
}

.project-switcher {
  align-items: end;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 36px;
  margin-bottom: 12px;
  padding: 12px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.project-selector-label {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.project-switcher:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.project-picker-field {
  display: grid;
  min-width: 0;
}

.project-switcher select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  min-height: 36px;
  min-width: 0;
  padding: 0 9px;
  text-transform: none;
  width: 100%;
}

.project-switcher select,
.project-switcher button {
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  margin-bottom: 5px;
  text-transform: none;
}

.project-title-input,
.sheet-title-input {
  background: transparent;
  border: 0;
  min-width: 0;
  padding: 0;
  width: 100%;
}

.project-title-input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.18;
  min-height: 36px;
  padding: 0 9px;
  text-transform: none;
}

.project-title-field {
  color: var(--muted);
  cursor: text;
  display: grid;
  font-size: 10px;
  font-weight: 760;
  gap: 5px;
  grid-column: 1 / -1;
  text-transform: none;
}

.project-progress {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  margin: 8px 0 2px;
}

.project-progress div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
}

.project-progress strong,
.project-progress span {
  display: block;
}

.project-progress strong {
  font-size: 17px;
}

.project-progress span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.meter {
  background: var(--panel-strong);
  border-radius: 2px;
  height: 7px;
  overflow: hidden;
  grid-column: 1 / -1;
}

.meter span {
  background: var(--accent);
  box-shadow: var(--glow);
  display: block;
  height: 100%;
  width: 0;
}

.section-list {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.library-actions {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: auto;
  min-width: 0;
  padding-top: 14px;
}

.library-actions button {
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  padding-left: 6px;
  padding-right: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.library-actions .primary-button {
  grid-column: 1 / -1;
}

.theme-toggle {
  text-transform: none;
}

.section-button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 11px;
  text-align: left;
  width: 100%;
}

.section-row {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  min-width: 0;
}

.section-row .section-button {
  min-width: 0;
}

.context-trigger {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  letter-spacing: 1px;
  min-height: 36px;
  min-width: 36px;
  opacity: 0.58;
  padding: 0;
}

.context-trigger:hover,
.context-trigger:focus-visible {
  background: var(--panel-strong);
  border-color: var(--line);
  color: var(--text);
  opacity: 1;
}

.section-button:hover,
.section-button.active {
  background: var(--accent-soft);
  border-color: var(--line);
}

.section-button strong {
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-button span {
  color: var(--muted);
  font-size: 12px;
}

.section-count {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-width: 28px;
  padding: 3px 8px;
  text-align: center;
}

.pane-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
}

.pane-header h2 {
  font-size: 18px;
  line-height: 1.1;
  margin: 0;
  text-transform: none;
}

.pane-header.compact {
  margin-bottom: 10px;
}

.pane-header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.move-sheet-button {
  font-size: 17px;
}

.icon-button:disabled,
.ghost-button:disabled,
.primary-button:disabled,
.danger-button:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.scene-trash svg {
  display: block;
  fill: none;
  height: 19px;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.9;
  width: 19px;
}

.scene-trash.drag-over {
  background: var(--warn-soft);
  border-color: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-soft);
  color: var(--warn);
  transform: scale(1.12);
}

body.sheet-drag-active .scene-trash:not([hidden]) {
  animation: scene-trash-pulse 800ms ease-in-out infinite alternate;
}

@keyframes scene-trash-pulse {
  from { box-shadow: 0 0 0 0 transparent; }
  to { box-shadow: 0 0 0 4px var(--accent-soft), var(--glow); }
}

.search-box {
  background: var(--panel-soft);
  border: 1px solid transparent;
  border-radius: 4px;
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 8px 10px;
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: none;
}

.search-box input {
  background: transparent;
  border: 0;
  min-width: 0;
  padding: 0;
}

.sheet-list {
  align-content: start;
  display: grid;
  gap: 8px;
  grid-auto-rows: max-content;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 18px;
  padding-right: 3px;
  position: relative;
}

.sheet-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  display: grid;
  gap: 7px;
  min-height: 100px;
  padding: 12px;
  padding-right: 34px;
  position: relative;
  text-align: left;
  transform-origin: center;
  transition:
    background var(--motion-standard) ease,
    border-color var(--motion-standard) ease,
    box-shadow var(--motion-overlay) ease,
    filter var(--motion-standard) ease,
    transform 280ms cubic-bezier(0.2, 0.86, 0.16, 1);
  user-select: none;
  will-change: transform;
  width: 100%;
}

.sheet-card.can-reorder {
  cursor: grab;
  touch-action: none;
}

.sheet-card.can-trash {
  cursor: grab;
  touch-action: none;
}

.sheet-card.can-reorder:hover .sheet-drag-handle,
.sheet-card.can-reorder:focus-within .sheet-drag-handle {
  opacity: 1;
}

.sheet-list.is-dragging .sheet-card.can-reorder {
  cursor: grabbing;
}

.sheet-list.is-dragging .sheet-card.can-trash {
  cursor: grabbing;
}

.sheet-list.is-dragging .sheet-card:not(.dragging):not(.sheet-card-placeholder) {
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 220ms ease,
    transform 320ms cubic-bezier(0.18, 0.92, 0.2, 1);
}

.sheet-drag-handle {
  color: var(--muted);
  fill: currentColor;
  height: 16px;
  opacity: 0.66;
  pointer-events: none;
  position: absolute;
  right: 44px;
  top: 12px;
  transition:
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
  width: 16px;
}

.sheet-card.dragging .sheet-drag-handle {
  opacity: 1;
  transform: scale(0.92);
}

.sheet-card.dragging,
.sheet-card.dragging:hover,
.sheet-card.dragging.active {
  background: var(--panel-soft);
  border-color: var(--accent);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.24),
    0 5px 12px rgba(0, 0, 0, 0.16),
    inset 1px 1px rgba(255, 255, 255, 0.08);
  cursor: grabbing;
  filter: saturate(1.06);
  opacity: 1;
  pointer-events: none;
}

.sheet-card-placeholder {
  background:
    linear-gradient(135deg, rgba(32, 33, 29, 0.04) 0 10px, transparent 10px),
    rgba(32, 33, 29, 0.035);
  border-color: rgba(32, 33, 29, 0.2);
  box-shadow:
    inset 0 1px 2px rgba(71, 62, 45, 0.16),
    inset 0 -1px rgba(255, 252, 242, 0.34);
  pointer-events: none;
}

.sheet-card:hover,
.sheet-card.active {
  background: var(--accent-soft);
  border-color: var(--line);
}

.sheet-card:not(.fragment-card) {
  padding: 0;
}

.sheet-card-content {
  background: transparent;
  color: inherit;
  display: grid;
  gap: 7px;
  min-height: 98px;
  min-width: 0;
  padding: 12px 40px 12px 12px;
  text-align: left;
  width: 100%;
}

.sheet-context-trigger {
  position: absolute;
  right: 4px;
  top: 4px;
}

.fragment-card .sheet-context-trigger {
  align-self: stretch;
  position: static;
}

.fragment-card {
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  padding: 0;
}

.fragment-card-content {
  background: transparent;
  color: inherit;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  text-align: left;
}

.fragment-promote {
  align-items: center;
  align-self: stretch;
  background: transparent;
  border-left: 1px solid transparent;
  color: var(--muted);
  display: flex;
  justify-content: center;
  padding: 0;
}

.fragment-promote:hover,
.fragment-promote:focus-visible {
  background: var(--panel-strong);
  border-left-color: var(--line);
  color: var(--accent-strong);
}

.fragment-promote svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 20px;
}

.sheet-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.24;
}

.sheet-card p {
  color: var(--muted);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sheet-card-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
}

body.sheet-drag-active {
  cursor: grabbing;
  user-select: none;
}

.status-dot {
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  margin-right: 5px;
  width: 8px;
}

.status-to-write {
  background: #3b7c50;
}

.status-draft {
  background: var(--accent);
}

.status-revising {
  background: #b9ff6d;
}

.status-done {
  background: #00ff66;
}

.app[data-theme="frontier"] {
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.72), rgba(235, 230, 216, 0.12) 160px),
    var(--bg);
}

.app[data-theme="frontier"] .library-pane,
.app[data-theme="frontier"] .sheet-pane,
.app[data-theme="frontier"] .inspector-pane {
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.46), transparent 132px),
    var(--panel);
  box-shadow: inset -1px 0 rgba(255, 252, 242, 0.38);
  position: relative;
}

.app[data-theme="frontier"] .library-pane::before,
.app[data-theme="frontier"] .sheet-pane::before,
.app[data-theme="frontier"] .inspector-pane::before {
  background:
    linear-gradient(90deg, rgba(32, 33, 29, 0.42) 0 38px, transparent 38px 46px, rgba(32, 33, 29, 0.2) 46px 92px, transparent 92px);
  content: "";
  height: 2px;
  left: 14px;
  opacity: 0.72;
  position: absolute;
  right: 14px;
  top: 8px;
}

.app[data-theme="frontier"] .editor-pane {
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.88), rgba(235, 230, 216, 0.68) 220px),
    var(--bg);
}

.app[data-theme="frontier"] .project-card,
.app[data-theme="frontier"] .project-switcher,
.app[data-theme="frontier"] .project-switcher select,
.app[data-theme="frontier"] .project-progress div,
.app[data-theme="frontier"] .section-count,
.app[data-theme="frontier"] .search-box,
.app[data-theme="frontier"] .outline-item,
.app[data-theme="frontier"] .toast,
.app[data-theme="frontier"] .inspector-stack textarea,
.app[data-theme="frontier"] .inspector-stack input,
.app[data-theme="frontier"] .inspector-stack select {
  border-color: rgba(95, 86, 70, 0.82);
  border-radius: 8px;
  border-width: 2.25px;
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.72),
    inset -1px -1px rgba(71, 62, 45, 0.18),
    0 1px 0 rgba(71, 62, 45, 0.12);
}

.app[data-theme="frontier"] .project-card,
.app[data-theme="frontier"] .project-switcher,
.app[data-theme="frontier"] .search-box,
.app[data-theme="frontier"] .outline-item {
  background:
    linear-gradient(135deg, rgba(32, 33, 29, 0.07) 0 10px, transparent 10px),
    rgba(243, 238, 226, 0.92);
  border-color: rgba(95, 86, 70, 0.82);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.84),
    inset -1px -1px rgba(71, 62, 45, 0.22),
    0 1px 1px rgba(71, 62, 45, 0.14);
}

.app[data-theme="frontier"] .project-switcher:hover,
.app[data-theme="frontier"] .project-switcher:focus-visible {
  background:
    linear-gradient(135deg, rgba(32, 33, 29, 0.09) 0 10px, transparent 10px),
    rgba(246, 241, 229, 0.98);
  border-color: rgba(32, 33, 29, 0.52);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.86),
    inset -1px -1px rgba(71, 62, 45, 0.24),
    0 2px 4px rgba(71, 62, 45, 0.16);
}

.app[data-theme="frontier"] .outline-item {
  border-style: solid;
}

.app[data-theme="frontier"] .brand-mark {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.app[data-theme="frontier"] .ghost-button,
.app[data-theme="frontier"] .primary-button,
.app[data-theme="frontier"] .danger-button,
.app[data-theme="frontier"] .icon-button,
.app[data-theme="frontier"] .section-button,
.app[data-theme="frontier"] .sheet-card {
  border-width: 2.25px;
  border-radius: 8px;
  border-color: rgba(95, 86, 70, 0.7);
  clip-path: none;
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.68),
    inset -1px -1px rgba(71, 62, 45, 0.2),
    0 1px 0 rgba(71, 62, 45, 0.12);
}

.app[data-theme="frontier"] .ghost-button,
.app[data-theme="frontier"] .icon-button {
  background:
    linear-gradient(90deg, rgba(32, 33, 29, 0.08), transparent 7px),
    rgba(255, 252, 242, 0.5);
}

.app[data-theme="frontier"] .primary-button {
  background: var(--accent);
  color: #fff7e8;
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.16),
    inset -1px -1px rgba(0, 0, 0, 0.34),
    0 1px 0 rgba(71, 62, 45, 0.14);
}

.app[data-theme="frontier"] .section-button:hover,
.app[data-theme="frontier"] .section-button.active,
.app[data-theme="frontier"] .sheet-card:hover,
.app[data-theme="frontier"] .sheet-card.active {
  background: rgba(32, 33, 29, 0.06);
  border-color: rgba(32, 33, 29, 0.32);
}

.app[data-theme="frontier"] .section-button.active {
  background: rgba(32, 33, 29, 0.1);
  border-color: rgba(32, 33, 29, 0.42);
  box-shadow:
    inset 3px 0 rgba(32, 33, 29, 0.56),
    inset 1px 1px rgba(255, 252, 242, 0.58),
    inset -1px -1px rgba(71, 62, 45, 0.2),
    0 1px 0 rgba(71, 62, 45, 0.12);
}

.app[data-theme="frontier"] .sheet-card.active {
  background: rgba(32, 33, 29, 0.1);
  border-color: rgba(32, 33, 29, 0.42);
  box-shadow:
    inset 3px 0 rgba(32, 33, 29, 0.56),
    inset 1px 1px rgba(255, 252, 242, 0.58),
    inset -1px -1px rgba(71, 62, 45, 0.2),
    0 1px 0 rgba(71, 62, 45, 0.12);
}

.app[data-theme="frontier"] .sheet-card.dragging {
  background:
    linear-gradient(135deg, rgba(32, 33, 29, 0.1) 0 10px, transparent 10px),
    rgba(246, 241, 229, 0.98);
  border-color: rgba(32, 33, 29, 0.6);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.82),
    inset -1px -1px rgba(71, 62, 45, 0.2),
    0 18px 34px rgba(71, 62, 45, 0.24),
    0 5px 10px rgba(71, 62, 45, 0.16);
}

.app[data-theme="frontier"] .sheet-card-placeholder {
  background:
    linear-gradient(135deg, rgba(32, 33, 29, 0.055) 0 10px, transparent 10px),
    rgba(215, 208, 192, 0.36);
  border-color: rgba(95, 86, 70, 0.34);
  box-shadow:
    inset 0 2px 4px rgba(71, 62, 45, 0.14),
    inset 0 -1px rgba(255, 252, 242, 0.54);
}

.app[data-theme="frontier"] .mode-switch button.active {
  background: var(--accent);
  border-radius: 6px;
  color: #fff7e8;
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.14),
    inset -1px -1px rgba(0, 0, 0, 0.36);
}

.app[data-theme="frontier"] .sheet-title-input {
  color: var(--accent-strong);
  text-transform: none;
}

.app[data-theme="frontier"] .editor-shell {
  max-width: 980px;
  position: relative;
}

.app[data-theme="frontier"] .editor-shell::before,
.app[data-theme="frontier"] .editor-shell::after {
  color: rgba(32, 33, 29, 0.54);
  font-size: 12px;
  position: absolute;
  top: 12px;
}

.app[data-theme="frontier"] .editor-shell::before {
  content: "MUNINN // DRAFT TERMINAL";
  left: clamp(24px, 5vw, 72px);
}

.app[data-theme="frontier"] .editor-shell::after {
  content: "SERVER ARCHIVE";
  right: clamp(24px, 5vw, 72px);
}

.app[data-theme="frontier"] .editor-meta {
  color: rgba(32, 33, 29, 0.54);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
}

.app[data-theme="frontier"] .sheet-body,
.app[data-theme="frontier"] .preview-body,
.app[data-theme="frontier"] .outline-body {
  color: var(--text);
}

.app[data-theme="frontier"] .sheet-title-input:focus,
.app[data-theme="frontier"] .sheet-title-input:focus-visible,
.app[data-theme="frontier"] .sheet-body:focus,
.app[data-theme="frontier"] .sheet-body:focus-visible {
  outline: none;
}

.app[data-theme="frontier"] .meter {
  border: 1px solid rgba(32, 33, 29, 0.18);
  border-radius: 8px;
  height: 9px;
}

.app[data-theme="frontier"] .meter span {
  background:
    repeating-linear-gradient(90deg, rgba(32, 33, 29, 0.72) 0 8px, rgba(255, 247, 232, 0.72) 8px 10px);
}

.app[data-theme="frontier"] .status-to-write {
  background: #8b887a;
}

.app[data-theme="frontier"] .status-draft {
  background: var(--accent);
}

.app[data-theme="frontier"] .status-revising {
  background: #4f7770;
}

.app[data-theme="frontier"] .status-done {
  background: #6f7d44;
}

body[data-theme="frontier"] .project-library-backdrop {
  background:
    radial-gradient(circle at 22% 20%, rgba(255, 252, 242, 0.18), transparent 34%),
    rgba(32, 33, 29, 0.24);
  backdrop-filter: blur(2px);
}

body[data-theme="frontier"] .project-library-panel {
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.78), rgba(235, 230, 216, 0.32) 180px),
    #e7e1d2;
  border-color: rgba(95, 86, 70, 0.86);
  border-width: 2.25px;
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.78),
    inset -1px -1px rgba(71, 62, 45, 0.2),
    0 26px 60px rgba(71, 62, 45, 0.28);
}

body[data-theme="frontier"] .project-library-panel::before {
  background:
    linear-gradient(90deg, rgba(32, 33, 29, 0.42) 0 46px, transparent 46px 56px, rgba(32, 33, 29, 0.2) 56px 126px, transparent 126px);
  content: "";
  height: 2px;
  left: 24px;
  opacity: 0.7;
  position: absolute;
  right: 24px;
  top: 10px;
}

body[data-theme="frontier"] .project-library-head {
  border-bottom: 2.25px solid rgba(95, 86, 70, 0.62);
  padding-top: 28px;
}

body[data-theme="frontier"] .project-library-head h2 {
  color: var(--accent-strong);
}

body[data-theme="frontier"] .project-library-close:hover,
body[data-theme="frontier"] .project-library-close:focus-visible,
body[data-theme="frontier"] .project-library-trash:hover,
body[data-theme="frontier"] .project-library-trash:focus-visible {
  background: rgba(32, 33, 29, 0.08);
  border-color: rgba(32, 33, 29, 0.46);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.78),
    inset -1px -1px rgba(71, 62, 45, 0.22);
}

body[data-theme="frontier"] .project-library-trash.drag-over {
  background: rgba(166, 61, 53, 0.12);
  border-color: #8f3933;
  color: #8f3933;
}

body[data-theme="frontier"] .project-delete-dialog {
  background: #eee8da;
  border: 2.25px solid rgba(95, 86, 70, 0.86);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.78),
    inset -1px -1px rgba(71, 62, 45, 0.2),
    0 22px 54px rgba(71, 62, 45, 0.3);
}

body[data-theme="frontier"] .project-folder {
  border-width: 2.25px;
}

body[data-theme="frontier"] .project-folder:hover,
body[data-theme="frontier"] .project-folder:focus-visible {
  background: rgba(32, 33, 29, 0.055);
  border-color: rgba(32, 33, 29, 0.3);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.68),
    inset -1px -1px rgba(71, 62, 45, 0.18),
    0 8px 18px rgba(71, 62, 45, 0.13);
}

body[data-theme="frontier"] .project-folder.active {
  background: rgba(32, 33, 29, 0.085);
  border-color: rgba(32, 33, 29, 0.44);
}

body[data-theme="frontier"] .project-folder-icon::before {
  background: #d8d1c2;
  border-color: rgba(95, 86, 70, 0.82);
  border-width: 2.25px;
  box-shadow: inset 1px 1px rgba(255, 252, 242, 0.66);
}

body[data-theme="frontier"] .project-folder-icon::after {
  background:
    linear-gradient(135deg, rgba(255, 252, 242, 0.64), rgba(255, 252, 242, 0.12) 42%, transparent 43%),
    #d7d0c0;
  border-color: rgba(95, 86, 70, 0.82);
  border-width: 2.25px;
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.72),
    inset -1px -1px rgba(71, 62, 45, 0.22),
    0 2px 1px rgba(71, 62, 45, 0.1);
}

body[data-theme="frontier"] .project-folder.active .project-folder-icon::before,
body[data-theme="frontier"] .project-folder.active .project-folder-icon::after {
  border-color: rgba(32, 33, 29, 0.62);
}

body[data-theme="frontier"] .toast {
  background: #f3eee2;
  border-radius: 8px;
}

.editor-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  margin: 0 auto;
  max-width: 920px;
  padding: 30px clamp(24px, 5vw, 72px) 16px;
}

.editor-head {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.editor-composer-head {
  min-width: 0;
}

.sheet-title-input {
  color: var(--text);
  font-family: var(--composer-font);
  font-size: clamp(24px, 2.8vw, 38px);
  font-weight: 700;
  line-height: 1.16;
  min-height: 52px;
  overflow: hidden;
  resize: none;
}

.editor-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 7px;
  text-transform: none;
}

.editor-meta span {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.editor-meta span[data-state="saving"] {
  color: var(--muted);
}

.editor-meta span[data-state="error"] {
  color: var(--warn);
  font-weight: 700;
}

.editor-mode-bar {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 330px) 42px;
  justify-content: space-between;
  margin: 4px 0 12px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.mode-switch {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin: 4px 0 12px;
  max-width: 330px;
  padding: 0;
}

.editor-mode-bar .mode-switch {
  margin: 0;
  max-width: none;
  min-width: 0;
}

.mode-switch button {
  background: transparent;
  border-radius: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  min-height: 30px;
}

.mode-switch button.active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: var(--glow);
}

.composer-inspector-toggle {
  align-items: center;
  align-self: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  justify-self: end;
  padding: 0;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    transform 140ms ease;
  width: 42px;
}

.composer-inspector-toggle:hover,
.composer-inspector-toggle:focus-visible {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: var(--glow);
  color: var(--text);
  outline: 0;
}

.composer-inspector-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: var(--glow);
  color: var(--accent-strong);
}

.composer-inspector-toggle svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.editor-mode-panel {
  display: grid;
  min-height: 0;
  overflow: hidden;
}

#write-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.composer-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 3px;
  min-height: 38px;
  padding: 0 0 7px;
}

.composer-toolbar button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  height: 30px;
  min-width: 30px;
  padding: 0 7px;
}

.composer-toolbar button:hover,
.composer-toolbar button:focus-visible,
.composer-toolbar button[aria-pressed="true"] {
  background: var(--panel-soft);
  color: var(--accent-strong);
}

.composer-toolbar .composer-add-lore {
  align-items: center;
  background: color-mix(in srgb, var(--panel-soft) 54%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 34%, transparent);
  color: color-mix(in srgb, var(--muted) 72%, var(--panel));
  display: inline-flex;
  font-size: 11px;
  font-weight: 760;
  justify-content: center;
  letter-spacing: 0.025em;
  min-width: 76px;
  padding-inline: 10px;
  transition:
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    color var(--motion-fast) ease;
}

.composer-toolbar .composer-add-lore:hover,
.composer-toolbar .composer-add-lore:focus-visible {
  border-color: color-mix(in srgb, var(--muted) 62%, transparent);
}

.composer-toolbar .composer-add-lore[data-selection-ready="true"] {
  animation: composer-add-lore-wobble 720ms ease-in-out 2;
  background: var(--accent);
  border-color: var(--accent-strong);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--accent-strong) 72%, #000);
  color: var(--surface-canvas);
}

.composer-toolbar .composer-add-lore[data-selection-ready="true"]:hover,
.composer-toolbar .composer-add-lore[data-selection-ready="true"]:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--surface-canvas);
}

@keyframes composer-add-lore-wobble {
  0%,
  100% {
    transform: rotate(0deg) translateY(0);
  }
  20% {
    transform: rotate(-1.5deg) translateY(-1px);
  }
  40% {
    transform: rotate(1.2deg) translateY(0);
  }
  60% {
    transform: rotate(-0.8deg) translateY(-1px);
  }
  80% {
    transform: rotate(0.4deg) translateY(0);
  }
}

.composer-toolbar-divider {
  background: var(--line);
  height: 18px;
  margin: 0 4px;
  width: 1px;
}

.composer-toolbar-spacer {
  flex: 1;
}

.editor-mode-panel > .sheet-body,
.editor-mode-panel > .preview-body,
.editor-mode-panel > .outline-body {
  height: 100%;
  min-height: 0;
}

.sheet-body,
.preview-body,
.outline-body {
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--composer-font);
  font-size: 18px;
  line-height: 1.78;
  min-height: 0;
  overflow: auto;
  padding: 10px 0 28px;
  resize: none;
  width: 100%;
}

.sheet-body {
  caret-color: var(--accent);
}

.structured-composer {
  cursor: text;
  overflow: auto;
}

.structured-composer .ProseMirror {
  min-height: 100%;
  outline: none;
  overflow-wrap: break-word;
  position: relative;
  white-space: pre-wrap;
}

.structured-composer .ProseMirror > :first-child {
  margin-top: 0;
}

.structured-composer .ProseMirror p {
  margin: 0 0 1em;
}

.structured-composer .ProseMirror h1,
.structured-composer .ProseMirror h2,
.structured-composer .ProseMirror h3,
.structured-composer .ProseMirror h4,
.structured-composer .ProseMirror h5,
.structured-composer .ProseMirror h6 {
  font-family: var(--composer-font);
  line-height: 1.25;
  margin: 1.35em 0 0.55em;
}

.structured-composer .ProseMirror h1 {
  font-size: 1.65em;
}

.structured-composer .ProseMirror h2 {
  font-size: 1.35em;
}

.structured-composer .ProseMirror blockquote {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  margin: 1em 0;
  padding-left: 18px;
}

.structured-composer .ProseMirror pre {
  background: var(--panel-soft);
  border-radius: 5px;
  font-family: var(--font-editor-mono);
  font-size: 0.86em;
  overflow-x: auto;
  padding: 12px 14px;
  white-space: pre-wrap;
}

.structured-composer .ProseMirror ul,
.structured-composer .ProseMirror ol {
  padding-left: 1.6em;
}

.structured-composer .ProseMirror-selectednode {
  outline: 2px solid var(--accent);
}

.structured-composer .lore-reference {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.18em;
}

.structured-composer:focus-within {
  outline: none;
}

.sheet-body::selection,
.sheet-body .ProseMirror ::selection,
.preview-body ::selection {
  background: var(--accent-soft);
}

.preview-body h1,
.preview-body h2,
.preview-body h3 {
  font-family: var(--composer-font);
  line-height: 1.2;
  margin: 22px 0 10px;
}

.preview-body p {
  margin: 0 0 18px;
}

.preview-body blockquote {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  margin: 18px 0;
  padding-left: 18px;
}

.outline-body {
  display: grid;
  font-family: var(--composer-font);
  gap: 10px;
}

.outline-item {
  border-left: 3px solid var(--accent);
  background: var(--panel-soft);
  border-radius: 0 4px 4px 0;
  padding: 12px 14px;
}

.outline-item strong {
  display: block;
  margin-bottom: 5px;
}

.outline-item p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.editor-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 12px;
  justify-content: flex-end;
  min-height: 40px;
}

.empty-state {
  align-items: center;
  display: grid;
  gap: 14px;
  height: 100%;
  justify-content: center;
  place-items: center;
}

.empty-state span {
  color: var(--muted);
}

.inspector-stack {
  display: grid;
  gap: 14px;
  grid-template-rows: minmax(0, 1fr) auto auto auto auto auto;
  min-height: 0;
  overflow: hidden;
}

#sheet-inspector-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100% + 8px - var(--inspector-composer-bottom-offset, 0px));
  min-height: 0;
  overflow: hidden;
}

.app[data-theme="sprypnt"],
.app[data-theme="neon"] {
  --inspector-composer-bottom-offset: 18px;
}

.app[data-theme="heist"],
.app[data-theme="olde"] {
  --inspector-composer-bottom-offset: 20px;
}

.app[data-theme="ghost"] {
  --inspector-composer-bottom-offset: 1px;
}

.app[data-theme="noir"] {
  --inspector-composer-bottom-offset: 15px;
}

.app[data-theme="gem"],
.app[data-theme="moby"] {
  --inspector-composer-bottom-offset: 17px;
}

.inspector-close svg {
  display: block;
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-width: 2;
  width: 17px;
}

.inspector-backdrop {
  background: rgba(0, 0, 0, 0.48);
  inset: 0;
  opacity: 1;
  position: fixed;
  transition: opacity 180ms ease;
  z-index: 19;
}

.inspector-stack label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 720;
  gap: 6px;
}

.inspector-stack textarea,
.inspector-stack input,
.inspector-stack select {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.inspector-stack textarea {
  line-height: 1.45;
  resize: vertical;
}

.inspector-notes-field {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

#sheet-notes {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  resize: none;
}

.field-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.checkbox-row {
  align-items: center;
  display: flex !important;
  gap: 9px !important;
}

.checkbox-row input {
  accent-color: var(--accent);
  width: auto;
}

.inspector-actions {
  display: flex;
  gap: 8px;
}

.inspector-actions button {
  flex: 1;
}

.toast {
  align-items: center;
  background: #031006;
  border: 1px solid var(--accent);
  border-radius: 4px;
  bottom: 18px;
  box-shadow: var(--glow);
  color: var(--accent-strong);
  display: flex;
  font-size: 14px;
  gap: 14px;
  left: 50%;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition:
    opacity var(--motion-standard) ease,
    transform var(--motion-standard) ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.toast button {
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  min-height: 36px;
  padding: 0 0 0 14px;
  text-transform: none;
}

.context-menu {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), var(--glow);
  display: grid;
  min-width: 204px;
  padding: 5px;
  position: fixed;
  z-index: 90;
}

.context-menu[hidden] {
  display: none;
}

.context-menu button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  min-height: 38px;
  padding: 0 11px;
  text-align: left;
}

.context-menu button:hover,
.context-menu button:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.context-menu button.danger {
  color: var(--warn);
}

.context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

body.project-library-modal-open {
  overflow: hidden;
}

body.lore-open {
  overflow: hidden;
}

.lore-overlay {
  display: grid;
  inset: 0;
  padding: 18px;
  place-items: center;
  position: fixed;
  z-index: 56;
}

.lore-overlay[hidden] {
  display: none !important;
}

.lore-backdrop {
  background: rgba(0, 0, 0, 0.58);
  border: 0;
  inset: 0;
  position: absolute;
}

.lore-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 86px rgba(0, 0, 0, 0.48), var(--glow);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: min(900px, calc(100dvh - 36px));
  max-width: 1440px;
  min-height: 560px;
  overflow: hidden;
  position: relative;
  width: min(1240px, calc(100vw - 36px));
  z-index: 1;
}

.lore-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px 22px;
}

.lore-head h2 {
  font-size: clamp(25px, 3vw, 40px);
  line-height: 1;
  margin: 2px 0 0;
  text-transform: none;
}

.lore-project-name,
.lore-count,
.lore-version {
  color: var(--muted);
  font-size: 12px;
}

.lore-head-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.lore-surface-tabs {
  align-items: center;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 5px;
  padding: 7px 14px;
}

.lore-surface-tabs button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  padding: 6px 11px;
}

.lore-surface-tabs button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.lore-close {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  display: inline-flex;
  font-size: 25px;
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 36px;
}

.lore-close:hover,
.lore-close:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.lore-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  min-height: 0;
}

.lore-browser {
  background: color-mix(in srgb, var(--panel) 74%, transparent);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px;
}

.lore-search,
.lore-field,
.lore-field-grid label,
.lore-relation-builder label {
  display: grid;
  gap: 6px;
}

.lore-search > span,
.lore-field > span,
.lore-field-grid label > span,
.lore-relation-builder label > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lore-search input,
.lore-form input,
.lore-form select,
.lore-form textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.lore-search input:focus,
.lore-form input:focus,
.lore-form select:focus,
.lore-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.lore-form textarea {
  line-height: 1.55;
  resize: vertical;
}

.lore-type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 12px 0 8px;
}

.lore-type-filters button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  padding: 5px 8px;
}

.lore-type-filters button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.lore-archived-toggle {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 7px;
  margin: 2px 0 10px;
}

.lore-archived-toggle input {
  accent-color: var(--accent);
}

.lore-entry-list {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 3px;
}

.lore-entry-card-row {
  align-items: stretch;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
}

.lore-bulk-select {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: center;
}

.lore-bulk-select input {
  accent-color: var(--accent);
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.lore-bulk-bar {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 5px;
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  padding: 10px;
}

.lore-bulk-bar[hidden] {
  display: none !important;
}

.lore-bulk-bar strong {
  font-size: 11px;
}

.lore-bulk-bar input {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  min-width: 0;
  padding: 8px;
}

.lore-bulk-bar div {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
}

.lore-bulk-bar > button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 10px;
  justify-self: start;
  padding: 0;
}

.lore-entry-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text);
  display: grid;
  gap: 5px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.lore-entry-card:hover,
.lore-entry-card:focus-visible,
.lore-entry-card[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

.lore-entry-card-head {
  align-items: center;
  display: flex;
  gap: 7px;
  justify-content: space-between;
}

.lore-entry-card strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lore-entry-card p {
  color: var(--muted);
  display: -webkit-box;
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lore-type-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  padding: 3px 5px;
  text-transform: uppercase;
}

.lore-entry-card.archived {
  opacity: 0.58;
}

.lore-list-empty,
.lore-editor-empty {
  color: var(--muted);
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 34px 20px;
  text-align: center;
}

.lore-load-more {
  justify-self: center;
  margin: 10px auto 18px;
}

.lore-list-empty strong,
.lore-editor-empty h3 {
  color: var(--text);
}

.lore-list-empty span,
.lore-editor-empty p {
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
  max-width: 460px;
}

.lore-editor {
  min-height: 0;
  overflow: auto;
}

.lore-editor-empty {
  align-content: center;
  height: 100%;
}

.lore-empty-mark {
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 24px;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.lore-form {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 940px;
  padding: 24px 28px 32px;
}

.lore-form[hidden] {
  display: none !important;
}

.lore-reference-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lore-reference-stats article {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 5px;
  padding: 11px 12px;
}

.lore-reference-stats article span,
.lore-reference-stats p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.lore-reference-stats article span {
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lore-reference-stats article strong {
  color: var(--text);
  font-size: 22px;
}

.lore-reference-stats p {
  grid-column: 1 / -1;
  margin: 0;
}

.lore-form-heading,
.lore-section-heading {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.lore-form-heading h3 {
  font-size: clamp(21px, 2.3vw, 31px);
  margin: 2px 0 0;
  text-transform: none;
}

.lore-image-field {
  align-items: center;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 18px;
  grid-template-columns: 148px minmax(0, 1fr);
  padding: 14px;
}

.lore-image-field:focus,
.lore-image-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.lore-image-preview-button {
  align-items: center;
  aspect-ratio: 1;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent);
  display: flex;
  font-family: var(--mono);
  font-size: 32px;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.lore-image-preview-button:hover,
.lore-image-preview-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.lore-image-preview-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.lore-image-preview-button img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.lore-image-copy {
  display: grid;
  gap: 7px;
}

.lore-image-copy h4 {
  font-size: 17px;
  margin: 0;
}

.lore-image-copy p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  margin: 0;
  max-width: 560px;
}

.lore-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.lore-image-actions .ghost-button {
  min-height: 34px;
}

.lore-field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 150px minmax(220px, 1fr) 150px 130px;
}

.lore-field-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lore-description {
  min-height: 180px;
}

.lore-relations {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-top: 18px;
}

.lore-merge-section {
  align-items: end;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.8fr);
  padding-top: 18px;
}

.lore-merge-section[hidden] {
  display: none !important;
}

.lore-merge-section h4 {
  font-size: 17px;
  margin: 2px 0 5px;
}

.lore-merge-section p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
  max-width: 620px;
}

.lore-merge-controls {
  display: grid;
  gap: 8px;
}

.lore-merge-controls select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  min-width: 0;
  padding: 9px;
}

.lore-intelligence-view {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.lore-intelligence-view[hidden] {
  display: none !important;
}

.lore-intelligence-view > header {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto 14px;
  max-width: 1160px;
}

.lore-intelligence-view > header h3 {
  font-size: clamp(21px, 2.4vw, 30px);
  margin: 2px 0 5px;
}

.lore-intelligence-view > header p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.lore-intelligence-view > .lore-message {
  margin: 0 auto 14px;
  max-width: 1160px;
}

.lore-graph-canvas {
  background-color: color-mix(in srgb, var(--panel) 76%, transparent);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 0);
  background-size: 20px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0 auto;
  max-width: 1160px;
  min-height: 520px;
  min-width: 900px;
  position: relative;
}

.lore-graph-view {
  overflow: auto;
}

.lore-graph-canvas svg {
  height: 100%;
  inset: 0;
  overflow: visible;
  position: absolute;
  width: 100%;
}

.lore-graph-edge line {
  stroke: color-mix(in srgb, var(--accent) 58%, var(--line));
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.lore-graph-edge path {
  fill: var(--accent);
}

.lore-graph-edge text {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 4px;
  text-anchor: middle;
  vector-effect: non-scaling-stroke;
}

.lore-graph-node {
  background: var(--panel-strong);
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: var(--text);
  display: grid;
  gap: 4px;
  min-height: 50px;
  padding: 8px 10px;
  position: absolute;
  text-align: left;
  transform: translate(-50%, -50%);
  width: 184px;
  z-index: 2;
}

.lore-graph-node:hover,
.lore-graph-node:focus-visible {
  background: var(--accent-soft);
  box-shadow: var(--glow);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 3;
}

.lore-graph-node strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lore-graph-node span {
  color: var(--muted);
  font-size: 9px;
}

.lore-graph-node[data-lore-type="character"] { border-left: 5px solid var(--accent); }
.lore-graph-node[data-lore-type="place"] { border-left: 5px solid color-mix(in srgb, var(--accent) 52%, white); }
.lore-graph-node[data-lore-type="thing"] { border-left: 5px solid var(--warn); }
.lore-graph-node[data-lore-type="concept"] { border-left: 5px solid var(--muted); }

.lore-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px auto 0;
  max-width: 1160px;
}

.lore-graph-legend span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  padding: 5px 8px;
}

.lore-intelligence-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  height: 100%;
  justify-content: center;
  min-height: 220px;
  text-align: center;
}

.lore-integrity-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 auto 18px;
  max-width: 1160px;
}

.lore-integrity-summary article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.lore-integrity-summary strong {
  font-size: 23px;
}

.lore-integrity-summary span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.lore-integrity-results {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1160px;
}

.lore-integrity-section {
  display: grid;
  gap: 8px;
}

.lore-integrity-section h4 {
  font-size: 16px;
  margin: 0;
}

.lore-duplicate-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto 1fr;
  padding: 12px;
}

.lore-duplicate-card > div {
  display: grid;
  gap: 3px;
}

.lore-duplicate-card span {
  color: var(--muted);
  font-size: 10px;
}

.lore-duplicate-card footer {
  display: flex;
  gap: 7px;
  grid-column: 1 / -1;
}

.lore-duplicate-match {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
}

.lore-integrity-row,
.lore-unreferenced-grid button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  text-align: left;
}

.lore-integrity-row:hover,
.lore-integrity-row:focus-visible,
.lore-unreferenced-grid button:hover,
.lore-unreferenced-grid button:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

.lore-integrity-row span,
.lore-unreferenced-grid button span {
  color: var(--muted);
  font-size: 10px;
}

.lore-unreferenced-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lore-reader-redirect {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
  padding: 9px;
}

.lore-section-heading h4 {
  font-size: 18px;
  margin: 2px 0 0;
}

.lore-relation-builder {
  align-items: end;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.8fr) minmax(150px, 1fr) auto;
}

.lore-relation-builder button {
  min-height: 39px;
  white-space: nowrap;
}

.lore-relationship-list,
.lore-incoming-relations {
  display: grid;
  gap: 7px;
}

.lore-relation-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 9px 10px;
}

.lore-relation-row span {
  color: var(--muted);
  font-size: 11px;
}

.lore-relation-row strong {
  color: var(--text);
}

.lore-relation-remove {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  padding: 5px 7px;
}

.lore-incoming-relations::before {
  color: var(--muted);
  content: "Incoming relationships";
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  margin-top: 4px;
  text-transform: uppercase;
}

.lore-form-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding-top: 18px;
}

.lore-message {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.lore-message[data-state="error"] {
  color: var(--warn);
}

@media (max-width: 920px) {
  .lore-panel {
    height: calc(100dvh - 24px);
    width: calc(100vw - 24px);
  }

  .lore-workspace {
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  }

  .lore-field-grid,
  .lore-relation-builder,
  .lore-merge-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lore-integrity-summary,
  .lore-unreferenced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .lore-overlay {
    padding: 0;
  }

  .lore-panel {
    border-radius: 0;
    height: 100dvh;
    min-height: 0;
    width: 100vw;
  }

  .lore-head {
    align-items: flex-start;
    padding: 13px 14px;
  }

  .lore-count {
    display: none;
  }

  .lore-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .lore-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(190px, 34dvh) minmax(0, 1fr);
  }

  .lore-browser {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 11px;
  }

  .lore-form {
    padding: 18px 14px 28px;
  }

  .lore-image-field {
    align-items: start;
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .lore-field-grid,
  .lore-field-grid-two,
  .lore-relation-builder,
  .lore-merge-section,
  .lore-integrity-summary,
  .lore-unreferenced-grid,
  .lore-duplicate-card {
    grid-template-columns: 1fr;
  }

  .lore-intelligence-view {
    grid-row: 1 / -1;
    padding: 16px 12px 24px;
  }

  .lore-duplicate-card footer {
    flex-direction: column;
  }

  .lore-form-actions {
    grid-template-columns: 1fr 1fr;
  }

  .lore-message {
    grid-column: 1 / -1;
  }
}

.project-library-overlay {
  display: grid;
  inset: 0;
  padding: 16px;
  place-items: center;
  pointer-events: none;
  position: fixed;
  z-index: 50;
}

.project-library-overlay[hidden] {
  display: none !important;
}

.project-library-overlay.is-open,
.project-library-overlay.is-closing {
  pointer-events: auto;
}

.project-library-backdrop {
  background:
    radial-gradient(circle at 24% 18%, rgba(183, 255, 208, 0.08), transparent 36%),
    rgba(0, 0, 0, 0.46);
  inset: 0;
  opacity: 0;
  position: absolute;
  transition: opacity 220ms ease;
}

.project-library-overlay.is-open .project-library-backdrop {
  opacity: 1;
}

.project-library-panel {
  --library-origin-x: 0px;
  --library-origin-y: 0px;
  --library-origin-scale-x: 0.14;
  --library-origin-scale-y: 0.14;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38), var(--glow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: min(66.666dvh, 720px);
  max-height: calc(100dvh - 32px);
  max-width: calc(100vw - 32px);
  min-height: min(520px, calc(100dvh - 32px));
  min-width: min(720px, calc(100vw - 32px));
  opacity: 0;
  overflow: hidden;
  position: relative;
  transform:
    translate3d(var(--library-origin-x), var(--library-origin-y), 0)
    scale(var(--library-origin-scale-x), var(--library-origin-scale-y));
  transform-origin: top left;
  transition:
    transform 340ms cubic-bezier(0.16, 1, 0.22, 1),
    opacity 180ms ease;
  width: min(66.666vw, 1040px);
  will-change: transform, opacity;
  z-index: 1;
}

.project-library-overlay.is-measuring .project-library-panel {
  opacity: 0;
  transform: none;
  transition: none;
}

.project-library-overlay.is-open .project-library-panel {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.project-library-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 22px 24px 16px;
}

.project-library-head h2 {
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 0.98;
  margin: 0;
  text-transform: none;
}

.project-library-count {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 8px;
  text-transform: none;
}

.project-library-actions {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.project-library-close,
.project-library-trash {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  height: 34px;
  justify-content: center;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
  width: 34px;
}

.project-library-backup {
  align-items: center;
  display: inline-grid;
  flex: 0 0 auto;
  height: 76px;
  justify-items: center;
  width: 76px;
}

.project-library-close:hover,
.project-library-close:focus-visible,
.project-library-trash:hover,
.project-library-trash:focus-visible,
.project-library-trash.drag-over {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: var(--glow);
}

.project-library-close svg,
.project-library-trash svg,
.project-library-backup svg {
  display: block;
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 2.2;
  width: 17px;
}

.project-library-trash {
  height: 76px;
  touch-action: none;
  width: 76px;
}

.project-library-trash svg {
  height: 58px;
  stroke-width: 1.9;
  width: 58px;
}

.project-library-trash.drag-over {
  background: rgba(190, 62, 52, 0.14);
  border-color: #c55349;
  color: #d7685d;
  transform: scale(1.12);
}

.project-library-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.project-library-shelf {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.project-library-grid {
  align-content: start;
  display: grid;
  gap: 24px 18px;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.deleted-projects {
  align-content: start;
  display: grid;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.project-trash-window {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--panel-soft) 96%, var(--accent)), var(--panel-soft));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  inset: 0;
  min-height: 0;
  overflow: hidden;
  position: absolute;
  z-index: 3;
}

.project-trash-window[hidden] {
  display: none;
}

.project-trash-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 22px 24px 18px;
}

.project-trash-head h2 {
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 0.98;
  margin: 0;
  text-transform: none;
}

.project-trash-head p {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.project-trash-close {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
}

.deleted-project-empty {
  align-content: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 100%;
  padding: 32px;
  text-align: center;
}

.deleted-project-empty[hidden] {
  display: none;
}

.deleted-project-empty strong {
  color: var(--text);
  font-size: 18px;
}

.deleted-project-empty span,
.deleted-project-item small {
  color: var(--muted);
  font-size: 11px;
}

.deleted-projects ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.deleted-project-item {
  align-items: center;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 10px 12px;
}

.deleted-project-item > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.deleted-project-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.deleted-project-actions button {
  min-height: 32px;
  padding: 6px 10px;
}

.project-folder-item {
  min-width: 0;
  position: relative;
}

.project-folder {
  align-items: start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  justify-items: center;
  min-height: 152px;
  padding: 14px 10px 12px;
  text-align: center;
  transition:
    background 170ms ease,
    border-color 170ms ease,
    box-shadow 170ms ease,
    transform 170ms ease;
  user-select: none;
  width: 100%;
}

.project-folder-item.dragging {
  opacity: 0.4;
  transform: scale(0.96);
}

.project-drag-preview {
  height: 42px;
  left: -1000px;
  opacity: 0.72;
  pointer-events: none;
  position: fixed;
  top: -1000px;
  width: 52px;
  z-index: -1;
}

.project-drag-preview .project-folder {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: var(--glow);
  min-height: 42px;
  padding: 4px;
}

.project-drag-preview .project-folder-icon {
  height: 30px;
  margin: 0;
  transform: scale(0.48);
  width: 42px;
}

.project-drag-preview .project-folder-title,
.project-drag-preview .project-folder-meta,
.project-drag-preview .project-context-trigger {
  display: none;
}

.project-context-trigger {
  position: absolute;
  right: 4px;
  top: 4px;
}

.project-library-panel.project-drag-active .project-library-trash {
  animation: trash-can-pulse 900ms ease-in-out infinite alternate;
  border-color: var(--accent);
  color: var(--text);
}

@keyframes trash-can-pulse {
  from { box-shadow: 0 0 0 0 rgba(183, 255, 208, 0); }
  to { box-shadow: 0 0 0 5px rgba(183, 255, 208, 0.12), var(--glow); }
}

.project-delete-confirmation {
  align-items: center;
  background: rgba(0, 0, 0, 0.36);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  z-index: 4;
}

.scene-delete-confirmation {
  align-items: center;
  background: rgba(0, 0, 0, 0.46);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 70;
}

.scene-delete-confirmation[hidden] {
  display: none;
}

.project-delete-confirmation[hidden] {
  display: none;
}

.project-delete-dialog {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.38), var(--glow);
  max-width: 460px;
  padding: 28px;
  text-align: center;
  width: 100%;
}

.project-delete-dialog h3 {
  font-size: 20px;
  margin: 0;
  text-transform: none;
}

.project-delete-dialog p {
  color: var(--muted);
  margin: 10px 0 24px;
  overflow-wrap: anywhere;
}

.project-delete-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.project-delete-actions button {
  min-width: 96px;
}

.danger-button {
  background: #a63d35;
  border: 1px solid #cf665d;
  border-radius: 4px;
  color: #fff;
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #bc4a40;
  box-shadow: 0 0 0 3px rgba(207, 102, 93, 0.2);
}

.project-folder:hover,
.project-folder:focus-visible {
  background: var(--accent-soft);
  border-color: var(--line);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
  outline: none;
  transform: translateY(-2px);
}

.project-folder-icon {
  display: block;
  height: 62px;
  margin: 4px 0 13px;
  position: relative;
  width: 82px;
}

.project-folder-icon::before,
.project-folder-icon::after {
  content: "";
  position: absolute;
}

.project-folder-icon::before {
  background: var(--panel-strong);
  border: 2px solid var(--line);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  height: 18px;
  left: 0;
  top: 2px;
  width: 38px;
}

.project-folder-icon::after {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent 44%),
    var(--panel);
  border: 2px solid var(--line);
  border-radius: 0 8px 8px 8px;
  bottom: 0;
  box-shadow:
    inset 1px 1px rgba(255, 255, 255, 0.12),
    inset -1px -1px rgba(0, 0, 0, 0.18);
  height: 48px;
  left: 0;
  right: 0;
}

.project-folder.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.project-folder.active .project-folder-icon::before,
.project-folder.active .project-folder-icon::after {
  border-color: var(--accent);
}

.project-folder-title {
  display: block;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.18;
  overflow-wrap: anywhere;
  text-transform: none;
}

.project-folder-meta {
  color: var(--muted);
  display: block;
  font-size: 10px;
  line-height: 1.25;
  margin-top: 6px;
  text-transform: none;
}

.composer-focus-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  opacity: 0.82;
  position: absolute;
  right: 20px;
  top: 20px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
  width: 30px;
  z-index: 5;
}

.composer-focus-toggle:hover {
  background: var(--panel-soft);
  border-color: var(--accent);
  color: var(--text);
  opacity: 1;
  box-shadow: var(--glow);
}

.composer-focus-toggle svg {
  display: block;
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 15px;
}

.composer-focus-toggle .focus-icon-collapse {
  display: none;
}

.app.focus-mode .composer-focus-toggle .focus-icon-expand {
  display: none;
}

.app.focus-mode .composer-focus-toggle .focus-icon-collapse {
  display: block;
}

.app.inspector-closed {
  grid-template-columns: 238px 318px minmax(360px, 1fr) 0;
}

.app.inspector-closed .inspector-pane {
  border-left: 0;
  overflow: hidden;
  padding: 0;
}

.app.focus-mode {
  grid-template-columns: 0 0 minmax(360px, 1fr) 306px;
}

.app.focus-mode .library-pane,
.app.focus-mode .sheet-pane {
  border: 0;
  display: none;
  overflow: hidden;
  padding: 0;
}

.app.focus-mode.inspector-closed {
  grid-template-columns: 0 0 minmax(360px, 1fr) 0;
}

.app.focus-mode .compact-toolbar {
  display: none;
}

.app.focus-mode .editor-pane {
  display: block;
  grid-column: 1 / 4;
  grid-row: 1 / -1;
}

.app.focus-mode .inspector-pane {
  grid-column: 4;
  grid-row: 1;
}

.app.focus-mode .editor-shell {
  max-width: 820px;
}

@media (max-width: 1279px) {
  body {
    overflow: hidden;
  }

  .app,
  .app.inspector-closed {
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .app[data-compact-surface="library"] {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .app[data-compact-surface="sheets"],
  .app[data-compact-surface="editor"] {
    grid-template-columns: 318px minmax(0, 1fr);
  }

  .compact-toolbar {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: 40px minmax(120px, 1fr) auto;
  }

  .library-pane,
  .sheet-pane,
  .editor-pane {
    grid-row: 2;
  }

  .app[data-compact-surface="library"] .library-pane {
    display: flex;
    grid-column: 1;
  }

  .app[data-compact-surface="library"] .sheet-pane {
    display: none;
  }

  .app[data-compact-surface="sheets"] .library-pane,
  .app[data-compact-surface="editor"] .library-pane {
    display: none;
  }

  .app[data-compact-surface="sheets"] .sheet-pane,
  .app[data-compact-surface="editor"] .sheet-pane {
    display: grid;
    grid-column: 1;
  }

  .editor-pane {
    display: block;
    grid-column: 2;
    min-height: 0;
  }

  .app[data-theme] .inspector-pane {
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    inset: 0 0 0 auto;
    position: fixed;
    transform: translateX(0);
    transition: transform 180ms ease;
    width: min(330px, 92vw);
    z-index: 20;
  }

  .app.inspector-closed .inspector-pane {
    transform: translateX(100%);
  }

  .app.focus-mode {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .app.focus-mode .editor-pane {
    grid-column: 1;
    grid-row: 1;
  }

  .project-library-overlay {
    padding: 12px;
  }

  .project-library-panel {
    max-height: calc(100dvh - 24px);
    max-width: calc(100vw - 24px);
    min-width: 0;
    width: min(900px, calc(100vw - 24px));
  }

  .project-library-grid {
    gap: 18px 12px;
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    padding: 18px;
  }
}

@media (max-width: 767px) {
  .app,
  .app.inspector-closed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .compact-toolbar {
    grid-template-columns: 40px minmax(72px, 1fr) auto;
  }

  .compact-surface-nav button {
    min-width: 44px;
    padding: 0 7px;
  }

  .library-pane,
  .sheet-pane,
  .editor-pane {
    border: 0;
    display: none;
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }

  .app[data-compact-surface="library"] .library-pane {
    display: flex;
  }

  .app[data-compact-surface="sheets"] .sheet-pane {
    display: grid;
  }

  .app[data-compact-surface="editor"] .sheet-pane {
    display: none;
  }

  .app[data-compact-surface="editor"] .editor-pane {
    display: block;
  }

  .app.focus-mode {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .app.focus-mode .editor-pane {
    display: block;
    grid-column: 1;
    grid-row: 1;
  }

  .library-pane,
  .sheet-pane {
    overflow: auto;
  }

  .editor-shell {
    padding: 20px 18px 12px;
  }

  .sheet-title-input {
    font-size: 29px;
  }

  .sheet-body,
  .preview-body,
  .outline-body {
    font-size: 17px;
  }

  .context-menu {
    bottom: 12px;
    left: 12px !important;
    right: 12px;
    top: auto !important;
  }

  .toast {
    bottom: 12px;
    max-width: calc(100vw - 24px);
    min-width: min(360px, calc(100vw - 24px));
  }
}

@media (max-width: 560px) {
  .library-actions {
    grid-template-columns: 1fr 1fr;
  }

  .library-actions .primary-button {
    grid-column: 1 / -1;
  }

  .editor-mode-bar {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .project-progress,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    max-width: none;
  }

  .project-library-head {
    padding: 18px 16px 12px;
  }

  .project-library-head h2 {
    font-size: 24px;
  }

  .project-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
  }

  .project-folder {
    min-height: 138px;
    padding-inline: 8px;
  }

  .project-folder-icon {
    height: 56px;
    width: 74px;
  }

  .editor-footer {
    justify-content: flex-start;
  }
}

@media (max-width: 1279px), (pointer: coarse) {
  .icon-button,
  .compact-nav-button,
  .compact-surface-nav button,
  .composer-inspector-toggle,
  .context-trigger,
  .mode-switch button,
  .toast button,
  .context-menu button {
    min-height: 44px;
    min-width: 44px;
  }

  .composer-inspector-toggle {
    height: 44px;
    width: 44px;
  }

  .icon-button {
    height: 44px;
    width: 44px;
  }

  .section-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .section-button,
  .ghost-button,
  .primary-button,
  .danger-button,
  .project-switcher select,
  .project-title-input,
  .inspector-stack input,
  .inspector-stack select {
    min-height: 44px;
  }

  .composer-focus-toggle {
    height: 44px;
    right: 8px;
    top: 8px;
    width: 44px;
  }

  .sheet-card-content {
    padding-right: 50px;
  }

  .sheet-drag-handle {
    right: 52px;
  }

  .sheet-context-trigger {
    right: 2px;
    top: 2px;
  }

  .fragment-card {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
  }
}

@media (pointer: coarse) {
  .context-trigger,
  .compact-nav-button,
  .compact-surface-nav button,
  .context-menu button {
    min-height: 48px;
    min-width: 48px;
  }

  .context-trigger {
    opacity: 1;
  }
}

.settings-trigger {
  cursor: pointer;
  padding: 0;
  transition:
    filter var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.settings-trigger:hover {
  filter: brightness(1.12) saturate(1.08);
}

.settings-trigger:focus-visible {
  outline: 3px solid var(--selection, var(--accent));
  outline-offset: 3px;
}

.settings-overlay {
  align-items: center;
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 22px;
  position: fixed;
  z-index: 970;
}

.settings-overlay[hidden] {
  display: none;
}

body.settings-open {
  overflow: hidden;
}

.settings-backdrop {
  backdrop-filter: blur(9px);
  background: color-mix(in srgb, var(--surface-canvas) 74%, transparent);
  inset: 0;
  position: absolute;
}

.settings-dialog {
  animation: settings-enter var(--motion-overlay) cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.44), var(--glow);
  color: var(--text-primary);
  max-height: min(780px, calc(100dvh - 44px));
  max-width: 720px;
  overflow: auto;
  padding: clamp(22px, 4vw, 36px);
  position: relative;
  width: 100%;
}

@keyframes settings-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.settings-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 20px;
}

.settings-head .eyebrow,
.settings-section .eyebrow {
  color: var(--text-secondary);
  display: block;
  font: 750 0.66rem/1.2 var(--font-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-head h2 {
  font-family: var(--font-display, var(--serif));
  font-size: clamp(2rem, 6vw, 3.35rem);
  line-height: 0.95;
  margin: 6px 0 9px;
}

.settings-head p,
.settings-section-copy p {
  color: var(--text-secondary);
  font: 0.78rem/1.55 var(--font-ui);
  margin: 0;
}

.settings-close {
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  flex: 0 0 auto;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.settings-close svg {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-width: 1.8;
  width: 22px;
}

.settings-close:hover,
.settings-close:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.settings-sections {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-section {
  align-content: start;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  display: grid;
  gap: 15px;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 220px;
  padding: 18px;
  position: relative;
}

.settings-section[hidden] {
  display: none;
}

.settings-account-section {
  grid-column: 1 / -1;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 150px;
}

.settings-dialog[data-workspace-enabled="false"] .settings-device-section {
  grid-column: 1 / -1;
  min-height: 180px;
}

.settings-section-index {
  color: var(--text-disabled);
  font: 800 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
  padding-top: 3px;
}

.settings-section-copy {
  min-width: 0;
}

.settings-section-copy h3 {
  font-family: var(--font-display, var(--serif));
  font-size: 1.15rem;
  line-height: 1.05;
  margin: 5px 0 9px;
}

.settings-section-copy strong {
  display: block;
  font: 750 0.84rem/1.35 var(--font-ui);
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.settings-action {
  align-self: end;
  background: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--text-primary));
  color: var(--surface-canvas);
  font: 800 0.7rem/1 var(--font-ui);
  grid-column: 2;
  justify-self: start;
  letter-spacing: 0.075em;
  min-height: 44px;
  min-width: 132px;
  padding: 0 16px;
  text-transform: uppercase;
}

.settings-account-section .settings-action {
  align-self: center;
  grid-column: 3;
  grid-row: 1;
}

.settings-action:hover,
.settings-action:focus-visible {
  background: var(--accent-strong);
}

.settings-action-danger {
  background: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 68%, var(--text-primary));
}

.settings-action-danger:hover,
.settings-action-danger:focus-visible {
  background: color-mix(in srgb, var(--warn) 82%, #fff);
}

body[data-theme="frontier"] .settings-backdrop {
  background: rgba(60, 54, 43, 0.42);
}

body[data-theme="frontier"] .settings-dialog {
  background:
    linear-gradient(90deg, transparent 0 45px, rgba(159, 61, 44, 0.16) 45px 46px, transparent 46px),
    repeating-linear-gradient(0deg, rgba(95, 86, 70, 0.045) 0 1px, transparent 1px 27px),
    #f7f2e7;
  border: 1px solid rgba(71, 62, 45, 0.72);
  box-shadow:
    inset 0 0 0 5px rgba(255, 252, 242, 0.72),
    0 28px 70px rgba(71, 62, 45, 0.28);
  padding-left: clamp(54px, 8vw, 70px);
}

body[data-theme="frontier"] .settings-head h2,
body[data-theme="frontier"] .settings-section-copy h3 {
  font-family: Charter, "Iowan Old Style", Georgia, serif;
}

body[data-theme="frontier"] .settings-section {
  background: rgba(243, 238, 226, 0.88);
  border-color: rgba(95, 86, 70, 0.5);
  box-shadow:
    inset 1px 1px rgba(255, 252, 242, 0.88),
    2px 2px 0 rgba(71, 62, 45, 0.08);
}

body[data-theme="frontier"] .settings-section-index {
  color: #b8701f;
}

body[data-theme="frontier"] .settings-action {
  background: #272822;
  border-color: #171814;
  color: #f7f2e7;
}

body[data-theme="frontier"] .settings-action-danger {
  background: #9f3d2c;
}

body[data-theme="sprypnt"] .settings-backdrop {
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 59, 157, 0.32) 0 4px, transparent 5px),
    radial-gradient(circle at 88% 82%, rgba(34, 241, 208, 0.3) 0 6px, transparent 7px),
    rgba(9, 6, 13, 0.82);
}

body[data-theme="sprypnt"] .settings-dialog {
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(143, 82, 255, 0.055) 46px 47px),
    #191020;
  border: 4px solid #09060d;
  box-shadow:
    8px 8px 0 var(--spray-teal),
    14px 14px 0 #09060d,
    -7px -7px 0 var(--spray-pink);
  overflow: visible;
}

body[data-theme="sprypnt"] .settings-dialog::after {
  background: var(--spray-yellow);
  border: 2px solid #09060d;
  bottom: -12px;
  color: var(--spray-ink);
  content: "SYSTEM // DIY";
  font: 900 0.62rem/1 var(--mono);
  letter-spacing: 0.12em;
  padding: 5px 8px 4px;
  position: absolute;
  right: 24px;
  transform: rotate(1.5deg);
}

body[data-theme="sprypnt"] .settings-head {
  border-bottom: 5px solid var(--spray-pink);
}

body[data-theme="sprypnt"] .settings-head h2 {
  color: #fff8ef;
  font-family: "Arial Black", Impact, sans-serif;
  font-style: italic;
  letter-spacing: -0.055em;
  text-shadow: 5px 4px 0 var(--spray-purple);
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .settings-head .eyebrow {
  background: var(--spray-teal);
  color: var(--spray-ink);
  display: inline-block;
  padding: 4px 7px 3px;
  transform: rotate(-1.5deg);
}

body[data-theme="sprypnt"] .settings-close {
  background: var(--spray-pink);
  border: 3px solid #09060d;
  box-shadow: 4px 4px 0 var(--spray-teal);
  color: var(--spray-ink);
  transform: rotate(1.5deg);
}

body[data-theme="sprypnt"] .settings-section {
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 227, 79, 0.6) 0 2px, transparent 3px),
    repeating-linear-gradient(-28deg, transparent 0 12px, rgba(255, 248, 239, 0.025) 12px 13px),
    #281632;
  border: 3px solid #09060d;
  box-shadow: 5px 5px 0 var(--spray-purple);
}

body[data-theme="sprypnt"] .settings-section:nth-child(2) {
  box-shadow: 5px 5px 0 var(--spray-pink);
  transform: rotate(-0.35deg);
}

body[data-theme="sprypnt"] .settings-section:nth-child(3) {
  box-shadow: 5px 5px 0 var(--spray-teal);
  transform: rotate(0.45deg);
}

body[data-theme="sprypnt"] .settings-section-index {
  background: var(--spray-yellow);
  color: var(--spray-ink);
  padding: 5px 4px 4px;
  text-align: center;
}

body[data-theme="sprypnt"] .settings-section-copy h3 {
  color: #fff8ef;
  font-family: "Arial Black", Impact, sans-serif;
  font-style: italic;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .settings-action {
  background: var(--spray-teal);
  border: 3px solid #09060d;
  box-shadow:
    inset 0 -4px 0 rgba(9, 6, 13, 0.22),
    4px 5px 0 #09060d;
  color: var(--spray-ink);
  font-family: "Arial Black", Impact, sans-serif;
}

body[data-theme="sprypnt"] .settings-action:hover,
body[data-theme="sprypnt"] .settings-action:focus-visible {
  background: var(--spray-yellow);
  transform: translate(-1px, -1px);
}

body[data-theme="sprypnt"] .settings-action:active:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(9, 6, 13, 0.22),
    1px 1px 0 #09060d;
  transform: translate(3px, 3px);
}

body[data-theme="sprypnt"] .settings-action-danger {
  background: var(--spray-pink);
}

body[data-theme="gem"] .settings-backdrop {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(155, 108, 255, 0.15), transparent 45%),
    rgba(4, 6, 5, 0.86);
}

body[data-theme="gem"] .settings-dialog {
  background:
    linear-gradient(118deg, transparent 0 49.8%, rgba(214, 173, 85, 0.08) 49.9% 50%, transparent 50.1%),
    #0e1311;
  border: 1px solid var(--gem-brass);
  box-shadow:
    inset 0 0 0 5px #060808,
    inset 0 0 0 6px rgba(214, 173, 85, 0.3),
    0 0 44px rgba(155, 108, 255, 0.25),
    0 30px 90px rgba(0, 0, 0, 0.72);
}

body[data-theme="gem"] .settings-head {
  border-bottom-color: var(--gem-brass);
}

body[data-theme="gem"] .settings-head h2,
body[data-theme="gem"] .settings-section-copy h3 {
  color: var(--gem-bone);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  letter-spacing: 0.04em;
}

body[data-theme="gem"] .settings-head .eyebrow,
body[data-theme="gem"] .settings-section .eyebrow {
  color: var(--gem-brass);
}

body[data-theme="gem"] .settings-close {
  background: var(--gem-ink);
  border-color: var(--gem-brass);
  clip-path: polygon(50% 0, 89% 17%, 100% 50%, 87% 84%, 50% 100%, 13% 84%, 0 50%, 11% 17%);
}

body[data-theme="gem"] .settings-section {
  background:
    linear-gradient(135deg, rgba(155, 108, 255, 0.08), transparent 60%),
    #151817;
  border-color: rgba(214, 173, 85, 0.48);
  box-shadow: inset 0 0 0 1px rgba(155, 108, 255, 0.08);
}

body[data-theme="gem"] .settings-section-index {
  color: var(--gem-violet);
}

body[data-theme="gem"] .settings-action {
  background: var(--gem-brass);
  border-color: #060808;
  color: var(--gem-ink);
}

body[data-theme="gem"] .settings-action-danger {
  background: var(--gem-wine);
  color: var(--gem-bone);
}

body[data-theme="moby"] .settings-backdrop {
  background: rgba(23, 24, 21, 0.5);
}

body[data-theme="moby"] .settings-dialog {
  background:
    linear-gradient(90deg, transparent 0 34px, rgba(122, 76, 45, 0.14) 34px 35px, transparent 35px),
    repeating-linear-gradient(0deg, rgba(23, 24, 21, 0.025) 0 1px, transparent 1px 24px),
    var(--moby-paper);
  border: 3px double var(--moby-ink);
  box-shadow:
    10px 10px 0 rgba(122, 76, 45, 0.22),
    0 30px 70px rgba(23, 24, 21, 0.28);
  padding-left: clamp(48px, 7vw, 62px);
}

body[data-theme="moby"] .settings-head {
  border-bottom: 3px double var(--moby-ink);
}

body[data-theme="moby"] .settings-head h2,
body[data-theme="moby"] .settings-section-copy h3 {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

body[data-theme="moby"] .settings-head .eyebrow,
body[data-theme="moby"] .settings-section .eyebrow {
  color: var(--moby-wood);
  font-family: var(--mono);
}

body[data-theme="moby"] .settings-close {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 50%;
}

body[data-theme="moby"] .settings-section {
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--moby-ink);
  box-shadow: 3px 3px 0 rgba(122, 76, 45, 0.13);
}

body[data-theme="moby"] .settings-section-index {
  color: var(--moby-wood);
}

body[data-theme="moby"] .settings-action {
  background: var(--moby-ink);
  border-color: var(--moby-ink);
  color: var(--moby-paper);
  font-family: var(--mono);
}

body[data-theme="moby"] .settings-action-danger {
  background: #8b2f24;
}

@media (max-width: 680px) {
  .settings-overlay {
    padding: 10px;
  }

  .settings-dialog {
    max-height: calc(100dvh - 20px);
    padding: 20px;
  }

  .settings-sections {
    grid-template-columns: 1fr;
  }

  .settings-account-section,
  .settings-dialog[data-workspace-enabled="false"] .settings-device-section {
    grid-column: 1;
  }

  .settings-account-section {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .settings-account-section .settings-action {
    grid-column: 2;
    grid-row: auto;
    justify-self: start;
  }

  .settings-section {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 0;
  }

  body[data-theme="frontier"] .settings-dialog,
  body[data-theme="moby"] .settings-dialog {
    padding-left: 42px;
  }

  body[data-theme="sprypnt"] .settings-dialog {
    overflow: auto;
  }
}

.tenant-admin-overlay {
  align-items: center;
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 20px;
  position: fixed;
  z-index: 980;
}

body.tenant-admin-open {
  overflow: hidden;
}

.tenant-admin-overlay[hidden] {
  display: none;
}

.tenant-admin-backdrop {
  background: color-mix(in srgb, var(--surface-canvas) 72%, transparent);
  border: 0;
  inset: 0;
  position: absolute;
}

.tenant-admin-dialog {
  background: var(--surface-overlay, var(--surface-sidebar));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel);
  color: var(--text-primary);
  max-height: min(860px, calc(100dvh - 40px));
  max-width: 760px;
  overflow: auto;
  padding: clamp(20px, 4vw, 34px);
  position: relative;
  width: 100%;
}

.tenant-admin-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 18px;
}

.tenant-admin-head h2,
.tenant-admin-section h3,
.tenant-invitation-preview h3,
.tenant-step-up h3 {
  font-family: var(--font-display);
  margin: 5px 0 7px;
}

.tenant-admin-head p,
.tenant-admin-section p,
.tenant-invitation-preview p,
.tenant-step-up p {
  color: var(--text-secondary);
  font: 0.78rem/1.55 var(--font-ui);
  margin: 0;
}

.tenant-admin-close {
  background: transparent;
  border: 1px solid var(--line-subtle);
  color: var(--text-primary);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 1.5rem;
  height: 38px;
  line-height: 1;
  width: 38px;
}

.tenant-admin-message {
  color: var(--text-secondary);
  font: 0.78rem/1.5 var(--font-ui);
  min-height: 1.2em;
}

.tenant-admin-message[data-state="error"] {
  color: var(--danger, var(--accent));
}

.tenant-admin-section,
.tenant-invitation-preview,
.tenant-step-up {
  border-bottom: 1px solid var(--line-subtle);
  padding: 20px 0;
}

.tenant-admin-section[hidden],
.tenant-invitation-preview[hidden],
.tenant-step-up[hidden] {
  display: none;
}

.tenant-switch-controls,
.tenant-admin-actions,
.tenant-invite-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tenant-switch-controls select {
  flex: 1 1 260px;
}

.tenant-admin-dialog select,
.tenant-admin-dialog input {
  background: var(--surface-canvas);
  border: 1px solid var(--line-subtle);
  color: var(--text-primary);
  font: 0.82rem var(--font-ui);
  min-height: 42px;
  padding: 8px 10px;
}

.tenant-admin-dialog label {
  color: var(--text-secondary);
  display: grid;
  flex: 1 1 220px;
  font: 0.68rem/1.4 var(--font-ui);
  gap: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tenant-admin-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.tenant-admin-list-item {
  align-items: center;
  background: color-mix(in srgb, var(--surface-canvas) 72%, transparent);
  border: 1px solid var(--line-subtle);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.tenant-admin-list-copy {
  min-width: 0;
}

.tenant-admin-list-copy strong,
.tenant-admin-list-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.tenant-admin-list-copy span {
  color: var(--text-secondary);
  font: 0.7rem/1.45 var(--font-ui);
  margin-top: 3px;
}

.tenant-member-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.tenant-member-actions select {
  min-height: 36px;
}

.tenant-member-actions button,
.tenant-admin-actions button,
.tenant-switch-controls button,
.tenant-invite-form button {
  min-height: 38px;
}

.tenant-admin-empty {
  color: var(--text-secondary);
  font: 0.78rem/1.5 var(--font-ui);
  padding: 8px 0;
}

.tenant-danger-section {
  border-bottom: 0;
}

.tenant-step-up {
  border: 1px solid var(--line-strong);
  margin-top: 18px;
  padding: 18px;
}

.tenant-step-up label {
  margin-top: 14px;
}

@media (max-width: 620px) {
  .tenant-admin-overlay {
    align-items: end;
    padding: 0;
  }

  .tenant-admin-dialog {
    border-bottom: 0;
    border-inline: 0;
    max-height: 92dvh;
    padding: 20px;
  }

  .tenant-admin-list-item {
    grid-template-columns: 1fr;
  }

  .tenant-member-actions {
    justify-content: flex-start;
  }
}

.auth-overlay {
  background:
    radial-gradient(circle at 50% 12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 38%),
    var(--surface-canvas);
  display: grid;
  inset: 0;
  padding: 24px;
  place-items: center;
  position: fixed;
  transition:
    opacity 380ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 0s;
  z-index: 1000;
}

.auth-overlay[hidden] {
  display: none;
}

body[data-auth-state="revealing"] .auth-overlay {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 380ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 380ms;
}

.auth-dialog {
  background: var(--surface-sidebar);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel);
  color: var(--text-primary);
  max-width: 420px;
  padding: clamp(24px, 5vw, 40px);
  position: relative;
  transition:
    opacity 260ms ease,
    transform 440ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
}

body[data-auth-state="revealing"] .auth-dialog {
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
}

.auth-kicker,
.auth-dialog label {
  color: var(--text-secondary);
  display: block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-dialog h1 {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 6vw, 2.4rem);
  line-height: 1.05;
  margin: 10px 0 14px;
}

.auth-dialog > p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 26px;
}

.auth-content {
  display: grid;
}

.auth-content > * {
  grid-area: 1 / 1;
  min-width: 0;
  transition:
    opacity 220ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0s;
}

.auth-overlay:not([data-phase="form"]) #auth-form {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  visibility: hidden;
}

.auth-overlay[data-phase="form"] .auth-handoff {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  visibility: hidden;
}

.auth-dialog input {
  background: var(--surface-canvas);
  border: 1px solid var(--line-subtle);
  color: var(--text-primary);
  font: inherit;
  margin: 7px 0 18px;
  min-height: 46px;
  outline: 0;
  padding: 10px 12px;
  width: 100%;
}

.auth-dialog input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--selection);
}

.auth-field[hidden] {
  display: none;
}

.auth-turnstile {
  margin: 0;
  max-height: 0;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition:
    max-height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    min-height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    margin 260ms ease,
    opacity 180ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
}

.auth-turnstile[hidden] {
  display: none;
}

.auth-turnstile[data-state="interactive"],
.auth-turnstile[data-state="error"] {
  margin: 2px 0 16px;
  max-height: 90px;
  min-height: 65px;
  opacity: 1;
  transform: none;
}

.auth-handoff {
  align-content: center;
  display: grid;
  justify-items: center;
  min-height: 280px;
  padding: 24px 0;
  text-align: center;
}

.auth-handoff-mark {
  align-items: center;
  display: flex;
  gap: 7px;
  height: 24px;
  justify-content: center;
  margin-bottom: 26px;
}

.auth-handoff-mark span {
  animation: auth-handoff-pulse 1.2s ease-in-out infinite;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: var(--glow);
  height: 7px;
  opacity: 0.3;
  width: 7px;
}

.auth-handoff-mark span:nth-child(2) {
  animation-delay: 120ms;
}

.auth-handoff-mark span:nth-child(3) {
  animation-delay: 240ms;
}

.auth-handoff strong {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.3;
}

.auth-handoff > span:last-child {
  color: var(--text-secondary);
  font: 0.78rem/1.6 var(--font-ui);
  margin-top: 8px;
  max-width: 30ch;
}

@keyframes auth-handoff-pulse {
  0%,
  70%,
  100% {
    opacity: 0.3;
    transform: translateY(0) scale(0.85);
  }

  35% {
    opacity: 1;
    transform: translateY(-3px) scale(1);
  }
}

.auth-email-confirmation {
  border-top: 1px solid var(--line-subtle);
  color: var(--text-secondary);
  font: 0.86rem/1.6 var(--font-ui);
  margin-top: 4px;
  padding-top: 22px;
}

.auth-email-confirmation[hidden] {
  display: none;
}

.auth-email-confirmation:focus {
  outline: 2px solid var(--selection);
  outline-offset: 6px;
}

.auth-email-confirmation p {
  margin: 0;
}

.auth-email-confirmation strong {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.auth-email-confirmation ol {
  margin: 18px 0;
  padding-left: 22px;
}

.auth-email-confirmation li + li {
  margin-top: 8px;
}

#auth-email-confirmation-help {
  font-size: 0.78rem;
}

.auth-dialog .primary-button,
.auth-dialog .ghost-button {
  margin-top: 10px;
  min-height: 46px;
  width: 100%;
}

.auth-dialog .primary-button {
  color: var(--surface-canvas);
}

.auth-link-button {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  display: block;
  font: 0.78rem/1.4 var(--font-ui);
  margin: 18px auto 0;
  padding: 4px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link-button:hover,
.auth-link-button:focus-visible {
  color: var(--text-primary);
}

.auth-link-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.auth-account-switch {
  align-items: baseline;
  border-top: 1px solid var(--line-subtle);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  font: 0.78rem/1.5 var(--font-ui);
  gap: 3px;
  justify-content: center;
  margin: 22px 0 0;
  padding-top: 18px;
}

.auth-account-switch[hidden] {
  display: none;
}

.auth-account-switch .auth-link-button {
  display: inline;
  margin: 0;
  padding: 0 3px;
}

.auth-message {
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.5;
  min-height: 1.2em;
}

.auth-message[data-state="error"] {
  color: var(--danger, var(--accent));
}

/* Phase 3: quiet editorial foundation */

.app[data-editor-font="serif"] {
  --composer-font: var(--font-editor-serif);
}

.app[data-editor-font="sans"] {
  --composer-font: var(--font-editor-sans);
}

.app[data-editor-font="mono"] {
  --composer-font: var(--font-editor-mono);
}

body {
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

body[data-theme="frontier"] {
  background: var(--surface-canvas);
}

.app[data-theme="frontier"] {
  background: var(--surface-canvas);
}

.app[data-theme="frontier"] .library-pane,
.app[data-theme="frontier"] .sheet-pane,
.app[data-theme="frontier"] .inspector-pane {
  background: var(--surface-sidebar);
  box-shadow: none;
}

.app[data-theme="frontier"] .library-pane::before,
.app[data-theme="frontier"] .sheet-pane::before,
.app[data-theme="frontier"] .inspector-pane::before,
.app[data-theme="frontier"] .editor-shell::before,
.app[data-theme="frontier"] .editor-shell::after,
body[data-theme="frontier"] .project-library-panel::before {
  display: none;
}

.app[data-theme="frontier"] .editor-pane {
  background: var(--surface-canvas);
}

.app[data-theme="frontier"] .project-switcher {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.app[data-theme="frontier"] .project-switcher:hover,
.app[data-theme="frontier"] .project-switcher:focus-visible {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.app[data-theme="frontier"] .project-switcher select,
.app[data-theme="frontier"] .project-title-input,
.app[data-theme="frontier"] .inspector-stack textarea,
.app[data-theme="frontier"] .inspector-stack input,
.app[data-theme="frontier"] .inspector-stack select {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.app[data-theme="frontier"] .project-progress div,
.app[data-theme="frontier"] .section-count {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.app[data-theme="frontier"] .search-box {
  background: rgba(243, 238, 226, 0.72);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.app[data-theme="frontier"] .search-box:focus-within {
  background: var(--surface-raised);
  border-color: var(--selection);
  box-shadow: 0 0 0 3px var(--selection-soft);
}

.app[data-theme="frontier"] .ghost-button,
.app[data-theme="frontier"] .icon-button,
.app[data-theme="frontier"] .section-button,
.app[data-theme="frontier"] .sheet-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.app[data-theme="frontier"] .ghost-button:hover,
.app[data-theme="frontier"] .icon-button:hover,
.app[data-theme="frontier"] .context-trigger:hover,
.app[data-theme="frontier"] .context-trigger:focus-visible {
  background: rgba(32, 33, 29, 0.055);
  border-color: transparent;
  box-shadow: none;
}

.app[data-theme="frontier"] .primary-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: none;
  color: #fff7e8;
}

.app[data-theme="frontier"] .primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.app[data-theme="frontier"] .section-button:hover,
.app[data-theme="frontier"] .sheet-card:hover {
  background: rgba(32, 33, 29, 0.05);
  border-color: transparent;
  box-shadow: none;
}

.app[data-theme="frontier"] .section-button.active,
.app[data-theme="frontier"] .sheet-card.active {
  background: var(--surface-selected);
  border-color: transparent;
  box-shadow: inset 3px 0 var(--selection);
}

.app[data-theme="frontier"] .sheet-card.dragging {
  background: var(--surface-raised);
  border: 1px solid var(--selection);
  box-shadow: 0 18px 36px rgba(71, 62, 45, 0.2);
}

.app[data-theme="frontier"] .sheet-card-placeholder {
  background: rgba(184, 112, 31, 0.06);
  border: 1px dashed rgba(184, 112, 31, 0.42);
  box-shadow: none;
}

.app[data-theme="frontier"] .mode-switch {
  background: rgba(32, 33, 29, 0.05);
  border-radius: var(--radius-sm);
  gap: 2px;
  padding: 3px;
}

.app[data-theme="frontier"] .mode-switch button.active {
  background: var(--surface-raised);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(71, 62, 45, 0.12);
  color: var(--text-primary);
}

.app[data-theme="frontier"] .sheet-title-input {
  color: var(--text-primary);
  font-weight: 650;
}

.app[data-theme="frontier"] .editor-shell {
  max-width: 900px;
  padding-top: 38px;
}

.sheet-body,
.preview-body,
.outline-body,
.sheet-title-input {
  font-family: var(--composer-font);
}

.sheet-body,
.preview-body,
.outline-body {
  font-size: 19px;
  line-height: 1.68;
}

.app[data-editor-font="mono"] .sheet-body,
.app[data-editor-font="mono"] .preview-body,
.app[data-editor-font="mono"] .outline-body {
  font-size: 17px;
  line-height: 1.7;
}

.app[data-theme="frontier"] .editor-meta,
.app[data-theme="frontier"] .editor-footer {
  color: var(--text-secondary);
}

.app[data-theme="frontier"] .meter {
  background: var(--border-subtle);
  border: 0;
  border-radius: var(--radius-pill);
  height: 5px;
}

.app[data-theme="frontier"] .meter span {
  background: var(--selection);
}

.app[data-theme="frontier"] .outline-item {
  background: var(--surface-raised);
  border: 0;
  border-left: 2px solid var(--selection);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: none;
}

body[data-theme="frontier"] .project-library-backdrop {
  background: rgba(32, 33, 29, 0.28);
  backdrop-filter: blur(6px);
}

body[data-theme="frontier"] .project-library-panel,
body[data-theme="frontier"] .project-delete-dialog {
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

body[data-theme="frontier"] .project-library-head {
  border-bottom: 1px solid var(--border-subtle);
  padding-top: 22px;
}

body[data-theme="frontier"] .project-library-head h2 {
  color: var(--text-primary);
}

body[data-theme="frontier"] .project-folder {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  box-shadow: none;
}

body[data-theme="frontier"] .project-folder:hover,
body[data-theme="frontier"] .project-folder:focus-visible {
  background: rgba(32, 33, 29, 0.05);
  border-color: transparent;
  box-shadow: none;
}

body[data-theme="frontier"] .project-folder.active {
  background: var(--surface-selected);
  border-color: transparent;
}

body[data-theme="frontier"] .project-folder-icon::before,
body[data-theme="frontier"] .project-folder-icon::after {
  background: #d8d1c2;
  border-color: rgba(95, 86, 70, 0.42);
  border-width: 1px;
  box-shadow: none;
}

body[data-theme="frontier"] .toast,
body[data-theme="frontier"] .context-menu {
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

body.inspector-overlay-open {
  overflow: hidden;
}

.app[data-theme="frontier"] .sheet-title-input:focus-visible,
.app[data-theme="frontier"] .sheet-body:focus-visible {
  outline: 2px solid var(--selection, var(--accent));
  outline-offset: 4px;
}

/* Phase 4: command layer */

.app-identity > div {
  min-width: 0;
}

.command-trigger,
.compact-command-trigger {
  align-items: center;
  background: transparent;
  border: 1px solid var(--border-subtle, var(--line));
  border-radius: var(--radius-sm);
  color: var(--text-secondary, var(--muted));
  display: inline-flex;
  font-size: 11px;
  font-weight: 720;
  justify-content: center;
  letter-spacing: -0.01em;
  min-height: 34px;
  transition:
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.command-trigger {
  gap: 2px;
  margin-left: auto;
  min-width: 42px;
  padding: 0 8px;
}

.command-trigger kbd {
  font: inherit;
}

.compact-command-trigger {
  min-height: 36px;
  min-width: 40px;
  padding: 0 6px;
}

.command-trigger:hover,
.compact-command-trigger:hover {
  background: var(--accent-soft);
  color: var(--text-primary, var(--text));
}

.command-trigger:focus-visible,
.compact-command-trigger:focus-visible {
  outline: 2px solid var(--selection, var(--accent));
  outline-offset: 2px;
}

body.command-palette-open {
  overflow: hidden;
}

body.ux-metrics-open {
  overflow: hidden;
}

.ux-metrics-overlay {
  display: grid;
  inset: 0;
  padding: 18px;
  place-items: center;
  position: fixed;
  z-index: 120;
}

.ux-metrics-overlay[hidden] {
  display: none !important;
}

.ux-metrics-backdrop {
  backdrop-filter: blur(9px);
  background: rgba(2, 7, 4, 0.5);
  inset: 0;
  position: absolute;
}

.ux-metrics-dialog {
  animation: command-palette-enter var(--motion-overlay) cubic-bezier(0.2, 0.8, 0.2, 1);
  background: var(--surface-overlay, var(--panel-soft));
  border: 1px solid var(--border-subtle, var(--line));
  border-radius: var(--radius-md);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38), var(--glow);
  display: grid;
  gap: 18px;
  max-height: calc(100dvh - 36px);
  max-width: 620px;
  overflow: auto;
  padding: 22px;
  position: relative;
  width: min(620px, calc(100vw - 36px));
}

.ux-metrics-head {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.ux-metrics-head h2 {
  font-size: 24px;
  letter-spacing: -0.025em;
  margin: 0;
}

.ux-metrics-head p {
  color: var(--text-secondary, var(--muted));
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0 0;
}

.ux-metrics-close {
  flex: 0 0 auto;
  font-size: 20px;
}

.ux-metrics-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ux-metrics-grid article {
  background: var(--accent-soft);
  border: 1px solid var(--border-subtle, var(--line));
  border-radius: var(--radius-sm);
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 14px;
}

.ux-metrics-grid span,
.ux-metrics-grid small {
  color: var(--text-secondary, var(--muted));
  font-size: 11px;
}

.ux-metrics-grid strong {
  align-self: end;
  color: var(--text-primary, var(--text));
  font-size: 24px;
  letter-spacing: -0.025em;
}

.ux-metrics-grid strong[data-state="pass"] {
  color: var(--selection, var(--accent));
}

.ux-metrics-grid strong[data-state="watch"] {
  color: var(--warn);
}

.ux-metrics-detail {
  color: var(--text-secondary, var(--muted));
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}

.ux-metrics-actions {
  align-items: center;
  border-top: 1px solid var(--border-subtle, var(--line));
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 16px;
}

.ux-metrics-actions button {
  min-width: 112px;
}

.command-palette-overlay {
  display: grid;
  inset: 0;
  padding: clamp(18px, 10vh, 104px) 18px 18px;
  place-items: start center;
  position: fixed;
  z-index: 110;
}

.command-palette-overlay[hidden] {
  display: none !important;
}

.command-palette-backdrop {
  backdrop-filter: blur(9px);
  background: rgba(2, 7, 4, 0.5);
  inset: 0;
  position: absolute;
}

.command-palette-dialog {
  animation: command-palette-enter var(--motion-overlay) cubic-bezier(0.2, 0.8, 0.2, 1);
  background: var(--surface-overlay, var(--panel-soft));
  border: 1px solid var(--border-subtle, var(--line));
  border-radius: var(--radius-md);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38), var(--glow);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(720px, calc(100dvh - clamp(36px, 20vh, 208px)));
  max-width: 680px;
  min-height: 330px;
  overflow: hidden;
  position: relative;
  width: min(680px, calc(100vw - 36px));
}

@keyframes command-palette-enter {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.command-palette-search {
  align-items: center;
  border-bottom: 1px solid var(--border-subtle, var(--line));
  display: grid;
  gap: 12px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 0 18px;
}

.command-palette-mark {
  align-items: center;
  background: var(--selection-soft, var(--accent-soft));
  border-radius: var(--radius-sm);
  color: var(--selection, var(--accent));
  display: inline-flex;
  font-size: 16px;
  font-weight: 780;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.command-palette-search input {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-primary, var(--text));
  font-size: 16px;
  font-weight: 560;
  height: 100%;
  min-width: 0;
  outline: 0;
  padding: 0;
  width: 100%;
}

.command-palette-search input::placeholder {
  color: var(--text-disabled, var(--muted));
  opacity: 1;
}

.command-palette-search > kbd,
.command-palette-item-meta kbd,
.command-palette-footer kbd {
  background: var(--accent-soft);
  border: 1px solid var(--border-subtle, var(--line));
  border-radius: 5px;
  color: var(--text-secondary, var(--muted));
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 720;
  line-height: 1;
  padding: 5px 6px;
  white-space: nowrap;
}

.command-palette-context {
  align-items: center;
  color: var(--text-secondary, var(--muted));
  display: flex;
  font-size: 11px;
  font-weight: 650;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 14px 4px;
}

.command-palette-location {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-results {
  display: grid;
  gap: 2px;
  min-height: 0;
  overflow: auto;
  padding: 4px 8px 8px;
}

.command-palette-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-primary, var(--text));
  display: grid;
  gap: 12px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--surface-selected, var(--accent-soft));
  box-shadow: inset 3px 0 var(--selection, var(--accent));
}

.command-palette-item-icon {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary, var(--muted));
  display: inline-flex;
  font-size: 13px;
  font-weight: 760;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.command-palette-item.active .command-palette-item-icon {
  background: var(--selection-soft, var(--accent-soft));
  color: var(--selection, var(--accent));
}

.command-palette-item-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.command-palette-item-copy strong,
.command-palette-item-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-item-copy strong {
  font-size: 13px;
  font-weight: 690;
}

.command-palette-item-copy span {
  color: var(--text-secondary, var(--muted));
  font-size: 11px;
}

.command-palette-item-meta {
  align-items: center;
  color: var(--text-secondary, var(--muted));
  display: flex;
  font-size: 10px;
  gap: 8px;
}

.command-palette-empty {
  align-content: center;
  color: var(--text-secondary, var(--muted));
  display: grid;
  gap: 5px;
  justify-items: center;
  min-height: 190px;
  padding: 24px;
  text-align: center;
}

.command-palette-empty[hidden] {
  display: none;
}

.command-palette-empty strong {
  color: var(--text-primary, var(--text));
  font-size: 14px;
}

.command-palette-empty span {
  font-size: 12px;
}

.command-palette-footer {
  align-items: center;
  border-top: 1px solid var(--border-subtle, var(--line));
  color: var(--text-secondary, var(--muted));
  display: flex;
  font-size: 10px;
  gap: 16px;
  min-height: 42px;
  padding: 7px 14px;
}

.command-palette-footer span {
  align-items: center;
  display: inline-flex;
  gap: 4px;
}

body[data-theme="frontier"] .command-palette-backdrop,
body[data-theme="frontier"] .ux-metrics-backdrop {
  background: rgba(32, 33, 29, 0.38);
}

body[data-theme="frontier"] .command-palette-dialog,
body[data-theme="frontier"] .ux-metrics-dialog {
  box-shadow: 0 28px 80px rgba(71, 62, 45, 0.28);
}

@media (max-width: 1279px) {
  .compact-toolbar {
    grid-template-columns: 40px minmax(120px, 1fr) 40px auto;
  }
}

@media (max-width: 767px) {
  .compact-toolbar {
    grid-template-columns: 40px minmax(72px, 1fr) 40px auto;
  }

  .command-palette-overlay {
    padding: 10px;
  }

  .command-palette-dialog {
    max-height: calc(100dvh - 20px);
    min-height: min(520px, calc(100dvh - 20px));
    width: calc(100vw - 20px);
  }

  .command-palette-item-meta > span {
    display: none;
  }
}

@media (max-width: 420px) {
  .compact-toolbar {
    grid-template-columns: 40px 40px minmax(0, 1fr);
  }

  .compact-location {
    display: none;
  }

  .compact-surface-nav {
    grid-column: 3;
    justify-content: flex-end;
    margin-left: 0;
  }

  .command-palette-search {
    gap: 9px;
    grid-template-columns: 32px minmax(0, 1fr);
    padding: 0 13px;
  }

  .command-palette-search > kbd,
  .command-palette-footer {
    display: none;
  }

  .command-palette-item {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .command-palette-item-meta {
    display: none;
  }

  .ux-metrics-dialog {
    gap: 14px;
    padding: 18px;
  }

  .ux-metrics-grid {
    grid-template-columns: 1fr;
  }

  .ux-metrics-grid article {
    min-height: 96px;
  }

  .ux-metrics-actions button {
    min-width: 0;
  }
}

/* Phase 4: contextual Lore linking and manuscript backlinks */
.preview-body .lore-reference {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.18em;
}

.preview-body .lore-reference:hover,
.preview-body .lore-reference:focus-visible,
.structured-composer .lore-reference:hover {
  background: var(--accent-soft);
  outline: none;
}

.lore-link-popover {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.46), var(--glow);
  display: grid;
  gap: 10px;
  max-height: calc(100dvh - 20px);
  overflow: auto;
  padding: 12px;
  position: fixed;
  width: min(420px, calc(100vw - 20px));
  z-index: 48;
}

.lore-decision-overlay {
  display: grid;
  inset: 0;
  padding: 18px;
  place-items: center;
  position: fixed;
  z-index: 130;
}

.lore-decision-overlay[hidden] {
  display: none !important;
}

.lore-decision-backdrop {
  backdrop-filter: blur(9px);
  background: rgba(2, 7, 4, 0.58);
  inset: 0;
  position: absolute;
}

.lore-decision-dialog {
  animation: command-palette-enter var(--motion-overlay) cubic-bezier(0.2, 0.8, 0.2, 1);
  background: var(--surface-overlay, var(--panel-soft));
  border: 1px solid var(--border-subtle, var(--line));
  border-radius: var(--radius-md);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46), var(--glow);
  display: grid;
  gap: 12px;
  max-width: 500px;
  padding: 24px;
  position: relative;
  width: min(500px, calc(100vw - 36px));
}

.lore-decision-dialog h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0;
}

.lore-decision-dialog p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.lore-decision-dialog .lore-decision-detail {
  color: var(--muted);
  font-size: 11px;
}

.lore-decision-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-top: 4px;
}

.lore-decision-actions button {
  min-height: 40px;
}

.lore-link-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.lore-link-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.lore-link-head strong {
  font-size: 14px;
}

.lore-link-head button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 20px;
  height: 30px;
  justify-content: center;
  line-height: 1;
  width: 30px;
}

.lore-link-selection {
  background: var(--panel);
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-family: var(--composer-font);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
  max-height: 68px;
  overflow: auto;
  padding: 8px 10px;
}

.lore-link-existing {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1fr;
}

.lore-link-existing button,
.lore-link-create button {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  min-height: 34px;
  padding: 7px 10px;
}

.lore-link-search {
  display: grid;
  gap: 5px;
}

.lore-link-search span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lore-link-search input,
.lore-link-create select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  min-height: 38px;
  min-width: 0;
  padding: 8px 9px;
  width: 100%;
}

.lore-link-search input:focus,
.lore-link-create select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.lore-link-message {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin: 0;
  min-height: 15px;
}

.lore-link-message[data-state="error"] {
  color: var(--warn);
}

.lore-link-results {
  display: grid;
  gap: 5px;
  max-height: 230px;
  overflow: auto;
}

.lore-link-results button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 50px;
  padding: 8px 9px;
  text-align: left;
  width: 100%;
}

.lore-link-results button:hover,
.lore-link-results button:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

.lore-link-results button > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.lore-link-results strong,
.lore-link-results small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lore-link-results small {
  color: var(--muted);
  font-size: 10px;
}

.lore-link-create {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: 120px minmax(0, 1fr);
  padding-top: 10px;
}

.lore-link-create button:disabled,
.lore-link-search input:disabled,
.lore-link-create select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.lore-reader-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100%;
}

.lore-reader-head {
  flex: 0 0 auto;
}

.lore-reader-content {
  display: grid;
  gap: 16px;
  padding: 4px 0 18px;
}

.lore-reader-state {
  color: var(--muted);
  display: grid;
  gap: 7px;
  line-height: 1.5;
  padding: 32px 4px;
}

.lore-reader-state strong {
  color: var(--text);
}

.lore-reader-missing strong {
  color: var(--warn);
}

.lore-reader-identity {
  align-items: center;
  display: flex;
  gap: 8px;
}

.lore-reader-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lore-reader-image {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 5px;
  max-height: 260px;
  object-fit: cover;
  width: 100%;
}

.lore-reader-summary,
.lore-reader-description,
.lore-reader-empty {
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

.lore-reader-summary {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.lore-reader-description,
.lore-reader-empty {
  color: var(--muted);
}

.lore-reader-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.lore-reader-chips span {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 9px;
  padding: 4px 7px;
}

.lore-reader-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  padding-top: 14px;
}

.lore-reader-section h3 {
  align-items: center;
  display: flex;
  font-family: var(--mono);
  font-size: 9px;
  gap: 6px;
  letter-spacing: 0.07em;
  margin: 0;
  text-transform: uppercase;
}

.lore-reader-section h3 span {
  color: var(--muted);
}

.lore-reader-section dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.lore-reader-section dl > div {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(70px, 0.6fr) minmax(0, 1fr);
}

.lore-reader-section dt,
.lore-reader-section dd {
  font-size: 10px;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
}

.lore-reader-section dt {
  color: var(--muted);
}

.lore-reader-relations,
.lore-reader-backlinks {
  display: grid;
  gap: 6px;
}

.lore-reader-backlink-row {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.lore-reader-relations button,
.lore-reader-backlink-row > button:first-child {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 9px;
  text-align: left;
  width: 100%;
}

.lore-reader-relations button:hover,
.lore-reader-relations button:focus-visible,
.lore-reader-backlink-row > button:first-child:hover,
.lore-reader-backlink-row > button:first-child:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}

.lore-reader-relations span,
.lore-reader-backlink-row > button:first-child span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.lore-reader-backlinks mark {
  background: var(--accent-soft);
  color: var(--text);
  padding: 0 2px;
}

.lore-reader-backlink-unlink {
  align-self: stretch;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 9px;
  padding: 7px;
}

.lore-reader-backlink-unlink:hover,
.lore-reader-backlink-unlink:focus-visible {
  border-color: var(--warn);
  color: var(--warn);
  outline: none;
}

.lore-reader-actions {
  background: var(--bg);
  border-top: 1px solid var(--line);
  bottom: -14px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-top: auto;
  padding: 12px 0 14px;
  position: sticky;
}

.lore-reader-actions:has(#lore-reader-unlink[hidden]) {
  grid-template-columns: 1fr;
}

@media (max-width: 560px) {
  .lore-reference-stats {
    grid-template-columns: 1fr;
  }

  .lore-reference-stats p {
    grid-column: 1;
  }

  .lore-link-popover {
    border-radius: var(--radius-md);
    max-height: calc(100dvh - 12px);
    width: calc(100vw - 12px);
  }

  .lore-link-results {
    max-height: 180px;
  }

  .lore-link-results button,
  .lore-link-existing button,
  .lore-link-create button,
  .lore-link-search input,
  .lore-link-create select {
    min-height: 44px;
  }

  .lore-link-create {
    grid-template-columns: 105px minmax(0, 1fr);
  }
}

/* MOBY: bone paper, black rigging, and a spare North Atlantic logbook */

body[data-theme="moby"] {
  color-scheme: light;
  --surface-canvas: #f3eee2;
  --surface-sidebar: #e8e1d4;
  --surface-raised: #fbf8f0;
  --surface-overlay: #fffdf7;
  --surface-selected: rgba(122, 76, 45, 0.14);
  --text-primary: #171815;
  --text-secondary: #55564f;
  --text-disabled: #686962;
  --border-subtle: rgba(23, 24, 21, 0.28);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #171815;
  --accent-strong: #050604;
  --accent-soft: rgba(23, 24, 21, 0.08);
  --selection: #7a4c2d;
  --selection-soft: rgba(122, 76, 45, 0.14);
  --moby-bone: #f3eee2;
  --moby-paper: #fffdf7;
  --moby-ink: #171815;
  --moby-wood: #7a4c2d;
  --moby-rope: #a39378;
  --moby-fog: #d8d2c5;
  --warn: #8b2f24;
  --warn-soft: rgba(139, 47, 36, 0.11);
  --shadow: 8px 8px 0 rgba(42, 35, 27, 0.1);
  --glow: 0 0 0 3px rgba(122, 76, 45, 0.14);
  --screen-grid: transparent;
  --scanline: transparent;
  --text-glow: none;
  --font-ui: "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
  background:
    linear-gradient(90deg, transparent 0 31px, rgba(23, 24, 21, 0.08) 31px 32px, transparent 32px),
    repeating-linear-gradient(0deg, rgba(23, 24, 21, 0.018) 0 1px, transparent 1px 7px),
    var(--moby-bone);
}

body[data-theme="moby"]::before {
  background:
    linear-gradient(90deg, var(--moby-ink) 0 54px, transparent 54px) 24px 22px / 86px 1px no-repeat,
    linear-gradient(180deg, rgba(122, 76, 45, 0.17), transparent 36%) right top / 3px 100% no-repeat;
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

body[data-theme="moby"] ::selection {
  background: var(--moby-ink);
  color: var(--moby-paper);
}

.app[data-theme="moby"] {
  background: transparent;
  isolation: isolate;
  position: relative;
  z-index: 1;
}

.app[data-theme="moby"] .library-pane,
.app[data-theme="moby"] .sheet-pane,
.app[data-theme="moby"] .inspector-pane {
  background:
    linear-gradient(90deg, rgba(122, 76, 45, 0.035), transparent 38%),
    var(--surface-sidebar);
  border-color: var(--moby-ink);
  box-shadow: none;
}

.app[data-theme="moby"] .library-pane,
.app[data-theme="moby"] .sheet-pane {
  border-right: 1px solid var(--moby-ink);
}

.app[data-theme="moby"] .inspector-pane {
  border-left: 1px solid var(--moby-ink);
}

.app[data-theme="moby"] .app-identity {
  border-bottom: 3px double var(--moby-ink);
  margin: 0 0 26px;
  padding: 3px 0 17px;
  position: relative;
}

.app[data-theme="moby"] .app-identity::after {
  background: var(--surface-sidebar);
  bottom: -9px;
  color: var(--moby-wood);
  content: "NANTUCKET / LOG 01";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 800;
  left: 48px;
  letter-spacing: 0.17em;
  padding: 2px 7px;
  position: absolute;
}

.app[data-theme="moby"] .brand-mark {
  background: var(--moby-ink);
  border: 1px solid var(--moby-ink);
  border-radius: 50% 46% 50% 44%;
  box-shadow: 3px 3px 0 rgba(122, 76, 45, 0.28);
  height: 39px;
  transform: rotate(-3deg);
  width: 39px;
}

.app[data-theme="moby"] .brand-mark svg {
  color: var(--moby-paper);
  height: 30px;
  transform: rotate(3deg);
  width: 20px;
}

.app[data-theme="moby"] .app-identity strong {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .app-identity div span {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.11em;
  margin-top: 4px;
  text-transform: uppercase;
}

.app[data-theme="moby"] .command-trigger {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  color: var(--moby-ink);
  min-width: 38px;
}

.app[data-theme="moby"] .command-trigger:hover {
  background: var(--moby-ink);
  box-shadow: 3px 3px 0 var(--moby-wood);
  color: var(--moby-paper);
  transform: translate(-1px, -1px);
}

.app[data-theme="moby"] .eyebrow,
.app[data-theme="moby"] .project-title-field,
.app[data-theme="moby"] .search-box span,
.app[data-theme="moby"] .inspector-stack > label,
.app[data-theme="moby"] .field-grid > label {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .eyebrow {
  align-items: center;
  display: flex;
  gap: 7px;
}

.app[data-theme="moby"] .eyebrow::before {
  background: var(--moby-ink);
  content: "";
  height: 1px;
  width: 13px;
}

.app[data-theme="moby"] .pane-header {
  border-bottom: 2px solid var(--moby-ink);
  min-height: 51px;
  padding-bottom: 9px;
  position: relative;
}

.app[data-theme="moby"] .pane-header::after {
  background: var(--moby-wood);
  bottom: -2px;
  content: "";
  height: 2px;
  position: absolute;
  right: 0;
  width: 34px;
}

.app[data-theme="moby"] .pane-header h2 {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.012em;
}

.app[data-theme="moby"] .project-switcher {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(122, 76, 45, 0.12);
  margin-bottom: 18px;
  padding: 12px;
}

.app[data-theme="moby"] .project-switcher:hover,
.app[data-theme="moby"] .project-switcher:focus-visible {
  border-color: var(--moby-ink);
  box-shadow: 4px 4px 0 rgba(122, 76, 45, 0.28);
}

.app[data-theme="moby"] .project-switcher select,
.app[data-theme="moby"] .project-title-input,
.app[data-theme="moby"] .inspector-stack textarea,
.app[data-theme="moby"] .inspector-stack input,
.app[data-theme="moby"] .inspector-stack select,
.app[data-theme="moby"] .search-box {
  background: rgba(255, 253, 247, 0.82);
  border: 1px solid rgba(23, 24, 21, 0.42);
  border-radius: 0;
  box-shadow: none;
  color: var(--moby-ink);
}

.app[data-theme="moby"] .search-box {
  margin: 13px 0 15px;
}

.app[data-theme="moby"] .search-box:focus-within,
.app[data-theme="moby"] .project-title-input:focus,
.app[data-theme="moby"] .inspector-stack textarea:focus,
.app[data-theme="moby"] .inspector-stack input:focus,
.app[data-theme="moby"] .inspector-stack select:focus {
  border-color: var(--moby-wood);
  box-shadow: inset 3px 0 var(--moby-wood);
}

.app[data-theme="moby"] .project-progress div {
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(23, 24, 21, 0.25);
  border-radius: 0;
}

.app[data-theme="moby"] .project-progress strong {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant-numeric: tabular-nums;
}

.app[data-theme="moby"] .project-progress span,
.app[data-theme="moby"] .sheet-card-footer {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .meter {
  background:
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(23, 24, 21, 0.3) 15px 16px),
    var(--moby-fog);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  height: 7px;
}

.app[data-theme="moby"] .meter span {
  background: var(--moby-wood);
  box-shadow: none;
}

.app[data-theme="moby"] .ghost-button,
.app[data-theme="moby"] .icon-button,
.app[data-theme="moby"] .compact-command-trigger {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: none;
  color: var(--moby-ink);
}

.app[data-theme="moby"] .ghost-button:hover,
.app[data-theme="moby"] .icon-button:hover,
.app[data-theme="moby"] .compact-command-trigger:hover {
  background: var(--moby-ink);
  border-color: var(--moby-ink);
  box-shadow: 2px 2px 0 var(--moby-wood);
  color: var(--moby-paper);
  transform: translate(-1px, -1px);
}

.app[data-theme="moby"] .primary-button {
  background: var(--moby-ink);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--moby-rope);
  color: var(--moby-paper);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .primary-button:hover {
  background: var(--moby-wood);
  border-color: var(--moby-wood);
  box-shadow: 3px 3px 0 var(--moby-ink);
  transform: translate(-1px, -1px);
}

.app[data-theme="moby"] .danger-button {
  background: var(--moby-paper);
  border: 1px solid var(--warn);
  border-radius: 0;
  color: var(--warn);
}

.app[data-theme="moby"] button:active:not(:disabled) {
  box-shadow: none;
  transform: translate(1px, 1px);
}

.app[data-theme="moby"] .section-list,
.app[data-theme="moby"] .sheet-list {
  gap: 0;
}

.app[data-theme="moby"] .section-list {
  border-top: 1px solid rgba(23, 24, 21, 0.35);
}

.app[data-theme="moby"] .section-button,
.app[data-theme="moby"] .sheet-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(23, 24, 21, 0.28);
  border-radius: 0;
  box-shadow: none;
  position: relative;
  transition:
    background var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.app[data-theme="moby"] .section-button:hover,
.app[data-theme="moby"] .sheet-card:hover {
  background: rgba(255, 253, 247, 0.7);
  border-color: rgba(23, 24, 21, 0.5);
  box-shadow: inset 3px 0 var(--moby-rope);
  transform: translateX(2px);
}

.app[data-theme="moby"] .section-button.active,
.app[data-theme="moby"] .sheet-card.active {
  background: var(--moby-ink);
  border-color: var(--moby-ink);
  box-shadow: inset 5px 0 var(--moby-wood);
  color: var(--moby-paper);
}

.app[data-theme="moby"] .section-button.active strong,
.app[data-theme="moby"] .section-button.active span,
.app[data-theme="moby"] .sheet-card.active strong,
.app[data-theme="moby"] .sheet-card.active p,
.app[data-theme="moby"] .sheet-card.active .sheet-card-footer {
  color: var(--moby-paper);
}

.app[data-theme="moby"] .section-count {
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  min-width: 24px;
  padding: 4px;
}

.app[data-theme="moby"] .section-button.active .section-count {
  color: var(--moby-paper);
}

.app[data-theme="moby"] .context-trigger {
  border-radius: 0;
}

.app[data-theme="moby"] .context-trigger:hover,
.app[data-theme="moby"] .context-trigger:focus-visible {
  background: var(--moby-wood);
  border-color: var(--moby-wood);
  color: var(--moby-paper);
}

.app[data-theme="moby"] .status-dot {
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: none;
  height: 6px;
  transform: rotate(45deg);
  width: 6px;
}

.app[data-theme="moby"] .status-to-write {
  background: var(--moby-paper);
}

.app[data-theme="moby"] .status-draft {
  background: var(--moby-rope);
}

.app[data-theme="moby"] .status-revising {
  background: var(--moby-wood);
}

.app[data-theme="moby"] .status-done {
  background: var(--moby-ink);
}

.app[data-theme="moby"] .editor-pane {
  background:
    linear-gradient(90deg, var(--moby-wood) 0 3px, transparent 3px),
    repeating-linear-gradient(0deg, rgba(23, 24, 21, 0.018) 0 1px, transparent 1px 8px),
    var(--moby-bone);
  padding: 16px 18px 16px 21px;
}

.app[data-theme="moby"] .editor-shell {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow:
    7px 7px 0 rgba(122, 76, 45, 0.1),
    0 24px 54px rgba(42, 35, 27, 0.08);
  color: var(--moby-ink);
  height: calc(100% - 8px);
  margin: 4px auto;
  max-width: 920px;
  padding: 50px clamp(24px, 5vw, 72px) 17px;
  position: relative;
}

.app[data-theme="moby"] .editor-shell::before {
  color: var(--moby-ink);
  content: "THE LINE / NORTH ATLANTIC";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 850;
  left: clamp(24px, 5vw, 72px);
  letter-spacing: 0.18em;
  pointer-events: none;
  position: absolute;
  top: 21px;
}

.app[data-theme="moby"] .editor-shell::after {
  background: linear-gradient(90deg, var(--moby-wood) 0 16px, transparent 16px 22px, var(--moby-ink) 22px);
  content: "";
  height: 2px;
  pointer-events: none;
  position: absolute;
  right: clamp(24px, 5vw, 72px);
  top: 24px;
  width: 74px;
}

.app[data-theme="moby"] .editor-composer-head,
.app[data-theme="moby"] .mode-switch,
.app[data-theme="moby"] .editor-mode-panel,
.app[data-theme="moby"] .editor-footer {
  position: relative;
  z-index: 1;
}

.app[data-theme="moby"] .mode-switch {
  background: transparent;
  border-bottom: 1px solid var(--moby-ink);
  border-radius: 0;
  gap: 0;
  max-width: 300px;
  padding: 0;
}

.app[data-theme="moby"] .mode-switch button {
  border-left: 1px solid var(--moby-ink);
  border-radius: 0;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .mode-switch button:last-child {
  border-right: 1px solid var(--moby-ink);
}

.app[data-theme="moby"] .mode-switch button:hover {
  background: rgba(122, 76, 45, 0.09);
  color: var(--moby-ink);
}

.app[data-theme="moby"] .mode-switch button.active {
  background: var(--moby-ink);
  box-shadow: inset 0 -3px var(--moby-wood);
  color: var(--moby-paper);
}

.app[data-theme="moby"] .composer-inspector-toggle {
  background: rgba(255, 252, 242, 0.4);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(86, 55, 35, 0.16);
  color: var(--moby-ink);
}

.app[data-theme="moby"] .composer-inspector-toggle:hover,
.app[data-theme="moby"] .composer-inspector-toggle:focus-visible {
  background: rgba(122, 76, 45, 0.09);
  border-color: var(--moby-ink);
  box-shadow: 2px 2px 0 rgba(86, 55, 35, 0.24);
  color: var(--moby-ink);
}

.app[data-theme="moby"] .composer-inspector-toggle[aria-pressed="true"] {
  background: var(--moby-ink);
  box-shadow: inset 0 -3px var(--moby-wood);
  color: var(--moby-paper);
}

.app[data-theme="moby"] .sheet-title-input,
.app[data-theme="moby"] .sheet-body,
.app[data-theme="moby"] .preview-body,
.app[data-theme="moby"] .outline-body {
  color: var(--moby-ink);
  text-shadow: none;
}

.app[data-theme="moby"] .sheet-title-input {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.app[data-theme="moby"] .sheet-body {
  caret-color: var(--moby-wood);
}

.app[data-theme="moby"] .sheet-title-input,
.app[data-theme="moby"] .sheet-body {
  -webkit-user-select: text;
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="moby"] .sheet-title-input:focus-visible,
.app[data-theme="moby"] .sheet-body:focus-visible {
  box-shadow: inset 3px 0 rgba(122, 76, 45, 0.18);
  outline: 1px solid var(--moby-wood);
  outline-offset: 5px;
}

.app[data-theme="moby"] .editor-meta,
.app[data-theme="moby"] .editor-footer {
  color: #65665f;
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .editor-meta span::before {
  background: var(--moby-ink);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 4px;
  margin-right: 6px;
  width: 4px;
}

.app[data-theme="moby"] .editor-meta span[data-state="saving"]::before {
  background: var(--moby-wood);
}

.app[data-theme="moby"] .editor-meta span[data-state="error"]::before {
  background: var(--warn);
}

.app[data-theme="moby"] .editor-footer {
  border-top: 3px double var(--moby-ink);
  padding-top: 10px;
}

.app[data-theme="moby"] .editor-footer::before {
  color: var(--moby-wood);
  content: "LOG";
  font-size: 7px;
  letter-spacing: 0.16em;
  margin-right: auto;
}

.app[data-theme="moby"] .outline-item {
  background: var(--moby-paper);
  border: 1px solid rgba(23, 24, 21, 0.38);
  border-left: 4px solid var(--moby-wood);
  border-radius: 0;
  box-shadow: none;
  color: var(--moby-ink);
}

.app[data-theme="moby"] .composer-focus-toggle {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(122, 76, 45, 0.2);
  color: var(--moby-ink);
}

.app[data-theme="moby"] .composer-focus-toggle:hover {
  background: var(--moby-ink);
  color: var(--moby-paper);
}

body[data-theme="moby"] .project-library-backdrop,
body[data-theme="moby"] .command-palette-backdrop,
body[data-theme="moby"] .ux-metrics-backdrop {
  background: rgba(23, 24, 21, 0.58);
  backdrop-filter: blur(5px) grayscale(1);
}

body[data-theme="moby"] .project-library-panel,
body[data-theme="moby"] .project-delete-dialog,
body[data-theme="moby"] .command-palette-dialog,
body[data-theme="moby"] .ux-metrics-dialog,
body[data-theme="moby"] .toast,
body[data-theme="moby"] .context-menu {
  background: var(--moby-paper);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow:
    7px 7px 0 var(--moby-wood),
    0 28px 70px rgba(23, 24, 21, 0.22);
  color: var(--moby-ink);
}

body[data-theme="moby"] .project-library-panel::before,
body[data-theme="moby"] .command-palette-dialog::before,
body[data-theme="moby"] .ux-metrics-dialog::before {
  background: linear-gradient(90deg, var(--moby-ink) 0 78%, var(--moby-wood) 78% 86%, transparent 86%);
  content: "";
  height: 3px;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

body[data-theme="moby"] .project-library-head {
  border-bottom: 3px double var(--moby-ink);
}

body[data-theme="moby"] .project-library-head h2,
body[data-theme="moby"] .ux-metrics-head h2 {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-weight: 700;
}

body[data-theme="moby"] .project-folder {
  background: var(--moby-paper);
  border: 1px solid rgba(23, 24, 21, 0.38);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(163, 147, 120, 0.25);
}

body[data-theme="moby"] .project-folder:hover,
body[data-theme="moby"] .project-folder:focus-visible {
  background: #f7f1e6;
  border-color: var(--moby-ink);
  box-shadow: 5px 5px 0 rgba(122, 76, 45, 0.28);
  transform: translate(-2px, -2px);
}

body[data-theme="moby"] .project-folder.active {
  background: var(--moby-ink);
  border-color: var(--moby-ink);
  box-shadow: 5px 5px 0 var(--moby-wood);
  color: var(--moby-paper);
}

body[data-theme="moby"] .project-folder-icon::before,
body[data-theme="moby"] .project-folder-icon::after {
  background: var(--moby-bone);
  border-color: var(--moby-ink);
  border-radius: 0;
  box-shadow: none;
}

body[data-theme="moby"] .project-folder.active .project-folder-icon::before,
body[data-theme="moby"] .project-folder.active .project-folder-icon::after {
  background: var(--moby-paper);
  border-color: var(--moby-paper);
}

body[data-theme="moby"] .command-palette-search {
  border-bottom: 2px solid var(--moby-ink);
}

body[data-theme="moby"] .command-palette-mark {
  background: var(--moby-ink);
  border: 1px solid var(--moby-ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--moby-wood);
  color: var(--moby-paper);
}

body[data-theme="moby"] .command-palette-search input {
  color: var(--moby-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
}

body[data-theme="moby"] .command-palette-item,
body[data-theme="moby"] .command-palette-item-icon,
body[data-theme="moby"] .command-palette-search > kbd,
body[data-theme="moby"] .command-palette-item-meta kbd,
body[data-theme="moby"] .command-palette-footer kbd {
  border-radius: 0;
}

body[data-theme="moby"] .command-palette-item:hover,
body[data-theme="moby"] .command-palette-item.active {
  background: var(--moby-ink);
  box-shadow: inset 4px 0 var(--moby-wood);
  color: var(--moby-paper);
  transform: translateX(2px);
}

body[data-theme="moby"] .command-palette-item.active .command-palette-item-icon {
  background: var(--moby-paper);
  border-color: var(--moby-paper);
  color: var(--moby-ink);
}

body[data-theme="moby"] .ux-metrics-grid article {
  background: var(--moby-paper);
  border: 1px solid rgba(23, 24, 21, 0.36);
  border-left: 4px solid var(--moby-rope);
  border-radius: 0;
  box-shadow: none;
}

body[data-theme="moby"] .ux-metrics-grid strong[data-state="pass"] {
  color: var(--moby-wood);
}

body[data-theme="moby"] .context-menu button:hover,
body[data-theme="moby"] .context-menu button:focus-visible {
  background: var(--moby-ink);
  box-shadow: inset 4px 0 var(--moby-wood);
  color: var(--moby-paper);
}

.app[data-theme="moby"] .compact-toolbar {
  background:
    linear-gradient(90deg, var(--moby-ink) 0 84%, var(--moby-wood) 84% 91%, transparent 91%) left bottom / 100% 2px no-repeat,
    var(--surface-sidebar);
  border-bottom: 1px solid var(--moby-ink);
}

.app[data-theme="moby"] .compact-nav-button,
.app[data-theme="moby"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.app[data-theme="moby"] .compact-surface-nav button.active {
  background: var(--moby-ink);
  border-color: var(--moby-ink);
  box-shadow: inset 0 -3px var(--moby-wood);
  color: var(--moby-paper);
}

body[data-theme="moby"] * {
  scrollbar-color: var(--moby-ink) var(--moby-fog);
}

@media (max-width: 767px) {
  .app[data-theme="moby"] .editor-pane {
    padding: 10px 10px 10px 13px;
  }

  .app[data-theme="moby"] .editor-shell {
    box-shadow: 4px 4px 0 rgba(122, 76, 45, 0.13);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding-top: 43px;
  }

  .app[data-theme="moby"] .editor-shell::before,
  .app[data-theme="moby"] .editor-shell::after {
    top: 18px;
  }

  .app[data-theme="moby"] .editor-shell::after {
    top: 21px;
  }

  body[data-theme="moby"] .command-palette-dialog,
  body[data-theme="moby"] .ux-metrics-dialog {
    box-shadow: 4px 4px 0 var(--moby-wood);
  }
}

@media (max-width: 420px) {
  .app[data-theme="moby"] .editor-shell::before {
    content: "NORTH ATLANTIC";
    font-size: 7px;
    letter-spacing: 0.1em;
  }

  .app[data-theme="moby"] .editor-shell::after {
    width: 48px;
  }

  .app[data-theme="moby"] .mode-switch button {
    letter-spacing: 0.055em;
    padding: 0 8px;
  }
}

/* SPRYPNT: paint-splatter graffiti punk */

body[data-theme="sprypnt"] {
  color-scheme: dark;
  --surface-canvas: #100b17;
  --surface-sidebar: #191020;
  --surface-raised: #281632;
  --surface-overlay: #32163c;
  --surface-selected: rgba(255, 59, 157, 0.2);
  --text-primary: #fff8ef;
  --text-secondary: #d8c4df;
  --text-disabled: #ad94b2;
  --border-subtle: rgba(255, 248, 239, 0.22);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #ff3b9d;
  --accent-strong: #ff84c4;
  --accent-soft: rgba(255, 59, 157, 0.17);
  --selection: #22f1d0;
  --selection-soft: rgba(34, 241, 208, 0.17);
  --spray-pink: #ff3b9d;
  --spray-teal: #22f1d0;
  --spray-yellow: #ffe34f;
  --spray-purple: #8f52ff;
  --spray-ink: #120c18;
  --spray-composer: #17101f;
  --spray-composer-text: #fff8ef;
  --spray-composer-muted: #d8c4df;
  --warn: #ffe34f;
  --warn-soft: rgba(255, 227, 79, 0.16);
  --shadow:
    8px 8px 0 rgba(255, 59, 157, 0.74),
    -5px -5px 0 rgba(34, 241, 208, 0.58);
  --glow: 0 0 0 3px rgba(34, 241, 208, 0.22);
  --screen-grid: transparent;
  --scanline: transparent;
  --text-glow: none;
  --font-ui: "Avenir Next", "Trebuchet MS", Arial, sans-serif;
  background:
    radial-gradient(circle at 4% 16%, var(--spray-pink) 0 3px, transparent 4px),
    radial-gradient(circle at 7% 19%, var(--spray-pink) 0 7px, transparent 8px),
    radial-gradient(circle at 10% 12%, rgba(255, 59, 157, 0.64) 0 2px, transparent 3px),
    radial-gradient(circle at 94% 10%, var(--spray-teal) 0 5px, transparent 6px),
    radial-gradient(circle at 91% 14%, rgba(34, 241, 208, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 97% 18%, rgba(34, 241, 208, 0.54) 0 9px, transparent 10px),
    radial-gradient(ellipse at 82% 86%, rgba(143, 82, 255, 0.36) 0 8%, transparent 24%),
    radial-gradient(ellipse at 17% 92%, rgba(255, 59, 157, 0.26) 0 7%, transparent 22%),
    linear-gradient(116deg, transparent 0 46%, rgba(255, 227, 79, 0.05) 46% 48%, transparent 48%),
    var(--surface-canvas);
}

body[data-theme="sprypnt"] ::selection {
  background: var(--spray-pink);
  color: var(--spray-ink);
}

.app[data-theme="sprypnt"] {
  background: transparent;
}

.app[data-theme="sprypnt"] .library-pane,
.app[data-theme="sprypnt"] .sheet-pane,
.app[data-theme="sprypnt"] .inspector-pane {
  background:
    radial-gradient(circle at 12px 18px, rgba(255, 59, 157, 0.13) 0 2px, transparent 3px),
    radial-gradient(circle at calc(100% - 18px) 72%, rgba(34, 241, 208, 0.11) 0 3px, transparent 4px),
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 48%),
    rgba(25, 16, 32, 0.96);
  border-color: #09060d;
  box-shadow:
    inset -1px 0 rgba(255, 59, 157, 0.34),
    inset 1px 0 rgba(34, 241, 208, 0.2);
}

.app[data-theme="sprypnt"] .library-pane {
  border-right: 3px solid #09060d;
}

.app[data-theme="sprypnt"] .sheet-pane {
  border-right: 3px solid var(--spray-pink);
}

.app[data-theme="sprypnt"] .inspector-pane {
  border-left: 3px solid var(--spray-teal);
}

.app[data-theme="sprypnt"] .app-identity {
  background: var(--spray-yellow);
  border: 3px solid var(--spray-ink);
  box-shadow:
    6px 6px 0 var(--spray-pink),
    -3px -3px 0 var(--spray-teal);
  color: var(--spray-ink);
  margin: 4px 4px 22px 2px;
  padding: 11px 10px;
  position: relative;
  transform: rotate(-0.8deg);
}

.app[data-theme="sprypnt"] .app-identity::after {
  background: var(--spray-purple);
  bottom: -8px;
  color: #ffffff;
  content: "WORDS / LOUD";
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 6px;
  position: absolute;
  right: 13px;
  transform: rotate(2.5deg);
}

.app[data-theme="sprypnt"] .brand-mark {
  background: var(--spray-pink);
  border: 2px solid var(--spray-ink);
  box-shadow: 3px 3px 0 var(--spray-teal);
  transform: rotate(4deg);
}

.app[data-theme="sprypnt"] .brand-mark svg {
  color: var(--spray-ink);
  height: 34px;
  width: 28px;
}

.app[data-theme="sprypnt"] .app-identity strong {
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 16px;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.92;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .app-identity div span {
  color: rgba(18, 12, 24, 0.78);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  margin-top: 6px;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .command-trigger {
  background: var(--spray-ink);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  color: var(--spray-teal);
  transform: rotate(1.5deg);
}

.app[data-theme="sprypnt"] .command-trigger:hover {
  background: var(--spray-pink);
  color: var(--spray-ink);
  transform: rotate(-1.5deg) translateY(-1px);
}

.app[data-theme="sprypnt"] .eyebrow,
.app[data-theme="sprypnt"] .project-title-field,
.app[data-theme="sprypnt"] .search-box span,
.app[data-theme="sprypnt"] .inspector-stack > label,
.app[data-theme="sprypnt"] .field-grid > label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .eyebrow {
  background: var(--spray-pink);
  color: var(--spray-ink);
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 7px 2px;
  transform: rotate(-1deg);
}

.app[data-theme="sprypnt"] .pane-header {
  border-bottom: 3px solid #09060d;
  min-height: 50px;
  padding-bottom: 7px;
  position: relative;
}

.app[data-theme="sprypnt"] .pane-header::after {
  background:
    radial-gradient(circle at 12% 52%, var(--spray-teal) 0 3px, transparent 4px),
    radial-gradient(circle at 28% 35%, var(--spray-teal) 0 1px, transparent 2px),
    linear-gradient(90deg, var(--spray-teal), transparent);
  bottom: -5px;
  content: "";
  height: 9px;
  pointer-events: none;
  position: absolute;
  right: 0;
  transform: rotate(-2deg);
  width: 78px;
}

.app[data-theme="sprypnt"] .pane-header h2 {
  color: var(--text-primary);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 19px;
  font-style: italic;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .project-switcher {
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 227, 79, 0.8) 0 3px, transparent 4px),
    var(--surface-raised);
  border: 2px solid var(--spray-pink);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--spray-teal);
  margin: 0 5px 18px 0;
  padding: 12px;
  transform: rotate(0.35deg);
}

.app[data-theme="sprypnt"] .project-switcher:hover,
.app[data-theme="sprypnt"] .project-switcher:focus-visible {
  background: var(--surface-overlay);
  border-color: var(--spray-yellow);
  box-shadow: 5px 5px 0 var(--spray-pink);
}

.app[data-theme="sprypnt"] .project-switcher select,
.app[data-theme="sprypnt"] .project-title-input,
.app[data-theme="sprypnt"] .inspector-stack textarea,
.app[data-theme="sprypnt"] .inspector-stack input,
.app[data-theme="sprypnt"] .inspector-stack select,
.app[data-theme="sprypnt"] .search-box {
  background: rgba(16, 11, 23, 0.86);
  border: 2px solid rgba(255, 248, 239, 0.42);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(143, 82, 255, 0.56);
  color: var(--text-primary);
}

.app[data-theme="sprypnt"] .search-box {
  margin: 13px 4px 14px 0;
}

.app[data-theme="sprypnt"] .search-box:focus-within,
.app[data-theme="sprypnt"] .project-title-input:focus,
.app[data-theme="sprypnt"] .inspector-stack textarea:focus,
.app[data-theme="sprypnt"] .inspector-stack input:focus,
.app[data-theme="sprypnt"] .inspector-stack select:focus {
  border-color: var(--spray-teal);
  box-shadow: 4px 4px 0 var(--spray-pink);
}

.app[data-theme="sprypnt"] .project-progress div,
.app[data-theme="sprypnt"] .section-count {
  background: var(--spray-ink);
  border: 1px solid var(--spray-teal);
  border-radius: 0;
}

.app[data-theme="sprypnt"] .project-progress strong {
  color: var(--spray-yellow);
  font-family: "Arial Black", Impact, sans-serif;
}

.app[data-theme="sprypnt"] .meter {
  background: var(--spray-ink);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  height: 9px;
  overflow: visible;
  transform: rotate(-0.7deg);
}

.app[data-theme="sprypnt"] .meter span {
  background: linear-gradient(90deg, var(--spray-pink), var(--spray-purple) 48%, var(--spray-teal) 76%, var(--spray-yellow));
  box-shadow: 2px 2px 0 rgba(255, 227, 79, 0.48);
}

.app[data-theme="sprypnt"] .ghost-button,
.app[data-theme="sprypnt"] .icon-button,
.app[data-theme="sprypnt"] .compact-command-trigger {
  background: var(--surface-raised);
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-pink);
  color: var(--text-primary);
}

.app[data-theme="sprypnt"] .ghost-button:hover,
.app[data-theme="sprypnt"] .icon-button:hover,
.app[data-theme="sprypnt"] .compact-command-trigger:hover {
  background: var(--spray-teal);
  border-color: #09060d;
  box-shadow: 4px 4px 0 var(--spray-purple);
  color: var(--spray-ink);
  transform: rotate(-1.5deg) translate(-1px, -1px);
}

.app[data-theme="sprypnt"] .primary-button {
  background: var(--spray-yellow);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--spray-pink);
  color: var(--spray-ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-style: italic;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .primary-button:hover {
  background: var(--spray-teal);
  border-color: var(--spray-ink);
  box-shadow: 5px 5px 0 var(--spray-purple);
  transform: rotate(1deg) translate(-1px, -1px);
}

.app[data-theme="sprypnt"] .danger-button {
  background: var(--spray-pink);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  color: var(--spray-ink);
}

.app[data-theme="sprypnt"] .section-list {
  gap: 9px;
}

.app[data-theme="sprypnt"] .section-button,
.app[data-theme="sprypnt"] .sheet-card {
  background: rgba(40, 22, 50, 0.8);
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(143, 82, 255, 0.42);
  position: relative;
}

.app[data-theme="sprypnt"] .section-button::before,
.app[data-theme="sprypnt"] .sheet-card::before {
  background: var(--spray-pink);
  content: "";
  height: 3px;
  left: 9px;
  position: absolute;
  top: -2px;
  transform: rotate(-1.5deg);
  width: 35px;
}

.app[data-theme="sprypnt"] .section-button:hover,
.app[data-theme="sprypnt"] .sheet-card:hover {
  background: var(--surface-overlay);
  border-color: var(--spray-teal);
  box-shadow: 4px 4px 0 var(--spray-pink);
  transform: translate(-1px, -1px);
}

.app[data-theme="sprypnt"] .section-button.active,
.app[data-theme="sprypnt"] .sheet-card.active {
  background: var(--spray-yellow);
  border-color: var(--spray-ink);
  box-shadow:
    5px 5px 0 var(--spray-pink),
    -3px -3px 0 var(--spray-teal);
  color: var(--spray-ink);
  clip-path: polygon(0 0, 96% 0, 100% 13%, 98% 100%, 3% 97%);
}

.app[data-theme="sprypnt"] .section-button.active strong,
.app[data-theme="sprypnt"] .section-button.active span,
.app[data-theme="sprypnt"] .sheet-card.active strong,
.app[data-theme="sprypnt"] .sheet-card.active p,
.app[data-theme="sprypnt"] .sheet-card.active .sheet-card-footer {
  color: var(--spray-ink);
}

.app[data-theme="sprypnt"] .section-count {
  color: var(--spray-teal);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 850;
}

.app[data-theme="sprypnt"] .section-button.active .section-count {
  background: var(--spray-ink);
  color: var(--spray-yellow);
}

.app[data-theme="sprypnt"] .context-trigger {
  border-radius: 0;
}

.app[data-theme="sprypnt"] .context-trigger:hover,
.app[data-theme="sprypnt"] .context-trigger:focus-visible {
  background: var(--spray-pink);
  border-color: var(--spray-ink);
  color: var(--spray-ink);
}

.app[data-theme="sprypnt"] .sheet-card-footer {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .status-dot {
  border: 1px solid var(--spray-ink);
  border-radius: 0;
  height: 8px;
  width: 8px;
}

.app[data-theme="sprypnt"] .status-to-write {
  background: var(--spray-purple);
}

.app[data-theme="sprypnt"] .status-draft {
  background: var(--spray-pink);
}

.app[data-theme="sprypnt"] .status-revising {
  background: var(--spray-yellow);
}

.app[data-theme="sprypnt"] .status-done {
  background: var(--spray-teal);
}

.app[data-theme="sprypnt"] .editor-pane {
  background:
    radial-gradient(circle at 8% 12%, var(--spray-pink) 0 4px, transparent 5px),
    radial-gradient(circle at 12% 9%, rgba(255, 59, 157, 0.64) 0 2px, transparent 3px),
    radial-gradient(circle at 91% 16%, var(--spray-teal) 0 6px, transparent 7px),
    radial-gradient(circle at 95% 21%, rgba(34, 241, 208, 0.72) 0 2px, transparent 3px),
    linear-gradient(128deg, transparent 0 48%, rgba(143, 82, 255, 0.14) 48% 54%, transparent 54%),
    #130c1b;
  padding: 15px;
}

.app[data-theme="sprypnt"] .editor-shell {
  background:
    radial-gradient(circle at 96% 5%, rgba(255, 59, 157, 0.34) 0 4px, transparent 5px),
    radial-gradient(circle at 93% 8%, rgba(255, 59, 157, 0.22) 0 2px, transparent 3px),
    radial-gradient(circle at 4% 94%, rgba(34, 241, 208, 0.16) 0 3px, transparent 4px),
    linear-gradient(115deg, transparent 0 74%, rgba(34, 241, 208, 0.08) 74% 77%, transparent 77%),
    linear-gradient(155deg, rgba(143, 82, 255, 0.12), transparent 38%),
    var(--spray-composer);
  border: 3px solid var(--spray-ink);
  box-shadow:
    11px 11px 0 var(--spray-pink),
    -7px -7px 0 var(--spray-teal);
  color: var(--spray-composer-text);
  height: calc(100% - 10px);
  isolation: isolate;
  margin: 5px auto;
  max-width: 930px;
  padding: 30px clamp(24px, 5vw, 72px) 16px;
  position: relative;
  transform: none;
}

.app[data-theme="sprypnt"] .editor-shell::before {
  background: var(--spray-yellow);
  border: 2px solid var(--spray-ink);
  color: var(--spray-ink);
  content: "MAKE / A / MESS";
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  left: clamp(20px, 4vw, 58px);
  letter-spacing: 0.1em;
  padding: 4px 7px;
  pointer-events: none;
  position: absolute;
  top: -9px;
  transform: rotate(-2deg);
  z-index: 0;
}

.app[data-theme="sprypnt"] .editor-shell::after {
  background: var(--spray-purple);
  content: "";
  height: 9px;
  pointer-events: none;
  position: absolute;
  right: 8%;
  top: -5px;
  transform: rotate(1.5deg);
  width: 66px;
  z-index: 0;
}

.app[data-theme="sprypnt"] .mode-switch,
.app[data-theme="sprypnt"] .editor-composer-head,
.app[data-theme="sprypnt"] .editor-mode-panel,
.app[data-theme="sprypnt"] .editor-footer {
  position: relative;
  z-index: 1;
}

.app[data-theme="sprypnt"] .mode-switch {
  background: var(--spray-ink);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  gap: 2px;
  padding: 3px;
}

.app[data-theme="sprypnt"] .mode-switch button {
  border-radius: 0;
  color: #fff7e9;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .mode-switch button:hover {
  background: rgba(255, 59, 157, 0.35);
}

.app[data-theme="sprypnt"] .mode-switch button.active {
  background: var(--spray-yellow);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-pink);
  color: var(--spray-ink);
  transform: rotate(-1deg);
}

.app[data-theme="sprypnt"] .composer-inspector-toggle {
  background: var(--spray-ink);
  border: 2px solid var(--spray-pink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-purple);
  color: #fff7e9;
}

.app[data-theme="sprypnt"] .composer-inspector-toggle:hover,
.app[data-theme="sprypnt"] .composer-inspector-toggle:focus-visible {
  background: rgba(255, 59, 157, 0.35);
  border-color: var(--spray-yellow);
  box-shadow: 3px 3px 0 var(--spray-purple);
  color: #fff7e9;
}

.app[data-theme="sprypnt"] .composer-inspector-toggle[aria-pressed="true"] {
  background: var(--spray-yellow);
  border-color: var(--spray-ink);
  box-shadow: 3px 3px 0 var(--spray-pink);
  color: var(--spray-ink);
  transform: rotate(-1deg);
}

.app[data-theme="sprypnt"] .sheet-title-input,
.app[data-theme="sprypnt"] .sheet-body,
.app[data-theme="sprypnt"] .preview-body,
.app[data-theme="sprypnt"] .outline-body {
  color: var(--spray-composer-text);
  text-shadow: none;
}

.app[data-theme="sprypnt"] .sheet-title-input,
.app[data-theme="sprypnt"] .sheet-body {
  -webkit-user-select: text;
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="sprypnt"] .preview-body blockquote,
.app[data-theme="sprypnt"] .outline-item p {
  color: var(--spray-composer-muted);
}

.app[data-theme="sprypnt"] .sheet-title-input {
  font-weight: 780;
  letter-spacing: -0.035em;
  text-decoration-color: var(--spray-pink);
  text-decoration-line: underline;
  text-decoration-thickness: 4px;
  text-underline-offset: 6px;
}

.app[data-theme="sprypnt"] .sheet-body {
  caret-color: var(--spray-pink);
}

.app[data-theme="sprypnt"] .sheet-title-input:focus-visible,
.app[data-theme="sprypnt"] .sheet-body:focus-visible {
  outline: 3px solid var(--spray-teal);
  outline-offset: 4px;
}

.app[data-theme="sprypnt"] .editor-meta,
.app[data-theme="sprypnt"] .editor-footer {
  color: var(--spray-composer-muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .editor-meta span[data-state="saving"] {
  color: var(--spray-pink);
}

.app[data-theme="sprypnt"] .editor-meta span[data-state="error"] {
  color: var(--spray-yellow);
}

.app[data-theme="sprypnt"] .editor-footer {
  border-top: 2px dashed var(--spray-pink);
  padding-top: 10px;
}

.app[data-theme="sprypnt"] .outline-item {
  background: rgba(255, 59, 157, 0.13);
  border: 2px solid var(--spray-ink);
  border-left: 7px solid var(--spray-teal);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(255, 59, 157, 0.34);
  color: var(--spray-composer-text);
}

.app[data-theme="sprypnt"] .composer-focus-toggle {
  background: var(--spray-pink);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-teal);
  color: var(--spray-ink);
}

body[data-theme="sprypnt"] .project-library-backdrop,
body[data-theme="sprypnt"] .command-palette-backdrop,
body[data-theme="sprypnt"] .ux-metrics-backdrop {
  background: rgba(9, 4, 13, 0.74);
  backdrop-filter: blur(7px) saturate(1.3);
}

body[data-theme="sprypnt"] .project-library-panel,
body[data-theme="sprypnt"] .project-delete-dialog,
body[data-theme="sprypnt"] .command-palette-dialog,
body[data-theme="sprypnt"] .ux-metrics-dialog,
body[data-theme="sprypnt"] .toast,
body[data-theme="sprypnt"] .context-menu {
  background:
    radial-gradient(circle at 96% 8%, rgba(34, 241, 208, 0.68) 0 3px, transparent 4px),
    radial-gradient(circle at 92% 12%, rgba(34, 241, 208, 0.4) 0 1px, transparent 2px),
    var(--surface-overlay);
  border: 3px solid #09060d;
  border-radius: 0;
  box-shadow:
    10px 10px 0 var(--spray-pink),
    -6px -6px 0 var(--spray-teal);
}

body[data-theme="sprypnt"] .project-library-panel::before,
body[data-theme="sprypnt"] .command-palette-dialog::before,
body[data-theme="sprypnt"] .ux-metrics-dialog::before {
  background: linear-gradient(90deg, var(--spray-pink) 0 42%, var(--spray-yellow) 42% 65%, var(--spray-teal) 65% 82%, var(--spray-purple) 82%);
  content: "";
  display: block;
  height: 5px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transform: rotate(-0.35deg);
  z-index: 3;
}

body[data-theme="sprypnt"] .project-library-head {
  border-bottom: 3px solid var(--spray-pink);
}

body[data-theme="sprypnt"] .project-library-head h2,
body[data-theme="sprypnt"] .ux-metrics-head h2 {
  font-family: "Arial Black", Impact, sans-serif;
  font-style: italic;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .project-folder {
  background: var(--surface-raised);
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(143, 82, 255, 0.56);
}

body[data-theme="sprypnt"] .project-folder:hover,
body[data-theme="sprypnt"] .project-folder:focus-visible {
  background: var(--spray-teal);
  border-color: #09060d;
  box-shadow: 5px 5px 0 var(--spray-pink);
  color: var(--spray-ink);
  transform: rotate(-0.6deg) translate(-1px, -1px);
}

body[data-theme="sprypnt"] .project-folder.active {
  background: var(--spray-yellow);
  border-color: #09060d;
  box-shadow:
    6px 6px 0 var(--spray-pink),
    -3px -3px 0 var(--spray-teal);
  color: var(--spray-ink);
}

body[data-theme="sprypnt"] .project-folder:hover .project-folder-meta,
body[data-theme="sprypnt"] .project-folder:focus-visible .project-folder-meta,
body[data-theme="sprypnt"] .project-folder.active .project-folder-meta {
  color: rgba(18, 12, 24, 0.7);
}

body[data-theme="sprypnt"] .project-folder-icon::before,
body[data-theme="sprypnt"] .project-folder-icon::after {
  background: var(--spray-purple);
  border-color: #09060d;
  border-radius: 0;
}

body[data-theme="sprypnt"] .command-palette-search {
  border-bottom: 3px solid var(--spray-pink);
}

body[data-theme="sprypnt"] .command-palette-mark {
  background: var(--spray-yellow);
  border: 2px solid var(--spray-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-teal);
  color: var(--spray-ink);
  transform: rotate(-4deg);
}

body[data-theme="sprypnt"] .command-palette-search input {
  font-family: "Arial Black", Impact, sans-serif;
  font-style: italic;
  letter-spacing: -0.025em;
}

body[data-theme="sprypnt"] .command-palette-item,
body[data-theme="sprypnt"] .command-palette-item-icon,
body[data-theme="sprypnt"] .command-palette-search > kbd,
body[data-theme="sprypnt"] .command-palette-item-meta kbd,
body[data-theme="sprypnt"] .command-palette-footer kbd {
  border-radius: 0;
}

body[data-theme="sprypnt"] .command-palette-item:hover,
body[data-theme="sprypnt"] .command-palette-item.active {
  background: var(--spray-teal);
  box-shadow: inset 5px 0 var(--spray-pink), 4px 4px 0 rgba(255, 59, 157, 0.42);
  color: var(--spray-ink);
  transform: rotate(-0.25deg);
}

body[data-theme="sprypnt"] .command-palette-item.active .command-palette-item-icon {
  background: var(--spray-yellow);
  border-color: var(--spray-ink);
  color: var(--spray-ink);
}

body[data-theme="sprypnt"] .command-palette-item:hover .command-palette-item-copy span,
body[data-theme="sprypnt"] .command-palette-item.active .command-palette-item-copy span,
body[data-theme="sprypnt"] .command-palette-item:hover .command-palette-item-meta,
body[data-theme="sprypnt"] .command-palette-item.active .command-palette-item-meta {
  color: rgba(18, 12, 24, 0.72);
}

body[data-theme="sprypnt"] .ux-metrics-grid article {
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--spray-purple);
}

body[data-theme="sprypnt"] .ux-metrics-grid article:nth-child(1),
body[data-theme="sprypnt"] .ux-metrics-grid article:nth-child(4) {
  background: rgba(255, 59, 157, 0.24);
}

body[data-theme="sprypnt"] .ux-metrics-grid article:nth-child(2) {
  background: rgba(34, 241, 208, 0.2);
}

body[data-theme="sprypnt"] .ux-metrics-grid article:nth-child(3) {
  background: rgba(255, 227, 79, 0.2);
}

body[data-theme="sprypnt"] .ux-metrics-grid strong[data-state="pass"] {
  color: var(--spray-teal);
}

body[data-theme="sprypnt"] .context-menu button:hover,
body[data-theme="sprypnt"] .context-menu button:focus-visible {
  background: var(--spray-yellow);
  color: var(--spray-ink);
}

.app[data-theme="sprypnt"] .compact-toolbar {
  background:
    linear-gradient(90deg, var(--spray-pink) 0 28%, var(--spray-yellow) 28% 48%, var(--spray-teal) 48% 76%, var(--spray-purple) 76%) left bottom / 100% 4px no-repeat,
    var(--surface-sidebar);
  border-bottom: 3px solid #09060d;
}

.app[data-theme="sprypnt"] .compact-nav-button,
.app[data-theme="sprypnt"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app[data-theme="sprypnt"] .compact-surface-nav button.active {
  background: var(--spray-yellow);
  border-color: var(--spray-ink);
  color: var(--spray-ink);
  transform: rotate(-1deg);
}

body[data-theme="sprypnt"] * {
  scrollbar-color: var(--spray-pink) var(--surface-raised);
}

@media (max-width: 767px) {
  .app[data-theme="sprypnt"] .editor-pane {
    padding: 9px;
  }

  .app[data-theme="sprypnt"] .editor-shell {
    box-shadow:
      6px 6px 0 var(--spray-pink),
      -4px -4px 0 var(--spray-teal);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding-top: 28px;
    transform: none;
  }

  body[data-theme="sprypnt"] .command-palette-dialog,
  body[data-theme="sprypnt"] .ux-metrics-dialog {
    box-shadow:
      6px 6px 0 var(--spray-pink),
      -4px -4px 0 var(--spray-teal);
  }
}

@media (max-width: 420px) {
  .app[data-theme="sprypnt"] .editor-shell::before {
    content: "MAKE / A / MESS";
    font-size: 7px;
    left: 14px;
  }

  .app[data-theme="sprypnt"] .mode-switch button {
    letter-spacing: 0.035em;
    padding: 0 9px;
  }
}

@media (pointer: coarse) {
  .command-trigger,
  .compact-command-trigger {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  button:active:not(:disabled),
  .project-folder:hover,
  .project-folder:focus-visible,
  .sheet-card:not(.dragging),
  .scene-trash.drag-over {
    transform: none !important;
  }

  body.sheet-drag-active .scene-trash:not([hidden]),
  .project-library-panel.project-drag-active .project-library-trash {
    animation: none !important;
  }
}

/* Starfield-inspired display refinement: restrained NASA-punk instrumentation */

body[data-theme="frontier"] {
  --surface-canvas: #e9e8e1;
  --surface-sidebar: #d9dad4;
  --surface-raised: #f3f1ea;
  --surface-overlay: #f8f6ef;
  --surface-selected: rgba(181, 75, 49, 0.12);
  --text-primary: #202524;
  --text-secondary: #555d5b;
  --text-disabled: #666d6a;
  --border-subtle: rgba(52, 61, 59, 0.27);
  --accent: #232d2e;
  --accent-strong: #121a1b;
  --accent-soft: rgba(35, 53, 55, 0.075);
  --selection: #b54b31;
  --selection-soft: rgba(181, 75, 49, 0.13);
  --system-blue: #315b64;
  --system-blue-soft: rgba(49, 91, 100, 0.12);
  --warn: #9d3d2d;
  --warn-soft: rgba(157, 61, 45, 0.12);
  --shadow: 0 22px 56px rgba(44, 50, 48, 0.19);
  --glow: 0 0 0 3px rgba(181, 75, 49, 0.12);
  background:
    linear-gradient(rgba(35, 45, 46, 0.026) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(35, 45, 46, 0.022) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--surface-canvas);
}

.app[data-theme="frontier"] {
  background: transparent;
}

.app[data-theme="frontier"] .library-pane,
.app[data-theme="frontier"] .sheet-pane,
.app[data-theme="frontier"] .inspector-pane {
  background:
    linear-gradient(180deg, rgba(255, 255, 251, 0.38), transparent 38px),
    var(--surface-sidebar);
  box-shadow:
    inset 0 1px rgba(255, 255, 251, 0.76),
    inset -1px 0 rgba(39, 49, 48, 0.06);
}

.app[data-theme="frontier"] .editor-pane {
  background:
    linear-gradient(90deg, rgba(35, 45, 46, 0.018) 1px, transparent 1px) 0 0 / 64px 64px,
    var(--surface-canvas);
}

.app[data-theme="frontier"] .app-identity {
  margin-bottom: 18px;
  padding-top: 17px;
  position: relative;
}

.app[data-theme="frontier"] .app-identity::before,
.app[data-theme="frontier"] .app-identity::after {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 720;
  letter-spacing: 0.12em;
  line-height: 1;
  position: absolute;
  text-transform: uppercase;
  top: 0;
}

.app[data-theme="frontier"] .app-identity::before {
  color: var(--text-secondary);
  content: "MN / WRKSTN-01";
  left: 0;
}

.app[data-theme="frontier"] .app-identity::after {
  color: var(--system-blue);
  content: "SYNC";
  right: 0;
}

.app[data-theme="frontier"] .brand-mark {
  position: relative;
}

.app[data-theme="frontier"] .brand-mark::after {
  background: var(--selection);
  bottom: 2px;
  content: "";
  height: 3px;
  position: absolute;
  right: -2px;
  width: 9px;
}

.app[data-theme="frontier"] .brand-mark svg {
  color: var(--accent-strong);
}

.app[data-theme="frontier"] .app-identity strong {
  font-size: 14px;
  font-weight: 720;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .app-identity div span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.035em;
  margin-top: 5px;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .eyebrow,
.app[data-theme="frontier"] .project-title-field,
.app[data-theme="frontier"] .search-box span,
.app[data-theme="frontier"] .inspector-stack > label,
.app[data-theme="frontier"] .field-grid > label {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .eyebrow {
  align-items: center;
  display: flex;
  gap: 6px;
}

.app[data-theme="frontier"] .eyebrow::before {
  background: var(--selection);
  content: "";
  height: 5px;
  width: 5px;
}

.app[data-theme="frontier"] .pane-header {
  border-bottom: 1px solid rgba(52, 61, 59, 0.2);
  margin-bottom: 2px;
  min-height: 52px;
  padding-bottom: 8px;
}

.app[data-theme="frontier"] .pane-header h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.012em;
}

.app[data-theme="frontier"] .project-switcher {
  border-bottom: 1px solid rgba(52, 61, 59, 0.18);
  border-top: 1px solid rgba(52, 61, 59, 0.18);
  padding: 10px 0 12px;
}

.app[data-theme="frontier"] .project-switcher select,
.app[data-theme="frontier"] .project-title-input,
.app[data-theme="frontier"] .inspector-stack textarea,
.app[data-theme="frontier"] .inspector-stack input,
.app[data-theme="frontier"] .inspector-stack select,
.app[data-theme="frontier"] .search-box {
  border-radius: 3px;
  box-shadow:
    inset 0 1px rgba(255, 255, 251, 0.72),
    inset 0 -1px rgba(35, 45, 46, 0.045);
}

.app[data-theme="frontier"] .project-progress strong,
.app[data-theme="frontier"] .section-count,
.app[data-theme="frontier"] .sheet-card-footer,
.app[data-theme="frontier"] .editor-meta,
.app[data-theme="frontier"] .editor-footer {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.app[data-theme="frontier"] .project-progress strong {
  color: var(--system-blue);
  font-size: 16px;
}

.app[data-theme="frontier"] .project-progress span,
.app[data-theme="frontier"] .section-button span,
.app[data-theme="frontier"] .sheet-card-footer {
  font-size: 9px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .meter {
  background:
    repeating-linear-gradient(90deg, rgba(35, 45, 46, 0.19) 0 7px, transparent 7px 10px),
    rgba(35, 45, 46, 0.07);
  border-radius: 1px;
  height: 6px;
}

.app[data-theme="frontier"] .meter span {
  background:
    repeating-linear-gradient(90deg, var(--selection) 0 7px, rgba(181, 75, 49, 0.62) 7px 10px);
  box-shadow: none;
}

.app[data-theme="frontier"] .ghost-button,
.app[data-theme="frontier"] .icon-button,
.app[data-theme="frontier"] .command-trigger,
.app[data-theme="frontier"] .compact-command-trigger {
  background: rgba(255, 255, 251, 0.19);
  border-color: rgba(52, 61, 59, 0.23);
  border-radius: 3px;
  box-shadow:
    inset 0 1px rgba(255, 255, 251, 0.66),
    inset 0 -1px rgba(35, 45, 46, 0.06);
}

.app[data-theme="frontier"] .ghost-button:hover,
.app[data-theme="frontier"] .icon-button:hover,
.app[data-theme="frontier"] .command-trigger:hover,
.app[data-theme="frontier"] .compact-command-trigger:hover {
  background: var(--surface-raised);
  border-color: rgba(181, 75, 49, 0.62);
  box-shadow:
    inset 0 -2px var(--selection),
    inset 0 1px rgba(255, 255, 251, 0.76);
}

.app[data-theme="frontier"] .primary-button {
  border-radius: 3px;
  box-shadow: inset 0 -3px var(--selection);
  letter-spacing: 0.02em;
}

.app[data-theme="frontier"] .section-button,
.app[data-theme="frontier"] .sheet-card {
  border-radius: 3px;
}

.app[data-theme="frontier"] .section-button:hover,
.app[data-theme="frontier"] .sheet-card:hover {
  background: rgba(35, 45, 46, 0.045);
  border-color: rgba(52, 61, 59, 0.14);
}

.app[data-theme="frontier"] .section-button.active,
.app[data-theme="frontier"] .sheet-card.active {
  background:
    linear-gradient(90deg, var(--selection-soft), rgba(181, 75, 49, 0.025) 72%),
    rgba(255, 255, 251, 0.16);
  border-color: rgba(181, 75, 49, 0.22);
  box-shadow: inset 3px 0 var(--selection);
}

.app[data-theme="frontier"] .section-button.active strong,
.app[data-theme="frontier"] .sheet-card.active strong {
  color: var(--accent-strong);
}

.app[data-theme="frontier"] .section-count {
  border: 1px solid rgba(49, 91, 100, 0.3);
  color: var(--system-blue);
  min-width: 26px;
  padding: 3px 7px;
}

.app[data-theme="frontier"] .status-dot {
  border-radius: 1px;
  height: 6px;
  width: 6px;
}

.app[data-theme="frontier"] .status-to-write {
  background: #7a817e;
}

.app[data-theme="frontier"] .status-draft {
  background: var(--selection);
}

.app[data-theme="frontier"] .status-revising {
  background: #9a742f;
}

.app[data-theme="frontier"] .status-done {
  background: var(--system-blue);
}

.app[data-theme="frontier"] .editor-shell {
  max-width: 920px;
  padding-top: 50px;
  position: relative;
}

.app[data-theme="frontier"] .editor-shell::before,
.app[data-theme="frontier"] .editor-shell::after {
  display: block;
  font-family: var(--mono);
  pointer-events: none;
  position: absolute;
  top: 22px;
}

.app[data-theme="frontier"] .editor-shell::before {
  border-top: 2px solid var(--selection);
  content: "";
  left: clamp(24px, 5vw, 72px);
  width: 44px;
}

.app[data-theme="frontier"] .editor-shell::after {
  color: var(--system-blue);
  content: "DOC / SERVER 01";
  font-size: 8px;
  font-weight: 720;
  letter-spacing: 0.12em;
  right: clamp(24px, 5vw, 72px);
}

.app[data-theme="frontier"] .mode-switch {
  background: transparent;
  border-bottom: 1px solid rgba(52, 61, 59, 0.2);
  border-radius: 0;
  gap: 0;
  padding: 0;
}

.app[data-theme="frontier"] .mode-switch button {
  border-radius: 0;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.1em;
  min-height: 34px;
  padding: 0 14px;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .mode-switch button:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.app[data-theme="frontier"] .mode-switch button.active {
  background: transparent;
  border-radius: 0;
  box-shadow: inset 0 -3px var(--selection);
  color: var(--accent-strong);
}

.app[data-theme="frontier"] .composer-inspector-toggle {
  background: var(--surface-raised);
  border: 1px solid rgba(52, 61, 59, 0.28);
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(39, 48, 46, 0.1);
  color: var(--text-secondary);
}

.app[data-theme="frontier"] .composer-inspector-toggle:hover,
.app[data-theme="frontier"] .composer-inspector-toggle:focus-visible {
  background: var(--accent-soft);
  border-color: var(--selection);
  box-shadow: 0 1px 6px rgba(39, 48, 46, 0.14);
  color: var(--text-primary);
}

.app[data-theme="frontier"] .composer-inspector-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--selection);
  box-shadow: inset 0 -3px var(--selection);
  color: var(--accent-strong);
}

.app[data-theme="frontier"] .sheet-title-input {
  letter-spacing: -0.018em;
}

.app[data-theme="frontier"] .editor-meta {
  font-size: 9px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .editor-meta span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.app[data-theme="frontier"] .editor-meta span::before {
  background: var(--system-blue);
  content: "";
  height: 5px;
  width: 5px;
}

.app[data-theme="frontier"] .editor-meta span[data-state="saving"]::before {
  background: #9a742f;
}

.app[data-theme="frontier"] .editor-meta span[data-state="error"]::before {
  background: var(--warn);
}

.app[data-theme="frontier"] .editor-footer {
  border-top: 1px solid rgba(52, 61, 59, 0.2);
  font-size: 9px;
  letter-spacing: 0.055em;
  padding-top: 12px;
  text-transform: uppercase;
}

.app[data-theme="frontier"] .editor-footer::before {
  background: var(--system-blue);
  content: "";
  height: 4px;
  margin-right: auto;
  width: 22px;
}

body[data-theme="frontier"] .command-palette-dialog,
body[data-theme="frontier"] .ux-metrics-dialog,
body[data-theme="frontier"] .project-library-panel,
body[data-theme="frontier"] .project-delete-dialog,
body[data-theme="frontier"] .toast,
body[data-theme="frontier"] .context-menu {
  border-color: rgba(52, 61, 59, 0.42);
  border-radius: 4px;
}

body[data-theme="frontier"] .command-palette-dialog::before,
body[data-theme="frontier"] .ux-metrics-dialog::before {
  background: linear-gradient(90deg, var(--selection) 0 78px, var(--system-blue) 78px 112px, transparent 112px);
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}

body[data-theme="frontier"] .command-palette-mark {
  background: var(--system-blue);
  border-radius: 2px;
  color: #f8f6ef;
}

body[data-theme="frontier"] .command-palette-context,
body[data-theme="frontier"] .command-palette-footer,
body[data-theme="frontier"] .command-palette-item-meta,
body[data-theme="frontier"] .ux-metrics-grid span,
body[data-theme="frontier"] .ux-metrics-grid small {
  font-family: var(--mono);
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

body[data-theme="frontier"] .command-palette-item,
body[data-theme="frontier"] .command-palette-item-icon,
body[data-theme="frontier"] .ux-metrics-grid article,
body[data-theme="frontier"] .command-palette-search > kbd,
body[data-theme="frontier"] .command-palette-item-meta kbd,
body[data-theme="frontier"] .command-palette-footer kbd {
  border-radius: 2px;
}

body[data-theme="frontier"] .command-palette-item:hover,
body[data-theme="frontier"] .command-palette-item.active {
  background: linear-gradient(90deg, var(--selection-soft), rgba(181, 75, 49, 0.025));
  box-shadow: inset 3px 0 var(--selection);
}

body[data-theme="frontier"] .ux-metrics-grid strong[data-state="pass"] {
  color: var(--system-blue);
}

@media (max-width: 767px) {
  .app[data-theme="frontier"] .compact-toolbar {
    background:
      linear-gradient(90deg, var(--selection) 0 54px, transparent 54px) left bottom / 100% 2px no-repeat,
      var(--surface-sidebar);
  }

  .app[data-theme="frontier"] .editor-shell {
    padding-top: 42px;
  }

  .app[data-theme="frontier"] .editor-shell::before,
  .app[data-theme="frontier"] .editor-shell::after {
    top: 17px;
  }
}

@media (max-width: 420px) {
  .app[data-theme="frontier"] .editor-shell::after {
    content: "DOC / 01";
  }

  .app[data-theme="frontier"] .mode-switch button {
    letter-spacing: 0.07em;
    padding: 0 10px;
  }
}

/* GEM: Gem City cosmic noir, hotel brass, and prismatic half-light */

body[data-theme="gem"] {
  color-scheme: dark;
  --surface-canvas: #070a09;
  --surface-sidebar: #0e1311;
  --surface-raised: #1a1e1a;
  --surface-overlay: #211d24;
  --surface-selected: rgba(155, 108, 255, 0.2);
  --text-primary: #f3ead3;
  --text-secondary: #c9bea3;
  --text-disabled: #9d957f;
  --border-subtle: rgba(214, 173, 85, 0.27);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #d6ad55;
  --accent-strong: #f0ce7a;
  --accent-soft: rgba(214, 173, 85, 0.13);
  --selection: #9b6cff;
  --selection-soft: rgba(155, 108, 255, 0.18);
  --gem-violet: #9b6cff;
  --gem-brass: #d6ad55;
  --gem-void: #a7c957;
  --gem-wine: #6c294b;
  --gem-teal: #4fa99d;
  --gem-ink: #060808;
  --gem-bone: #f3ead3;
  --warn: #e36a5d;
  --warn-soft: rgba(227, 106, 93, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
  --glow:
    0 0 0 1px rgba(214, 173, 85, 0.62),
    0 0 22px rgba(155, 108, 255, 0.2);
  --screen-grid: transparent;
  --scanline: transparent;
  --text-glow: none;
  --font-ui: "Avenir Next", "Gill Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 89% 8%, rgba(155, 108, 255, 0.17) 0 1.3%, transparent 1.55% 6%, rgba(214, 173, 85, 0.045) 6.2% 6.5%, transparent 6.8%),
    radial-gradient(ellipse at 9% 91%, rgba(167, 201, 87, 0.12) 0 2%, transparent 9%),
    linear-gradient(126deg, transparent 0 72%, rgba(155, 108, 255, 0.055) 72% 72.25%, transparent 72.25%),
    repeating-linear-gradient(90deg, rgba(214, 173, 85, 0.022) 0 1px, transparent 1px 52px),
    var(--surface-canvas);
}

body[data-theme="gem"]::before {
  background:
    linear-gradient(118deg, transparent 0 49.8%, rgba(214, 173, 85, 0.08) 49.9% 50%, transparent 50.1%),
    radial-gradient(ellipse at 50% 105%, rgba(167, 201, 87, 0.08), transparent 48%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

body[data-theme="gem"] ::selection {
  background: var(--gem-violet);
  color: #fff9e8;
}

.app[data-theme="gem"] {
  background: transparent;
  isolation: isolate;
  position: relative;
  z-index: 1;
}

.app[data-theme="gem"] .library-pane,
.app[data-theme="gem"] .sheet-pane,
.app[data-theme="gem"] .inspector-pane {
  background:
    linear-gradient(180deg, rgba(214, 173, 85, 0.035), transparent 76px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 11px),
    rgba(14, 19, 17, 0.975);
  border-color: rgba(214, 173, 85, 0.3);
  box-shadow:
    inset -1px 0 rgba(0, 0, 0, 0.48),
    inset 1px 0 rgba(214, 173, 85, 0.055);
}

.app[data-theme="gem"] .library-pane {
  border-right: 1px solid rgba(214, 173, 85, 0.38);
}

.app[data-theme="gem"] .sheet-pane {
  border-right: 1px solid rgba(155, 108, 255, 0.42);
}

.app[data-theme="gem"] .inspector-pane {
  border-left: 1px solid rgba(167, 201, 87, 0.35);
}

.app[data-theme="gem"] .app-identity {
  background:
    linear-gradient(135deg, rgba(155, 108, 255, 0.12), transparent 38%),
    #111715;
  border: 1px solid rgba(214, 173, 85, 0.64);
  box-shadow:
    inset 0 0 0 3px #0a0d0c,
    inset 0 0 0 4px rgba(214, 173, 85, 0.16),
    0 12px 28px rgba(0, 0, 0, 0.28);
  margin: 1px 0 25px;
  padding: 13px 12px 17px;
  position: relative;
}

.app[data-theme="gem"] .app-identity::before {
  background: linear-gradient(90deg, var(--gem-violet), var(--gem-brass) 46%, var(--gem-void));
  bottom: 0;
  content: "";
  height: 2px;
  left: 12px;
  position: absolute;
  right: 12px;
}

.app[data-theme="gem"] .app-identity::after {
  background: var(--gem-ink);
  border-left: 1px solid var(--gem-brass);
  border-right: 1px solid var(--gem-brass);
  bottom: -10px;
  color: var(--gem-brass);
  content: "HALF-LIGHT / GEM CITY";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 760;
  left: 20px;
  letter-spacing: 0.15em;
  padding: 4px 8px 3px;
  position: absolute;
}

.app[data-theme="gem"] .brand-mark {
  background:
    radial-gradient(ellipse at 50% 50%, var(--gem-ink) 0 19%, var(--gem-violet) 21% 33%, var(--gem-wine) 35% 58%, #101513 60%);
  border: 1px solid var(--gem-brass);
  clip-path: polygon(50% 0, 89% 17%, 100% 50%, 87% 84%, 50% 100%, 13% 84%, 0 50%, 11% 17%);
  height: 42px;
  width: 42px;
}

.app[data-theme="gem"] .brand-mark svg {
  color: var(--gem-bone);
  filter: drop-shadow(0 0 5px rgba(167, 201, 87, 0.54));
  height: 30px;
  width: 24px;
}

.app[data-theme="gem"] .app-identity strong {
  color: var(--gem-bone);
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .app-identity div span {
  color: var(--gem-void);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.045em;
  margin-top: 5px;
  text-transform: uppercase;
}

.app[data-theme="gem"] .command-trigger {
  background: #0a0d0c;
  border: 1px solid var(--gem-brass);
  border-radius: 50%;
  color: var(--gem-brass);
  height: 34px;
  min-width: 34px;
}

.app[data-theme="gem"] .command-trigger:hover {
  background: var(--gem-violet);
  border-color: #e7d99e;
  box-shadow: 0 0 18px rgba(155, 108, 255, 0.42);
  color: #fff9e8;
  transform: translateY(-1px) rotate(5deg);
}

.app[data-theme="gem"] .eyebrow,
.app[data-theme="gem"] .project-title-field,
.app[data-theme="gem"] .search-box span,
.app[data-theme="gem"] .inspector-stack > label,
.app[data-theme="gem"] .field-grid > label {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 740;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .eyebrow {
  align-items: center;
  display: flex;
  gap: 7px;
}

.app[data-theme="gem"] .eyebrow::before {
  background: var(--gem-violet);
  border: 1px solid var(--gem-brass);
  box-shadow: 0 0 8px rgba(155, 108, 255, 0.5);
  content: "";
  height: 7px;
  transform: rotate(45deg);
  width: 7px;
}

.app[data-theme="gem"] .pane-header {
  border-bottom: 1px solid rgba(214, 173, 85, 0.25);
  min-height: 52px;
  padding-bottom: 9px;
  position: relative;
}

.app[data-theme="gem"] .pane-header::after {
  background: linear-gradient(90deg, var(--gem-brass) 0 30px, var(--gem-violet) 30px 48px, transparent 48px);
  bottom: -1px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  width: 78px;
}

.app[data-theme="gem"] .pane-header h2 {
  color: var(--gem-bone);
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.015em;
}

.app[data-theme="gem"] .project-switcher {
  background:
    linear-gradient(145deg, rgba(108, 41, 75, 0.22), transparent 44%),
    #151a17;
  border: 1px solid rgba(214, 173, 85, 0.46);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 3px #0c100e,
    0 12px 24px rgba(0, 0, 0, 0.18);
  margin-bottom: 18px;
  padding: 13px;
  position: relative;
}

.app[data-theme="gem"] .project-switcher:hover,
.app[data-theme="gem"] .project-switcher:focus-visible {
  border-color: var(--gem-brass);
  box-shadow:
    inset 0 0 0 3px #0c100e,
    0 0 0 1px rgba(155, 108, 255, 0.48),
    0 14px 28px rgba(0, 0, 0, 0.26);
}

.app[data-theme="gem"] .project-switcher select,
.app[data-theme="gem"] .project-title-input,
.app[data-theme="gem"] .inspector-stack textarea,
.app[data-theme="gem"] .inspector-stack input,
.app[data-theme="gem"] .inspector-stack select,
.app[data-theme="gem"] .search-box {
  background:
    linear-gradient(90deg, rgba(155, 108, 255, 0.04), transparent 36%),
    #090d0b;
  border: 1px solid rgba(214, 173, 85, 0.28);
  border-radius: 2px;
  box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.42);
  color: var(--text-primary);
}

.app[data-theme="gem"] .search-box {
  margin: 13px 0 15px;
}

.app[data-theme="gem"] .search-box:focus-within,
.app[data-theme="gem"] .project-title-input:focus,
.app[data-theme="gem"] .inspector-stack textarea:focus,
.app[data-theme="gem"] .inspector-stack input:focus,
.app[data-theme="gem"] .inspector-stack select:focus {
  border-color: var(--gem-violet);
  box-shadow:
    inset 0 1px 8px rgba(0, 0, 0, 0.42),
    0 0 0 2px rgba(155, 108, 255, 0.13),
    0 0 18px rgba(155, 108, 255, 0.12);
}

.app[data-theme="gem"] .project-progress div {
  background: rgba(6, 8, 8, 0.72);
  border: 1px solid rgba(214, 173, 85, 0.22);
  border-radius: 2px;
}

.app[data-theme="gem"] .project-progress strong {
  color: var(--gem-brass);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant-numeric: tabular-nums;
}

.app[data-theme="gem"] .project-progress span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .meter {
  background:
    repeating-linear-gradient(90deg, rgba(214, 173, 85, 0.13) 0 10px, transparent 10px 13px),
    #060808;
  border: 1px solid rgba(214, 173, 85, 0.26);
  border-radius: 1px;
  height: 7px;
}

.app[data-theme="gem"] .meter span {
  background: linear-gradient(90deg, var(--gem-wine), var(--gem-violet) 42%, var(--gem-brass) 74%, var(--gem-void));
  box-shadow: 0 0 12px rgba(155, 108, 255, 0.34);
}

.app[data-theme="gem"] .ghost-button,
.app[data-theme="gem"] .icon-button,
.app[data-theme="gem"] .compact-command-trigger {
  background: linear-gradient(180deg, #20251f, #121613);
  border: 1px solid rgba(214, 173, 85, 0.34);
  border-radius: 2px;
  box-shadow:
    inset 0 1px rgba(243, 234, 211, 0.06),
    0 4px 10px rgba(0, 0, 0, 0.16);
  color: var(--text-primary);
}

.app[data-theme="gem"] .ghost-button:hover,
.app[data-theme="gem"] .icon-button:hover,
.app[data-theme="gem"] .compact-command-trigger:hover {
  background: linear-gradient(180deg, #3b2850, #21192d);
  border-color: var(--gem-brass);
  box-shadow:
    inset 0 -2px var(--gem-violet),
    0 0 16px rgba(155, 108, 255, 0.2);
  color: #fff9e8;
  transform: translateY(-1px);
}

.app[data-theme="gem"] .primary-button {
  background: linear-gradient(135deg, #f0ce7a, var(--gem-brass));
  border: 1px solid #f4dda0;
  border-radius: 2px;
  box-shadow:
    inset 0 -3px rgba(79, 46, 10, 0.34),
    0 6px 16px rgba(0, 0, 0, 0.24);
  color: #171108;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .primary-button:hover {
  background: linear-gradient(135deg, #c4e56f, var(--gem-void));
  border-color: #e5f5b8;
  box-shadow:
    inset 0 -3px rgba(44, 65, 14, 0.34),
    0 0 20px rgba(167, 201, 87, 0.24);
  transform: translateY(-1px);
}

.app[data-theme="gem"] .danger-button {
  background: linear-gradient(180deg, #7b3247, #4d1e31);
  border: 1px solid #bd6d7a;
  border-radius: 2px;
  color: #fff0e4;
}

.app[data-theme="gem"] button:active:not(:disabled) {
  transform: translateY(1px);
}

.app[data-theme="gem"] .section-list {
  gap: 7px;
}

.app[data-theme="gem"] .section-button,
.app[data-theme="gem"] .sheet-card {
  background:
    linear-gradient(90deg, rgba(108, 41, 75, 0.12), transparent 32%),
    #141916;
  border: 1px solid rgba(214, 173, 85, 0.17);
  border-radius: 2px;
  box-shadow: inset 2px 0 rgba(214, 173, 85, 0.2);
  position: relative;
  transition:
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.app[data-theme="gem"] .section-button::before,
.app[data-theme="gem"] .sheet-card::before {
  background: var(--gem-brass);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  content: "";
  height: 6px;
  left: 10px;
  opacity: 0.48;
  position: absolute;
  top: -3px;
  width: 6px;
}

.app[data-theme="gem"] .section-button:hover,
.app[data-theme="gem"] .sheet-card:hover {
  background:
    linear-gradient(90deg, rgba(155, 108, 255, 0.16), transparent 46%),
    #1b201d;
  border-color: rgba(155, 108, 255, 0.58);
  box-shadow:
    inset 3px 0 var(--gem-violet),
    0 8px 20px rgba(0, 0, 0, 0.2),
    0 0 14px rgba(155, 108, 255, 0.09);
  transform: translateX(2px);
}

.app[data-theme="gem"] .section-button.active,
.app[data-theme="gem"] .sheet-card.active {
  background:
    radial-gradient(ellipse at 92% 18%, rgba(167, 201, 87, 0.25) 0 3%, transparent 4%),
    linear-gradient(118deg, #4d2543, #36264e 56%, #18241d);
  border-color: var(--gem-brass);
  box-shadow:
    inset 4px 0 var(--gem-violet),
    inset 0 0 0 1px rgba(243, 234, 211, 0.04),
    0 8px 22px rgba(0, 0, 0, 0.27);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.app[data-theme="gem"] .section-button.active strong,
.app[data-theme="gem"] .section-button.active span,
.app[data-theme="gem"] .sheet-card.active strong,
.app[data-theme="gem"] .sheet-card.active p,
.app[data-theme="gem"] .sheet-card.active .sheet-card-footer {
  color: #fff7e4;
}

.app[data-theme="gem"] .section-count {
  background: #080b0a;
  border: 1px solid rgba(214, 173, 85, 0.38);
  border-radius: 50%;
  color: var(--gem-brass);
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  min-width: 25px;
  padding: 4px;
}

.app[data-theme="gem"] .section-button.active .section-count {
  border-color: var(--gem-void);
  color: var(--gem-void);
}

.app[data-theme="gem"] .context-trigger {
  border-radius: 50%;
}

.app[data-theme="gem"] .context-trigger:hover,
.app[data-theme="gem"] .context-trigger:focus-visible {
  background: var(--gem-violet);
  border-color: var(--gem-brass);
  color: #fff9e8;
}

.app[data-theme="gem"] .sheet-card-footer {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 720;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .status-dot {
  border: 1px solid rgba(243, 234, 211, 0.38);
  border-radius: 50%;
  box-shadow: 0 0 7px currentColor;
  height: 7px;
  width: 7px;
}

.app[data-theme="gem"] .status-to-write {
  background: #726b5d;
}

.app[data-theme="gem"] .status-draft {
  background: var(--gem-violet);
}

.app[data-theme="gem"] .status-revising {
  background: var(--gem-brass);
}

.app[data-theme="gem"] .status-done {
  background: var(--gem-void);
}

.app[data-theme="gem"] .editor-pane {
  background:
    radial-gradient(ellipse at 50% 108%, rgba(167, 201, 87, 0.12), transparent 42%),
    radial-gradient(ellipse at 91% 9%, rgba(155, 108, 255, 0.14) 0 1.5%, transparent 1.8% 7%, rgba(214, 173, 85, 0.035) 7.2% 7.5%, transparent 7.8%),
    repeating-linear-gradient(135deg, rgba(214, 173, 85, 0.018) 0 1px, transparent 1px 28px),
    #090c0b;
  padding: 16px;
}

.app[data-theme="gem"] .editor-shell {
  background:
    linear-gradient(90deg, transparent 0 97%, rgba(155, 108, 255, 0.04) 97%),
    radial-gradient(ellipse at 50% 0, rgba(214, 173, 85, 0.055), transparent 42%),
    #101512;
  border: 1px solid rgba(214, 173, 85, 0.6);
  border-radius: 2px;
  box-shadow:
    0 0 0 4px #080b09,
    0 0 0 5px rgba(155, 108, 255, 0.25),
    0 28px 68px rgba(0, 0, 0, 0.52),
    inset 0 0 70px rgba(0, 0, 0, 0.18);
  color: var(--gem-bone);
  height: calc(100% - 10px);
  margin: 5px auto;
  max-width: 920px;
  padding: 49px clamp(24px, 5vw, 72px) 17px;
  position: relative;
}

.app[data-theme="gem"] .editor-shell::before {
  color: var(--gem-brass);
  content: "YOU WALK BETWEEN WORLDS";
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 760;
  left: clamp(24px, 5vw, 72px);
  letter-spacing: 0.18em;
  pointer-events: none;
  position: absolute;
  top: 21px;
  z-index: 0;
}

.app[data-theme="gem"] .editor-shell::after {
  background:
    linear-gradient(90deg, var(--gem-violet) 0 18px, transparent 18px 24px, var(--gem-brass) 24px 52px, transparent 52px 58px, var(--gem-void) 58px);
  content: "";
  height: 3px;
  pointer-events: none;
  position: absolute;
  right: clamp(24px, 5vw, 72px);
  top: 25px;
  width: 82px;
  z-index: 0;
}

.app[data-theme="gem"] .editor-composer-head,
.app[data-theme="gem"] .mode-switch,
.app[data-theme="gem"] .editor-mode-panel,
.app[data-theme="gem"] .editor-footer {
  position: relative;
  z-index: 1;
}

.app[data-theme="gem"] .mode-switch {
  background: #070a09;
  border: 1px solid rgba(214, 173, 85, 0.35);
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(214, 173, 85, 0.04);
  gap: 2px;
  padding: 3px;
}

.app[data-theme="gem"] .mode-switch button {
  border-radius: 1px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .mode-switch button:hover {
  background: rgba(155, 108, 255, 0.12);
  color: var(--gem-bone);
}

.app[data-theme="gem"] .mode-switch button.active {
  background: linear-gradient(135deg, #6c3c92, #493264);
  border: 1px solid rgba(214, 173, 85, 0.55);
  box-shadow:
    inset 0 -2px var(--gem-violet),
    0 0 12px rgba(155, 108, 255, 0.19);
  color: #fff9e8;
}

.app[data-theme="gem"] .composer-inspector-toggle {
  background: #070a09;
  border: 1px solid rgba(214, 173, 85, 0.48);
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(214, 173, 85, 0.04);
  color: var(--text-secondary);
}

.app[data-theme="gem"] .composer-inspector-toggle:hover,
.app[data-theme="gem"] .composer-inspector-toggle:focus-visible {
  background: rgba(155, 108, 255, 0.12);
  border-color: rgba(214, 173, 85, 0.72);
  box-shadow: 0 0 12px rgba(155, 108, 255, 0.19);
  color: var(--gem-bone);
}

.app[data-theme="gem"] .composer-inspector-toggle[aria-pressed="true"] {
  background: linear-gradient(135deg, #6c3c92, #493264);
  border-color: rgba(214, 173, 85, 0.75);
  box-shadow:
    inset 0 -2px var(--gem-violet),
    0 0 12px rgba(155, 108, 255, 0.19);
  color: #fff9e8;
}

.app[data-theme="gem"] .sheet-title-input,
.app[data-theme="gem"] .sheet-body,
.app[data-theme="gem"] .preview-body,
.app[data-theme="gem"] .outline-body {
  color: var(--gem-bone);
  text-shadow: none;
}

.app[data-theme="gem"] .preview-body blockquote,
.app[data-theme="gem"] .outline-item p {
  color: var(--text-secondary);
}

.app[data-theme="gem"] .sheet-title-input {
  color: #fff7e4;
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-weight: 650;
  letter-spacing: -0.018em;
  text-decoration-color: rgba(155, 108, 255, 0.7);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 8px;
}

.app[data-theme="gem"] .sheet-body {
  caret-color: var(--gem-void);
}

.app[data-theme="gem"] .sheet-title-input,
.app[data-theme="gem"] .sheet-body {
  -webkit-user-select: text;
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="gem"] .sheet-title-input:focus-visible,
.app[data-theme="gem"] .sheet-body:focus-visible {
  outline: 1px solid var(--gem-violet);
  outline-offset: 5px;
  box-shadow: 0 0 18px rgba(155, 108, 255, 0.1);
}

.app[data-theme="gem"] .editor-meta,
.app[data-theme="gem"] .editor-footer {
  color: #a89f89;
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .editor-meta span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.app[data-theme="gem"] .editor-meta span::before {
  background: var(--gem-void);
  border-radius: 50%;
  box-shadow: 0 0 7px rgba(167, 201, 87, 0.46);
  content: "";
  height: 5px;
  width: 5px;
}

.app[data-theme="gem"] .editor-meta span[data-state="saving"]::before {
  background: var(--gem-brass);
  box-shadow: 0 0 7px rgba(214, 173, 85, 0.46);
}

.app[data-theme="gem"] .editor-meta span[data-state="error"]::before {
  background: var(--warn);
  box-shadow: 0 0 7px rgba(227, 106, 93, 0.46);
}

.app[data-theme="gem"] .editor-footer {
  border-top: 1px solid rgba(214, 173, 85, 0.22);
  padding-top: 11px;
}

.app[data-theme="gem"] .editor-footer::before {
  background: var(--gem-violet);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  content: "";
  height: 7px;
  margin-right: auto;
  width: 7px;
}

.app[data-theme="gem"] .outline-item {
  background: rgba(108, 41, 75, 0.13);
  border: 1px solid rgba(214, 173, 85, 0.3);
  border-left: 3px solid var(--gem-violet);
  border-radius: 2px;
  color: var(--gem-bone);
}

.app[data-theme="gem"] .composer-focus-toggle {
  background: #101512;
  border: 1px solid var(--gem-brass);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(155, 108, 255, 0.14);
  color: var(--gem-brass);
}

.app[data-theme="gem"] .composer-focus-toggle:hover {
  background: var(--gem-violet);
  color: #fff9e8;
}

body[data-theme="gem"] .project-library-backdrop,
body[data-theme="gem"] .command-palette-backdrop,
body[data-theme="gem"] .ux-metrics-backdrop {
  background:
    linear-gradient(120deg, rgba(5, 7, 7, 0.88), rgba(40, 19, 51, 0.76)),
    rgba(5, 7, 7, 0.86);
  backdrop-filter: blur(9px) saturate(1.12);
}

body[data-theme="gem"] .project-library-panel,
body[data-theme="gem"] .project-delete-dialog,
body[data-theme="gem"] .command-palette-dialog,
body[data-theme="gem"] .ux-metrics-dialog,
body[data-theme="gem"] .toast,
body[data-theme="gem"] .context-menu {
  background:
    radial-gradient(ellipse at 96% 5%, rgba(155, 108, 255, 0.2) 0 2%, transparent 8%),
    linear-gradient(145deg, rgba(108, 41, 75, 0.13), transparent 38%),
    #111613;
  border: 1px solid rgba(214, 173, 85, 0.68);
  border-radius: 2px;
  box-shadow:
    0 0 0 4px #080a09,
    0 0 0 5px rgba(155, 108, 255, 0.22),
    0 28px 80px rgba(0, 0, 0, 0.58);
}

body[data-theme="gem"] .project-library-panel::before,
body[data-theme="gem"] .command-palette-dialog::before,
body[data-theme="gem"] .ux-metrics-dialog::before {
  background: linear-gradient(90deg, var(--gem-violet) 0 34%, var(--gem-brass) 34% 66%, var(--gem-void) 66% 78%, transparent 78%);
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

body[data-theme="gem"] .project-library-head {
  border-bottom: 1px solid rgba(214, 173, 85, 0.34);
}

body[data-theme="gem"] .project-library-head h2,
body[data-theme="gem"] .ux-metrics-head h2 {
  color: var(--gem-bone);
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-weight: 650;
  letter-spacing: 0.025em;
}

body[data-theme="gem"] .project-folder {
  background:
    linear-gradient(135deg, rgba(155, 108, 255, 0.08), transparent 40%),
    #171c19;
  border: 1px solid rgba(214, 173, 85, 0.3);
  border-radius: 2px;
  box-shadow: inset 2px 0 rgba(214, 173, 85, 0.22);
}

body[data-theme="gem"] .project-folder:hover,
body[data-theme="gem"] .project-folder:focus-visible {
  background:
    linear-gradient(135deg, rgba(155, 108, 255, 0.22), transparent 52%),
    #202520;
  border-color: var(--gem-violet);
  box-shadow:
    inset 3px 0 var(--gem-violet),
    0 9px 24px rgba(0, 0, 0, 0.24);
  transform: translateY(-2px);
}

body[data-theme="gem"] .project-folder.active {
  background: linear-gradient(125deg, #4b2541, #312347 60%, #17231c);
  border-color: var(--gem-brass);
  box-shadow:
    inset 4px 0 var(--gem-violet),
    0 10px 28px rgba(0, 0, 0, 0.3);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

body[data-theme="gem"] .project-folder-icon::before,
body[data-theme="gem"] .project-folder-icon::after {
  background: #332640;
  border-color: var(--gem-brass);
  border-radius: 1px;
}

body[data-theme="gem"] .command-palette-search {
  border-bottom: 1px solid rgba(214, 173, 85, 0.35);
}

body[data-theme="gem"] .command-palette-mark {
  background: linear-gradient(135deg, var(--gem-violet), #59367c);
  border: 1px solid var(--gem-brass);
  border-radius: 0;
  box-shadow: 0 0 15px rgba(155, 108, 255, 0.28);
  clip-path: polygon(50% 0, 92% 23%, 92% 77%, 50% 100%, 8% 77%, 8% 23%);
  color: #fff9e8;
}

body[data-theme="gem"] .command-palette-search input {
  color: var(--gem-bone);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  letter-spacing: 0.012em;
}

body[data-theme="gem"] .command-palette-item,
body[data-theme="gem"] .command-palette-item-icon,
body[data-theme="gem"] .command-palette-search > kbd,
body[data-theme="gem"] .command-palette-item-meta kbd,
body[data-theme="gem"] .command-palette-footer kbd {
  border-radius: 2px;
}

body[data-theme="gem"] .command-palette-item:hover,
body[data-theme="gem"] .command-palette-item.active {
  background:
    linear-gradient(90deg, rgba(155, 108, 255, 0.24), rgba(108, 41, 75, 0.16) 62%, transparent),
    #171c19;
  box-shadow: inset 3px 0 var(--gem-violet);
  color: var(--gem-bone);
  transform: translateX(2px);
}

body[data-theme="gem"] .command-palette-item.active .command-palette-item-icon {
  background: var(--gem-brass);
  border-color: #f3dda0;
  color: #171108;
}

body[data-theme="gem"] .ux-metrics-grid article {
  background:
    linear-gradient(145deg, rgba(155, 108, 255, 0.08), transparent 44%),
    #171c19;
  border: 1px solid rgba(214, 173, 85, 0.3);
  border-radius: 2px;
  box-shadow: inset 2px 0 rgba(155, 108, 255, 0.4);
}

body[data-theme="gem"] .ux-metrics-grid strong[data-state="pass"] {
  color: var(--gem-void);
}

body[data-theme="gem"] .context-menu button:hover,
body[data-theme="gem"] .context-menu button:focus-visible {
  background: linear-gradient(90deg, rgba(155, 108, 255, 0.3), transparent);
  box-shadow: inset 3px 0 var(--gem-violet);
  color: var(--gem-bone);
}

.app[data-theme="gem"] .compact-toolbar {
  background:
    linear-gradient(90deg, var(--gem-violet) 0 34%, var(--gem-brass) 34% 70%, var(--gem-void) 70% 82%, transparent 82%) left bottom / 100% 2px no-repeat,
    #0d1210;
  border-bottom: 1px solid rgba(214, 173, 85, 0.35);
}

.app[data-theme="gem"] .compact-nav-button,
.app[data-theme="gem"] .compact-surface-nav button {
  border-radius: 2px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app[data-theme="gem"] .compact-surface-nav button.active {
  background: linear-gradient(135deg, #5f397f, #39264e);
  border-color: var(--gem-brass);
  color: #fff9e8;
  box-shadow: inset 0 -2px var(--gem-violet);
}

body[data-theme="gem"] * {
  scrollbar-color: var(--gem-violet) #101512;
}

@media (max-width: 767px) {
  .app[data-theme="gem"] .editor-pane {
    padding: 10px;
  }

  .app[data-theme="gem"] .editor-shell {
    box-shadow:
      0 0 0 3px #080b09,
      0 0 0 4px rgba(155, 108, 255, 0.24),
      0 18px 38px rgba(0, 0, 0, 0.44);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding-top: 43px;
  }

  .app[data-theme="gem"] .editor-shell::before,
  .app[data-theme="gem"] .editor-shell::after {
    top: 18px;
  }

  .app[data-theme="gem"] .editor-shell::after {
    top: 22px;
  }

  body[data-theme="gem"] .command-palette-dialog,
  body[data-theme="gem"] .ux-metrics-dialog {
    box-shadow:
      0 0 0 3px #080a09,
      0 0 0 4px rgba(155, 108, 255, 0.2),
      0 18px 46px rgba(0, 0, 0, 0.52);
  }
}

@media (max-width: 420px) {
  .app[data-theme="gem"] .editor-shell::before {
    content: "BETWEEN WORLDS";
    font-size: 7px;
    letter-spacing: 0.12em;
  }

  .app[data-theme="gem"] .editor-shell::after {
    width: 52px;
  }

  .app[data-theme="gem"] .mode-switch button {
    letter-spacing: 0.055em;
    padding: 0 9px;
  }
}

/* Project deck and cartridge library */

:root,
.app[data-theme="matrix"],
body[data-theme="matrix"] {
  --project-case: #0a150e;
  --project-case-edge: #254b31;
  --project-case-highlight: #173421;
  --project-case-shadow: #020704;
  --project-screen: #031108;
  --project-screen-text: #a8ffc4;
  --project-screen-muted: #58b978;
  --project-screen-line: rgba(0, 255, 102, 0.22);
  --project-control: #132d1c;
  --project-control-edge: #4f8f62;
  --project-control-text: #b7ffd0;
  --project-slot: #000;
  --cartridge-shell: #183923;
  --cartridge-shell-deep: #07140b;
  --cartridge-edge: #4d8e60;
  --cartridge-label: #d5efdc;
  --cartridge-label-text: #102b19;
  --cartridge-accent: #00ff66;
  --cartridge-contacts: #c4a85b;
  --shelf-surface: #07140c;
  --shelf-edge: #285237;
}

.app[data-theme="frontier"],
body[data-theme="frontier"] {
  --project-case: #bcb8aa;
  --project-case-edge: #494d49;
  --project-case-highlight: #e3e0d6;
  --project-case-shadow: #777a72;
  --project-screen: #202b28;
  --project-screen-text: #ffd98c;
  --project-screen-muted: #aebbaa;
  --project-screen-line: rgba(255, 213, 125, 0.16);
  --project-control: #d0cbbd;
  --project-control-edge: #494d49;
  --project-control-text: #202524;
  --project-slot: #171b19;
  --cartridge-shell: #666c67;
  --cartridge-shell-deep: #303532;
  --cartridge-edge: #202524;
  --cartridge-label: #e8dfc9;
  --cartridge-label-text: #202524;
  --cartridge-accent: #b54b31;
  --cartridge-contacts: #b88a45;
  --shelf-surface: #d0ccc0;
  --shelf-edge: #515650;
}

.app[data-theme="sprypnt"],
body[data-theme="sprypnt"] {
  --project-case: #8f52ff;
  --project-case-edge: #09060d;
  --project-case-highlight: #ff3b9d;
  --project-case-shadow: #09060d;
  --project-screen: #120d18;
  --project-screen-text: #fff8ef;
  --project-screen-muted: #22f1d0;
  --project-screen-line: rgba(34, 241, 208, 0.24);
  --project-control: #ffe34f;
  --project-control-edge: #09060d;
  --project-control-text: #120c18;
  --project-slot: #09060d;
  --cartridge-shell: #ff3b9d;
  --cartridge-shell-deep: #8f52ff;
  --cartridge-edge: #09060d;
  --cartridge-label: #ffe34f;
  --cartridge-label-text: #120c18;
  --cartridge-accent: #22f1d0;
  --cartridge-contacts: #fff8ef;
  --shelf-surface: #171020;
  --shelf-edge: #22f1d0;
}

.app[data-theme="gem"],
body[data-theme="gem"] {
  --project-case: #151a17;
  --project-case-edge: #d6ad55;
  --project-case-highlight: #4b2541;
  --project-case-shadow: #080a09;
  --project-screen: #080d0a;
  --project-screen-text: #f4e8c7;
  --project-screen-muted: #bca9d7;
  --project-screen-line: rgba(155, 108, 255, 0.22);
  --project-control: #312347;
  --project-control-edge: #d6ad55;
  --project-control-text: #fff9e8;
  --project-slot: #030504;
  --cartridge-shell: #312347;
  --cartridge-shell-deep: #120f17;
  --cartridge-edge: #d6ad55;
  --cartridge-label: #efe1bd;
  --cartridge-label-text: #2e2135;
  --cartridge-accent: #9b6cff;
  --cartridge-contacts: #d6ad55;
  --shelf-surface: #101512;
  --shelf-edge: #6c294b;
}

.app[data-theme="moby"],
body[data-theme="moby"] {
  --project-case: #f3eee2;
  --project-case-edge: #171815;
  --project-case-highlight: #fffdf7;
  --project-case-shadow: #a39378;
  --project-screen: #172023;
  --project-screen-text: #f3eee2;
  --project-screen-muted: #a9c4c9;
  --project-screen-line: rgba(219, 237, 239, 0.15);
  --project-control: #f8f3e8;
  --project-control-edge: #171815;
  --project-control-text: #171815;
  --project-slot: #171815;
  --cartridge-shell: #e8e0d0;
  --cartridge-shell-deep: #7a4c2d;
  --cartridge-edge: #171815;
  --cartridge-label: #fffdf7;
  --cartridge-label-text: #171815;
  --cartridge-accent: #7a4c2d;
  --cartridge-contacts: #7a4c2d;
  --shelf-surface: #ede5d7;
  --shelf-edge: #171815;
}

.project-switcher,
.app[data-theme="frontier"] .project-switcher,
.app[data-theme="moby"] .project-switcher,
.app[data-theme="sprypnt"] .project-switcher,
.app[data-theme="gem"] .project-switcher {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
  display: block;
  margin: 0 0 22px;
  overflow: visible;
  padding: 0;
  position: relative;
  transform: none;
}

.project-switcher:hover,
.project-switcher:focus-visible,
.app[data-theme="frontier"] .project-switcher:hover,
.app[data-theme="frontier"] .project-switcher:focus-visible,
.app[data-theme="moby"] .project-switcher:hover,
.app[data-theme="moby"] .project-switcher:focus-visible,
.app[data-theme="sprypnt"] .project-switcher:hover,
.app[data-theme="sprypnt"] .project-switcher:focus-visible,
.app[data-theme="gem"] .project-switcher:hover,
.app[data-theme="gem"] .project-switcher:focus-visible {
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}

.project-selector-label {
  margin: 0 0 6px 3px;
}

#project-switcher.project-switcher {
  display: block;
}

#project-switcher.project-switcher > .project-selector-label {
  display: block;
  margin: 0 0 6px 3px;
}

#project-switcher.project-switcher > .project-device {
  display: block;
  margin: 0;
  width: 100%;
}

.project-device {
  background:
    linear-gradient(145deg, var(--project-case-highlight), transparent 30%),
    linear-gradient(165deg, var(--project-case), var(--project-case-shadow));
  border: 2px solid var(--project-case-edge);
  border-radius: 15px 15px 9px 9px;
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.13),
    inset -3px -3px rgba(0, 0, 0, 0.24),
    0 8px 0 var(--project-case-shadow),
    0 15px 24px rgba(0, 0, 0, 0.2);
  padding: 13px 13px 12px;
  position: relative;
  z-index: 2;
}

.project-device::before {
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent),
    var(--project-case-edge);
  border-radius: 999px;
  content: "";
  height: 4px;
  left: 30%;
  opacity: 0.72;
  position: absolute;
  right: 30%;
  top: 5px;
}

.project-device-fastener {
  background: var(--project-case-edge);
  border: 1px solid var(--project-case-shadow);
  border-radius: 50%;
  box-shadow: inset 1px 1px rgba(255, 255, 255, 0.22);
  height: 5px;
  position: absolute;
  top: 7px;
  width: 5px;
}

.project-device-fastener::after {
  background: var(--project-case-shadow);
  content: "";
  height: 1px;
  left: 1px;
  position: absolute;
  top: 1px;
  transform: rotate(-28deg);
  width: 2px;
}

.project-device-fastener-a {
  left: 8px;
}

.project-device-fastener-b {
  right: 8px;
}

.olde-scroll-roller,
.olde-scroll-inscription,
.olde-dragon-maw {
  display: none;
}

.project-device-screen {
  background:
    radial-gradient(ellipse at 48% 42%, transparent 22%, rgba(0, 0, 0, 0.26) 100%),
    repeating-linear-gradient(0deg, transparent 0 3px, var(--project-screen-line) 3px 4px),
    var(--project-screen);
  border: 4px solid var(--project-case-shadow);
  border-radius: 19px / 12px;
  box-shadow:
    inset 0 0 22px rgba(0, 0, 0, 0.78),
    0 0 0 1px var(--project-case-edge);
  color: var(--project-screen-text);
  min-height: 142px;
  overflow: hidden;
  padding: 17px 16px 13px;
  position: relative;
}

.project-device-screen-glare {
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.15), transparent 24% 76%, rgba(255, 255, 255, 0.04));
  border-radius: inherit;
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.project-device .project-title-field {
  color: var(--project-screen-muted);
  display: grid;
  font-family: var(--mono);
  font-size: 8px;
  gap: 2px;
  letter-spacing: 0.12em;
  position: relative;
  text-transform: uppercase;
  z-index: 3;
}

.project-device .project-title-input,
.app[data-theme="frontier"] .project-device .project-title-input,
.app[data-theme="moby"] .project-device .project-title-input,
.app[data-theme="sprypnt"] .project-device .project-title-input,
.app[data-theme="gem"] .project-device .project-title-input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--project-screen-line);
  border-radius: 0;
  box-shadow: none;
  color: var(--project-screen-text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 760;
  min-height: 30px;
  padding: 3px 0 4px;
  text-shadow: 0 0 10px color-mix(in srgb, var(--project-screen-text) 36%, transparent);
}

.project-device .project-title-input:focus,
.project-device .project-title-input:focus-visible {
  border-color: var(--project-screen-text);
  outline: 0;
}

.project-device .project-progress {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-top: 9px;
  position: relative;
  z-index: 3;
}

.project-device .project-progress div,
.app[data-theme="frontier"] .project-device .project-progress div {
  background: color-mix(in srgb, var(--project-screen-text) 5%, transparent);
  border: 1px solid var(--project-screen-line);
  border-radius: 4px;
  color: var(--project-screen-muted);
  padding: 6px 7px 5px;
}

.project-device .project-progress strong,
.app[data-theme="frontier"] .project-device .project-progress strong {
  color: var(--project-screen-text);
  font-family: var(--mono);
  font-size: 13px;
  text-shadow: 0 0 8px color-mix(in srgb, var(--project-screen-text) 32%, transparent);
}

.project-device .project-progress span {
  color: var(--project-screen-muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-device .meter {
  background: color-mix(in srgb, var(--project-screen-text) 10%, transparent);
  border: 1px solid var(--project-screen-line);
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  position: relative;
  z-index: 3;
}

.project-device .meter span {
  background: var(--project-screen-text);
  box-shadow: 0 0 8px var(--project-screen-text);
}

.project-device-controls {
  align-items: start;
  display: grid;
  gap: 11px 12px;
  grid-template-areas:
    "slot eject"
    "new library";
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, 42px);
  min-height: 95px;
  overflow: visible;
  padding-top: 15px;
  position: relative;
}

.project-device-slot {
  grid-area: slot;
  height: 42px;
  overflow: visible;
  position: relative;
  z-index: 4;
}

.project-device-slot-line {
  background: var(--project-slot);
  border: 1px solid var(--project-case-edge);
  border-radius: 999px;
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.9),
    0 1px rgba(255, 255, 255, 0.12);
  display: block;
  height: 9px;
  left: 2px;
  position: absolute;
  right: 2px;
  top: 15px;
  z-index: 5;
}

.project-eject,
.project-new,
.project-library-open {
  --project-button-face: var(--project-control);
  --project-button-shadow: var(--project-case-shadow);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--project-button-face) 78%, #fff) 0 7%,
      var(--project-button-face) 8% 58%,
      color-mix(in srgb, var(--project-button-face) 72%, #000) 100%
    );
  border: 2px solid var(--project-control-edge);
  border-radius: 6px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.32),
    inset 2px 0 0 rgba(255, 255, 255, 0.12),
    inset -2px 0 0 rgba(0, 0, 0, 0.18),
    inset 0 -3px 0 rgba(0, 0, 0, 0.28),
    0 5px 0 var(--project-button-shadow),
    0 9px 12px rgba(0, 0, 0, 0.24);
  color: var(--project-control-text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  height: 42px;
  letter-spacing: 0.07em;
  padding: 0 8px;
  text-shadow: 0 1px rgba(255, 255, 255, 0.18);
  text-transform: uppercase;
  touch-action: manipulation;
  transform: translateY(0);
  transition:
    box-shadow 80ms ease-out,
    filter 120ms ease-out,
    transform 80ms ease-out;
}

.project-eject {
  grid-area: eject;
}

.project-new {
  grid-area: new;
}

.project-library-open {
  grid-area: library;
}

.project-eject:hover:not(:disabled),
.project-eject:focus-visible,
.project-new:hover,
.project-new:focus-visible,
.project-library-open:hover,
.project-library-open:focus-visible {
  filter: brightness(1.09) saturate(1.04);
  outline: 3px solid var(--cartridge-accent);
  outline-offset: 2px;
}

.project-eject:hover:not(:disabled),
.project-new:hover,
.project-library-open:hover {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.36),
    inset 2px 0 0 rgba(255, 255, 255, 0.14),
    inset -2px 0 0 rgba(0, 0, 0, 0.16),
    inset 0 -3px 0 rgba(0, 0, 0, 0.26),
    0 6px 0 var(--project-button-shadow),
    0 11px 15px rgba(0, 0, 0, 0.27);
  transform: translateY(-1px);
}

.project-eject:active:not(:disabled),
.project-new:active,
.project-library-open:active {
  box-shadow:
    inset 0 3px 0 rgba(0, 0, 0, 0.3),
    inset 2px 0 0 rgba(0, 0, 0, 0.14),
    inset -2px 0 0 rgba(255, 255, 255, 0.1),
    0 1px 0 var(--project-button-shadow),
    0 4px 7px rgba(0, 0, 0, 0.24);
  filter: brightness(0.96);
  transform: translateY(4px);
}

.project-eject:disabled {
  cursor: wait;
  opacity: 0.62;
}

.project-picker-cartridge {
  display: block;
  height: 110px;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 8px;
  transform: translate(-50%, -76px) scale(0.7);
  transform-origin: top center;
  width: 116px;
  z-index: 4;
}

.project-switcher[data-cartridge-motion="ejecting"] .project-picker-cartridge {
  animation: project-cartridge-eject 460ms cubic-bezier(0.2, 0.74, 0.22, 1) both;
}

.project-switcher[data-cartridge-motion="inserting"] .project-picker-cartridge {
  animation: project-cartridge-insert 620ms cubic-bezier(0.5, 0, 0.18, 1) both;
}

@keyframes project-cartridge-eject {
  0% {
    opacity: 0;
    transform: translate(-50%, -72px) scale(0.7);
  }
  18% {
    opacity: 1;
  }
  72% {
    opacity: 1;
    transform: translate(-50%, 18px) rotate(-1deg) scale(0.7);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 50px) rotate(2deg) scale(0.7);
  }
}

@keyframes project-cartridge-insert {
  0% {
    opacity: 1;
    transform: translate(-50%, 58px) rotate(2deg) scale(0.7);
  }
  58% {
    opacity: 1;
    transform: translate(-50%, 2px) rotate(0) scale(0.7);
  }
  86% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -72px) scale(0.7);
  }
}

.project-picker-cartridge,
.project-cartridge-shell {
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(255, 255, 255, 0.09) 8% 11%, transparent 11% 89%, rgba(0, 0, 0, 0.2) 89% 92%, transparent 92%),
    linear-gradient(145deg, color-mix(in srgb, var(--cartridge-shell) 82%, #fff), var(--cartridge-shell) 42%, var(--cartridge-shell-deep));
  border: 2px solid var(--cartridge-edge);
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.12),
    inset -3px -3px rgba(0, 0, 0, 0.22),
    0 6px 0 color-mix(in srgb, var(--cartridge-shell-deep) 82%, #000),
    0 10px 18px rgba(0, 0, 0, 0.25);
  clip-path: polygon(0 12%, 9% 12%, 9% 3%, 23% 3%, 26% 0, 76% 0, 79% 4%, 93% 4%, 93% 12%, 100% 12%, 100% 94%, 88% 94%, 84% 100%, 16% 100%, 12% 94%, 0 94%);
  color: var(--cartridge-label-text);
  overflow: hidden;
}

.project-cartridge-key {
  background: var(--cartridge-accent);
  border: 1px solid var(--cartridge-edge);
  height: 6px;
  position: absolute;
  right: 14px;
  top: 8px;
  transform: skewX(-18deg);
  width: 22px;
}

.project-cartridge-label {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.28), transparent 34%),
    var(--cartridge-label);
  border: 2px solid var(--cartridge-edge);
  bottom: 22px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cartridge-accent) 25%, transparent);
  display: grid;
  left: 12px;
  overflow: hidden;
  padding: 7px 7px 6px;
  position: absolute;
  right: 12px;
  text-align: left;
  top: 23px;
}

.project-cartridge-kicker {
  color: color-mix(in srgb, var(--cartridge-label-text) 72%, transparent);
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.project-cartridge-name {
  align-self: center;
  display: -webkit-box;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.08;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-transform: uppercase;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.project-cartridge-meta {
  align-self: end;
  color: color-mix(in srgb, var(--cartridge-label-text) 72%, transparent);
  font-family: var(--mono);
  font-size: 6px;
  line-height: 1.1;
}

.project-cartridge-contacts {
  background:
    repeating-linear-gradient(90deg, var(--cartridge-contacts) 0 7px, transparent 7px 10px);
  border-top: 2px solid var(--cartridge-edge);
  bottom: 8px;
  height: 7px;
  left: 22px;
  position: absolute;
  right: 22px;
}

.project-picker-cartridge .project-cartridge-meta {
  display: none;
}

.project-library-panel,
body[data-theme="frontier"] .project-library-panel,
body[data-theme="moby"] .project-library-panel,
body[data-theme="sprypnt"] .project-library-panel,
body[data-theme="gem"] .project-library-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.project-library-shelf-head {
  align-items: center;
  background: color-mix(in srgb, var(--shelf-surface) 92%, var(--cartridge-accent));
  border-bottom: 1px solid var(--shelf-edge);
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 760;
  justify-content: space-between;
  letter-spacing: 0.09em;
  padding: 8px 24px;
  text-transform: uppercase;
}

.project-library-grid {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 22% 78%, rgba(0, 0, 0, 0.12)),
    repeating-linear-gradient(
      0deg,
      transparent 0 172px,
      color-mix(in srgb, var(--shelf-edge) 56%, transparent) 172px 176px,
      color-mix(in srgb, var(--shelf-surface) 58%, #000) 176px 188px,
      color-mix(in srgb, var(--shelf-edge) 76%, #000) 188px 191px
    ),
    var(--shelf-surface);
  gap: 16px 14px;
  grid-auto-rows: 175px;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  padding: 12px 22px 24px;
}

.project-folder-item.project-cartridge-item {
  align-self: end;
  height: 168px;
  min-width: 0;
  position: relative;
}

.project-cartridge-card,
body[data-theme="frontier"] .project-cartridge-card,
body[data-theme="moby"] .project-cartridge-card,
body[data-theme="sprypnt"] .project-cartridge-card,
body[data-theme="gem"] .project-cartridge-card {
  align-items: end;
  background: transparent;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  color: var(--text);
  display: grid;
  height: 100%;
  justify-items: center;
  min-height: 0;
  padding: 10px 6px 12px;
  transition: background 170ms ease, box-shadow 170ms ease, transform 170ms ease;
  width: 100%;
}

.project-cartridge-card:hover,
.project-cartridge-card:focus-visible,
body[data-theme="frontier"] .project-cartridge-card:hover,
body[data-theme="frontier"] .project-cartridge-card:focus-visible,
body[data-theme="moby"] .project-cartridge-card:hover,
body[data-theme="moby"] .project-cartridge-card:focus-visible,
body[data-theme="sprypnt"] .project-cartridge-card:hover,
body[data-theme="sprypnt"] .project-cartridge-card:focus-visible,
body[data-theme="gem"] .project-cartridge-card:hover,
body[data-theme="gem"] .project-cartridge-card:focus-visible {
  background: color-mix(in srgb, var(--cartridge-accent) 9%, transparent);
  border: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cartridge-accent) 62%, transparent);
  color: var(--text);
  outline: 0;
  transform: translateY(-2px);
}

.project-cartridge-card.active,
body[data-theme="frontier"] .project-cartridge-card.active,
body[data-theme="moby"] .project-cartridge-card.active,
body[data-theme="sprypnt"] .project-cartridge-card.active,
body[data-theme="gem"] .project-cartridge-card.active {
  background: color-mix(in srgb, var(--cartridge-accent) 14%, transparent);
  border: 0;
  box-shadow: inset 0 0 0 2px var(--cartridge-accent);
  clip-path: none;
  color: var(--text);
}

.project-cartridge-shell,
.project-folder-icon.project-cartridge-shell,
body[data-theme="frontier"] .project-folder-icon.project-cartridge-shell,
body[data-theme="moby"] .project-folder-icon.project-cartridge-shell,
body[data-theme="sprypnt"] .project-folder-icon.project-cartridge-shell,
body[data-theme="gem"] .project-folder-icon.project-cartridge-shell {
  display: block;
  height: 126px;
  margin: 0;
  position: relative;
  transition: filter 170ms ease, transform 170ms ease;
  width: 116px;
}

.project-folder-icon.project-cartridge-shell::before,
.project-folder-icon.project-cartridge-shell::after,
body[data-theme="frontier"] .project-folder-icon.project-cartridge-shell::before,
body[data-theme="frontier"] .project-folder-icon.project-cartridge-shell::after,
body[data-theme="moby"] .project-folder-icon.project-cartridge-shell::before,
body[data-theme="moby"] .project-folder-icon.project-cartridge-shell::after,
body[data-theme="sprypnt"] .project-folder-icon.project-cartridge-shell::before,
body[data-theme="sprypnt"] .project-folder-icon.project-cartridge-shell::after,
body[data-theme="gem"] .project-folder-icon.project-cartridge-shell::before,
body[data-theme="gem"] .project-folder-icon.project-cartridge-shell::after {
  content: none;
}

.project-cartridge-card:hover .project-cartridge-shell,
.project-cartridge-card:focus-visible .project-cartridge-shell {
  filter: brightness(1.08);
  transform: translateY(-4px) rotate(-1deg);
}

.project-cartridge-item.active .project-cartridge-shell {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--cartridge-accent) 52%, transparent));
}

.project-cartridge-item.is-loading .project-cartridge-shell {
  animation: cartridge-read-pulse 480ms ease-in-out infinite alternate;
}

.project-library-overlay.is-open .project-cartridge-item.is-returned {
  animation: cartridge-shelf-return 440ms cubic-bezier(0.16, 1, 0.22, 1) both;
}

@keyframes cartridge-shelf-return {
  from {
    opacity: 0;
    transform: translateY(-76px) rotate(3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes cartridge-read-pulse {
  from { filter: brightness(1) drop-shadow(0 0 0 transparent); }
  to { filter: brightness(1.18) drop-shadow(0 0 8px var(--cartridge-accent)); }
}

.project-cartridge-item .project-context-trigger {
  right: 6px;
  top: 7px;
  z-index: 3;
}

.project-folder-item.dragging {
  opacity: 0.35;
}

.project-drag-preview .project-cartridge-card {
  background: transparent;
  min-height: 42px;
  padding: 0;
}

.project-drag-preview .project-cartridge-shell {
  height: 42px;
  margin: 0;
  transform: scale(0.34);
  transform-origin: top left;
  width: 52px;
}

.app[data-theme="frontier"] .project-device {
  border-radius: 3px 3px 9px 9px;
}

.app[data-theme="frontier"] .project-device::after {
  color: #3e4644;
  content: "MN-07  /  STORY DATA UNIT";
  font-family: var(--mono);
  font-size: 6px;
  left: 15px;
  letter-spacing: 0.08em;
  position: absolute;
  top: 4px;
}

.app[data-theme="sprypnt"] .project-device {
  border-radius: 2px;
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.14),
    6px 6px 0 var(--spray-teal),
    9px 9px 0 #09060d;
  transform: rotate(0.3deg);
}

.app[data-theme="sprypnt"] .project-device::after {
  color: #09060d;
  content: "LOAD YR WORLD";
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 7px;
  font-style: italic;
  letter-spacing: -0.02em;
  position: absolute;
  right: 15px;
  top: 4px;
  transform: rotate(-2deg);
}

.app[data-theme="sprypnt"] .project-eject {
  --project-button-face: var(--spray-yellow);
  --project-button-shadow: #09060d;
}

.app[data-theme="sprypnt"] .project-new {
  --project-button-face: var(--spray-pink);
  --project-button-shadow: var(--spray-purple);
}

.app[data-theme="sprypnt"] .project-library-open {
  --project-button-face: var(--spray-teal);
  --project-button-shadow: #09060d;
}

.app[data-theme="sprypnt"] .project-eject,
.app[data-theme="sprypnt"] .project-new,
.app[data-theme="sprypnt"] .project-library-open {
  --button-shadow-shift: 0px;
  --button-tilt: 0deg;
  background:
    radial-gradient(circle at 82% 24%, rgba(9, 6, 13, 0.24) 0 1px, transparent 2px),
    radial-gradient(circle at 14% 72%, rgba(255, 255, 255, 0.28) 0 1px, transparent 2px),
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(9, 6, 13, 0.055) 11px 12px),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--project-button-face) 78%, #fff) 0 8%,
      var(--project-button-face) 9% 58%,
      color-mix(in srgb, var(--project-button-face) 68%, #000) 100%
    );
  border: 3px solid #09060d;
  border-color: #09060d;
  border-radius: 2px;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.42),
    inset 3px 0 0 rgba(255, 255, 255, 0.12),
    inset -3px 0 0 rgba(0, 0, 0, 0.2),
    inset 0 -5px 0 rgba(0, 0, 0, 0.33),
    0 6px 0 #09060d,
    var(--button-shadow-shift) 9px 0 var(--project-button-shadow),
    0 13px 15px rgba(0, 0, 0, 0.3);
  clip-path: polygon(0 5px, 5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
  color: var(--spray-ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 8px;
  font-style: italic;
  letter-spacing: 0.025em;
  padding: 0 8px 1px 28px;
  position: relative;
  text-align: left;
  text-shadow: none;
  transform: translateY(0) rotate(var(--button-tilt));
  transform-origin: center;
}

.app[data-theme="sprypnt"] .project-eject::before,
.app[data-theme="sprypnt"] .project-new::before,
.app[data-theme="sprypnt"] .project-library-open::before {
  align-items: center;
  background: #09060d;
  color: var(--project-button-face);
  content: var(--button-mark);
  display: flex;
  font-family: var(--mono);
  font-size: 12px;
  font-style: normal;
  height: 20px;
  justify-content: center;
  left: 5px;
  line-height: 1;
  position: absolute;
  top: 7px;
  width: 18px;
}

.app[data-theme="sprypnt"] .project-eject {
  --button-mark: "▲";
  --button-shadow-shift: 3px;
  --button-tilt: -0.65deg;
}

.app[data-theme="sprypnt"] .project-new {
  --button-mark: "+";
  --button-shadow-shift: -3px;
  --button-tilt: 0.8deg;
}

.app[data-theme="sprypnt"] .project-library-open {
  --button-mark: "▤";
  --button-shadow-shift: 3px;
  --button-tilt: -0.4deg;
}

.app[data-theme="sprypnt"] .project-eject:hover:not(:disabled),
.app[data-theme="sprypnt"] .project-new:hover,
.app[data-theme="sprypnt"] .project-library-open:hover {
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.5),
    inset 3px 0 0 rgba(255, 255, 255, 0.14),
    inset -3px 0 0 rgba(0, 0, 0, 0.18),
    inset 0 -5px 0 rgba(0, 0, 0, 0.3),
    0 7px 0 #09060d,
    var(--button-shadow-shift) 10px 0 var(--project-button-shadow),
    0 15px 17px rgba(0, 0, 0, 0.34);
  transform: translateY(-1px) rotate(var(--button-tilt));
}

.app[data-theme="sprypnt"] .project-eject:focus-visible,
.app[data-theme="sprypnt"] .project-new:focus-visible,
.app[data-theme="sprypnt"] .project-library-open:focus-visible {
  filter:
    brightness(1.08)
    saturate(1.06)
    drop-shadow(0 0 2px #fff8ef)
    drop-shadow(0 0 4px var(--cartridge-accent));
  outline: 0;
}

.app[data-theme="sprypnt"] .project-eject:active:not(:disabled),
.app[data-theme="sprypnt"] .project-new:active,
.app[data-theme="sprypnt"] .project-library-open:active {
  box-shadow:
    inset 0 3px 0 rgba(0, 0, 0, 0.3),
    inset 2px 0 0 rgba(0, 0, 0, 0.14),
    inset -2px 0 0 rgba(255, 255, 255, 0.1),
    0 2px 0 #09060d,
    var(--button-shadow-shift) 4px 0 var(--project-button-shadow),
    0 6px 8px rgba(0, 0, 0, 0.26);
  filter: brightness(0.94);
  transform: translateY(4px) rotate(var(--button-tilt));
}

.app[data-theme="sprypnt"] .project-eject:disabled::before {
  opacity: 0.68;
}

.app[data-theme="sprypnt"] .project-eject:disabled {
  transform: translateY(0) rotate(var(--button-tilt));
}

.app[data-theme="gem"] .project-device {
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 3px #090c0a,
    0 0 0 1px rgba(155, 108, 255, 0.35),
    0 10px 0 #080a09,
    0 18px 30px rgba(0, 0, 0, 0.36);
}

.app[data-theme="gem"] .project-device::after {
  color: var(--gem-brass);
  content: "◈  ARCHIVE RELIQUARY  ◈";
  font-family: var(--mono);
  font-size: 6px;
  left: 0;
  letter-spacing: 0.1em;
  position: absolute;
  right: 0;
  text-align: center;
  top: 4px;
}

.app[data-theme="moby"] .project-device {
  border-radius: 0;
  box-shadow:
    inset 0 0 0 3px #fffdf7,
    5px 5px 0 var(--moby-wood);
}

.app[data-theme="moby"] .project-device-screen,
.app[data-theme="moby"] .project-device .project-progress div,
.app[data-theme="moby"] .project-eject,
.app[data-theme="moby"] .project-new,
.app[data-theme="moby"] .project-library-open {
  border-radius: 0;
}

.app[data-theme="moby"] .project-device::after {
  color: var(--moby-ink);
  content: "SHIP'S MANUSCRIPT REGISTER";
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 7px;
  font-weight: 700;
  left: 15px;
  letter-spacing: 0.05em;
  position: absolute;
  top: 3px;
}

body[data-theme="sprypnt"] .project-library-grid {
  background:
    radial-gradient(circle at 4% 13%, rgba(255, 59, 157, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 94% 28%, rgba(255, 227, 79, 0.76) 0 3px, transparent 4px),
    radial-gradient(circle at 88% 76%, rgba(143, 82, 255, 0.48) 0 2px, transparent 3px),
    linear-gradient(90deg, rgba(143, 82, 255, 0.055) 1px, transparent 1px) 0 0 / 82px 100%,
    repeating-linear-gradient(
      0deg,
      transparent 0 174px,
      rgba(255, 59, 157, 0.5) 174px 176px,
      var(--spray-teal) 176px 179px,
      #09060d 179px 189px,
      rgba(143, 82, 255, 0.42) 189px 192px
    ),
    var(--shelf-surface);
  gap: 0 22px;
  grid-auto-rows: 192px;
  grid-template-columns: repeat(auto-fill, minmax(152px, 166px));
  justify-content: start;
  padding: 16px 30px 32px;
  position: relative;
}

/*
 * SPRYPNT Project Library art direction
 *
 * The skin stays loud, but the library follows a disciplined zine grid:
 * fixed cartridge bays, a single control console, and restrained paint texture.
 */

body[data-theme="sprypnt"] .project-library-panel {
  background:
    linear-gradient(118deg, rgba(143, 82, 255, 0.08), transparent 36%),
    radial-gradient(circle at 96% 9%, rgba(34, 241, 208, 0.54) 0 3px, transparent 4px),
    radial-gradient(circle at 92% 13%, rgba(34, 241, 208, 0.28) 0 1px, transparent 2px),
    #180d20;
  border: 2px solid #09060d;
  box-shadow:
    12px 12px 0 var(--spray-pink),
    -7px -7px 0 var(--spray-teal),
    0 30px 80px rgba(0, 0, 0, 0.5);
  isolation: isolate;
}

body[data-theme="sprypnt"] .project-library-panel::before {
  background:
    linear-gradient(
      90deg,
      var(--spray-pink) 0 38%,
      var(--spray-yellow) 38% 61%,
      var(--spray-teal) 61% 82%,
      var(--spray-purple) 82%
    );
  height: 7px;
  transform: none;
}

body[data-theme="sprypnt"] .project-library-panel::after {
  bottom: 7px;
  color: rgba(255, 248, 239, 0.34);
  content: "MN // PROJECT DECK // LIB-01";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.14em;
  pointer-events: none;
  position: absolute;
  right: 16px;
  text-transform: uppercase;
  z-index: 2;
}

body[data-theme="sprypnt"] .project-library-head {
  align-items: center;
  background:
    linear-gradient(112deg, rgba(255, 59, 157, 0.12), transparent 34%),
    linear-gradient(90deg, transparent 0 74%, rgba(143, 82, 255, 0.12) 74% 100%),
    #24112d;
  border-bottom: 0;
  min-height: 132px;
  padding: 28px 32px 24px;
  position: relative;
}

body[data-theme="sprypnt"] .project-library-head::after {
  background:
    linear-gradient(90deg, var(--spray-pink) 0 58%, var(--spray-purple) 58% 75%, transparent 75%);
  bottom: 0;
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  right: 0;
}

body[data-theme="sprypnt"] .project-library-heading {
  align-content: start;
  display: grid;
  justify-items: start;
  min-width: 0;
}

body[data-theme="sprypnt"] .project-library-head .eyebrow {
  background: var(--spray-pink);
  border: 2px solid #09060d;
  box-shadow: 3px 3px 0 var(--spray-teal);
  color: var(--spray-ink);
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin: 0 0 8px 3px;
  padding: 4px 8px 3px;
  text-transform: uppercase;
  transform: rotate(-1.6deg);
}

body[data-theme="sprypnt"] .project-library-head h2 {
  color: #fff8ef;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.84;
  margin-left: -2px;
  max-width: 680px;
  text-shadow: 4px 4px 0 rgba(143, 82, 255, 0.52);
}

body[data-theme="sprypnt"] .project-library-count {
  background: var(--spray-yellow);
  border: 2px solid #09060d;
  box-shadow: 3px 3px 0 var(--spray-purple);
  color: var(--spray-ink);
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 14px 0 0 2px;
  padding: 5px 8px 4px;
  text-transform: uppercase;
  transform: rotate(0.7deg);
}

body[data-theme="sprypnt"] .project-library-actions {
  align-items: center;
  background: rgba(9, 6, 13, 0.62);
  border: 2px solid var(--spray-pink);
  box-shadow:
    5px 5px 0 rgba(143, 82, 255, 0.78),
    inset 0 0 0 1px rgba(255, 248, 239, 0.08);
  gap: 8px;
  padding: 8px;
  transform: rotate(0.25deg);
}

body[data-theme="sprypnt"] .project-library-backup {
  background: #120c18;
  border: 2px solid var(--spray-yellow);
  border-radius: 0;
  box-shadow: none;
  color: #fff8ef;
  display: grid;
  font-family: var(--mono);
  height: 76px;
  padding: 6px;
  place-items: center;
  width: 76px;
}

body[data-theme="sprypnt"] .project-library-backup svg {
  height: 42px;
  stroke-width: 2;
  width: 42px;
}

body[data-theme="sprypnt"] .project-library-backup:hover,
body[data-theme="sprypnt"] .project-library-backup:focus-visible {
  background: var(--spray-teal);
  border-color: #09060d;
  box-shadow: 3px 3px 0 var(--spray-yellow);
  color: var(--spray-ink);
  outline: 0;
  transform: translate(-1px, -1px);
}

body[data-theme="sprypnt"] .project-library-trash {
  background: #120c18;
  border: 2px solid var(--spray-teal);
  border-radius: 0;
  color: #fff8ef;
  display: grid;
  grid-template-rows: 38px auto;
  height: 76px;
  padding: 6px 7px 5px;
  place-items: center;
  width: 76px;
}

body[data-theme="sprypnt"] .project-library-trash::after {
  color: var(--spray-teal);
  content: "TRASH";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

body[data-theme="sprypnt"] .project-library-trash svg {
  height: 31px;
  stroke-width: 2.2;
  width: 31px;
}

body[data-theme="sprypnt"] .project-library-trash:hover,
body[data-theme="sprypnt"] .project-library-trash:focus-visible {
  background: var(--spray-yellow);
  border-color: #09060d;
  box-shadow: 4px 4px 0 var(--spray-pink);
  color: var(--spray-ink);
  outline: 0;
  transform: rotate(-1deg) translate(-1px, -1px);
}

body[data-theme="sprypnt"] .project-library-trash:hover::after,
body[data-theme="sprypnt"] .project-library-trash:focus-visible::after {
  color: var(--spray-ink);
}

body[data-theme="sprypnt"] .project-library-trash.drag-over {
  background: var(--spray-pink);
  border-color: var(--spray-yellow);
  box-shadow:
    0 0 0 4px #09060d,
    6px 6px 0 var(--spray-teal);
  color: var(--spray-ink);
}

body[data-theme="sprypnt"] .project-library-close {
  align-self: start;
  background: var(--spray-pink);
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-teal);
  color: var(--spray-ink);
  height: 44px;
  width: 44px;
}

body[data-theme="sprypnt"] .project-library-close:hover,
body[data-theme="sprypnt"] .project-library-close:focus-visible {
  background: var(--spray-yellow);
  border-color: #09060d;
  box-shadow: 4px 4px 0 var(--spray-purple);
  color: var(--spray-ink);
  outline: 0;
  transform: rotate(2deg) translate(-1px, -1px);
}

body[data-theme="sprypnt"] .project-library-shelf {
  background: #171020;
  position: relative;
}

body[data-theme="sprypnt"] .project-library-shelf-head {
  background:
    linear-gradient(90deg, rgba(255, 59, 157, 0.14), transparent 42%),
    #141b28;
  border-bottom: 2px solid var(--spray-teal);
  border-top: 2px solid #09060d;
  color: #d8c4df;
  font-size: 8px;
  min-height: 40px;
  padding: 10px 30px 9px;
}

body[data-theme="sprypnt"] .project-library-shelf-head span:first-child {
  color: var(--spray-pink);
}

body[data-theme="sprypnt"] .project-library-shelf-head span:first-child::before {
  color: var(--spray-yellow);
  content: "01 / ";
}

body[data-theme="sprypnt"] .project-library-shelf-head span:last-child {
  color: #fff8ef;
}

body[data-theme="sprypnt"] .project-library-grid::after {
  bottom: 18px;
  color: rgba(255, 227, 79, 0.055);
  content: "SPRAY // SAVE // REPEAT";
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(28px, 5vw, 64px);
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 0.78;
  pointer-events: none;
  position: absolute;
  right: 28px;
  text-align: right;
  text-transform: uppercase;
  z-index: 0;
}

body[data-theme="sprypnt"] .project-folder-item.project-cartridge-item {
  align-self: end;
  height: 184px;
  overflow: visible;
  position: relative;
  width: 100%;
  z-index: 1;
}

body[data-theme="sprypnt"] .project-cartridge-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  clip-path: none;
  overflow: visible;
  padding: 20px 10px 18px;
}

body[data-theme="sprypnt"] .project-cartridge-card:hover,
body[data-theme="sprypnt"] .project-cartridge-card:focus-visible {
  background:
    linear-gradient(135deg, rgba(34, 241, 208, 0.1), transparent 58%),
    rgba(143, 82, 255, 0.08);
  box-shadow:
    inset 0 0 0 2px var(--spray-yellow),
    4px 4px 0 rgba(143, 82, 255, 0.72);
  outline: 0;
  transform: translate(-1px, -3px) rotate(-0.35deg);
}

body[data-theme="sprypnt"] .project-cartridge-card.active {
  background:
    linear-gradient(135deg, rgba(255, 59, 157, 0.12), transparent 50%),
    #1e2d37;
  box-shadow:
    inset 0 0 0 3px var(--spray-teal),
    5px 5px 0 var(--spray-pink);
  clip-path: polygon(0 0, 91% 0, 100% 10%, 100% 100%, 0 100%);
}

body[data-theme="sprypnt"] .project-cartridge-item.active::before {
  background: var(--spray-yellow);
  border: 2px solid #09060d;
  box-shadow: 2px 2px 0 var(--spray-pink);
  color: var(--spray-ink);
  content: "LOADED";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  left: 7px;
  letter-spacing: 0.12em;
  padding: 3px 6px 2px;
  position: absolute;
  text-transform: uppercase;
  top: 4px;
  transform: rotate(-2deg);
  z-index: 4;
}

body[data-theme="sprypnt"] .project-cartridge-item.active::after {
  background: var(--spray-yellow);
  border: 2px solid #09060d;
  border-radius: 50%;
  bottom: 7px;
  box-shadow: 0 0 0 2px var(--spray-pink);
  content: "";
  height: 8px;
  position: absolute;
  right: 7px;
  width: 8px;
  z-index: 4;
}

body[data-theme="sprypnt"] .project-cartridge-shell,
body[data-theme="sprypnt"] .project-folder-icon.project-cartridge-shell {
  background:
    radial-gradient(circle at 10px 13px, var(--spray-yellow) 0 2px, #09060d 3px 4px, transparent 5px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 10%, transparent 10% 82%, rgba(9, 6, 13, 0.24) 82% 91%, transparent 91%),
    linear-gradient(145deg, #ff4fa9 0 48%, #d83ba6 48% 72%, #8f52ff 72%);
  border: 3px solid #09060d;
  box-shadow:
    inset 3px 0 rgba(255, 255, 255, 0.12),
    inset -6px 0 rgba(9, 6, 13, 0.18),
    0 6px 0 #532278,
    5px 10px 0 rgba(9, 6, 13, 0.5);
  height: 136px;
  width: 124px;
}

body[data-theme="sprypnt"] .project-cartridge-card:hover .project-cartridge-shell,
body[data-theme="sprypnt"] .project-cartridge-card:focus-visible .project-cartridge-shell {
  filter: brightness(1.05) saturate(1.06);
  transform: translateY(-4px) rotate(-1deg);
}

body[data-theme="sprypnt"] .project-cartridge-item.active .project-cartridge-shell {
  filter:
    drop-shadow(0 0 5px rgba(34, 241, 208, 0.58))
    drop-shadow(3px 3px 0 rgba(143, 82, 255, 0.7));
}

body[data-theme="sprypnt"] .project-cartridge-label {
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.38), transparent 28%),
    repeating-linear-gradient(0deg, rgba(9, 6, 13, 0.045) 0 1px, transparent 1px 5px),
    var(--spray-yellow);
  border: 3px solid #09060d;
  bottom: 22px;
  box-shadow: inset 0 0 0 2px rgba(255, 59, 157, 0.18);
  left: 12px;
  padding: 8px 8px 7px;
  right: 12px;
  top: 24px;
}

body[data-theme="sprypnt"] .project-cartridge-kicker {
  color: rgba(9, 6, 13, 0.72);
  font-size: 6px;
  letter-spacing: 0.11em;
}

body[data-theme="sprypnt"] .project-cartridge-name {
  color: #09060d;
  font-size: 10px;
  line-height: 1.02;
  text-shadow: 1px 0 rgba(255, 59, 157, 0.14);
}

body[data-theme="sprypnt"] .project-cartridge-meta {
  color: rgba(9, 6, 13, 0.7);
  font-size: 6px;
  letter-spacing: 0.025em;
}

body[data-theme="sprypnt"] .project-cartridge-key {
  background: var(--spray-teal);
  border: 2px solid #09060d;
  box-shadow: 2px 2px 0 rgba(9, 6, 13, 0.32);
  height: 7px;
  right: 11px;
  top: 7px;
  width: 24px;
}

body[data-theme="sprypnt"] .project-cartridge-item .project-context-trigger {
  background: #120c18;
  border: 1px solid var(--spray-purple);
  border-radius: 0;
  color: #fff8ef;
  height: 24px;
  right: 6px;
  top: 4px;
  width: 32px;
}

body[data-theme="sprypnt"] .project-cartridge-item .project-context-trigger:hover,
body[data-theme="sprypnt"] .project-cartridge-item .project-context-trigger:focus-visible {
  background: var(--spray-yellow);
  border-color: #09060d;
  box-shadow: 2px 2px 0 var(--spray-pink);
  color: var(--spray-ink);
  outline: 0;
}

body[data-theme="sprypnt"] .project-trash-window {
  background:
    radial-gradient(circle at 92% 13%, rgba(255, 59, 157, 0.56) 0 2px, transparent 3px),
    linear-gradient(118deg, rgba(143, 82, 255, 0.1), transparent 42%),
    #180d20;
}

body[data-theme="sprypnt"] .project-trash-head {
  align-items: center;
  background: #24112d;
  border-bottom: 4px solid var(--spray-pink);
  padding: 24px 30px 20px;
}

body[data-theme="sprypnt"] .project-trash-head .eyebrow {
  color: var(--spray-teal);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .project-trash-head h2 {
  color: #fff8ef;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 0.9;
  margin-top: 6px;
  text-shadow: 4px 4px 0 rgba(143, 82, 255, 0.55);
}

body[data-theme="sprypnt"] .project-trash-head p {
  color: #d8c4df;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

body[data-theme="sprypnt"] .project-trash-close {
  background: var(--spray-teal);
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--spray-purple);
  color: var(--spray-ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.06em;
  min-height: 44px;
  padding: 0 13px;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .project-trash-close:hover,
body[data-theme="sprypnt"] .project-trash-close:focus-visible {
  background: var(--spray-yellow);
  border-color: #09060d;
  box-shadow: 4px 4px 0 var(--spray-pink);
  color: var(--spray-ink);
  outline: 0;
  transform: translate(-1px, -1px);
}

body[data-theme="sprypnt"] .deleted-projects {
  padding: 24px 30px 32px;
}

body[data-theme="sprypnt"] .deleted-projects ul {
  gap: 12px;
}

body[data-theme="sprypnt"] .deleted-project-item {
  background:
    linear-gradient(90deg, rgba(34, 241, 208, 0.08), transparent 30%),
    #21102a;
  border: 2px solid rgba(255, 248, 239, 0.16);
  border-left: 6px solid var(--spray-teal);
  border-radius: 0;
  box-shadow: 5px 5px 0 rgba(143, 82, 255, 0.45);
  min-height: 70px;
  padding: 12px 14px;
}

body[data-theme="sprypnt"] .deleted-project-item strong {
  color: #fff8ef;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 16px;
  font-style: italic;
  line-height: 1;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .deleted-project-item small {
  color: #d8c4df;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
}

body[data-theme="sprypnt"] .deleted-project-actions .ghost-button {
  background: #120c18;
  border: 2px solid var(--spray-teal);
  border-radius: 0;
  color: #fff8ef;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .deleted-project-actions .danger-button {
  background: var(--spray-pink);
  border: 2px solid #09060d;
  border-radius: 0;
  box-shadow: 3px 3px 0 #09060d;
  color: var(--spray-ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

body[data-theme="sprypnt"] .deleted-project-actions button:hover,
body[data-theme="sprypnt"] .deleted-project-actions button:focus-visible {
  background: var(--spray-yellow);
  border-color: #09060d;
  color: var(--spray-ink);
  outline: 0;
  transform: translate(-1px, -1px);
}

body[data-theme="sprypnt"] .deleted-project-empty {
  color: #d8c4df;
  font-family: var(--mono);
}

body[data-theme="sprypnt"] .deleted-project-empty strong {
  background: var(--spray-yellow);
  border: 2px solid #09060d;
  box-shadow: 4px 4px 0 var(--spray-pink);
  color: var(--spray-ink);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 20px;
  font-style: italic;
  padding: 8px 12px;
  text-transform: uppercase;
  transform: rotate(-1deg);
}

@media (max-width: 820px) {
  body[data-theme="sprypnt"] .project-library-head {
    padding-inline: 24px;
  }

  body[data-theme="sprypnt"] .project-library-actions {
    transform: none;
  }

  body[data-theme="sprypnt"] .project-library-grid {
    gap: 0 16px;
    grid-template-columns: repeat(auto-fill, minmax(142px, 154px));
    padding-inline: 22px;
  }
}

@media (max-width: 640px) {
  body[data-theme="sprypnt"] .project-library-head {
    align-items: stretch;
    flex-direction: column;
    padding: 24px 18px 18px;
  }

  body[data-theme="sprypnt"] .project-library-head h2 {
    font-size: clamp(31px, 12vw, 46px);
  }

  body[data-theme="sprypnt"] .project-library-actions {
    display: grid;
    grid-template-columns: 76px 76px 44px;
    justify-content: end;
    width: 100%;
  }

  body[data-theme="sprypnt"] .project-library-backup {
    min-width: 76px;
  }

  body[data-theme="sprypnt"] .project-library-shelf-head {
    padding-inline: 14px;
  }

  body[data-theme="sprypnt"] .project-library-grid {
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 12px 26px;
  }

  body[data-theme="sprypnt"] .project-folder-item.project-cartridge-item {
    height: 178px;
  }

  body[data-theme="sprypnt"] .project-cartridge-shell,
  body[data-theme="sprypnt"] .project-folder-icon.project-cartridge-shell {
    height: 122px;
    width: 112px;
  }

  body[data-theme="sprypnt"] .project-trash-head {
    align-items: stretch;
    flex-direction: column;
    padding: 20px 18px 17px;
  }

  body[data-theme="sprypnt"] .project-trash-close {
    justify-content: center;
    width: 100%;
  }

  body[data-theme="sprypnt"] .deleted-projects {
    padding: 18px;
  }
}

body[data-theme="gem"] .project-library-grid {
  background:
    radial-gradient(circle at 14% 17%, rgba(214, 173, 85, 0.44) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 9%, rgba(155, 108, 255, 0.5) 0 1px, transparent 2px),
    repeating-linear-gradient(0deg, transparent 0 172px, rgba(214, 173, 85, 0.36) 172px 174px, #090c0a 174px 191px),
    var(--shelf-surface);
}

body[data-theme="moby"] .project-library-grid {
  background:
    linear-gradient(90deg, transparent 0 70%, rgba(122, 76, 45, 0.07) 70%),
    repeating-linear-gradient(0deg, transparent 0 172px, var(--moby-ink) 172px 174px, var(--moby-wood) 174px 181px, var(--moby-ink) 181px 184px, transparent 184px 191px),
    var(--shelf-surface);
}

@media (max-width: 1279px) {
  .project-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  }
}

@media (max-width: 820px) {
  .deleted-project-item {
    align-items: stretch;
    flex-direction: column;
  }

  .deleted-project-actions {
    flex-wrap: wrap;
  }

  .deleted-project-actions button {
    flex: 1 1 160px;
  }
}

@media (max-width: 560px) {
  .project-device {
    padding-inline: 11px;
  }

  .project-device-screen {
    min-height: 132px;
    padding-inline: 13px;
  }

  .project-library-shelf-head {
    padding-inline: 16px;
  }

  .project-trash-head {
    align-items: stretch;
    flex-direction: column;
    padding: 18px 16px 14px;
  }

  .project-trash-close {
    justify-content: center;
    width: 100%;
  }

  .deleted-projects {
    padding: 14px;
  }

  .project-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 10px 20px;
  }

  .project-folder-item.project-cartridge-item {
    height: 164px;
  }

  .project-cartridge-card {
    min-height: 0;
    padding-inline: 2px;
  }

  .project-cartridge-shell,
  .project-folder-icon.project-cartridge-shell {
    height: 118px;
    width: 108px;
  }
}

@media (max-width: 360px) {
  .project-device-controls {
    gap: 9px 7px;
  }

  .project-cartridge-shell,
  .project-folder-icon.project-cartridge-shell {
    height: 110px;
    width: 100px;
  }
}

/* OLDE: illuminated manuscript, vellum, rubrication, and black-letter structure */

body[data-theme="olde"] {
  color-scheme: light;
  --surface-canvas: #d8bd85;
  --surface-sidebar: #c8aa70;
  --surface-raised: #e7d2a7;
  --surface-overlay: #f1dfb7;
  --surface-selected: rgba(125, 25, 29, 0.14);
  --text-primary: #1a140c;
  --text-secondary: #4b3a24;
  --text-disabled: #675438;
  --border-subtle: rgba(26, 20, 12, 0.38);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #7d191d;
  --accent-strong: #4e0e10;
  --accent-soft: rgba(125, 25, 29, 0.13);
  --selection: #7d191d;
  --selection-soft: rgba(125, 25, 29, 0.16);
  --olde-parchment: #e7d2a7;
  --olde-parchment-deep: #c8aa70;
  --olde-page: #f5e6bf;
  --olde-ink: #1a140c;
  --olde-rubric: #7d191d;
  --olde-gold: #a77720;
  --olde-blue: #284565;
  --olde-green: #345139;
  --warn: #7d191d;
  --warn-soft: rgba(125, 25, 29, 0.14);
  --shadow:
    8px 8px 0 rgba(26, 20, 12, 0.72),
    -4px -4px 0 rgba(167, 119, 32, 0.7);
  --glow: 0 0 0 3px rgba(125, 25, 29, 0.18);
  --screen-grid: rgba(26, 20, 12, 0.035);
  --scanline: transparent;
  --text-glow: none;
  --font-ui: Baskerville, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-editor-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(125, 25, 29, 0.11) 0 2px, transparent 3px),
    radial-gradient(circle at 91% 14%, rgba(40, 69, 101, 0.1) 0 3px, transparent 4px),
    radial-gradient(ellipse at 18% 86%, rgba(89, 58, 22, 0.12), transparent 31%),
    radial-gradient(ellipse at 82% 78%, rgba(167, 119, 32, 0.1), transparent 34%),
    repeating-linear-gradient(7deg, rgba(75, 48, 18, 0.025) 0 1px, transparent 1px 7px),
    linear-gradient(112deg, rgba(255, 247, 220, 0.32), transparent 42%),
    var(--surface-canvas);
}

body[data-theme="olde"] ::selection {
  background: var(--olde-rubric);
  color: var(--olde-page);
}

.app[data-theme="olde"] {
  background: transparent;
}

.app[data-theme="olde"] .library-pane,
.app[data-theme="olde"] .sheet-pane,
.app[data-theme="olde"] .inspector-pane {
  background:
    linear-gradient(90deg, transparent 0 14px, rgba(125, 25, 29, 0.13) 14px 15px, transparent 15px),
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.028) 0 1px, transparent 1px 23px),
    linear-gradient(145deg, rgba(255, 248, 226, 0.18), transparent 52%),
    rgba(216, 189, 133, 0.96);
  border-color: var(--olde-ink);
  box-shadow: inset 0 0 0 3px rgba(245, 230, 191, 0.24);
}

.app[data-theme="olde"] .library-pane {
  border-right: 3px double var(--olde-ink);
}

.app[data-theme="olde"] .sheet-pane {
  border-right: 3px double var(--olde-rubric);
}

.app[data-theme="olde"] .inspector-pane {
  border-left: 3px double var(--olde-ink);
}

.app[data-theme="olde"] .app-identity {
  background:
    linear-gradient(135deg, rgba(255, 249, 226, 0.54), transparent 38%),
    var(--olde-page);
  border: 4px double var(--olde-ink);
  box-shadow:
    6px 6px 0 var(--olde-rubric),
    -3px -3px 0 var(--olde-gold);
  color: var(--olde-ink);
  margin: 4px 4px 24px 2px;
  padding: 11px 10px;
  position: relative;
  transform: rotate(-0.35deg);
}

.app[data-theme="olde"] .app-identity::after {
  background: var(--olde-ink);
  border: 1px solid var(--olde-gold);
  bottom: -10px;
  color: var(--olde-page);
  content: "SCRIPTORIUM / FOLIO I";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.13em;
  padding: 4px 7px 3px;
  position: absolute;
  right: 12px;
  text-transform: uppercase;
  transform: rotate(1.2deg);
}

.app[data-theme="olde"] .brand-mark {
  background:
    radial-gradient(circle at 50% 50%, var(--olde-gold) 0 28%, transparent 29%),
    var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 50% 46% 50% 43%;
  box-shadow:
    inset 0 0 0 3px var(--olde-page),
    3px 3px 0 var(--olde-ink);
  transform: rotate(-3deg);
}

.app[data-theme="olde"] .brand-mark svg {
  color: var(--olde-ink);
  height: 33px;
  width: 27px;
}

.app[data-theme="olde"] .app-identity strong {
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 17px;
  font-variant: small-caps;
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 0.94;
}

.app[data-theme="olde"] .app-identity div span {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.045em;
  margin-top: 5px;
  text-transform: uppercase;
}

.app[data-theme="olde"] .command-trigger {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-rubric);
  color: var(--olde-page);
}

.app[data-theme="olde"] .command-trigger:hover {
  background: var(--olde-rubric);
  color: var(--olde-page);
  transform: translate(-1px, -1px);
}

.app[data-theme="olde"] .eyebrow,
.app[data-theme="olde"] .project-title-field,
.app[data-theme="olde"] .search-box span,
.app[data-theme="olde"] .inspector-stack > label,
.app[data-theme="olde"] .field-grid > label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

.app[data-theme="olde"] .eyebrow {
  background: var(--olde-rubric);
  border: 1px solid var(--olde-ink);
  color: var(--olde-page);
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 7px 2px;
  transform: rotate(-0.7deg);
}

.app[data-theme="olde"] .pane-header {
  border-bottom: 4px double var(--olde-ink);
  min-height: 50px;
  padding-bottom: 8px;
  position: relative;
}

.app[data-theme="olde"] .pane-header::after {
  color: var(--olde-rubric);
  content: "❦";
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  right: 3px;
  top: 4px;
}

.app[data-theme="olde"] .pane-header h2 {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 20px;
  font-variant: small-caps;
  font-weight: 850;
  letter-spacing: 0.035em;
}

.app[data-theme="olde"] .project-switcher select,
.app[data-theme="olde"] .project-title-input,
.app[data-theme="olde"] .inspector-stack textarea,
.app[data-theme="olde"] .inspector-stack input,
.app[data-theme="olde"] .inspector-stack select,
.app[data-theme="olde"] .search-box {
  background:
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.025) 0 1px, transparent 1px 19px),
    var(--olde-page);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(125, 25, 29, 0.45);
  color: var(--olde-ink);
}

.app[data-theme="olde"] .search-box {
  margin: 13px 4px 14px 0;
}

.app[data-theme="olde"] .search-box:focus-within,
.app[data-theme="olde"] .project-title-input:focus,
.app[data-theme="olde"] .inspector-stack textarea:focus,
.app[data-theme="olde"] .inspector-stack input:focus,
.app[data-theme="olde"] .inspector-stack select:focus {
  border-color: var(--olde-rubric);
  box-shadow:
    0 0 0 2px var(--olde-gold),
    4px 4px 0 var(--olde-ink);
}

.app[data-theme="olde"] .project-progress div,
.app[data-theme="olde"] .section-count {
  background: var(--olde-page);
  border: 1px solid var(--olde-ink);
  border-radius: 0;
}

.app[data-theme="olde"] .project-progress strong {
  color: var(--olde-rubric);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
}

.app[data-theme="olde"] .meter {
  background: var(--olde-ink);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  height: 8px;
  overflow: visible;
}

.app[data-theme="olde"] .meter span {
  background:
    repeating-linear-gradient(90deg, var(--olde-rubric) 0 12px, var(--olde-gold) 12px 15px);
  box-shadow: 2px 2px 0 rgba(26, 20, 12, 0.34);
}

.app[data-theme="olde"] .ghost-button,
.app[data-theme="olde"] .icon-button,
.app[data-theme="olde"] .compact-command-trigger {
  background: var(--olde-page);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-rubric);
  color: var(--olde-ink);
}

.app[data-theme="olde"] .ghost-button:hover,
.app[data-theme="olde"] .icon-button:hover,
.app[data-theme="olde"] .compact-command-trigger:hover {
  background: var(--olde-gold);
  box-shadow: 4px 4px 0 var(--olde-ink);
  color: var(--olde-ink);
  transform: translate(-1px, -1px);
}

.app[data-theme="olde"] .primary-button {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--olde-rubric);
  color: var(--olde-page);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.app[data-theme="olde"] .primary-button:hover {
  background: var(--olde-rubric);
  border-color: var(--olde-ink);
  box-shadow: 5px 5px 0 var(--olde-gold);
  transform: translate(-1px, -1px);
}

.app[data-theme="olde"] .danger-button {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  color: var(--olde-page);
}

.app[data-theme="olde"] .section-list {
  gap: 9px;
}

.app[data-theme="olde"] .section-button,
.app[data-theme="olde"] .sheet-card {
  background:
    linear-gradient(90deg, rgba(125, 25, 29, 0.07), transparent 34%),
    var(--olde-parchment);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(26, 20, 12, 0.32);
  position: relative;
}

.app[data-theme="olde"] .section-button::before,
.app[data-theme="olde"] .sheet-card::before {
  background: var(--olde-rubric);
  content: "";
  height: calc(100% - 10px);
  left: 4px;
  position: absolute;
  top: 5px;
  width: 3px;
}

.app[data-theme="olde"] .section-button:hover,
.app[data-theme="olde"] .sheet-card:hover {
  background: var(--olde-page);
  border-color: var(--olde-rubric);
  box-shadow:
    4px 4px 0 var(--olde-ink),
    inset 0 0 0 2px rgba(167, 119, 32, 0.28);
  transform: translate(-1px, -1px);
}

.app[data-theme="olde"] .section-button.active,
.app[data-theme="olde"] .sheet-card.active {
  background:
    radial-gradient(circle at 92% 16%, var(--olde-gold) 0 3px, transparent 4px),
    var(--olde-page);
  border: 3px double var(--olde-ink);
  box-shadow:
    5px 5px 0 var(--olde-rubric),
    -2px -2px 0 var(--olde-gold);
  color: var(--olde-ink);
  clip-path: polygon(0 0, 96% 0, 100% 10%, 98% 100%, 2% 98%);
}

.app[data-theme="olde"] .section-button.active strong,
.app[data-theme="olde"] .section-button.active span,
.app[data-theme="olde"] .sheet-card.active strong,
.app[data-theme="olde"] .sheet-card.active p,
.app[data-theme="olde"] .sheet-card.active .sheet-card-footer {
  color: var(--olde-ink);
}

.app[data-theme="olde"] .section-count {
  color: var(--olde-rubric);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 850;
}

.app[data-theme="olde"] .section-button.active .section-count {
  background: var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="olde"] .context-trigger {
  border-radius: 0;
}

.app[data-theme="olde"] .context-trigger:hover,
.app[data-theme="olde"] .context-trigger:focus-visible {
  background: var(--olde-rubric);
  border-color: var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="olde"] .sheet-card-footer {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.app[data-theme="olde"] .status-dot {
  border: 1px solid var(--olde-ink);
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.app[data-theme="olde"] .status-to-write {
  background: var(--olde-blue);
}

.app[data-theme="olde"] .status-draft {
  background: var(--olde-rubric);
}

.app[data-theme="olde"] .status-revising {
  background: var(--olde-gold);
}

.app[data-theme="olde"] .status-done {
  background: var(--olde-green);
}

.app[data-theme="olde"] .editor-pane {
  background:
    radial-gradient(circle at 7% 10%, rgba(125, 25, 29, 0.14) 0 2px, transparent 3px),
    radial-gradient(circle at 94% 13%, rgba(40, 69, 101, 0.12) 0 3px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(26, 20, 12, 0.028) 0 1px, transparent 1px 46px),
    linear-gradient(136deg, rgba(255, 246, 215, 0.16), transparent 45%),
    #b99a62;
  padding: 15px;
}

.app[data-theme="olde"] .editor-shell {
  background:
    linear-gradient(90deg, transparent 0 50px, rgba(125, 25, 29, 0.16) 50px 51px, transparent 51px),
    radial-gradient(circle at 96% 7%, rgba(167, 119, 32, 0.18) 0 4px, transparent 5px),
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.022) 0 1px, transparent 1px 25px),
    linear-gradient(126deg, rgba(255, 249, 226, 0.46), transparent 39%),
    var(--olde-page);
  border: 5px double var(--olde-ink);
  box-shadow:
    10px 10px 0 var(--olde-rubric),
    -6px -6px 0 var(--olde-gold),
    0 24px 54px rgba(50, 30, 10, 0.28);
  color: var(--olde-ink);
  height: calc(100% - 10px);
  isolation: isolate;
  margin: 5px auto;
  max-width: 930px;
  padding: 34px clamp(28px, 6vw, 82px) 18px;
  position: relative;
  transform: none;
}

.app[data-theme="olde"] .editor-shell::before {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  box-shadow: 3px 3px 0 var(--olde-gold);
  color: var(--olde-page);
  content: "✦ INCIPIT ✦";
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 9px;
  font-weight: 850;
  left: clamp(24px, 5vw, 70px);
  letter-spacing: 0.12em;
  padding: 4px 10px 3px;
  pointer-events: none;
  position: absolute;
  top: -10px;
  z-index: 0;
}

.app[data-theme="olde"] .editor-shell::after {
  border:
    1px solid color-mix(in srgb, var(--olde-rubric) 48%, transparent);
  box-shadow:
    inset 0 0 0 3px rgba(167, 119, 32, 0.13),
    inset 0 0 0 5px rgba(26, 20, 12, 0.07);
  content: "";
  inset: 15px;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.app[data-theme="olde"] .mode-switch,
.app[data-theme="olde"] .editor-composer-head,
.app[data-theme="olde"] .editor-mode-panel,
.app[data-theme="olde"] .editor-footer {
  position: relative;
  z-index: 1;
}

.app[data-theme="olde"] .mode-switch {
  background: var(--olde-ink);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  gap: 2px;
  padding: 3px;
}

.app[data-theme="olde"] .mode-switch button {
  border-radius: 0;
  color: var(--olde-page);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="olde"] .mode-switch button:hover {
  background: rgba(125, 25, 29, 0.74);
}

.app[data-theme="olde"] .mode-switch button.active {
  background: var(--olde-page);
  border-radius: 0;
  box-shadow:
    inset 0 -3px var(--olde-gold),
    3px 3px 0 var(--olde-rubric);
  color: var(--olde-ink);
  transform: rotate(-0.5deg);
}

.app[data-theme="olde"] .composer-inspector-toggle {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-rubric);
  color: var(--olde-page);
}

.app[data-theme="olde"] .composer-inspector-toggle:hover,
.app[data-theme="olde"] .composer-inspector-toggle:focus-visible {
  background: var(--olde-rubric);
  border-color: var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="olde"] .composer-inspector-toggle[aria-pressed="true"] {
  background: var(--olde-gold);
  border-color: var(--olde-ink);
  color: var(--olde-ink);
  transform: rotate(-0.7deg);
}

.app[data-theme="olde"] .sheet-title-input,
.app[data-theme="olde"] .sheet-body,
.app[data-theme="olde"] .preview-body,
.app[data-theme="olde"] .outline-body {
  color: var(--olde-ink);
  text-shadow: none;
}

.app[data-theme="olde"] .sheet-title-input,
.app[data-theme="olde"] .sheet-body {
  -webkit-user-select: text;
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="olde"] .sheet-title-input {
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
  font-weight: 850;
  letter-spacing: 0.015em;
  text-decoration-color: var(--olde-rubric);
  text-decoration-line: underline;
  text-decoration-style: double;
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
}

.app[data-theme="olde"] .sheet-body {
  caret-color: var(--olde-rubric);
}

.app[data-theme="olde"] .sheet-body > p:first-of-type::first-letter {
  color: var(--olde-rubric);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 2em;
  font-weight: 900;
  line-height: 0.72;
  text-shadow: 1px 1px 0 var(--olde-gold);
}

.app[data-theme="olde"] .sheet-title-input:focus-visible,
.app[data-theme="olde"] .sheet-body:focus-visible {
  outline: 3px double var(--olde-rubric);
  outline-offset: 4px;
}

.app[data-theme="olde"] .composer-toolbar {
  border-bottom: 3px double var(--olde-ink);
}

.app[data-theme="olde"] .composer-toolbar button {
  border-radius: 0;
  color: var(--text-secondary);
}

.app[data-theme="olde"] .composer-toolbar button:hover,
.app[data-theme="olde"] .composer-toolbar button:focus-visible,
.app[data-theme="olde"] .composer-toolbar button[aria-pressed="true"] {
  background: var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="olde"] .composer-toolbar .composer-add-lore {
  background: rgba(26, 20, 12, 0.06);
  border: 1px solid rgba(26, 20, 12, 0.38);
  color: var(--text-disabled);
}

.app[data-theme="olde"] .composer-toolbar .composer-add-lore[data-selection-ready="true"] {
  background: var(--olde-rubric);
  border-color: var(--olde-ink);
  box-shadow:
    inset 0 0 0 2px var(--olde-gold),
    0 3px 0 var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="olde"] .editor-meta,
.app[data-theme="olde"] .editor-footer {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app[data-theme="olde"] .editor-footer {
  border-top: 3px double var(--olde-rubric);
  padding-top: 10px;
}

.app[data-theme="olde"] .outline-item {
  background: rgba(245, 230, 191, 0.7);
  border: 2px solid var(--olde-ink);
  border-left: 6px solid var(--olde-rubric);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(167, 119, 32, 0.42);
  color: var(--olde-ink);
}

.app[data-theme="olde"] .composer-focus-toggle {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-gold);
  color: var(--olde-page);
}

body[data-theme="olde"] .project-library-backdrop,
body[data-theme="olde"] .command-palette-backdrop,
body[data-theme="olde"] .ux-metrics-backdrop,
body[data-theme="olde"] .lore-backdrop,
body[data-theme="olde"] .settings-backdrop,
body[data-theme="olde"] .tenant-admin-backdrop {
  background: rgba(42, 29, 13, 0.58);
  backdrop-filter: blur(5px) sepia(0.22);
}

body[data-theme="olde"] .project-library-panel,
body[data-theme="olde"] .project-delete-dialog,
body[data-theme="olde"] .command-palette-dialog,
body[data-theme="olde"] .ux-metrics-dialog,
body[data-theme="olde"] .lore-panel,
body[data-theme="olde"] .tenant-admin-dialog,
body[data-theme="olde"] .toast,
body[data-theme="olde"] .context-menu {
  background:
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.02) 0 1px, transparent 1px 24px),
    linear-gradient(128deg, rgba(255, 249, 226, 0.5), transparent 40%),
    var(--olde-page);
  border: 5px double var(--olde-ink);
  border-radius: 0;
  box-shadow:
    9px 9px 0 var(--olde-rubric),
    -5px -5px 0 var(--olde-gold),
    0 30px 80px rgba(42, 29, 13, 0.4);
  color: var(--olde-ink);
}

body[data-theme="olde"] .command-palette-dialog::before,
body[data-theme="olde"] .ux-metrics-dialog::before {
  background:
    repeating-linear-gradient(90deg, var(--olde-rubric) 0 34px, var(--olde-gold) 34px 38px, var(--olde-ink) 38px 40px);
  content: "";
  display: block;
  height: 5px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

body[data-theme="olde"] .command-palette-search,
body[data-theme="olde"] .lore-head,
body[data-theme="olde"] .tenant-admin-head {
  border-bottom: 4px double var(--olde-ink);
}

body[data-theme="olde"] .command-palette-mark,
body[data-theme="olde"] .lore-type-badge {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--olde-gold);
  color: var(--olde-page);
}

body[data-theme="olde"] .command-palette-search input,
body[data-theme="olde"] .lore-head h2,
body[data-theme="olde"] .tenant-admin-head h2,
body[data-theme="olde"] .ux-metrics-head h2 {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.035em;
}

body[data-theme="olde"] .command-palette-item,
body[data-theme="olde"] .command-palette-item-icon,
body[data-theme="olde"] .command-palette-search > kbd,
body[data-theme="olde"] .command-palette-item-meta kbd,
body[data-theme="olde"] .command-palette-footer kbd {
  border-radius: 0;
}

body[data-theme="olde"] .command-palette-item:hover,
body[data-theme="olde"] .command-palette-item.active,
body[data-theme="olde"] .context-menu button:hover,
body[data-theme="olde"] .context-menu button:focus-visible {
  background: var(--olde-ink);
  box-shadow: inset 5px 0 var(--olde-rubric);
  color: var(--olde-page);
}

body[data-theme="olde"] .command-palette-item.active .command-palette-item-icon {
  background: var(--olde-gold);
  border-color: var(--olde-page);
  color: var(--olde-ink);
}

body[data-theme="olde"] .ux-metrics-grid article,
body[data-theme="olde"] .tenant-admin-section,
body[data-theme="olde"] .tenant-admin-list-item {
  background: rgba(231, 210, 167, 0.72);
  border: 2px solid var(--olde-ink);
  border-left: 6px solid var(--olde-rubric);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(167, 119, 32, 0.34);
}

body[data-theme="olde"] .lore-panel input,
body[data-theme="olde"] .lore-panel textarea,
body[data-theme="olde"] .lore-panel select,
body[data-theme="olde"] .tenant-admin-dialog input,
body[data-theme="olde"] .tenant-admin-dialog select {
  background: var(--olde-page);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  color: var(--olde-ink);
}

body[data-theme="olde"] .lore-entry-card {
  background: var(--olde-parchment);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(26, 20, 12, 0.28);
}

body[data-theme="olde"] .lore-entry-card:hover,
body[data-theme="olde"] .lore-entry-card:focus-visible,
body[data-theme="olde"] .lore-entry-card[aria-current="true"] {
  background: var(--olde-page);
  border-color: var(--olde-rubric);
  box-shadow: 4px 4px 0 var(--olde-gold);
}

body[data-theme="olde"] .settings-dialog {
  background:
    linear-gradient(90deg, transparent 0 44px, rgba(125, 25, 29, 0.17) 44px 45px, transparent 45px),
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.025) 0 1px, transparent 1px 25px),
    linear-gradient(128deg, rgba(255, 249, 226, 0.52), transparent 38%),
    var(--olde-page);
  border: 5px double var(--olde-ink);
  box-shadow:
    10px 10px 0 var(--olde-rubric),
    -5px -5px 0 var(--olde-gold),
    0 30px 70px rgba(42, 29, 13, 0.34);
  overflow: visible;
  padding-left: clamp(54px, 8vw, 70px);
}

body[data-theme="olde"] .settings-dialog::after {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  bottom: -11px;
  color: var(--olde-page);
  content: "ORDO / OFFICINA";
  font: 800 0.58rem/1 var(--mono);
  letter-spacing: 0.12em;
  padding: 5px 8px 4px;
  position: absolute;
  right: 24px;
}

body[data-theme="olde"] .settings-head {
  border-bottom: 4px double var(--olde-rubric);
}

body[data-theme="olde"] .settings-head h2,
body[data-theme="olde"] .settings-section-copy h3 {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.045em;
}

body[data-theme="olde"] .settings-head .eyebrow,
body[data-theme="olde"] .settings-section .eyebrow {
  color: var(--olde-rubric);
}

body[data-theme="olde"] .settings-close,
body[data-theme="olde"] .tenant-admin-close {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--olde-gold);
  color: var(--olde-page);
}

body[data-theme="olde"] .settings-section {
  background:
    radial-gradient(circle at 91% 16%, rgba(167, 119, 32, 0.24) 0 2px, transparent 3px),
    rgba(231, 210, 167, 0.78);
  border: 2px solid var(--olde-ink);
  box-shadow: 4px 4px 0 rgba(125, 25, 29, 0.38);
}

body[data-theme="olde"] .settings-section:nth-child(2) {
  transform: rotate(-0.2deg);
}

body[data-theme="olde"] .settings-section:nth-child(3) {
  transform: rotate(0.25deg);
}

body[data-theme="olde"] .settings-section-index {
  background: var(--olde-rubric);
  color: var(--olde-page);
  padding: 5px 4px 4px;
  text-align: center;
}

body[data-theme="olde"] .settings-action {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  box-shadow: 4px 4px 0 var(--olde-rubric);
  color: var(--olde-page);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
}

body[data-theme="olde"] .settings-action:hover,
body[data-theme="olde"] .settings-action:focus-visible {
  background: var(--olde-rubric);
  transform: translate(-1px, -1px);
}

body[data-theme="olde"] .settings-action-danger {
  background: var(--olde-rubric);
}

.app[data-theme="olde"],
body[data-theme="olde"] {
  --project-case: #d0b57e;
  --project-case-edge: #1a140c;
  --project-case-highlight: #f5e6bf;
  --project-case-shadow: #775a2a;
  --project-screen: #24251d;
  --project-screen-text: #f5e6bf;
  --project-screen-muted: #cfb878;
  --project-screen-line: rgba(245, 230, 191, 0.14);
  --project-control: #1a140c;
  --project-control-edge: #a77720;
  --project-control-text: #f5e6bf;
  --project-slot: #1a140c;
  --cartridge-shell: #d6bd89;
  --cartridge-shell-deep: #7d191d;
  --cartridge-edge: #1a140c;
  --cartridge-label: #f5e6bf;
  --cartridge-label-text: #1a140c;
  --cartridge-accent: #a77720;
  --cartridge-contacts: #a77720;
  --shelf-surface: #d0b57e;
  --shelf-edge: #1a140c;
}

.app[data-theme="olde"] .project-device {
  background:
    radial-gradient(ellipse at 20% 14%, rgba(255, 252, 227, 0.78), transparent 32%),
    radial-gradient(ellipse at 82% 76%, rgba(125, 25, 29, 0.08), transparent 34%),
    repeating-linear-gradient(0deg, rgba(55, 37, 15, 0.026) 0 1px, transparent 1px 4px),
    linear-gradient(98deg, #c4a66a 0, var(--olde-page) 7%, #f7e8c2 51%, var(--olde-parchment) 94%, #b89352 100%);
  border: 2px solid var(--olde-ink);
  border-radius: 5px 11px 7px 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 221, 0.9),
    inset 13px 0 20px rgba(91, 61, 24, 0.12),
    inset -12px 0 18px rgba(91, 61, 24, 0.12),
    4px 10px 0 rgba(74, 48, 18, 0.34),
    8px 16px 24px rgba(42, 29, 13, 0.23);
  isolation: isolate;
  padding: 31px 14px 33px;
}

.app[data-theme="olde"] .project-device::before {
  background:
    linear-gradient(90deg, transparent, rgba(125, 25, 29, 0.48), transparent) center 7px / calc(100% - 34px) 1px no-repeat,
    linear-gradient(90deg, transparent, var(--olde-ink), transparent) center bottom 7px / calc(100% - 52px) 1px no-repeat;
  border: 0;
  border-radius: 0;
  bottom: 16px;
  content: "";
  height: auto;
  left: 0;
  opacity: 0.74;
  position: absolute;
  right: 0;
  top: 16px;
  z-index: -1;
}

.app[data-theme="olde"] .project-device::after {
  background:
    radial-gradient(circle, var(--olde-rubric) 0 2px, transparent 2.5px) 5px 5px / 16px 16px,
    linear-gradient(90deg, var(--olde-rubric), var(--olde-gold), var(--olde-rubric)) center / calc(100% - 32px) 2px no-repeat;
  bottom: 22px;
  content: "";
  height: 12px;
  left: 8px;
  opacity: 0.68;
  position: absolute;
  right: 8px;
  top: auto;
  transform: none;
  z-index: 1;
}

.app[data-theme="olde"] .project-device-fastener {
  display: none;
}

.app[data-theme="olde"] .olde-scroll-roller {
  background:
    linear-gradient(180deg, rgba(255, 248, 220, 0.88), transparent 34%),
    repeating-linear-gradient(90deg, rgba(50, 32, 12, 0.08) 0 1px, transparent 1px 6px),
    linear-gradient(90deg, #8a612d, #dbbd7d 9%, #f2d99f 50%, #c99f59 91%, #745023);
  border: 2px solid var(--olde-ink);
  border-radius: 50% / 42%;
  box-shadow:
    inset 0 -5px 7px rgba(73, 45, 13, 0.34),
    inset 0 2px rgba(255, 248, 221, 0.62),
    2px 4px 0 rgba(58, 38, 15, 0.34);
  display: block;
  height: 26px;
  left: -7px;
  position: absolute;
  right: -7px;
  z-index: 6;
}

.app[data-theme="olde"] .olde-scroll-roller::before,
.app[data-theme="olde"] .olde-scroll-roller::after {
  background:
    radial-gradient(circle at 38% 34%, var(--olde-gold) 0 2px, transparent 2.5px),
    var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--olde-ink);
  content: "";
  height: 14px;
  position: absolute;
  top: 4px;
  width: 14px;
}

.app[data-theme="olde"] .olde-scroll-roller::before {
  left: -4px;
}

.app[data-theme="olde"] .olde-scroll-roller::after {
  right: -4px;
}

.app[data-theme="olde"] .olde-scroll-roller > span {
  border-bottom: 1px solid rgba(26, 20, 12, 0.74);
  border-top: 1px solid rgba(255, 248, 221, 0.48);
  display: block;
  inset: 9px 17px auto;
  position: absolute;
}

.app[data-theme="olde"] .olde-scroll-roller-top {
  top: -8px;
  transform: rotate(-0.45deg);
}

.app[data-theme="olde"] .olde-scroll-roller-bottom {
  bottom: -9px;
  transform: rotate(0.35deg);
}

.app[data-theme="olde"] .olde-scroll-inscription {
  color: var(--olde-rubric);
  display: block;
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 6px;
  font-variant: small-caps;
  font-weight: 900;
  left: 20px;
  letter-spacing: 0.12em;
  position: absolute;
  right: 20px;
  text-align: center;
  top: 17px;
  z-index: 7;
}

.app[data-theme="olde"] .project-device-screen {
  background:
    radial-gradient(circle at 8px 8px, var(--olde-rubric) 0 1px, transparent 1.5px) 0 0 / 16px 16px,
    linear-gradient(90deg, transparent, rgba(167, 119, 32, 0.1), transparent),
    rgba(255, 247, 220, 0.24);
  border: 1px solid rgba(26, 20, 12, 0.62);
  border-radius: 2px 6px 3px 2px;
  box-shadow:
    inset 0 0 26px rgba(94, 62, 22, 0.12),
    0 0 0 3px rgba(245, 230, 191, 0.72),
    0 0 0 4px var(--olde-rubric),
    0 0 0 6px rgba(245, 230, 191, 0.78),
    0 0 0 7px var(--olde-ink);
  color: var(--olde-ink);
  min-height: 171px;
  overflow: visible;
  padding: 25px 16px 15px;
  position: relative;
}

.app[data-theme="olde"] .project-device-screen::before,
.app[data-theme="olde"] .project-device-screen::after {
  color: var(--olde-rubric);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  position: absolute;
  top: 8px;
}

.app[data-theme="olde"] .project-device-screen::before {
  content: "❧";
  left: 9px;
}

.app[data-theme="olde"] .project-device-screen::after {
  content: "❧";
  right: 9px;
  transform: scaleX(-1);
}

.app[data-theme="olde"] .project-device-screen-glare {
  background:
    linear-gradient(var(--olde-gold), var(--olde-gold)) center 12px / calc(100% - 62px) 1px no-repeat,
    linear-gradient(90deg, var(--olde-rubric), var(--olde-gold), var(--olde-rubric)) center bottom 9px / calc(100% - 32px) 2px no-repeat;
  border-radius: 0;
  opacity: 0.76;
}

.app[data-theme="olde"] .project-device .project-title-field {
  color: var(--olde-rubric);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 8px;
  font-variant: small-caps;
  font-weight: 900;
  gap: 1px;
  letter-spacing: 0.13em;
  text-align: center;
  text-shadow: none;
}

.app[data-theme="olde"] .project-device .project-title-field > span::before,
.app[data-theme="olde"] .project-device .project-title-field > span::after {
  color: var(--olde-gold);
  content: "✦";
  padding: 0 5px;
}

.app[data-theme="olde"] .project-device .project-title-input {
  background: transparent;
  border: 0;
  border-bottom: 3px double var(--olde-rubric);
  border-radius: 0;
  box-shadow: none;
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 17px;
  font-variant: small-caps;
  font-weight: 850;
  letter-spacing: 0.02em;
  min-height: 32px;
  padding: 2px 0 4px;
  text-align: center;
  text-shadow: none;
}

.app[data-theme="olde"] .project-device .project-title-input:focus,
.app[data-theme="olde"] .project-device .project-title-input:focus-visible {
  border-color: var(--olde-rubric);
  outline: 2px dotted var(--olde-gold);
  outline-offset: 3px;
}

.app[data-theme="olde"] .project-device .project-progress {
  gap: 11px;
  margin-top: 12px;
}

.app[data-theme="olde"] .project-device .project-progress div {
  background:
    radial-gradient(circle at 50% 0, rgba(125, 25, 29, 0.1), transparent 56%),
    rgba(245, 230, 191, 0.18);
  border: 3px double var(--olde-ink);
  border-radius: 50% 43% 48% 45% / 12% 15% 13% 16%;
  box-shadow: 1px 2px 0 rgba(125, 25, 29, 0.24);
  color: var(--olde-rubric);
  padding: 6px 4px 5px;
  text-align: center;
  transform: rotate(-0.5deg);
}

.app[data-theme="olde"] .project-device .project-progress div + div {
  transform: rotate(0.65deg);
}

.app[data-theme="olde"] .project-device .project-progress strong {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 14px;
  font-variant-numeric: oldstyle-nums;
  text-shadow: none;
}

.app[data-theme="olde"] .project-device .project-progress span {
  color: var(--olde-rubric);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 7px;
  font-variant: small-caps;
  font-weight: 850;
}

.app[data-theme="olde"] .project-device .meter {
  background:
    linear-gradient(90deg, transparent 0 4%, var(--olde-ink) 4% 96%, transparent 96%) center / 100% 1px no-repeat;
  border: 0;
  height: 9px;
  margin: 9px 8px 0;
  overflow: visible;
}

.app[data-theme="olde"] .project-device .meter::before,
.app[data-theme="olde"] .project-device .meter::after {
  color: var(--olde-rubric);
  content: "✦";
  font-size: 7px;
  position: absolute;
  top: -1px;
}

.app[data-theme="olde"] .project-device .meter::before {
  left: -5px;
}

.app[data-theme="olde"] .project-device .meter::after {
  right: -5px;
}

.app[data-theme="olde"] .project-device .meter span {
  background:
    repeating-linear-gradient(90deg, var(--olde-rubric) 0 10px, var(--olde-gold) 10px 13px);
  border: 1px solid var(--olde-ink);
  box-shadow: none;
  height: 6px;
  position: relative;
  top: 2px;
}

.app[data-theme="olde"] .project-device-controls {
  align-items: stretch;
  gap: 8px 7px;
  grid-template-areas:
    "slot slot slot"
    "eject new library";
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 84px 42px;
  min-height: 134px;
  padding: 6px 1px 0;
}

.app[data-theme="olde"] .project-device-slot {
  align-self: stretch;
  height: 84px;
  overflow: visible;
}

.app[data-theme="olde"] .project-device-slot-line {
  background:
    radial-gradient(ellipse at 50% 42%, #5f0f16 0 24%, #2a0909 51%, var(--olde-ink) 74%);
  border: 2px solid var(--olde-rubric);
  border-radius: 50%;
  box-shadow:
    inset 0 4px 7px #080503,
    0 0 0 2px var(--olde-ink),
    0 2px 0 var(--olde-gold);
  height: 30px;
  left: 13%;
  opacity: 0.92;
  right: 13%;
  top: 28px;
  transform: scaleY(0.42);
  transform-origin: center;
  transition: transform 150ms ease;
  z-index: 3;
}

.app[data-theme="olde"] .olde-dragon-maw {
  color: var(--olde-ink);
  display: block;
  height: 86px;
  inset: -1px 0 auto;
  overflow: visible;
  pointer-events: none;
  position: absolute;
  width: 100%;
  z-index: 5;
}

.app[data-theme="olde"] .olde-dragon-hide {
  fill: var(--olde-rubric);
  stroke: var(--olde-ink);
  stroke-linejoin: round;
  stroke-width: 3;
}

.app[data-theme="olde"] .olde-dragon-horn,
.app[data-theme="olde"] .olde-dragon-whisker,
.app[data-theme="olde"] .olde-dragon-brow,
.app[data-theme="olde"] .olde-dragon-pupil,
.app[data-theme="olde"] .olde-dragon-nostril,
.app[data-theme="olde"] .olde-dragon-scale {
  fill: none;
  stroke: var(--olde-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app[data-theme="olde"] .olde-dragon-horn {
  fill: var(--olde-gold);
  stroke-width: 3;
}

.app[data-theme="olde"] .olde-dragon-whisker {
  stroke-width: 2;
}

.app[data-theme="olde"] .olde-dragon-brow,
.app[data-theme="olde"] .olde-dragon-pupil,
.app[data-theme="olde"] .olde-dragon-nostril {
  stroke-width: 2.5;
}

.app[data-theme="olde"] .olde-dragon-scale {
  stroke: var(--olde-gold);
  stroke-width: 2;
}

.app[data-theme="olde"] .olde-dragon-eye {
  fill: var(--olde-gold);
  stroke: var(--olde-ink);
  stroke-width: 2;
}

.app[data-theme="olde"] .olde-dragon-teeth {
  fill: var(--olde-page);
  stroke: var(--olde-ink);
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.app[data-theme="olde"] .olde-dragon-upper,
.app[data-theme="olde"] .olde-dragon-lower {
  transform-box: fill-box;
  transform-origin: center;
}

.app[data-theme="olde"] .olde-dragon-upper {
  transform: translateY(7px);
}

.app[data-theme="olde"] .olde-dragon-lower {
  transform: translateY(-7px);
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="ejecting"] .project-device-slot-line,
.app[data-theme="olde"] .project-switcher[data-cartridge-motion="inserting"] .project-device-slot-line {
  transform: scaleY(1);
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="ejecting"] .olde-dragon-upper {
  animation: olde-dragon-upper-eject 460ms cubic-bezier(0.25, 0.72, 0.2, 1) both;
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="ejecting"] .olde-dragon-lower {
  animation: olde-dragon-lower-eject 460ms cubic-bezier(0.25, 0.72, 0.2, 1) both;
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="inserting"] .olde-dragon-upper {
  animation: olde-dragon-upper-insert 620ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="inserting"] .olde-dragon-lower {
  animation: olde-dragon-lower-insert 620ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes olde-dragon-upper-eject {
  0%,
  14% {
    transform: translateY(7px) rotate(0);
  }

  34%,
  78% {
    transform: translateY(-9px) rotate(-1deg);
  }

  100% {
    transform: translateY(-3px) rotate(0);
  }
}

@keyframes olde-dragon-lower-eject {
  0%,
  14% {
    transform: translateY(-7px) rotate(0);
  }

  34%,
  78% {
    transform: translateY(9px) rotate(1deg);
  }

  100% {
    transform: translateY(3px) rotate(0);
  }
}

@keyframes olde-dragon-upper-insert {
  0%,
  54% {
    transform: translateY(-9px) rotate(-1deg);
  }

  78% {
    transform: translateY(10px) rotate(0.8deg);
  }

  100% {
    transform: translateY(7px) rotate(0);
  }
}

@keyframes olde-dragon-lower-insert {
  0%,
  54% {
    transform: translateY(9px) rotate(1deg);
  }

  78% {
    transform: translateY(-10px) rotate(-0.8deg);
  }

  100% {
    transform: translateY(-7px) rotate(0);
  }
}

.app[data-theme="olde"] .project-picker-cartridge {
  background:
    linear-gradient(90deg, rgba(90, 55, 17, 0.22), transparent 12% 88%, rgba(90, 55, 17, 0.22)),
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.05) 0 1px, transparent 1px 5px),
    var(--olde-page);
  border: 2px solid var(--olde-ink);
  border-radius: 5px;
  box-shadow:
    inset 5px 0 6px rgba(106, 71, 27, 0.15),
    inset -5px 0 6px rgba(106, 71, 27, 0.15),
    2px 4px 0 rgba(26, 20, 12, 0.42);
  clip-path: none;
  height: 78px;
  overflow: visible;
  top: 20px;
  width: 76px;
  z-index: 4;
}

.app[data-theme="olde"] .project-picker-cartridge::before,
.app[data-theme="olde"] .project-picker-cartridge::after {
  background: linear-gradient(180deg, var(--olde-page), #b89151);
  border: 2px solid var(--olde-ink);
  border-radius: 50%;
  content: "";
  height: 9px;
  left: -6px;
  position: absolute;
  right: -6px;
}

.app[data-theme="olde"] .project-picker-cartridge::before {
  top: -5px;
}

.app[data-theme="olde"] .project-picker-cartridge::after {
  bottom: -5px;
}

.app[data-theme="olde"] .project-picker-cartridge .project-cartridge-key {
  background: var(--olde-rubric);
  border: 1px solid var(--olde-ink);
  border-radius: 50%;
  height: 10px;
  left: auto;
  right: 4px;
  top: 5px;
  transform: none;
  width: 10px;
}

.app[data-theme="olde"] .project-picker-cartridge .project-cartridge-label {
  background: transparent;
  border: 0;
  bottom: 8px;
  box-shadow: none;
  inset: 10px 6px 8px;
  padding: 4px 2px;
  text-align: center;
}

.app[data-theme="olde"] .project-picker-cartridge .project-cartridge-kicker {
  color: var(--olde-rubric);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 4px;
  letter-spacing: 0.04em;
}

.app[data-theme="olde"] .project-picker-cartridge .project-cartridge-name {
  -webkit-line-clamp: 3;
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 8px;
  font-variant: small-caps;
  line-height: 1.05;
}

.app[data-theme="olde"] .project-picker-cartridge .project-cartridge-contacts {
  display: none;
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="ejecting"] .project-picker-cartridge {
  animation: olde-scroll-cartridge-eject 460ms cubic-bezier(0.2, 0.74, 0.22, 1) both;
}

.app[data-theme="olde"] .project-switcher[data-cartridge-motion="inserting"] .project-picker-cartridge {
  animation: olde-scroll-cartridge-insert 620ms cubic-bezier(0.5, 0, 0.18, 1) both;
}

@keyframes olde-scroll-cartridge-eject {
  0% {
    opacity: 0;
    transform: translate(-50%, -55px) scale(0.6);
  }

  18% {
    opacity: 1;
  }

  68% {
    opacity: 1;
    transform: translate(-50%, 8px) rotate(-2deg) scale(0.68);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, 53px) rotate(3deg) scale(0.7);
  }
}

@keyframes olde-scroll-cartridge-insert {
  0% {
    opacity: 1;
    transform: translate(-50%, 56px) rotate(3deg) scale(0.7);
  }

  56% {
    opacity: 1;
    transform: translate(-50%, -4px) rotate(0) scale(0.66);
  }

  82% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -57px) scale(0.58);
  }
}

.app[data-theme="olde"] .project-eject,
.app[data-theme="olde"] .project-new,
.app[data-theme="olde"] .project-library-open {
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 247, 220, 0.38), transparent 28%),
    color-mix(in srgb, var(--project-button-face) 28%, var(--olde-page));
  border: 2px solid var(--olde-ink);
  border-radius: 46% 48% 43% 51% / 11% 16% 13% 15%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 226, 0.48),
    2px 3px 0 rgba(26, 20, 12, 0.34);
  clip-path: polygon(2% 8%, 98% 2%, 96% 94%, 4% 100%);
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: 7px;
  font-variant: small-caps;
  font-weight: 900;
  height: 40px;
  letter-spacing: 0.035em;
  overflow: visible;
  padding: 0 3px;
  position: relative;
  text-shadow: none;
  transform: rotate(-0.7deg);
}

.app[data-theme="olde"] .project-eject::before,
.app[data-theme="olde"] .project-new::before,
.app[data-theme="olde"] .project-library-open::before {
  background:
    linear-gradient(105deg, transparent 0 34%, rgba(26, 20, 12, 0.1) 35% 37%, transparent 38%),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(26, 20, 12, 0.05) 4px 5px);
  content: "";
  inset: 2px;
  pointer-events: none;
  position: absolute;
}

.app[data-theme="olde"] .project-eject::after,
.app[data-theme="olde"] .project-new::after,
.app[data-theme="olde"] .project-library-open::after {
  border: 1px solid color-mix(in srgb, var(--olde-ink) 72%, transparent);
  border-radius: inherit;
  content: "";
  inset: -4px -3px -2px -4px;
  pointer-events: none;
  position: absolute;
  transform: rotate(1.5deg);
}

.app[data-theme="olde"] .project-eject {
  --project-button-face: var(--olde-gold);
  transform: rotate(-0.9deg);
}

.app[data-theme="olde"] .project-new {
  --project-button-face: var(--olde-rubric);
  color: #3c0b0d;
  transform: rotate(0.8deg);
}

.app[data-theme="olde"] .project-library-open {
  --project-button-face: var(--olde-gold);
  transform: rotate(-0.25deg);
}

.app[data-theme="olde"] .project-eject:hover:not(:disabled),
.app[data-theme="olde"] .project-eject:focus-visible,
.app[data-theme="olde"] .project-new:hover,
.app[data-theme="olde"] .project-new:focus-visible,
.app[data-theme="olde"] .project-library-open:hover,
.app[data-theme="olde"] .project-library-open:focus-visible {
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 247, 220, 0.38), transparent 28%),
    color-mix(in srgb, var(--project-button-face) 54%, var(--olde-page));
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 226, 0.54),
    3px 4px 0 rgba(26, 20, 12, 0.42);
  filter: none;
  outline: 2px dotted var(--olde-rubric);
  outline-offset: 3px;
  transform: translate(-1px, -1px) rotate(-0.4deg);
}

.app[data-theme="olde"] .project-eject:active:not(:disabled),
.app[data-theme="olde"] .project-new:active,
.app[data-theme="olde"] .project-library-open:active {
  box-shadow:
    inset 1px 2px 0 rgba(26, 20, 12, 0.22),
    1px 1px 0 rgba(26, 20, 12, 0.34);
  transform: translate(2px, 2px) rotate(0.4deg);
}

.app[data-theme="olde"] .project-eject:disabled {
  cursor: wait;
  filter: grayscale(0.5);
  opacity: 0.56;
}

body[data-theme="olde"] .project-library-panel {
  background:
    linear-gradient(90deg, transparent 0 32px, rgba(125, 25, 29, 0.15) 32px 33px, transparent 33px),
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.024) 0 1px, transparent 1px 25px),
    linear-gradient(128deg, rgba(255, 249, 226, 0.5), transparent 38%),
    var(--olde-page);
  isolation: isolate;
}

body[data-theme="olde"] .project-library-panel::before {
  background:
    repeating-linear-gradient(90deg, var(--olde-rubric) 0 52px, var(--olde-gold) 52px 57px, var(--olde-ink) 57px 60px);
  content: "";
  height: 7px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

body[data-theme="olde"] .project-library-panel::after {
  bottom: 7px;
  color: rgba(26, 20, 12, 0.36);
  content: "MUNINN · ARMARIUM · FOLIO I";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.14em;
  pointer-events: none;
  position: absolute;
  right: 16px;
  text-transform: uppercase;
  z-index: 2;
}

body[data-theme="olde"] .project-library-head {
  align-items: center;
  background:
    radial-gradient(circle at 94% 17%, rgba(167, 119, 32, 0.2) 0 4px, transparent 5px),
    linear-gradient(112deg, rgba(125, 25, 29, 0.08), transparent 34%),
    var(--olde-parchment);
  border-bottom: 4px double var(--olde-rubric);
  min-height: 132px;
  padding: 28px 32px 24px;
}

body[data-theme="olde"] .project-library-head .eyebrow {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  box-shadow: 3px 3px 0 var(--olde-gold);
  color: var(--olde-page);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin: 0 0 8px 3px;
  padding: 4px 8px 3px;
  text-transform: uppercase;
}

body[data-theme="olde"] .project-library-head h2 {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: clamp(34px, 5vw, 58px);
  font-variant: small-caps;
  letter-spacing: 0.025em;
  line-height: 0.84;
  margin-left: -2px;
  text-shadow: 3px 3px 0 rgba(167, 119, 32, 0.36);
}

body[data-theme="olde"] .project-library-count {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  box-shadow: 3px 3px 0 var(--olde-rubric);
  color: var(--olde-page);
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 14px 0 0 2px;
  padding: 5px 8px 4px;
  text-transform: uppercase;
}

body[data-theme="olde"] .project-library-actions {
  background: rgba(245, 230, 191, 0.62);
  border: 4px double var(--olde-ink);
  box-shadow: 5px 5px 0 var(--olde-rubric);
  gap: 8px;
  padding: 8px;
}

body[data-theme="olde"] .project-library-backup,
body[data-theme="olde"] .project-library-trash {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 0;
  color: var(--olde-page);
  height: 76px;
  width: 76px;
}

body[data-theme="olde"] .project-library-backup:hover,
body[data-theme="olde"] .project-library-backup:focus-visible,
body[data-theme="olde"] .project-library-trash:hover,
body[data-theme="olde"] .project-library-trash:focus-visible {
  background: var(--olde-rubric);
  border-color: var(--olde-ink);
  box-shadow: 3px 3px 0 var(--olde-gold);
  color: var(--olde-page);
  outline: 0;
  transform: translate(-1px, -1px);
}

body[data-theme="olde"] .project-library-trash::after {
  color: var(--olde-gold);
  content: "OBLIVION";
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

body[data-theme="olde"] .project-library-close {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--olde-gold);
  color: var(--olde-page);
}

body[data-theme="olde"] .project-library-shelf {
  background: var(--olde-parchment-deep);
}

body[data-theme="olde"] .project-library-shelf-head {
  background:
    linear-gradient(90deg, rgba(125, 25, 29, 0.11), transparent 42%),
    var(--olde-parchment);
  border-bottom: 3px double var(--olde-ink);
  border-top: 2px solid var(--olde-rubric);
  color: var(--text-secondary);
  font-size: 8px;
  min-height: 40px;
  padding: 10px 30px 9px;
}

body[data-theme="olde"] .project-library-shelf-head span:first-child {
  color: var(--olde-rubric);
}

body[data-theme="olde"] .project-library-shelf-head span:first-child::before {
  color: var(--olde-gold);
  content: "FOL. I / ";
}

body[data-theme="olde"] .project-library-grid {
  background:
    radial-gradient(circle at 4% 13%, rgba(125, 25, 29, 0.24) 0 2px, transparent 3px),
    linear-gradient(90deg, rgba(26, 20, 12, 0.04) 1px, transparent 1px) 0 0 / 82px 100%,
    repeating-linear-gradient(
      0deg,
      transparent 0 172px,
      var(--olde-ink) 172px 175px,
      var(--olde-gold) 175px 181px,
      var(--olde-ink) 181px 184px,
      transparent 184px 192px
    ),
    var(--olde-parchment-deep);
  gap: 0 22px;
  grid-auto-rows: 192px;
  grid-template-columns: repeat(auto-fill, minmax(152px, 166px));
  justify-content: start;
  padding: 16px 30px 32px;
  position: relative;
}

body[data-theme="olde"] .project-library-grid::after {
  bottom: 18px;
  color: rgba(125, 25, 29, 0.07);
  content: "SCRIPTA MANENT";
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-size: clamp(32px, 6vw, 72px);
  font-variant: small-caps;
  font-weight: 900;
  letter-spacing: 0.03em;
  pointer-events: none;
  position: absolute;
  right: 28px;
  z-index: 0;
}

body[data-theme="olde"] .project-folder-item.project-cartridge-item {
  align-self: end;
  height: 184px;
  overflow: visible;
  position: relative;
  width: 100%;
  z-index: 1;
}

body[data-theme="olde"] .project-cartridge-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  padding: 20px 10px 18px;
}

body[data-theme="olde"] .project-cartridge-card:hover,
body[data-theme="olde"] .project-cartridge-card:focus-visible {
  background: rgba(245, 230, 191, 0.34);
  box-shadow:
    inset 0 0 0 2px var(--olde-rubric),
    4px 4px 0 rgba(26, 20, 12, 0.48);
  outline: 0;
  transform: translate(-1px, -3px) rotate(-0.25deg);
}

body[data-theme="olde"] .project-cartridge-card.active {
  background: rgba(245, 230, 191, 0.58);
  box-shadow:
    inset 0 0 0 3px var(--olde-ink),
    5px 5px 0 var(--olde-rubric);
  clip-path: polygon(0 0, 91% 0, 100% 10%, 100% 100%, 0 100%);
}

body[data-theme="olde"] .project-cartridge-item.active::before {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  box-shadow: 2px 2px 0 var(--olde-gold);
  color: var(--olde-page);
  content: "IN HAND";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  left: 7px;
  letter-spacing: 0.1em;
  padding: 3px 6px 2px;
  position: absolute;
  text-transform: uppercase;
  top: 4px;
  z-index: 4;
}

body[data-theme="olde"] .project-cartridge-item.active::after {
  background: var(--olde-gold);
  border: 2px solid var(--olde-ink);
  border-radius: 50%;
  bottom: 7px;
  box-shadow: 0 0 0 2px var(--olde-rubric);
  content: "";
  height: 8px;
  position: absolute;
  right: 7px;
  width: 8px;
  z-index: 4;
}

body[data-theme="olde"] .project-cartridge-shell,
body[data-theme="olde"] .project-folder-icon.project-cartridge-shell {
  background:
    linear-gradient(90deg, var(--olde-rubric) 0 9%, transparent 9% 84%, rgba(26, 20, 12, 0.2) 84% 91%, transparent 91%),
    linear-gradient(145deg, #ead7aa 0 54%, #c8aa70 54% 74%, #7d191d 74%);
  border: 4px double var(--olde-ink);
  border-radius: 3px 3px 9px 3px;
  box-shadow:
    inset 4px 0 rgba(245, 230, 191, 0.52),
    inset -6px 0 rgba(26, 20, 12, 0.12),
    0 6px 0 #69481d,
    5px 10px 0 rgba(26, 20, 12, 0.36);
  height: 136px;
  width: 124px;
}

body[data-theme="olde"] .project-cartridge-label {
  background:
    repeating-linear-gradient(0deg, rgba(26, 20, 12, 0.035) 0 1px, transparent 1px 6px),
    var(--olde-page);
  border: 3px double var(--olde-ink);
  bottom: 22px;
  box-shadow: inset 0 0 0 2px rgba(167, 119, 32, 0.16);
  left: 12px;
  padding: 8px 8px 7px;
  right: 12px;
  top: 24px;
}

body[data-theme="olde"] .project-cartridge-kicker,
body[data-theme="olde"] .project-cartridge-meta {
  color: rgba(26, 20, 12, 0.72);
}

body[data-theme="olde"] .project-cartridge-name {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
  font-weight: 900;
}

body[data-theme="olde"] .project-cartridge-key {
  background: var(--olde-gold);
  border: 2px solid var(--olde-ink);
}

body[data-theme="olde"] .project-cartridge-item .project-context-trigger {
  background: var(--olde-ink);
  border: 1px solid var(--olde-gold);
  border-radius: 0;
  color: var(--olde-page);
}

body[data-theme="olde"] .project-trash-window {
  background:
    linear-gradient(90deg, transparent 0 34px, rgba(125, 25, 29, 0.15) 34px 35px, transparent 35px),
    var(--olde-page);
}

body[data-theme="olde"] .project-trash-head {
  background: var(--olde-parchment);
  border-bottom: 4px double var(--olde-rubric);
}

body[data-theme="olde"] .project-trash-head h2 {
  color: var(--olde-ink);
  font-family: Baskerville, "Iowan Old Style", Georgia, serif;
  font-variant: small-caps;
}

body[data-theme="olde"] .project-trash-close {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-rubric);
  color: var(--olde-page);
}

body[data-theme="olde"] .deleted-project-item {
  background: var(--olde-parchment);
  border: 2px solid var(--olde-ink);
  border-left: 6px solid var(--olde-rubric);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(167, 119, 32, 0.4);
}

body[data-theme="olde"] .deleted-project-actions .ghost-button {
  background: var(--olde-page);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  color: var(--olde-ink);
}

body[data-theme="olde"] .deleted-project-actions .danger-button {
  background: var(--olde-rubric);
  border: 2px solid var(--olde-ink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="olde"] .compact-toolbar {
  background:
    repeating-linear-gradient(90deg, var(--olde-rubric) 0 40px, var(--olde-gold) 40px 45px, var(--olde-ink) 45px 48px) left bottom / 100% 4px no-repeat,
    var(--olde-parchment);
  border-bottom: 3px double var(--olde-ink);
}

.app[data-theme="olde"] .compact-nav-button,
.app[data-theme="olde"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app[data-theme="olde"] .compact-surface-nav button.active {
  background: var(--olde-ink);
  border-color: var(--olde-gold);
  color: var(--olde-page);
}

body[data-theme="olde"] * {
  scrollbar-color: var(--olde-rubric) var(--olde-parchment);
}

@media (max-width: 820px) {
  body[data-theme="olde"] .project-library-grid {
    gap: 0 16px;
    grid-template-columns: repeat(auto-fill, minmax(142px, 154px));
    padding-inline: 22px;
  }
}

@media (max-width: 767px) {
  .app[data-theme="olde"] .editor-pane {
    padding: 9px;
  }

  .app[data-theme="olde"] .editor-shell {
    box-shadow:
      6px 6px 0 var(--olde-rubric),
      -4px -4px 0 var(--olde-gold);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding-top: 30px;
  }

  .app[data-theme="olde"] .editor-mode-panel,
  .app[data-theme="olde"] #write-panel,
  .app[data-theme="olde"] .sheet-body,
  .app[data-theme="olde"] .preview-body,
  .app[data-theme="olde"] .outline-body {
    max-width: 100%;
    min-width: 0;
  }

  .app[data-theme="olde"] .composer-toolbar {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app[data-theme="olde"] .composer-toolbar::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 640px) {
  body[data-theme="olde"] .project-library-head {
    align-items: stretch;
    flex-direction: column;
    padding: 24px 18px 18px;
  }

  body[data-theme="olde"] .project-library-actions {
    display: grid;
    grid-template-columns: 76px 76px 44px;
    justify-content: end;
    width: 100%;
  }

  body[data-theme="olde"] .project-library-grid {
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 12px 26px;
  }
}

@media (max-width: 420px) {
  .app[data-theme="olde"] .editor-shell::before {
    content: "INCIPIT";
    font-size: 7px;
    left: 14px;
  }

  .app[data-theme="olde"] .mode-switch button {
    letter-spacing: 0.035em;
    padding: 0 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer-toolbar .composer-add-lore[data-selection-ready="true"] {
    animation: none;
  }

  .project-eject,
  .project-new,
  .project-library-open {
    transition: none;
  }

  .project-switcher[data-cartridge-motion="ejecting"] .project-picker-cartridge,
  .project-switcher[data-cartridge-motion="inserting"] .project-picker-cartridge,
  .project-switcher[data-cartridge-motion="ejecting"] .olde-dragon-upper,
  .project-switcher[data-cartridge-motion="ejecting"] .olde-dragon-lower,
  .project-switcher[data-cartridge-motion="inserting"] .olde-dragon-upper,
  .project-switcher[data-cartridge-motion="inserting"] .olde-dragon-lower,
  .project-library-overlay.is-open .project-cartridge-item.is-returned,
  .project-cartridge-item.is-loading .project-cartridge-shell {
    animation: none !important;
  }
}

/* NEON: biomechanical command hardware, acid instrumentation, and warning geometry */

body[data-theme="neon"] {
  color-scheme: dark;
  --surface-canvas: #08090d;
  --surface-sidebar: #12111b;
  --surface-raised: #211a31;
  --surface-overlay: #2c2042;
  --surface-selected: rgba(200, 255, 61, 0.16);
  --text-primary: #f5f5f2;
  --text-secondary: #bec9a8;
  --text-disabled: #929b83;
  --border-subtle: rgba(200, 255, 61, 0.24);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #c8ff3d;
  --accent-strong: #e6ff96;
  --accent-soft: rgba(200, 255, 61, 0.14);
  --selection: #ff6b27;
  --selection-soft: rgba(255, 107, 39, 0.18);
  --neon-black: #08090d;
  --neon-graphite: #15151c;
  --neon-violet-deep: #34204d;
  --neon-violet: #7048b8;
  --neon-violet-hot: #9a6cff;
  --neon-acid: #c8ff3d;
  --neon-orange: #ff6b27;
  --neon-alert: #ff3456;
  --neon-ice: #f5f5f2;
  --neon-muted: #bec9a8;
  --neon-display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue Condensed", Impact, sans-serif;
  --warn: #ff6b27;
  --warn-soft: rgba(255, 107, 39, 0.16);
  --shadow:
    9px 9px 0 rgba(8, 9, 13, 0.94),
    13px 13px 0 rgba(255, 107, 39, 0.52);
  --glow:
    0 0 0 2px rgba(200, 255, 61, 0.36),
    0 0 22px rgba(200, 255, 61, 0.18);
  --screen-grid: rgba(200, 255, 61, 0.035);
  --scanline: rgba(200, 255, 61, 0.018);
  --text-glow: none;
  --font-ui: "Arial Narrow", "Roboto Condensed", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
  background:
    linear-gradient(118deg, transparent 0 68%, rgba(112, 72, 184, 0.18) 68% 75%, transparent 75%),
    linear-gradient(62deg, transparent 0 14%, rgba(255, 107, 39, 0.075) 14% 16%, transparent 16%),
    radial-gradient(circle at 94% 12%, rgba(200, 255, 61, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 91% 15%, rgba(200, 255, 61, 0.3) 0 8px, transparent 9px),
    radial-gradient(ellipse at 16% 92%, rgba(112, 72, 184, 0.36), transparent 30%),
    repeating-linear-gradient(120deg, transparent 0 42px, rgba(200, 255, 61, 0.022) 42px 43px),
    var(--surface-canvas);
}

body[data-theme="neon"] ::selection {
  background: var(--neon-acid);
  color: var(--neon-black);
}

.app[data-theme="neon"] {
  background: transparent;
}

.app[data-theme="neon"] .library-pane,
.app[data-theme="neon"] .sheet-pane,
.app[data-theme="neon"] .inspector-pane {
  background:
    linear-gradient(125deg, transparent 0 88%, rgba(200, 255, 61, 0.055) 88%),
    repeating-linear-gradient(0deg, transparent 0 37px, rgba(154, 108, 255, 0.035) 37px 38px),
    rgba(18, 17, 27, 0.97);
  border-color: var(--neon-black);
  box-shadow:
    inset -1px 0 rgba(200, 255, 61, 0.18),
    inset 1px 0 rgba(255, 107, 39, 0.14);
}

.app[data-theme="neon"] .library-pane {
  border-right: 4px solid var(--neon-black);
}

.app[data-theme="neon"] .sheet-pane {
  border-right: 3px solid var(--neon-orange);
}

.app[data-theme="neon"] .inspector-pane {
  border-left: 3px solid var(--neon-acid);
}

.app[data-theme="neon"] .app-identity {
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(135deg, var(--neon-violet) 0 71%, var(--neon-violet-deep) 71%);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    5px 5px 0 var(--neon-orange),
    -3px -3px 0 var(--neon-acid);
  clip-path: polygon(0 0, 92% 0, 100% 18%, 100% 100%, 9% 100%, 0 78%);
  color: var(--neon-ice);
  margin: 4px 4px 23px 1px;
  min-height: 78px;
  padding: 12px 10px 12px 13px;
  position: relative;
}

.app[data-theme="neon"] .app-identity::before {
  background:
    repeating-linear-gradient(135deg, var(--neon-orange) 0 6px, var(--neon-black) 6px 12px);
  bottom: 0;
  content: "";
  height: 5px;
  left: 26%;
  position: absolute;
  right: 5%;
}

.app[data-theme="neon"] .app-identity::after {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  bottom: -10px;
  color: var(--neon-black);
  content: "SYNCH / AUTHOR // 07";
  font: 900 7px/1 var(--mono);
  letter-spacing: 0.11em;
  padding: 4px 7px 3px;
  position: absolute;
  right: 13px;
  transform: skewX(-10deg);
}

.app[data-theme="neon"] .brand-mark {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  color: var(--neon-black);
  clip-path: polygon(0 0, 84% 0, 100% 17%, 100% 100%, 0 100%);
  transform: rotate(-2deg);
}

.app[data-theme="neon"] .brand-mark svg {
  height: 34px;
  width: 27px;
}

.app[data-theme="neon"] .app-identity strong {
  font-family: var(--neon-display);
  font-size: 18px;
  font-stretch: condensed;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 0.9;
  text-transform: uppercase;
}

.app[data-theme="neon"] .app-identity div span {
  color: rgba(245, 245, 242, 0.76);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.045em;
  margin-top: 6px;
  text-transform: uppercase;
}

.app[data-theme="neon"] .command-trigger {
  background: var(--neon-black);
  border: 2px solid var(--neon-acid);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  color: var(--neon-acid);
  clip-path: polygon(9% 0, 100% 0, 100% 84%, 84% 100%, 0 100%, 0 16%);
}

.app[data-theme="neon"] .command-trigger:hover {
  background: var(--neon-orange);
  border-color: var(--neon-black);
  color: var(--neon-black);
  transform: translate(-1px, -1px);
}

.app[data-theme="neon"] .eyebrow,
.app[data-theme="neon"] .project-title-field,
.app[data-theme="neon"] .search-box span,
.app[data-theme="neon"] .inspector-stack > label,
.app[data-theme="neon"] .field-grid > label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .eyebrow {
  background: var(--neon-orange);
  border-left: 9px solid var(--neon-acid);
  color: var(--neon-black);
  display: inline-block;
  padding: 4px 8px 3px 5px;
  transform: skewX(-9deg);
}

.app[data-theme="neon"] .pane-header {
  border-bottom: 4px solid var(--neon-black);
  min-height: 52px;
  padding-bottom: 8px;
  position: relative;
}

.app[data-theme="neon"] .pane-header::after {
  background:
    repeating-linear-gradient(135deg, var(--neon-acid) 0 8px, var(--neon-black) 8px 16px);
  bottom: -6px;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  content: "";
  height: 8px;
  pointer-events: none;
  position: absolute;
  right: 0;
  width: 86px;
}

.app[data-theme="neon"] .pane-header h2 {
  color: var(--neon-ice);
  font-family: var(--neon-display);
  font-size: 21px;
  font-stretch: condensed;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .project-switcher {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: default;
  display: block;
  margin: 0 0 23px;
  overflow: visible;
  padding: 0;
  transform: none;
}

.app[data-theme="neon"] .project-switcher:hover,
.app[data-theme="neon"] .project-switcher:focus-visible {
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}

.app[data-theme="neon"] .project-switcher select,
.app[data-theme="neon"] .project-title-input,
.app[data-theme="neon"] .inspector-stack textarea,
.app[data-theme="neon"] .inspector-stack input,
.app[data-theme="neon"] .inspector-stack select,
.app[data-theme="neon"] .search-box {
  background: rgba(8, 9, 13, 0.9);
  border: 2px solid rgba(200, 255, 61, 0.38);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(112, 72, 184, 0.72);
  color: var(--neon-ice);
}

.app[data-theme="neon"] .search-box:focus-within,
.app[data-theme="neon"] .project-title-input:focus,
.app[data-theme="neon"] .inspector-stack textarea:focus,
.app[data-theme="neon"] .inspector-stack input:focus,
.app[data-theme="neon"] .inspector-stack select:focus {
  border-color: var(--neon-acid);
  box-shadow: 4px 4px 0 var(--neon-orange);
}

.app[data-theme="neon"] .project-progress div,
.app[data-theme="neon"] .section-count {
  background: var(--neon-black);
  border: 1px solid var(--neon-acid);
  border-radius: 0;
}

.app[data-theme="neon"] .project-progress strong {
  color: var(--neon-acid);
  font-family: var(--neon-display);
  font-style: italic;
}

.app[data-theme="neon"] .meter {
  background: var(--neon-black);
  border: 1px solid var(--neon-violet-hot);
  border-radius: 0;
  height: 8px;
  overflow: visible;
}

.app[data-theme="neon"] .meter span {
  background:
    repeating-linear-gradient(90deg, var(--neon-acid) 0 12px, var(--neon-orange) 12px 16px);
  box-shadow: 0 0 10px rgba(200, 255, 61, 0.44);
}

.app[data-theme="neon"] .ghost-button,
.app[data-theme="neon"] .icon-button,
.app[data-theme="neon"] .compact-command-trigger {
  background: var(--neon-violet-deep);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  color: var(--neon-ice);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}

.app[data-theme="neon"] .ghost-button:hover,
.app[data-theme="neon"] .icon-button:hover,
.app[data-theme="neon"] .compact-command-trigger:hover {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  box-shadow: 4px 4px 0 var(--neon-violet);
  color: var(--neon-black);
  transform: translate(-1px, -1px);
}

.app[data-theme="neon"] .primary-button {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--neon-orange);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  color: var(--neon-black);
  font-family: var(--neon-display);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .primary-button:hover {
  background: var(--neon-orange);
  box-shadow: 5px 5px 0 var(--neon-violet-hot);
  transform: translate(-1px, -1px);
}

.app[data-theme="neon"] .danger-button {
  background: var(--neon-alert);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  color: var(--neon-black);
}

.app[data-theme="neon"] .section-list {
  gap: 10px;
}

.app[data-theme="neon"] .section-button,
.app[data-theme="neon"] .sheet-card {
  background:
    linear-gradient(112deg, rgba(112, 72, 184, 0.2), transparent 44%),
    #20192e;
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(112, 72, 184, 0.72);
  clip-path: polygon(0 0, 91% 0, 100% 16%, 97% 100%, 6% 100%, 0 88%);
  position: relative;
}

.app[data-theme="neon"] .section-button::before,
.app[data-theme="neon"] .sheet-card::before {
  background:
    repeating-linear-gradient(135deg, var(--neon-orange) 0 6px, var(--neon-black) 6px 11px);
  content: "";
  height: 4px;
  left: 10px;
  position: absolute;
  top: -1px;
  width: 45px;
}

.app[data-theme="neon"] .section-button:hover,
.app[data-theme="neon"] .sheet-card:hover {
  background:
    linear-gradient(112deg, rgba(200, 255, 61, 0.12), transparent 50%),
    #2a2040;
  border-color: var(--neon-acid);
  box-shadow: 5px 5px 0 var(--neon-orange);
  transform: translate(-1px, -1px);
}

.app[data-theme="neon"] .section-button.active,
.app[data-theme="neon"] .sheet-card.active {
  background:
    linear-gradient(122deg, rgba(245, 245, 242, 0.14), transparent 35%),
    var(--neon-violet);
  border-color: var(--neon-black);
  box-shadow:
    6px 6px 0 var(--neon-orange),
    -3px -3px 0 var(--neon-acid);
  color: var(--neon-ice);
  clip-path: polygon(0 0, 87% 0, 100% 21%, 96% 100%, 8% 96%, 0 82%);
}

.app[data-theme="neon"] .section-count {
  color: var(--neon-acid);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
}

.app[data-theme="neon"] .section-button.active .section-count {
  background: var(--neon-black);
  color: var(--neon-orange);
}

.app[data-theme="neon"] .context-trigger {
  border-radius: 0;
}

.app[data-theme="neon"] .context-trigger:hover,
.app[data-theme="neon"] .context-trigger:focus-visible {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  color: var(--neon-black);
}

.app[data-theme="neon"] .sheet-card-footer {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .status-dot {
  border: 1px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 0 0 5px currentColor;
  height: 8px;
  transform: rotate(45deg);
  width: 8px;
}

.app[data-theme="neon"] .status-to-write {
  background: var(--neon-violet-hot);
}

.app[data-theme="neon"] .status-draft {
  background: var(--neon-orange);
}

.app[data-theme="neon"] .status-revising {
  background: var(--neon-alert);
}

.app[data-theme="neon"] .status-done {
  background: var(--neon-acid);
}

.app[data-theme="neon"] .editor-pane {
  background:
    linear-gradient(118deg, transparent 0 77%, rgba(112, 72, 184, 0.24) 77% 85%, transparent 85%),
    linear-gradient(62deg, transparent 0 11%, rgba(255, 107, 39, 0.11) 11% 13%, transparent 13%),
    radial-gradient(circle at 94% 12%, var(--neon-acid) 0 3px, transparent 4px),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(200, 255, 61, 0.025) 78px 79px),
    #0b0c12;
  padding: 15px;
}

.app[data-theme="neon"] .editor-shell {
  background:
    linear-gradient(126deg, rgba(112, 72, 184, 0.18), transparent 34%),
    linear-gradient(64deg, transparent 0 84%, rgba(200, 255, 61, 0.055) 84%),
    #12131a;
  border: 3px solid var(--neon-black);
  border-top-color: var(--neon-acid);
  box-shadow:
    11px 11px 0 var(--neon-orange),
    -7px -7px 0 var(--neon-violet);
  clip-path: polygon(0 0, 94% 0, 100% 6%, 100% 100%, 4% 100%, 0 96%);
  color: var(--neon-ice);
  height: calc(100% - 10px);
  isolation: isolate;
  margin: 5px auto;
  max-width: 930px;
  padding: 31px clamp(24px, 5vw, 72px) 16px;
  position: relative;
  transform: none;
}

.app[data-theme="neon"] .editor-shell::before {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  color: var(--neon-black);
  content: "SYNCH RATE / 100";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  left: clamp(20px, 4vw, 58px);
  letter-spacing: 0.12em;
  padding: 5px 8px 4px;
  pointer-events: none;
  position: absolute;
  top: -2px;
  transform: skewX(-12deg);
  z-index: 0;
}

.app[data-theme="neon"] .editor-shell::after {
  background:
    repeating-linear-gradient(135deg, var(--neon-orange) 0 8px, var(--neon-black) 8px 15px);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  content: "";
  height: 10px;
  pointer-events: none;
  position: absolute;
  right: 8%;
  top: 0;
  width: 88px;
  z-index: 0;
}

.app[data-theme="neon"] .mode-switch,
.app[data-theme="neon"] .editor-composer-head,
.app[data-theme="neon"] .editor-mode-panel,
.app[data-theme="neon"] .editor-footer {
  position: relative;
  z-index: 1;
}

.app[data-theme="neon"] .mode-switch {
  background: var(--neon-black);
  border: 2px solid var(--neon-violet);
  border-radius: 0;
  clip-path: polygon(0 0, 96% 0, 100% 22%, 100% 100%, 3% 100%, 0 78%);
  gap: 2px;
  padding: 3px;
}

.app[data-theme="neon"] .mode-switch button {
  border-radius: 0;
  color: var(--neon-muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .mode-switch button:hover {
  background: rgba(112, 72, 184, 0.36);
  color: var(--neon-ice);
}

.app[data-theme="neon"] .mode-switch button.active {
  background: var(--neon-acid);
  box-shadow: 3px 3px 0 var(--neon-orange);
  clip-path: polygon(0 0, 92% 0, 100% 25%, 96% 100%, 5% 100%, 0 78%);
  color: var(--neon-black);
}

.app[data-theme="neon"] .composer-inspector-toggle {
  background: var(--neon-violet-deep);
  border: 2px solid var(--neon-acid);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  clip-path: polygon(0 0, 82% 0, 100% 18%, 100% 100%, 18% 100%, 0 82%);
  color: var(--neon-acid);
}

.app[data-theme="neon"] .composer-inspector-toggle:hover,
.app[data-theme="neon"] .composer-inspector-toggle:focus-visible {
  background: var(--neon-orange);
  border-color: var(--neon-black);
  color: var(--neon-black);
}

.app[data-theme="neon"] .composer-inspector-toggle[aria-pressed="true"] {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  box-shadow: 3px 3px 0 var(--neon-violet-hot);
  color: var(--neon-black);
}

.app[data-theme="neon"] .sheet-title-input,
.app[data-theme="neon"] .sheet-body,
.app[data-theme="neon"] .preview-body,
.app[data-theme="neon"] .outline-body {
  color: var(--neon-ice);
  text-shadow: none;
}

.app[data-theme="neon"] .sheet-title-input,
.app[data-theme="neon"] .sheet-body {
  -webkit-user-select: text;
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="neon"] .sheet-title-input {
  font-weight: 800;
  letter-spacing: -0.035em;
  text-decoration-color: var(--neon-orange);
  text-decoration-line: underline;
  text-decoration-thickness: 5px;
  text-underline-offset: 8px;
}

.app[data-theme="neon"] .sheet-title-input:focus-visible,
.app[data-theme="neon"] .sheet-body:focus-visible {
  outline-color: var(--neon-acid);
}

.app[data-theme="neon"] .preview-body blockquote,
.app[data-theme="neon"] .outline-item p,
.app[data-theme="neon"] .editor-meta,
.app[data-theme="neon"] .editor-footer {
  color: var(--neon-muted);
}

.app[data-theme="neon"] .editor-meta,
.app[data-theme="neon"] .editor-footer {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .editor-footer {
  border-top: 2px solid var(--neon-orange);
}

.app[data-theme="neon"] .outline-item {
  background: rgba(112, 72, 184, 0.16);
  border: 2px solid var(--neon-black);
  border-left: 7px solid var(--neon-acid);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(255, 107, 39, 0.42);
  clip-path: polygon(0 0, 96% 0, 100% 16%, 98% 100%, 4% 100%, 0 86%);
  color: var(--neon-ice);
}

.app[data-theme="neon"] .composer-focus-toggle {
  background: var(--neon-orange);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-acid);
  clip-path: polygon(0 0, 80% 0, 100% 20%, 100% 100%, 20% 100%, 0 80%);
  color: var(--neon-black);
}

.app[data-theme="neon"] .composer-toolbar .composer-add-lore {
  background: var(--neon-violet-deep);
  border: 1px solid var(--neon-violet-hot);
  border-radius: 0;
  color: var(--neon-muted);
  clip-path: polygon(0 0, 92% 0, 100% 25%, 96% 100%, 4% 100%, 0 78%);
}

.app[data-theme="neon"] .composer-toolbar .composer-add-lore[data-selection-ready="true"] {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  box-shadow: 3px 3px 0 var(--neon-orange);
  color: var(--neon-black);
}

.app[data-theme="neon"],
body[data-theme="neon"] {
  --project-case: #7048b8;
  --project-case-edge: #08090d;
  --project-case-highlight: #9a6cff;
  --project-case-shadow: #34204d;
  --project-screen: #090c0c;
  --project-screen-text: #c8ff3d;
  --project-screen-muted: #bec9a8;
  --project-screen-line: rgba(200, 255, 61, 0.24);
  --project-control: #ff6b27;
  --project-control-edge: #08090d;
  --project-control-text: #08090d;
  --project-slot: #050609;
  --cartridge-shell: #7048b8;
  --cartridge-shell-deep: #34204d;
  --cartridge-edge: #08090d;
  --cartridge-label: #c8ff3d;
  --cartridge-label-text: #08090d;
  --cartridge-accent: #ff6b27;
  --cartridge-contacts: #c8ff3d;
  --shelf-surface: #101117;
  --shelf-edge: #c8ff3d;
}

.app[data-theme="neon"] .project-device {
  background:
    linear-gradient(136deg, rgba(245, 245, 242, 0.16), transparent 25%),
    linear-gradient(152deg, var(--neon-violet) 0 62%, var(--neon-violet-deep) 62%);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    inset 3px 3px rgba(245, 245, 242, 0.1),
    inset -4px -4px rgba(8, 9, 13, 0.34),
    6px 8px 0 var(--neon-orange),
    10px 14px 0 rgba(8, 9, 13, 0.72);
  clip-path: polygon(0 0, 94% 0, 100% 6%, 100% 95%, 95% 100%, 5% 100%, 0 94%);
  padding-top: 16px;
}

.app[data-theme="neon"] .project-device::before {
  background:
    repeating-linear-gradient(135deg, var(--neon-acid) 0 7px, var(--neon-black) 7px 13px);
  border-radius: 0;
  height: 5px;
  left: 30%;
  opacity: 1;
  right: 8%;
  top: 6px;
}

.app[data-theme="neon"] .project-device::after {
  color: var(--neon-black);
  content: "MN / NEON CONTROL ARRAY";
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 950;
  left: 9px;
  letter-spacing: 0.09em;
  position: absolute;
  top: 5px;
}

.app[data-theme="neon"] .project-device-fastener {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  border-radius: 0;
  transform: rotate(45deg);
}

.app[data-theme="neon"] .project-device-screen {
  background:
    linear-gradient(135deg, transparent 0 78%, rgba(112, 72, 184, 0.16) 78%),
    radial-gradient(ellipse at 48% 42%, transparent 22%, rgba(0, 0, 0, 0.54) 100%),
    repeating-linear-gradient(0deg, transparent 0 3px, var(--project-screen-line) 3px 4px),
    var(--project-screen);
  border: 3px solid var(--neon-black);
  border-left-color: var(--neon-acid);
  border-radius: 0;
  box-shadow:
    inset 0 0 25px rgba(0, 0, 0, 0.86),
    4px 4px 0 var(--neon-violet-deep);
  clip-path: polygon(0 0, 94% 0, 100% 12%, 100% 100%, 6% 100%, 0 88%);
}

.app[data-theme="neon"] .project-device-screen-glare {
  background:
    linear-gradient(118deg, rgba(200, 255, 61, 0.1), transparent 20% 80%, rgba(255, 107, 39, 0.06));
  border-radius: 0;
}

.app[data-theme="neon"] .project-device .project-title-input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--project-screen-line);
  border-radius: 0;
  box-shadow: none;
  color: var(--project-screen-text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 850;
  text-shadow: 0 0 10px rgba(200, 255, 61, 0.42);
}

.app[data-theme="neon"] .project-device .project-progress div {
  background: rgba(200, 255, 61, 0.04);
  border: 1px solid var(--project-screen-line);
  border-radius: 0;
  clip-path: polygon(0 0, 90% 0, 100% 18%, 96% 100%, 4% 100%, 0 82%);
}

.app[data-theme="neon"] .project-device-controls {
  gap: 12px 10px;
}

.app[data-theme="neon"] .project-device-slot-line {
  background:
    repeating-linear-gradient(135deg, var(--neon-orange) 0 7px, var(--neon-black) 7px 14px);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.9),
    3px 3px 0 var(--neon-acid);
  height: 12px;
  top: 14px;
}

.app[data-theme="neon"] .project-eject,
.app[data-theme="neon"] .project-new,
.app[data-theme="neon"] .project-library-open {
  --button-mark: "!";
  --button-shadow-shift: 3px;
  --button-tilt: -0.35deg;
  background:
    radial-gradient(circle at 86% 18%, rgba(245, 245, 242, 0.62) 0 1px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(8, 9, 13, 0.055) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, color-mix(in srgb, var(--project-button-face) 76%, #fff) 0 8%, var(--project-button-face) 9% 63%, color-mix(in srgb, var(--project-button-face) 72%, #000) 100%);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.28),
    inset 0 -5px 0 rgba(8, 9, 13, 0.3),
    0 6px 0 var(--neon-black),
    var(--button-shadow-shift) 9px 0 var(--project-button-shadow);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  color: var(--neon-black);
  font-family: var(--neon-display);
  font-size: 10px;
  font-style: italic;
  letter-spacing: 0.025em;
  transform: translateY(0) rotate(var(--button-tilt));
}

.app[data-theme="neon"] .project-eject {
  --button-mark: "▲";
  --button-tilt: -0.5deg;
  --project-button-face: var(--neon-orange);
  --project-button-shadow: var(--neon-violet-hot);
}

.app[data-theme="neon"] .project-new {
  --button-mark: "+";
  --button-shadow-shift: -3px;
  --button-tilt: 0.55deg;
  --project-button-face: var(--neon-acid);
  --project-button-shadow: var(--neon-orange);
}

.app[data-theme="neon"] .project-library-open {
  --button-mark: "▤";
  --button-tilt: -0.25deg;
  --project-button-face: var(--neon-violet-hot);
  --project-button-shadow: var(--neon-acid);
  color: var(--neon-ice);
}

.app[data-theme="neon"] .project-eject::before,
.app[data-theme="neon"] .project-new::before,
.app[data-theme="neon"] .project-library-open::before {
  align-items: center;
  background: var(--neon-black);
  color: var(--neon-acid);
  content: var(--button-mark);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 10px;
  height: 18px;
  justify-content: center;
  margin-right: 6px;
  transform: skewX(-7deg);
  width: 18px;
}

.app[data-theme="neon"] .project-eject:hover:not(:disabled),
.app[data-theme="neon"] .project-new:hover,
.app[data-theme="neon"] .project-library-open:hover {
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.4),
    inset 0 -5px 0 rgba(8, 9, 13, 0.26),
    0 8px 0 var(--neon-black),
    var(--button-shadow-shift) 11px 0 var(--project-button-shadow);
  filter: brightness(1.08);
  transform: translateY(-1px) rotate(var(--button-tilt));
}

.app[data-theme="neon"] .project-eject:active:not(:disabled),
.app[data-theme="neon"] .project-new:active,
.app[data-theme="neon"] .project-library-open:active {
  box-shadow:
    inset 0 3px 0 rgba(8, 9, 13, 0.28),
    0 2px 0 var(--neon-black),
    var(--button-shadow-shift) 4px 0 var(--project-button-shadow);
  filter: brightness(0.92);
  transform: translateY(5px) rotate(var(--button-tilt));
}

.app[data-theme="neon"] .project-eject:focus-visible,
.app[data-theme="neon"] .project-new:focus-visible,
.app[data-theme="neon"] .project-library-open:focus-visible {
  filter:
    brightness(1.08)
    drop-shadow(0 0 4px var(--neon-acid));
  outline: 0;
}

body[data-theme="neon"] .project-library-backdrop,
body[data-theme="neon"] .command-palette-backdrop,
body[data-theme="neon"] .ux-metrics-backdrop,
body[data-theme="neon"] .settings-backdrop,
body[data-theme="neon"] .lore-backdrop,
body[data-theme="neon"] .tenant-admin-backdrop {
  background:
    linear-gradient(118deg, transparent 0 72%, rgba(112, 72, 184, 0.18) 72%),
    rgba(5, 6, 9, 0.84);
  backdrop-filter: blur(8px) saturate(1.15);
}

body[data-theme="neon"] .project-library-panel,
body[data-theme="neon"] .project-delete-dialog,
body[data-theme="neon"] .command-palette-dialog,
body[data-theme="neon"] .ux-metrics-dialog,
body[data-theme="neon"] .settings-dialog,
body[data-theme="neon"] .lore-panel,
body[data-theme="neon"] .lore-decision-dialog,
body[data-theme="neon"] .tenant-admin-dialog,
body[data-theme="neon"] .toast,
body[data-theme="neon"] .context-menu {
  background:
    linear-gradient(124deg, rgba(112, 72, 184, 0.15), transparent 38%),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(200, 255, 61, 0.025) 58px 59px),
    var(--surface-overlay);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    10px 10px 0 var(--neon-orange),
    -6px -6px 0 var(--neon-acid),
    0 30px 80px rgba(0, 0, 0, 0.58);
}

body[data-theme="neon"] .project-library-panel {
  background:
    linear-gradient(118deg, rgba(112, 72, 184, 0.13), transparent 38%),
    radial-gradient(circle at 96% 10%, rgba(200, 255, 61, 0.72) 0 2px, transparent 3px),
    #11121a;
  isolation: isolate;
}

body[data-theme="neon"] .project-library-panel::before,
body[data-theme="neon"] .command-palette-dialog::before,
body[data-theme="neon"] .ux-metrics-dialog::before {
  background:
    linear-gradient(90deg, var(--neon-acid) 0 46%, var(--neon-orange) 46% 68%, var(--neon-violet) 68%);
  content: "";
  display: block;
  height: 7px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

body[data-theme="neon"] .project-library-panel::after {
  bottom: 7px;
  color: rgba(200, 255, 61, 0.36);
  content: "MN // NEON ARRAY // PROJECT CORE 07";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.13em;
  pointer-events: none;
  position: absolute;
  right: 16px;
  text-transform: uppercase;
  z-index: 2;
}

body[data-theme="neon"] .project-library-head {
  align-items: center;
  background:
    linear-gradient(112deg, rgba(112, 72, 184, 0.28), transparent 42%),
    linear-gradient(90deg, transparent 0 72%, rgba(255, 107, 39, 0.1) 72%),
    #191524;
  border-bottom: 0;
  min-height: 132px;
  padding: 28px 32px 24px;
  position: relative;
}

body[data-theme="neon"] .project-library-head::after {
  background:
    repeating-linear-gradient(135deg, var(--neon-orange) 0 10px, var(--neon-black) 10px 20px);
  bottom: 0;
  clip-path: polygon(0 0, 82% 0, 84% 100%, 0 100%);
  content: "";
  height: 6px;
  left: 0;
  position: absolute;
  right: 0;
}

body[data-theme="neon"] .project-library-heading {
  align-content: start;
  display: grid;
  justify-items: start;
  min-width: 0;
}

body[data-theme="neon"] .project-library-head .eyebrow {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  box-shadow: 3px 3px 0 var(--neon-orange);
  color: var(--neon-black);
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.11em;
  margin: 0 0 9px 3px;
  padding: 4px 9px 3px;
  text-transform: uppercase;
  transform: skewX(-10deg);
}

body[data-theme="neon"] .project-library-head h2,
body[data-theme="neon"] .ux-metrics-head h2 {
  color: var(--neon-ice);
  font-family: var(--neon-display);
  font-size: clamp(34px, 5vw, 59px);
  font-stretch: condensed;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 0.84;
  max-width: 720px;
  text-shadow: 5px 5px 0 var(--neon-violet);
  text-transform: uppercase;
}

body[data-theme="neon"] .project-library-count {
  background: var(--neon-orange);
  border: 2px solid var(--neon-black);
  box-shadow: 3px 3px 0 var(--neon-acid);
  color: var(--neon-black);
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.09em;
  margin-top: 14px;
  padding: 5px 9px 4px;
  text-transform: uppercase;
  transform: skewX(7deg);
}

body[data-theme="neon"] .project-library-actions {
  align-items: center;
  background: rgba(8, 9, 13, 0.82);
  border: 2px solid var(--neon-violet-hot);
  box-shadow:
    5px 5px 0 var(--neon-orange),
    inset 0 0 0 1px rgba(200, 255, 61, 0.12);
  clip-path: polygon(0 0, 94% 0, 100% 12%, 100% 100%, 6% 100%, 0 88%);
  gap: 8px;
  padding: 8px;
}

body[data-theme="neon"] .project-library-backup,
body[data-theme="neon"] .project-library-trash {
  background: var(--neon-black);
  border: 2px solid var(--neon-acid);
  border-radius: 0;
  color: var(--neon-ice);
  height: 76px;
  width: 76px;
}

body[data-theme="neon"] .project-library-backup {
  display: grid;
  padding: 6px;
  place-items: center;
}

body[data-theme="neon"] .project-library-backup svg {
  height: 42px;
  stroke-width: 2;
  width: 42px;
}

body[data-theme="neon"] .project-library-trash {
  display: grid;
  grid-template-rows: 38px auto;
  padding: 6px 7px 5px;
  place-items: center;
}

body[data-theme="neon"] .project-library-trash::after {
  color: var(--neon-acid);
  content: "PURGE";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

body[data-theme="neon"] .project-library-trash svg {
  height: 31px;
  stroke-width: 2.2;
  width: 31px;
}

body[data-theme="neon"] .project-library-backup:hover,
body[data-theme="neon"] .project-library-backup:focus-visible,
body[data-theme="neon"] .project-library-trash:hover,
body[data-theme="neon"] .project-library-trash:focus-visible {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  box-shadow: 4px 4px 0 var(--neon-orange);
  color: var(--neon-black);
  outline: 0;
  transform: translate(-1px, -1px);
}

body[data-theme="neon"] .project-library-trash:hover::after,
body[data-theme="neon"] .project-library-trash:focus-visible::after {
  color: var(--neon-black);
}

body[data-theme="neon"] .project-library-close {
  align-self: start;
  background: var(--neon-orange);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-acid);
  clip-path: polygon(0 0, 79% 0, 100% 21%, 100% 100%, 21% 100%, 0 79%);
  color: var(--neon-black);
  height: 44px;
  width: 44px;
}

body[data-theme="neon"] .project-library-close:hover,
body[data-theme="neon"] .project-library-close:focus-visible {
  background: var(--neon-acid);
  box-shadow: 4px 4px 0 var(--neon-violet-hot);
  outline: 0;
  transform: translate(-1px, -1px);
}

body[data-theme="neon"] .project-library-shelf {
  background: var(--shelf-surface);
  position: relative;
}

body[data-theme="neon"] .project-library-shelf-head {
  background:
    linear-gradient(90deg, rgba(112, 72, 184, 0.24), transparent 44%),
    #141722;
  border-bottom: 2px solid var(--neon-acid);
  border-top: 2px solid var(--neon-black);
  color: var(--neon-muted);
  font-size: 8px;
  min-height: 40px;
  padding: 10px 30px 9px;
}

body[data-theme="neon"] .project-library-shelf-head span:first-child {
  color: var(--neon-acid);
}

body[data-theme="neon"] .project-library-shelf-head span:first-child::before {
  color: var(--neon-orange);
  content: "07 / ";
}

body[data-theme="neon"] .project-library-shelf-head span:last-child {
  color: var(--neon-ice);
}

body[data-theme="neon"] .project-library-grid {
  background:
    radial-gradient(circle at 94% 26%, rgba(200, 255, 61, 0.64) 0 2px, transparent 3px),
    linear-gradient(90deg, rgba(112, 72, 184, 0.075) 1px, transparent 1px) 0 0 / 82px 100%,
    repeating-linear-gradient(
      0deg,
      transparent 0 172px,
      var(--neon-violet) 172px 175px,
      var(--neon-acid) 175px 178px,
      var(--neon-black) 178px 188px,
      var(--neon-orange) 188px 192px
    ),
    var(--shelf-surface);
  gap: 0 22px;
  grid-auto-rows: 192px;
  grid-template-columns: repeat(auto-fill, minmax(152px, 166px));
  justify-content: start;
  padding: 16px 30px 32px;
  position: relative;
}

body[data-theme="neon"] .project-library-grid::after {
  bottom: 18px;
  color: rgba(200, 255, 61, 0.055);
  content: "SYNCH // WRITE // SURVIVE";
  font-family: var(--neon-display);
  font-size: clamp(28px, 5vw, 64px);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.05em;
  line-height: 0.78;
  pointer-events: none;
  position: absolute;
  right: 28px;
  text-align: right;
  text-transform: uppercase;
  z-index: 0;
}

body[data-theme="neon"] .project-folder-item.project-cartridge-item {
  align-self: end;
  height: 184px;
  overflow: visible;
  position: relative;
  width: 100%;
  z-index: 1;
}

body[data-theme="neon"] .project-cartridge-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  clip-path: none;
  overflow: visible;
  padding: 20px 10px 18px;
}

body[data-theme="neon"] .project-cartridge-card:hover,
body[data-theme="neon"] .project-cartridge-card:focus-visible {
  background:
    linear-gradient(135deg, rgba(200, 255, 61, 0.1), transparent 58%),
    rgba(112, 72, 184, 0.12);
  box-shadow:
    inset 0 0 0 2px var(--neon-orange),
    4px 4px 0 var(--neon-violet);
  outline: 0;
  transform: translate(-1px, -3px) rotate(-0.35deg);
}

body[data-theme="neon"] .project-cartridge-card.active {
  background:
    linear-gradient(135deg, rgba(255, 107, 39, 0.12), transparent 52%),
    #1b2130;
  box-shadow:
    inset 0 0 0 3px var(--neon-acid),
    5px 5px 0 var(--neon-orange);
  clip-path: polygon(0 0, 90% 0, 100% 11%, 97% 100%, 5% 100%, 0 91%);
}

body[data-theme="neon"] .project-cartridge-item.active::before {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  box-shadow: 2px 2px 0 var(--neon-orange);
  color: var(--neon-black);
  content: "LINKED";
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 900;
  left: 7px;
  letter-spacing: 0.12em;
  padding: 3px 6px 2px;
  position: absolute;
  text-transform: uppercase;
  top: 4px;
  transform: skewX(-10deg);
  z-index: 4;
}

body[data-theme="neon"] .project-cartridge-item.active::after {
  background: var(--neon-orange);
  border: 2px solid var(--neon-black);
  bottom: 7px;
  box-shadow: 0 0 0 2px var(--neon-acid);
  content: "";
  height: 8px;
  position: absolute;
  right: 7px;
  transform: rotate(45deg);
  width: 8px;
  z-index: 4;
}

body[data-theme="neon"] .project-cartridge-shell,
body[data-theme="neon"] .project-folder-icon.project-cartridge-shell {
  background:
    radial-gradient(circle at 10px 13px, var(--neon-acid) 0 2px, var(--neon-black) 3px 4px, transparent 5px),
    linear-gradient(90deg, rgba(245, 245, 242, 0.13) 0 10%, transparent 10% 82%, rgba(8, 9, 13, 0.28) 82% 91%, transparent 91%),
    linear-gradient(145deg, var(--neon-violet-hot) 0 48%, var(--neon-violet) 48% 72%, var(--neon-violet-deep) 72%);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    inset 3px 0 rgba(245, 245, 242, 0.11),
    inset -6px 0 rgba(8, 9, 13, 0.24),
    0 6px 0 #241637,
    5px 10px 0 rgba(8, 9, 13, 0.58);
  clip-path: polygon(0 0, 78% 0, 86% 8%, 100% 8%, 100% 100%, 8% 100%, 0 92%);
  height: 136px;
  width: 124px;
}

body[data-theme="neon"] .project-cartridge-card:hover .project-cartridge-shell,
body[data-theme="neon"] .project-cartridge-card:focus-visible .project-cartridge-shell {
  filter: brightness(1.08) saturate(1.08);
  transform: translateY(-4px) rotate(-1deg);
}

body[data-theme="neon"] .project-cartridge-item.active .project-cartridge-shell {
  filter:
    drop-shadow(0 0 6px rgba(200, 255, 61, 0.62))
    drop-shadow(3px 3px 0 rgba(255, 107, 39, 0.72));
}

body[data-theme="neon"] .project-cartridge-label {
  background:
    linear-gradient(108deg, rgba(245, 245, 242, 0.28), transparent 28%),
    repeating-linear-gradient(0deg, rgba(8, 9, 13, 0.055) 0 1px, transparent 1px 5px),
    var(--neon-acid);
  border: 3px solid var(--neon-black);
  bottom: 22px;
  box-shadow: inset 0 0 0 2px rgba(112, 72, 184, 0.25);
  clip-path: polygon(0 0, 90% 0, 100% 12%, 100% 100%, 7% 100%, 0 90%);
  left: 12px;
  padding: 8px 8px 7px;
  right: 12px;
  top: 24px;
}

body[data-theme="neon"] .project-cartridge-kicker,
body[data-theme="neon"] .project-cartridge-meta {
  color: rgba(8, 9, 13, 0.72);
}

body[data-theme="neon"] .project-cartridge-name {
  color: var(--neon-black);
  font-family: var(--neon-display);
  font-size: 11px;
  font-stretch: condensed;
  font-style: italic;
  font-weight: 950;
  line-height: 0.96;
  text-transform: uppercase;
}

body[data-theme="neon"] .project-cartridge-key {
  background: var(--neon-orange);
  border: 2px solid var(--neon-black);
  box-shadow: 2px 2px 0 rgba(8, 9, 13, 0.35);
}

body[data-theme="neon"] .project-cartridge-item .project-context-trigger {
  background: var(--neon-black);
  border: 1px solid var(--neon-acid);
  border-radius: 0;
  color: var(--neon-ice);
}

body[data-theme="neon"] .project-cartridge-item .project-context-trigger:hover,
body[data-theme="neon"] .project-cartridge-item .project-context-trigger:focus-visible {
  background: var(--neon-orange);
  border-color: var(--neon-black);
  color: var(--neon-black);
}

body[data-theme="neon"] .project-trash-window {
  background:
    linear-gradient(118deg, rgba(112, 72, 184, 0.14), transparent 42%),
    #11121a;
}

body[data-theme="neon"] .project-trash-head {
  background: #1b1728;
  border-bottom: 5px solid var(--neon-orange);
}

body[data-theme="neon"] .project-trash-head .eyebrow {
  color: var(--neon-acid);
  font-family: var(--mono);
}

body[data-theme="neon"] .project-trash-head h2 {
  color: var(--neon-ice);
  font-family: var(--neon-display);
  font-style: italic;
  font-weight: 950;
  text-shadow: 4px 4px 0 var(--neon-violet);
  text-transform: uppercase;
}

body[data-theme="neon"] .project-trash-close {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--neon-orange);
  color: var(--neon-black);
  font-family: var(--mono);
  font-weight: 900;
  text-transform: uppercase;
}

body[data-theme="neon"] .deleted-project-item {
  background:
    linear-gradient(90deg, rgba(112, 72, 184, 0.16), transparent 34%),
    #1d1928;
  border: 2px solid rgba(200, 255, 61, 0.18);
  border-left: 7px solid var(--neon-orange);
  border-radius: 0;
  box-shadow: 5px 5px 0 rgba(112, 72, 184, 0.56);
  clip-path: polygon(0 0, 98% 0, 100% 16%, 100% 100%, 2% 100%, 0 84%);
}

body[data-theme="neon"] .deleted-project-item strong {
  color: var(--neon-ice);
  font-family: var(--neon-display);
  font-style: italic;
  text-transform: uppercase;
}

body[data-theme="neon"] .deleted-project-actions .ghost-button {
  background: var(--neon-black);
  border: 2px solid var(--neon-acid);
  border-radius: 0;
  color: var(--neon-ice);
}

body[data-theme="neon"] .deleted-project-actions .danger-button {
  background: var(--neon-alert);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  color: var(--neon-black);
}

body[data-theme="neon"] .settings-dialog {
  overflow: visible;
}

body[data-theme="neon"] .settings-dialog::after {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  bottom: -12px;
  color: var(--neon-black);
  content: "SYSTEM // SYNCHRONIZED";
  font: 900 0.62rem/1 var(--mono);
  letter-spacing: 0.12em;
  padding: 5px 8px 4px;
  position: absolute;
  right: 24px;
  transform: skewX(-10deg);
}

body[data-theme="neon"] .settings-head {
  border-bottom: 5px solid var(--neon-orange);
}

body[data-theme="neon"] .settings-head h2,
body[data-theme="neon"] .settings-section-copy h3 {
  color: var(--neon-ice);
  font-family: var(--neon-display);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

body[data-theme="neon"] .settings-head h2 {
  text-shadow: 5px 4px 0 var(--neon-violet);
}

body[data-theme="neon"] .settings-head .eyebrow {
  background: var(--neon-acid);
  color: var(--neon-black);
  padding: 4px 8px 3px;
  transform: skewX(-10deg);
}

body[data-theme="neon"] .settings-close {
  background: var(--neon-orange);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--neon-acid);
  clip-path: polygon(0 0, 80% 0, 100% 20%, 100% 100%, 20% 100%, 0 80%);
  color: var(--neon-black);
}

body[data-theme="neon"] .settings-section {
  background:
    linear-gradient(124deg, rgba(112, 72, 184, 0.18), transparent 40%),
    repeating-linear-gradient(-28deg, transparent 0 14px, rgba(200, 255, 61, 0.025) 14px 15px),
    #211a31;
  border: 3px solid var(--neon-black);
  border-left-color: var(--neon-acid);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--neon-violet);
  clip-path: polygon(0 0, 96% 0, 100% 12%, 98% 100%, 4% 100%, 0 88%);
}

body[data-theme="neon"] .settings-section:nth-child(2) {
  border-left-color: var(--neon-orange);
  box-shadow: 5px 5px 0 var(--neon-orange);
}

body[data-theme="neon"] .settings-section:nth-child(3) {
  border-left-color: var(--neon-violet-hot);
  box-shadow: 5px 5px 0 var(--neon-acid);
}

body[data-theme="neon"] .settings-section-index {
  background: var(--neon-acid);
  color: var(--neon-black);
  padding: 5px 4px 4px;
  text-align: center;
}

body[data-theme="neon"] .settings-action {
  background: var(--neon-acid);
  border: 3px solid var(--neon-black);
  border-radius: 0;
  box-shadow:
    inset 0 -4px 0 rgba(8, 9, 13, 0.22),
    4px 5px 0 var(--neon-orange);
  clip-path: polygon(0 0, 94% 0, 100% 20%, 100% 100%, 6% 100%, 0 80%);
  color: var(--neon-black);
  font-family: var(--neon-display);
  font-style: italic;
  font-weight: 950;
  text-transform: uppercase;
}

body[data-theme="neon"] .settings-action:hover,
body[data-theme="neon"] .settings-action:focus-visible {
  background: var(--neon-orange);
  transform: translate(-1px, -1px);
}

body[data-theme="neon"] .settings-action:active:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(8, 9, 13, 0.28),
    1px 1px 0 var(--neon-black);
  transform: translate(3px, 3px);
}

body[data-theme="neon"] .settings-action-danger {
  background: var(--neon-alert);
}

body[data-theme="neon"] .command-palette-search {
  border-bottom: 4px solid var(--neon-orange);
}

body[data-theme="neon"] .command-palette-mark {
  background: var(--neon-acid);
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  clip-path: polygon(0 0, 80% 0, 100% 20%, 100% 100%, 20% 100%, 0 80%);
  color: var(--neon-black);
}

body[data-theme="neon"] .command-palette-search input {
  font-family: var(--neon-display);
  font-style: italic;
  font-weight: 900;
}

body[data-theme="neon"] .command-palette-item,
body[data-theme="neon"] .command-palette-item-icon,
body[data-theme="neon"] .command-palette-search > kbd,
body[data-theme="neon"] .command-palette-item-meta kbd,
body[data-theme="neon"] .command-palette-footer kbd {
  border-radius: 0;
}

body[data-theme="neon"] .command-palette-item:hover,
body[data-theme="neon"] .command-palette-item.active {
  background: var(--neon-acid);
  box-shadow:
    inset 6px 0 var(--neon-orange),
    4px 4px 0 var(--neon-violet);
  color: var(--neon-black);
  clip-path: polygon(0 0, 98% 0, 100% 18%, 100% 100%, 2% 100%, 0 82%);
}

body[data-theme="neon"] .command-palette-item.active .command-palette-item-icon {
  background: var(--neon-orange);
  border-color: var(--neon-black);
  color: var(--neon-black);
}

body[data-theme="neon"] .command-palette-item:hover .command-palette-item-copy span,
body[data-theme="neon"] .command-palette-item.active .command-palette-item-copy span,
body[data-theme="neon"] .command-palette-item:hover .command-palette-item-meta,
body[data-theme="neon"] .command-palette-item.active .command-palette-item-meta {
  color: rgba(8, 9, 13, 0.72);
}

body[data-theme="neon"] .ux-metrics-grid article {
  border: 2px solid var(--neon-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--neon-violet);
  clip-path: polygon(0 0, 94% 0, 100% 12%, 98% 100%, 4% 100%, 0 88%);
}

body[data-theme="neon"] .ux-metrics-grid article:nth-child(1),
body[data-theme="neon"] .ux-metrics-grid article:nth-child(4) {
  background: rgba(112, 72, 184, 0.26);
}

body[data-theme="neon"] .ux-metrics-grid article:nth-child(2) {
  background: rgba(200, 255, 61, 0.14);
}

body[data-theme="neon"] .ux-metrics-grid article:nth-child(3) {
  background: rgba(255, 107, 39, 0.18);
}

body[data-theme="neon"] .context-menu button:hover,
body[data-theme="neon"] .context-menu button:focus-visible {
  background: var(--neon-acid);
  color: var(--neon-black);
}

.app[data-theme="neon"] .compact-toolbar {
  background:
    linear-gradient(90deg, var(--neon-acid) 0 46%, var(--neon-orange) 46% 68%, var(--neon-violet) 68%) left bottom / 100% 5px no-repeat,
    var(--surface-sidebar);
  border-bottom: 3px solid var(--neon-black);
}

.app[data-theme="neon"] .compact-nav-button,
.app[data-theme="neon"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app[data-theme="neon"] .compact-surface-nav button.active {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  clip-path: polygon(0 0, 90% 0, 100% 20%, 100% 100%, 10% 100%, 0 80%);
  color: var(--neon-black);
}

body[data-theme="neon"] * {
  scrollbar-color: var(--neon-orange) var(--surface-raised);
}

@media (max-width: 820px) {
  body[data-theme="neon"] .project-library-head {
    padding-inline: 24px;
  }

  body[data-theme="neon"] .project-library-grid {
    gap: 0 16px;
    grid-template-columns: repeat(auto-fill, minmax(142px, 154px));
    padding-inline: 22px;
  }
}

@media (max-width: 767px) {
  .app[data-theme="neon"] .editor-pane {
    padding: 9px;
  }

  .app[data-theme="neon"] .editor-shell {
    box-shadow:
      6px 6px 0 var(--neon-orange),
      -4px -4px 0 var(--neon-violet);
    clip-path: polygon(0 0, 96% 0, 100% 4%, 100% 100%, 3% 100%, 0 97%);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding-top: 30px;
  }

  .app[data-theme="neon"] .editor-mode-panel,
  .app[data-theme="neon"] #write-panel,
  .app[data-theme="neon"] .sheet-body,
  .app[data-theme="neon"] .preview-body,
  .app[data-theme="neon"] .outline-body {
    max-width: 100%;
    min-width: 0;
  }

  .app[data-theme="neon"] .composer-toolbar {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app[data-theme="neon"] .composer-toolbar::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 640px) {
  body[data-theme="neon"] .project-library-head {
    align-items: stretch;
    flex-direction: column;
    padding: 24px 18px 18px;
  }

  body[data-theme="neon"] .project-library-actions {
    display: grid;
    grid-template-columns: 76px 76px 44px;
    justify-content: end;
    width: 100%;
  }

  body[data-theme="neon"] .project-library-grid {
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 12px 26px;
  }
}

@media (max-width: 420px) {
  .app[data-theme="neon"] .editor-shell::before {
    content: "SYNCH / 100";
    font-size: 7px;
    left: 14px;
  }

  .app[data-theme="neon"] .mode-switch button {
    letter-spacing: 0.035em;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app[data-theme="neon"] .project-eject,
  .app[data-theme="neon"] .project-new,
  .app[data-theme="neon"] .project-library-open,
  .app[data-theme="neon"] .section-button,
  .app[data-theme="neon"] .sheet-card {
    transition: none;
  }
}

/* GHOST: soft-black glass, quiet luminance, and restrained signal geometry */

body[data-theme="ghost"] {
  color-scheme: dark;
  --surface-canvas: #070708;
  --surface-sidebar: #0c0c0e;
  --surface-raised: #121215;
  --surface-overlay: #18181c;
  --surface-selected: rgba(231, 231, 227, 0.09);
  --text-primary: #e7e7e3;
  --text-secondary: #b8b8b3;
  --text-disabled: #91918d;
  --border-subtle: rgba(216, 216, 211, 0.18);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #d8d8d3;
  --accent-strong: #f0f0eb;
  --accent-soft: rgba(216, 216, 211, 0.09);
  --selection: #f0f0eb;
  --selection-soft: rgba(240, 240, 235, 0.15);
  --ghost-black: #070708;
  --ghost-ink: #0c0c0e;
  --ghost-glass: #121215;
  --ghost-glass-high: #18181c;
  --ghost-white: #d8d8d3;
  --ghost-white-high: #f0f0eb;
  --ghost-muted: #b8b8b3;
  --ghost-dim: #91918d;
  --ghost-line: rgba(216, 216, 211, 0.28);
  --ghost-line-soft: rgba(216, 216, 211, 0.14);
  --ghost-specular: rgba(255, 255, 252, 0.055);
  --warn: #d8d8d3;
  --warn-soft: rgba(216, 216, 211, 0.1);
  --shadow:
    0 22px 54px rgba(0, 0, 0, 0.46),
    inset 0 1px rgba(255, 255, 252, 0.035);
  --glow:
    0 0 0 1px rgba(216, 216, 211, 0.24),
    0 0 16px rgba(216, 216, 211, 0.07);
  --screen-grid: transparent;
  --scanline: transparent;
  --text-glow: none;
  --font-ui: "Helvetica Neue", "Avenir Next", Inter, Arial, sans-serif;
  background:
    radial-gradient(ellipse at 18% -12%, rgba(255, 255, 252, 0.045), transparent 37%),
    radial-gradient(ellipse at 92% 104%, rgba(255, 255, 252, 0.024), transparent 34%),
    linear-gradient(112deg, #060607 0%, #09090b 52%, #060607 100%);
}

body[data-theme="ghost"]::before {
  background:
    linear-gradient(118deg, transparent 0 44%, rgba(255, 255, 252, 0.018) 52%, transparent 61%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

body[data-theme="ghost"] ::selection {
  background: var(--ghost-white-high);
  color: var(--ghost-black);
}

.app[data-theme="ghost"] {
  background: transparent;
}

.app[data-theme="ghost"] .library-pane,
.app[data-theme="ghost"] .sheet-pane,
.app[data-theme="ghost"] .inspector-pane {
  background:
    linear-gradient(145deg, var(--ghost-specular), transparent 19%),
    rgba(12, 12, 14, 0.94);
  border-color: var(--ghost-line-soft);
  box-shadow:
    inset -1px 0 rgba(255, 255, 252, 0.025),
    0 20px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(0.25);
}

.app[data-theme="ghost"] .library-pane,
.app[data-theme="ghost"] .sheet-pane {
  border-right: 1px solid var(--ghost-line-soft);
}

.app[data-theme="ghost"] .inspector-pane {
  border-left: 1px solid var(--ghost-line-soft);
}

.app[data-theme="ghost"] .app-identity {
  background:
    linear-gradient(128deg, rgba(255, 255, 252, 0.055), transparent 31%),
    rgba(15, 15, 17, 0.92);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.05),
    0 0 18px rgba(216, 216, 211, 0.035);
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  color: var(--ghost-white-high);
  margin: 3px 2px 20px;
  min-height: 76px;
  padding: 13px 11px;
  position: relative;
}

.app[data-theme="ghost"] .app-identity::before {
  background: linear-gradient(90deg, transparent, var(--ghost-line), transparent);
  bottom: 5px;
  content: "";
  height: 1px;
  left: 30%;
  position: absolute;
  right: 9%;
}

.app[data-theme="ghost"] .app-identity::after {
  bottom: -16px;
  color: var(--ghost-dim);
  content: "GHOST / QUIET SYSTEM";
  font: 600 7px/1 var(--mono);
  letter-spacing: 0.16em;
  position: absolute;
  right: 5px;
}

.app[data-theme="ghost"] .brand-mark {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.08), transparent 48%),
    var(--ghost-black);
  border: 1px solid var(--ghost-white);
  border-radius: 0;
  box-shadow: 0 0 12px rgba(216, 216, 211, 0.07);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  color: var(--ghost-white-high);
}

.app[data-theme="ghost"] .app-identity strong {
  color: var(--ghost-white-high);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.app[data-theme="ghost"] .app-identity div span {
  color: var(--ghost-muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-top: 7px;
  text-transform: uppercase;
}

.app[data-theme="ghost"] .command-trigger,
.app[data-theme="ghost"] .composer-inspector-toggle,
.app[data-theme="ghost"] .composer-focus-toggle {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.05), transparent 46%),
    var(--ghost-ink);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.035),
    0 0 12px rgba(216, 216, 211, 0.045);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  color: var(--ghost-white);
}

.app[data-theme="ghost"] .command-trigger:hover,
.app[data-theme="ghost"] .composer-inspector-toggle:hover,
.app[data-theme="ghost"] .composer-focus-toggle:hover,
.app[data-theme="ghost"] .composer-inspector-toggle.active {
  background: var(--ghost-white-high);
  border-color: var(--ghost-white-high);
  color: var(--ghost-black);
  box-shadow: 0 0 16px rgba(216, 216, 211, 0.11);
}

.app[data-theme="ghost"] .eyebrow,
.app[data-theme="ghost"] .project-title-field,
.app[data-theme="ghost"] .search-box span,
.app[data-theme="ghost"] .inspector-stack > label,
.app[data-theme="ghost"] .field-grid > label {
  color: var(--ghost-muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app[data-theme="ghost"] .eyebrow {
  background: transparent;
  border: 0;
  border-left: 1px solid var(--ghost-white);
  color: var(--ghost-white);
  padding-left: 8px;
}

.app[data-theme="ghost"] h1,
.app[data-theme="ghost"] h2,
.app[data-theme="ghost"] h3 {
  color: var(--ghost-white-high);
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.app[data-theme="ghost"] input,
.app[data-theme="ghost"] textarea,
.app[data-theme="ghost"] select,
.app[data-theme="ghost"] .search-box {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.025), transparent 45%),
    rgba(7, 7, 8, 0.74);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.22);
  color: var(--ghost-white);
}

.app[data-theme="ghost"] input:focus,
.app[data-theme="ghost"] textarea:focus,
.app[data-theme="ghost"] select:focus,
.app[data-theme="ghost"] .search-box:focus-within {
  border-color: var(--ghost-white);
  box-shadow:
    0 0 0 1px rgba(216, 216, 211, 0.13),
    0 0 14px rgba(216, 216, 211, 0.055);
  outline: 0;
}

.app[data-theme="ghost"] button {
  font-family: var(--font-ui);
}

.app[data-theme="ghost"] .icon-button,
.app[data-theme="ghost"] .ghost-button,
.app[data-theme="ghost"] .inspector-actions button,
.app[data-theme="ghost"] .sheet-actions button,
.app[data-theme="ghost"] .compact-nav-button {
  background: rgba(12, 12, 14, 0.72);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: inset 0 1px rgba(255, 255, 252, 0.025);
  color: var(--ghost-muted);
}

.app[data-theme="ghost"] .icon-button:hover,
.app[data-theme="ghost"] .ghost-button:hover,
.app[data-theme="ghost"] .inspector-actions button:hover,
.app[data-theme="ghost"] .sheet-actions button:hover,
.app[data-theme="ghost"] .compact-nav-button:hover {
  border-color: var(--ghost-white);
  color: var(--ghost-white-high);
  box-shadow: 0 0 12px rgba(216, 216, 211, 0.055);
}

.app[data-theme="ghost"] .primary-button {
  background: var(--ghost-white-high);
  border: 1px solid var(--ghost-white-high);
  border-radius: 0;
  box-shadow:
    inset 0 -2px rgba(0, 0, 0, 0.16),
    0 4px 14px rgba(216, 216, 211, 0.07);
  color: var(--ghost-black);
}

.app[data-theme="ghost"] .danger-button {
  background: transparent;
  border: 1px double var(--ghost-white);
  border-radius: 0;
  color: var(--ghost-white);
}

.app[data-theme="ghost"] .section-button,
.app[data-theme="ghost"] .sheet-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 252, 0.035), transparent 22%),
    rgba(14, 14, 16, 0.92);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: inset 0 1px rgba(255, 255, 252, 0.025);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  color: var(--ghost-muted);
}

.app[data-theme="ghost"] .section-button:hover,
.app[data-theme="ghost"] .sheet-card:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 252, 0.055), transparent 24%),
    var(--ghost-glass);
  border-color: var(--ghost-line);
  color: var(--ghost-white);
  transform: translateX(2px);
}

.app[data-theme="ghost"] .section-button.active,
.app[data-theme="ghost"] .sheet-card.active {
  background:
    linear-gradient(135deg, rgba(255, 255, 252, 0.07), transparent 26%),
    var(--ghost-glass-high);
  border-color: var(--ghost-white);
  box-shadow:
    inset 2px 0 var(--ghost-white),
    0 0 14px rgba(216, 216, 211, 0.055);
  color: var(--ghost-white-high);
}

.app[data-theme="ghost"] .section-button.active::before,
.app[data-theme="ghost"] .sheet-card.active::before {
  background: var(--ghost-white);
}

.app[data-theme="ghost"] .section-count,
.app[data-theme="ghost"] .sheet-status {
  background: transparent;
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  color: var(--ghost-muted);
  font-family: var(--mono);
}

.app[data-theme="ghost"] .section-button.active .section-count {
  background: var(--ghost-white-high);
  border-color: var(--ghost-white-high);
  color: var(--ghost-black);
}

.app[data-theme="ghost"] .sheet-card.active .sheet-status {
  background: transparent;
  border-color: var(--ghost-line);
  color: var(--ghost-white);
}

.app[data-theme="ghost"] .section-button::after,
.app[data-theme="ghost"] .sheet-card::after {
  color: var(--ghost-dim);
}

.app[data-theme="ghost"] .editor-pane {
  background:
    radial-gradient(ellipse at 48% -18%, rgba(255, 255, 252, 0.035), transparent 35%),
    transparent;
}

.app[data-theme="ghost"] .editor-shell {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.035), transparent 16%),
    linear-gradient(105deg, rgba(15, 15, 17, 0.97), rgba(9, 9, 11, 0.99));
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.035),
    0 28px 70px rgba(0, 0, 0, 0.34);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  isolation: isolate;
  transform: none;
}

.app[data-theme="ghost"] .editor-shell::before {
  color: var(--ghost-dim);
  content: "SIGNAL / STILL";
  font: 500 7px/1 var(--mono);
  left: 19px;
  letter-spacing: 0.18em;
  pointer-events: none;
  position: absolute;
  top: 14px;
  z-index: 0;
}

.app[data-theme="ghost"] .editor-shell::after {
  background: linear-gradient(90deg, var(--ghost-line), transparent 38%);
  content: "";
  height: 1px;
  left: 18px;
  opacity: 0.7;
  pointer-events: none;
  position: absolute;
  right: 26px;
  top: 27px;
  z-index: 0;
}

.app[data-theme="ghost"] .editor-shell > * {
  position: relative;
  z-index: 1;
}

.app[data-theme="ghost"] .editor-topbar {
  border-bottom-color: var(--ghost-line-soft);
}

.app[data-theme="ghost"] .mode-switch {
  background: rgba(7, 7, 8, 0.76);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: inset 0 1px rgba(255, 255, 252, 0.025);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
}

.app[data-theme="ghost"] .mode-switch button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ghost-dim);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app[data-theme="ghost"] .mode-switch button:hover {
  color: var(--ghost-white);
}

.app[data-theme="ghost"] .mode-switch button.active {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.08), transparent 50%),
    var(--ghost-glass-high);
  box-shadow: inset 0 -1px var(--ghost-white);
  color: var(--ghost-white-high);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}

.app[data-theme="ghost"] .composer-toolbar {
  background: rgba(7, 7, 8, 0.64);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: inset 0 1px rgba(255, 255, 252, 0.02);
}

.app[data-theme="ghost"] .composer-toolbar button {
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  color: var(--ghost-muted);
}

.app[data-theme="ghost"] .composer-toolbar button:hover,
.app[data-theme="ghost"] .composer-toolbar button.active {
  background: var(--ghost-glass-high);
  border-color: var(--ghost-line);
  color: var(--ghost-white-high);
}

.app[data-theme="ghost"] .composer-toolbar .composer-add-lore {
  background: transparent;
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  color: var(--ghost-dim);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}

.app[data-theme="ghost"] .composer-toolbar .composer-add-lore[data-selection-ready="true"] {
  background: var(--ghost-white-high);
  border-color: var(--ghost-white-high);
  box-shadow: 0 0 16px rgba(216, 216, 211, 0.1);
  color: var(--ghost-black);
}

.app[data-theme="ghost"] .sheet-title-input,
.app[data-theme="ghost"] .sheet-body {
  background: transparent;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--ghost-white-high);
  outline: 0 !important;
  pointer-events: auto;
  user-select: text;
  z-index: 2;
}

.app[data-theme="ghost"] .sheet-title-input {
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.app[data-theme="ghost"] .sheet-body,
.app[data-theme="ghost"] .preview-body,
.app[data-theme="ghost"] .outline-body {
  caret-color: var(--ghost-white-high);
  color: var(--ghost-white);
}

.app[data-theme="ghost"] .sheet-title-input:focus,
.app[data-theme="ghost"] .sheet-body:focus {
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.app[data-theme="ghost"] .sheet-body a,
.app[data-theme="ghost"] .preview-body a,
.app[data-theme="ghost"] .lore-mention {
  color: var(--ghost-white-high);
  text-decoration-color: var(--ghost-line);
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
}

.app[data-theme="ghost"] .editor-meta,
.app[data-theme="ghost"] .editor-footer,
.app[data-theme="ghost"] .outline-item p {
  color: var(--ghost-dim);
}

.app[data-theme="ghost"] .editor-meta,
.app[data-theme="ghost"] .editor-footer {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app[data-theme="ghost"] .editor-footer {
  border-top: 1px solid var(--ghost-line-soft);
}

.app[data-theme="ghost"] .outline-item {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.03), transparent 30%),
    rgba(12, 12, 14, 0.84);
  border: 1px solid var(--ghost-line-soft);
  border-left-color: var(--ghost-white);
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  color: var(--ghost-white);
}

.app[data-theme="ghost"],
body[data-theme="ghost"] {
  --project-case: #111114;
  --project-case-edge: #d0d0cb;
  --project-case-highlight: #1a1a1e;
  --project-case-shadow: #050506;
  --project-screen: #080809;
  --project-screen-text: #e4e4df;
  --project-screen-muted: #a2a29e;
  --project-screen-line: rgba(224, 224, 218, 0.12);
  --project-control: #151518;
  --project-control-edge: #cacac5;
  --project-control-text: #e7e7e3;
  --project-slot: #030304;
  --cartridge-shell: #151518;
  --cartridge-shell-deep: #09090b;
  --cartridge-edge: #d0d0cb;
  --cartridge-label: #e4e4df;
  --cartridge-label-text: #0a0a0b;
  --cartridge-accent: #8e8e8a;
  --cartridge-contacts: #c8c8c3;
  --shelf-surface: #09090b;
  --shelf-edge: #bdbdb8;
}

.app[data-theme="ghost"] .project-device {
  background:
    linear-gradient(136deg, rgba(255, 255, 252, 0.06), transparent 21%),
    linear-gradient(152deg, #141417 0 64%, #0b0b0d 64%);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.045),
    inset -8px -10px 20px rgba(0, 0, 0, 0.22),
    0 20px 42px rgba(0, 0, 0, 0.36),
    0 0 16px rgba(216, 216, 211, 0.035);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 8px 100%, 0 calc(100% - 8px));
  padding-top: 17px;
}

.app[data-theme="ghost"] .project-device::before {
  background: linear-gradient(90deg, transparent, var(--ghost-line), transparent);
  height: 1px;
  left: 34%;
  opacity: 1;
  right: 8%;
  top: 8px;
}

.app[data-theme="ghost"] .project-device::after {
  color: var(--ghost-dim);
  content: "MN / GHOST ARRAY";
  font: 500 6px/1 var(--mono);
  left: 10px;
  letter-spacing: 0.15em;
  position: absolute;
  top: 6px;
}

.app[data-theme="ghost"] .project-device-fastener {
  background: var(--ghost-black);
  border: 1px solid var(--ghost-line);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 252, 0.025);
}

.app[data-theme="ghost"] .project-device-screen {
  background:
    radial-gradient(ellipse at 50% 36%, rgba(255, 255, 252, 0.035), transparent 52%),
    linear-gradient(145deg, rgba(255, 255, 252, 0.022), transparent 42%),
    var(--project-screen);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.62),
    0 0 12px rgba(216, 216, 211, 0.035);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}

.app[data-theme="ghost"] .project-device-screen-glare {
  background: linear-gradient(118deg, rgba(255, 255, 252, 0.045), transparent 22% 78%, rgba(255, 255, 252, 0.018));
  border-radius: 0;
}

.app[data-theme="ghost"] .project-device .project-title-input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--project-screen-line);
  border-radius: 0;
  box-shadow: none;
  color: var(--project-screen-text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  text-shadow: 0 0 10px rgba(216, 216, 211, 0.07);
}

.app[data-theme="ghost"] .project-device .project-progress div {
  background: rgba(255, 255, 252, 0.018);
  border: 1px solid var(--project-screen-line);
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}

.app[data-theme="ghost"] .project-device-slot-line {
  background: var(--ghost-black);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow:
    inset 0 3px 7px rgba(0, 0, 0, 0.92),
    0 0 8px rgba(216, 216, 211, 0.025);
  height: 9px;
  top: 15px;
}

.app[data-theme="ghost"] .project-eject,
.app[data-theme="ghost"] .project-new,
.app[data-theme="ghost"] .project-library-open {
  --button-mark: "·";
  background:
    linear-gradient(180deg, rgba(255, 255, 252, 0.055), transparent 14%),
    linear-gradient(145deg, #18181b, #0e0e10);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.06),
    inset 0 -3px rgba(0, 0, 0, 0.28),
    0 4px 0 #050506,
    0 5px 12px rgba(0, 0, 0, 0.32);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  color: var(--ghost-white);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.09em;
  transform: translateY(0);
}

.app[data-theme="ghost"] .project-eject {
  --button-mark: "↑";
}

.app[data-theme="ghost"] .project-new {
  --button-mark: "+";
}

.app[data-theme="ghost"] .project-library-open {
  --button-mark: "□";
}

.app[data-theme="ghost"] .project-eject::before,
.app[data-theme="ghost"] .project-new::before,
.app[data-theme="ghost"] .project-library-open::before {
  align-items: center;
  border: 1px solid var(--ghost-line-soft);
  color: var(--ghost-white);
  content: var(--button-mark);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 9px;
  height: 17px;
  justify-content: center;
  margin-right: 7px;
  width: 17px;
}

.app[data-theme="ghost"] .project-eject:hover:not(:disabled),
.app[data-theme="ghost"] .project-new:hover,
.app[data-theme="ghost"] .project-library-open:hover {
  background: var(--ghost-white-high);
  border-color: var(--ghost-white-high);
  box-shadow:
    inset 0 -3px rgba(0, 0, 0, 0.16),
    0 5px 0 #080809,
    0 0 16px rgba(216, 216, 211, 0.08);
  color: var(--ghost-black);
  transform: translateY(-1px);
}

.app[data-theme="ghost"] .project-eject:hover:not(:disabled)::before,
.app[data-theme="ghost"] .project-new:hover::before,
.app[data-theme="ghost"] .project-library-open:hover::before {
  border-color: rgba(7, 7, 8, 0.28);
  color: var(--ghost-black);
}

.app[data-theme="ghost"] .project-eject:active:not(:disabled),
.app[data-theme="ghost"] .project-new:active,
.app[data-theme="ghost"] .project-library-open:active {
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.26),
    0 1px 0 #050506;
  transform: translateY(4px);
}

.app[data-theme="ghost"] .project-eject:focus-visible,
.app[data-theme="ghost"] .project-new:focus-visible,
.app[data-theme="ghost"] .project-library-open:focus-visible {
  box-shadow:
    0 0 0 1px var(--ghost-white-high),
    0 0 16px rgba(216, 216, 211, 0.1);
  outline: 0;
}

body[data-theme="ghost"] .project-library-backdrop,
body[data-theme="ghost"] .command-palette-backdrop,
body[data-theme="ghost"] .ux-metrics-backdrop,
body[data-theme="ghost"] .settings-backdrop,
body[data-theme="ghost"] .lore-backdrop,
body[data-theme="ghost"] .tenant-admin-backdrop {
  background:
    radial-gradient(ellipse at 50% 28%, rgba(255, 255, 252, 0.025), transparent 45%),
    rgba(3, 3, 4, 0.82);
  backdrop-filter: blur(16px) saturate(0.2);
}

body[data-theme="ghost"] .project-library-panel,
body[data-theme="ghost"] .project-delete-dialog,
body[data-theme="ghost"] .command-palette-dialog,
body[data-theme="ghost"] .ux-metrics-dialog,
body[data-theme="ghost"] .settings-dialog,
body[data-theme="ghost"] .lore-panel,
body[data-theme="ghost"] .lore-decision-dialog,
body[data-theme="ghost"] .tenant-admin-dialog,
body[data-theme="ghost"] .toast,
body[data-theme="ghost"] .context-menu {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.045), transparent 18%),
    rgba(16, 16, 18, 0.97);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.045),
    0 30px 90px rgba(0, 0, 0, 0.58),
    0 0 22px rgba(216, 216, 211, 0.035);
}

body[data-theme="ghost"] .project-library-panel {
  background:
    radial-gradient(ellipse at 17% 0%, rgba(255, 255, 252, 0.04), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 252, 0.02), transparent 24%),
    #0b0b0d;
  isolation: isolate;
}

body[data-theme="ghost"] .project-library-panel::before,
body[data-theme="ghost"] .command-palette-dialog::before,
body[data-theme="ghost"] .ux-metrics-dialog::before,
body[data-theme="ghost"] .settings-dialog::before {
  background: linear-gradient(90deg, transparent, var(--ghost-line), transparent);
  content: "";
  display: block;
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 3;
}

body[data-theme="ghost"] .project-library-panel::after {
  bottom: 9px;
  color: rgba(216, 216, 211, 0.28);
  content: "MN // GHOST ARCHIVE // 00";
  font: 500 7px/1 var(--mono);
  letter-spacing: 0.16em;
  pointer-events: none;
  position: absolute;
  right: 17px;
  text-transform: uppercase;
  z-index: 2;
}

body[data-theme="ghost"] .project-library-head {
  align-items: center;
  background:
    linear-gradient(130deg, rgba(255, 255, 252, 0.038), transparent 29%),
    rgba(14, 14, 16, 0.94);
  border-bottom: 1px solid var(--ghost-line-soft);
  min-height: 126px;
  padding: 27px 32px 23px;
  position: relative;
}

body[data-theme="ghost"] .project-library-heading h2 {
  color: var(--ghost-white-high);
  font-family: var(--font-ui);
  font-size: clamp(34px, 5vw, 68px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

body[data-theme="ghost"] .project-library-kicker,
body[data-theme="ghost"] .project-library-count,
body[data-theme="ghost"] .project-library-rail {
  color: var(--ghost-muted);
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body[data-theme="ghost"] .project-library-count {
  background: transparent;
  border: 1px solid var(--ghost-line-soft);
  color: var(--ghost-white);
}

body[data-theme="ghost"] .project-library-actions {
  background: rgba(7, 7, 8, 0.52);
  border: 1px solid var(--ghost-line-soft);
  padding: 7px;
}

body[data-theme="ghost"] .project-library-backup,
body[data-theme="ghost"] .project-library-trash,
body[data-theme="ghost"] .project-library-close {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.045), transparent 48%),
    var(--ghost-ink);
  border: 1px solid var(--ghost-line);
  border-radius: 0;
  box-shadow: inset 0 1px rgba(255, 255, 252, 0.035);
  color: var(--ghost-white);
}

body[data-theme="ghost"] .project-library-backup:hover,
body[data-theme="ghost"] .project-library-trash:hover,
body[data-theme="ghost"] .project-library-close:hover {
  background: var(--ghost-white-high);
  border-color: var(--ghost-white-high);
  color: var(--ghost-black);
  box-shadow: 0 0 16px rgba(216, 216, 211, 0.09);
}

body[data-theme="ghost"] .project-library-rail {
  background: #0d0d0f;
  border-bottom: 1px solid var(--ghost-line);
  border-top: 1px solid var(--ghost-line-soft);
}

body[data-theme="ghost"] .project-library-grid {
  background:
    linear-gradient(90deg, transparent 0 calc(100% - 1px), rgba(216, 216, 211, 0.04) calc(100% - 1px)) 0 0 / 168px 100%,
    linear-gradient(180deg, rgba(255, 255, 252, 0.016), transparent 38%),
    var(--ghost-black);
  border-bottom: 1px solid var(--ghost-line);
  border-top: 1px solid var(--ghost-line);
}

body[data-theme="ghost"] .project-library-grid::after {
  bottom: 22px;
  color: rgba(216, 216, 211, 0.07);
  content: "BLACK // WHITE // WRITE";
  font-family: var(--font-ui);
  font-size: clamp(30px, 6vw, 92px);
  font-weight: 300;
  letter-spacing: -0.055em;
  pointer-events: none;
  position: absolute;
  right: 34px;
  text-transform: uppercase;
}

body[data-theme="ghost"] .project-cartridge-item {
  color: var(--ghost-white);
}

body[data-theme="ghost"] .project-cartridge-item::after {
  background: rgba(255, 255, 252, 0.035);
  border: 1px solid var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: none;
}

body[data-theme="ghost"] .project-cartridge-item:hover::after,
body[data-theme="ghost"] .project-cartridge-item.active::after {
  border-color: var(--ghost-white);
  box-shadow: 0 0 16px rgba(216, 216, 211, 0.06);
}

body[data-theme="ghost"] .project-cartridge-shell {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.06), transparent 26%),
    linear-gradient(152deg, var(--cartridge-shell), var(--cartridge-shell-deep));
  border: 1px solid var(--cartridge-edge);
  border-radius: 0;
  box-shadow:
    inset 0 1px rgba(255, 255, 252, 0.045),
    0 12px 24px rgba(0, 0, 0, 0.34);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px));
}

body[data-theme="ghost"] .project-cartridge-label {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.92), rgba(205, 205, 200, 0.94));
  border: 1px solid var(--ghost-black);
  border-radius: 0;
  color: var(--ghost-black);
}

body[data-theme="ghost"] .project-cartridge-contacts span {
  background: var(--cartridge-contacts);
  box-shadow: none;
}

body[data-theme="ghost"] .project-cartridge-item.active::before {
  background: var(--ghost-white-high);
  border: 1px solid var(--ghost-black);
  color: var(--ghost-black);
  content: "PRESENT";
  font: 600 7px/1 var(--mono);
  letter-spacing: 0.14em;
}

body[data-theme="ghost"] .project-trash-window,
body[data-theme="ghost"] .settings-body,
body[data-theme="ghost"] .settings-section,
body[data-theme="ghost"] .lore-card,
body[data-theme="ghost"] .command-item,
body[data-theme="ghost"] .ux-metric-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 252, 0.025), transparent 30%),
    rgba(11, 11, 13, 0.9);
  border-color: var(--ghost-line-soft);
  border-radius: 0;
  box-shadow: inset 0 1px rgba(255, 255, 252, 0.02);
}

body[data-theme="ghost"] .command-item:hover,
body[data-theme="ghost"] .command-item[aria-selected="true"],
body[data-theme="ghost"] .lore-card:hover {
  background: var(--ghost-glass-high);
  border-color: var(--ghost-line);
  color: var(--ghost-white-high);
}

body[data-theme="ghost"] .settings-tab.active,
body[data-theme="ghost"] .command-item[aria-selected="true"] {
  box-shadow: inset 2px 0 var(--ghost-white);
}

body[data-theme="ghost"] .toast {
  color: var(--ghost-white);
}

.app[data-theme="ghost"] .compact-toolbar {
  background:
    linear-gradient(90deg, transparent, var(--ghost-line), transparent) left bottom / 100% 1px no-repeat,
    rgba(12, 12, 14, 0.97);
  border-bottom: 1px solid var(--ghost-line-soft);
}

.app[data-theme="ghost"] .compact-nav-button,
.app[data-theme="ghost"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--ghost-muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="ghost"] .compact-surface-nav button.active {
  background: var(--ghost-white-high);
  border-color: var(--ghost-white-high);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
  color: var(--ghost-black);
}

body[data-theme="ghost"] * {
  scrollbar-color: var(--ghost-dim) var(--ghost-black);
}

body[data-theme="ghost"] *::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

body[data-theme="ghost"] *::-webkit-scrollbar-track {
  background: var(--ghost-black);
}

body[data-theme="ghost"] *::-webkit-scrollbar-thumb {
  background: var(--ghost-dim);
  border: 2px solid var(--ghost-black);
  border-radius: 0;
}

@media (max-width: 767px) {
  .app[data-theme="ghost"] .editor-pane {
    padding: 9px;
  }

  .app[data-theme="ghost"] .editor-shell {
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    height: calc(100% - 6px);
    margin: 3px auto;
    padding-top: 30px;
  }

  .app[data-theme="ghost"] .editor-mode-panel,
  .app[data-theme="ghost"] #write-panel,
  .app[data-theme="ghost"] .sheet-body,
  .app[data-theme="ghost"] .preview-body,
  .app[data-theme="ghost"] .outline-body {
    max-width: 100%;
    min-width: 0;
  }

  .app[data-theme="ghost"] .composer-toolbar {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app[data-theme="ghost"] .composer-toolbar::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 640px) {
  body[data-theme="ghost"] .project-library-head {
    align-items: stretch;
    flex-direction: column;
    padding: 24px 18px 18px;
  }

  body[data-theme="ghost"] .project-library-actions {
    display: grid;
    grid-template-columns: 76px 76px 44px;
    justify-content: end;
    width: 100%;
  }

  body[data-theme="ghost"] .project-library-grid {
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 12px 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app[data-theme="ghost"] .project-eject,
  .app[data-theme="ghost"] .project-new,
  .app[data-theme="ghost"] .project-library-open,
  .app[data-theme="ghost"] .section-button,
  .app[data-theme="ghost"] .sheet-card {
    transition: none;
  }
}

/* NOIR: metropolitan art deco, cast-metal memory hardware, and negotiation dossiers */

body[data-theme="noir"] {
  color-scheme: dark;
  --surface-canvas: #070706;
  --surface-sidebar: #11110f;
  --surface-raised: #1b1a17;
  --surface-overlay: #25221d;
  --surface-selected: rgba(220, 76, 82, 0.16);
  --text-primary: #f3ecd9;
  --text-secondary: #c8bfa8;
  --text-disabled: #9a927f;
  --border-subtle: rgba(201, 166, 91, 0.3);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #dc4c52;
  --accent-strong: #ff7377;
  --accent-soft: rgba(220, 76, 82, 0.14);
  --selection: #c9a65b;
  --selection-soft: rgba(201, 166, 91, 0.2);
  --noir-ink: #070706;
  --noir-black: #11110f;
  --noir-charcoal: #1b1a17;
  --noir-steel: #6f7470;
  --noir-bone: #f3ecd9;
  --noir-paper: #e8ddc3;
  --noir-paper-deep: #cabe9f;
  --noir-brass: #c9a65b;
  --noir-brass-deep: #6e5427;
  --noir-red: #b51f2d;
  --noir-red-hot: #dc4c52;
  --noir-screen: #17170f;
  --noir-screen-text: #e6c977;
  --noir-display: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
  --warn: #dc4c52;
  --warn-soft: rgba(220, 76, 82, 0.16);
  --shadow:
    0 18px 38px rgba(0, 0, 0, 0.55),
    7px 7px 0 rgba(181, 31, 45, 0.34);
  --glow:
    0 0 0 1px rgba(201, 166, 91, 0.52),
    0 0 20px rgba(201, 166, 91, 0.13);
  --screen-grid: rgba(201, 166, 91, 0.032);
  --scanline: rgba(243, 236, 217, 0.012);
  --text-glow: none;
  --font-ui: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(181, 31, 45, 0.09), transparent 20%),
    linear-gradient(90deg, transparent 0 7%, rgba(201, 166, 91, 0.055) 7% 7.2%, transparent 7.2% 92.8%, rgba(201, 166, 91, 0.055) 92.8% 93%, transparent 93%),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(201, 166, 91, 0.024) 58px 59px),
    repeating-linear-gradient(0deg, transparent 0 33px, rgba(243, 236, 217, 0.016) 33px 34px),
    radial-gradient(ellipse at 50% 110%, rgba(181, 31, 45, 0.18), transparent 42%),
    var(--surface-canvas);
}

body[data-theme="noir"] ::selection {
  background: var(--noir-red-hot);
  color: var(--noir-bone);
}

.app[data-theme="noir"] {
  background: transparent;
}

.app[data-theme="noir"] .library-pane,
.app[data-theme="noir"] .sheet-pane,
.app[data-theme="noir"] .inspector-pane {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025), transparent 16% 84%, rgba(0, 0, 0, 0.28)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(201, 166, 91, 0.025) 39px 40px),
    rgba(17, 17, 15, 0.97);
  border-color: var(--noir-brass-deep);
  box-shadow:
    inset -1px 0 rgba(201, 166, 91, 0.2),
    inset 1px 0 rgba(243, 236, 217, 0.035);
}

.app[data-theme="noir"] .library-pane {
  border-right: 3px double var(--noir-brass);
}

.app[data-theme="noir"] .sheet-pane {
  border-right: 4px solid var(--noir-red);
}

.app[data-theme="noir"] .inspector-pane {
  border-left: 1px solid var(--noir-brass);
}

.app[data-theme="noir"] .app-identity {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 28%),
    linear-gradient(100deg, var(--noir-charcoal), var(--noir-ink));
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 4px var(--noir-ink),
    inset 0 0 0 5px var(--noir-brass-deep),
    5px 5px 0 var(--noir-red);
  clip-path: polygon(0 0, 91% 0, 100% 18%, 100% 100%, 7% 100%, 0 82%);
  color: var(--noir-bone);
  margin: 3px 4px 24px 0;
  min-height: 82px;
  padding: 14px 12px 13px;
}

.app[data-theme="noir"] .app-identity::after {
  border-bottom: 1px solid var(--noir-brass);
  border-top: 1px solid var(--noir-brass);
  bottom: 9px;
  content: "";
  height: 2px;
  left: 74px;
  opacity: 0.7;
  position: absolute;
  right: 12px;
}

.app[data-theme="noir"] .brand-mark {
  background:
    radial-gradient(circle, var(--noir-red-hot) 0 3px, transparent 4px),
    var(--noir-ink);
  border: 2px solid var(--noir-brass);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 3px var(--noir-ink),
    inset 0 0 0 4px var(--noir-red),
    0 0 0 2px var(--noir-ink);
  color: var(--noir-bone);
  height: 54px;
  transform: rotate(-2deg);
  width: 54px;
}

.app[data-theme="noir"] .app-identity strong {
  color: var(--noir-bone);
  font-family: var(--noir-display);
  font-size: 21px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="noir"] #project-subtitle,
.app[data-theme="noir"] .sync-status,
.app[data-theme="noir"] .command-trigger {
  color: var(--noir-brass);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .sync-status-dot {
  background: var(--noir-red-hot);
  box-shadow: 0 0 8px rgba(220, 76, 82, 0.72);
}

.app[data-theme="noir"] .command-trigger {
  background: var(--noir-red);
  border: 1px solid var(--noir-bone);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--noir-brass-deep);
  color: var(--noir-bone);
}

.app[data-theme="noir"] .project-selector-label {
  align-items: center;
  background: var(--noir-paper);
  border-left: 7px solid var(--noir-red);
  box-shadow: 4px 4px 0 var(--noir-brass-deep);
  color: var(--noir-ink);
  display: flex;
  font-family: var(--noir-display);
  font-size: 10px;
  font-weight: 950;
  justify-content: space-between;
  letter-spacing: 0.18em;
  min-height: 28px;
  padding: 0 10px;
  text-transform: uppercase;
}

.app[data-theme="noir"] .project-selector-label::after {
  color: var(--noir-red);
  content: "MEM / CONSOLE";
  font: 650 6px/1 var(--mono);
  letter-spacing: 0.12em;
}

.app[data-theme="noir"] .project-device {
  --project-case: #1b1a17;
  --project-case-highlight: rgba(243, 236, 217, 0.09);
  --project-case-shadow: #070706;
  --project-case-edge: #c9a65b;
  --project-screen: #17170f;
  --project-screen-line: rgba(230, 201, 119, 0.24);
  --project-screen-text: #e6c977;
  --project-screen-muted: #c8b57e;
  --project-slot: #020201;
  --project-control: #b51f2d;
  --project-control-edge: #f3ecd9;
  --project-control-text: #f3ecd9;
  --cartridge-shell: #22211e;
  --cartridge-shell-deep: #090908;
  --cartridge-edge: #c9a65b;
  --cartridge-label: #e8ddc3;
  --cartridge-label-text: #171611;
  --cartridge-accent: #b51f2d;
  --cartridge-contacts: #c9a65b;
  --shelf-surface: #0d0d0b;
  --shelf-edge: #6e5427;
  background:
    linear-gradient(90deg, transparent 0 5%, rgba(201, 166, 91, 0.08) 5% 5.5%, transparent 5.5% 94.5%, rgba(201, 166, 91, 0.08) 94.5% 95%, transparent 95%),
    linear-gradient(145deg, var(--project-case-highlight), transparent 25%),
    linear-gradient(165deg, var(--project-case), var(--project-case-shadow));
  border: 2px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 4px var(--noir-ink),
    inset 0 0 0 5px var(--noir-brass-deep),
    0 8px 0 var(--noir-ink),
    0 11px 0 var(--noir-red),
    0 17px 24px rgba(0, 0, 0, 0.52);
  clip-path: polygon(0 0, 94% 0, 100% 6%, 100% 94%, 94% 100%, 6% 100%, 0 94%);
  padding: 16px 14px 13px;
}

.app[data-theme="noir"] .project-device::before {
  background:
    radial-gradient(circle at 50% 50%, var(--noir-red-hot) 0 2px, transparent 3px),
    linear-gradient(90deg, transparent, var(--noir-brass), transparent);
  border-radius: 0;
  height: 5px;
  left: 25%;
  right: 25%;
  top: 6px;
}

.app[data-theme="noir"] .project-device::after {
  color: var(--noir-brass);
  content: "NEGOTIATION FILE / 08";
  font: 700 5px/1 var(--mono);
  letter-spacing: 0.14em;
  position: absolute;
  right: 14px;
  top: 8px;
}

.app[data-theme="noir"] .project-device-fastener {
  background: var(--noir-brass);
  border: 2px solid var(--noir-ink);
  box-shadow: 0 0 0 1px var(--noir-brass-deep);
  height: 7px;
  top: 8px;
  width: 7px;
}

.app[data-theme="noir"] .project-device-screen {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(230, 201, 119, 0.1), transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(230, 201, 119, 0.105) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(230, 201, 119, 0.035) 47px 48px),
    var(--noir-screen);
  border: 5px solid var(--noir-ink);
  border-radius: 48% / 9%;
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.92),
    0 0 0 1px var(--noir-brass),
    0 0 0 4px var(--noir-charcoal);
  color: var(--noir-screen-text);
  min-height: 158px;
  padding: 22px 17px 16px;
}

.app[data-theme="noir"] .project-device-screen::after {
  border-bottom: 1px solid rgba(230, 201, 119, 0.32);
  border-top: 1px solid rgba(230, 201, 119, 0.32);
  bottom: 9px;
  content: "";
  height: 3px;
  left: 22%;
  position: absolute;
  right: 22%;
}

.app[data-theme="noir"] .project-device-screen-glare {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 24% 76%, rgba(201, 166, 91, 0.04));
}

.app[data-theme="noir"] .project-device .project-title-field {
  color: var(--noir-screen-text);
  font-family: var(--noir-display);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.app[data-theme="noir"] .project-device .project-title-input {
  border-bottom: 2px solid var(--noir-red);
  color: var(--noir-bone);
  font-family: var(--noir-display);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .project-device .project-progress div {
  background:
    linear-gradient(135deg, rgba(201, 166, 91, 0.1), transparent 55%),
    rgba(7, 7, 6, 0.58);
  border: 1px solid var(--noir-brass-deep);
  border-radius: 0;
  box-shadow: inset 3px 0 var(--noir-red);
}

.app[data-theme="noir"] .project-device .project-progress strong {
  color: var(--noir-screen-text);
  font-family: var(--noir-display);
  font-size: 16px;
}

.app[data-theme="noir"] .project-device .project-progress span {
  color: var(--noir-brass);
}

.app[data-theme="noir"] .project-device .meter {
  background: var(--noir-ink);
  border-color: var(--noir-brass-deep);
}

.app[data-theme="noir"] .project-device .meter span {
  background: repeating-linear-gradient(90deg, var(--noir-red) 0 11px, var(--noir-red-hot) 11px 14px, transparent 14px 16px);
  box-shadow: 0 0 8px rgba(220, 76, 82, 0.58);
}

.app[data-theme="noir"] .project-device-slot-line {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    inset 0 4px 6px #000,
    0 2px 0 var(--noir-brass-deep);
  clip-path: polygon(4% 0, 96% 0, 100% 50%, 96% 100%, 4% 100%, 0 50%);
  height: 12px;
}

.app[data-theme="noir"] .project-eject,
.app[data-theme="noir"] .project-new,
.app[data-theme="noir"] .project-library-open {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0 5%, transparent 6%),
    linear-gradient(145deg, var(--project-button-face), color-mix(in srgb, var(--project-button-face) 68%, #000));
  border: 2px solid var(--noir-bone);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 3px var(--noir-ink),
    inset 0 0 0 4px rgba(201, 166, 91, 0.52),
    0 6px 0 var(--noir-ink),
    0 8px 0 var(--noir-brass-deep),
    0 12px 16px rgba(0, 0, 0, 0.5);
  clip-path: polygon(0 0, 91% 0, 100% 22%, 100% 100%, 9% 100%, 0 78%);
  color: var(--noir-bone);
  font-family: var(--noir-display);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-shadow: 0 1px #000;
}

.app[data-theme="noir"] .project-eject {
  --project-button-face: var(--noir-red);
}

.app[data-theme="noir"] .project-new {
  --project-button-face: #31312d;
}

.app[data-theme="noir"] .project-library-open {
  --project-button-face: var(--noir-brass-deep);
}

.app[data-theme="noir"] .project-eject:hover:not(:disabled),
.app[data-theme="noir"] .project-new:hover,
.app[data-theme="noir"] .project-library-open:hover {
  box-shadow:
    inset 0 0 0 3px var(--noir-ink),
    inset 0 0 0 4px var(--noir-brass),
    0 7px 0 var(--noir-ink),
    0 9px 0 var(--noir-red),
    0 14px 18px rgba(0, 0, 0, 0.52);
}

.app[data-theme="noir"] .project-eject:active:not(:disabled),
.app[data-theme="noir"] .project-new:active,
.app[data-theme="noir"] .project-library-open:active {
  box-shadow:
    inset 0 3px 0 rgba(0, 0, 0, 0.7),
    inset 0 0 0 3px var(--noir-ink),
    0 1px 0 var(--noir-ink);
}

.app[data-theme="noir"] .section-button {
  background:
    linear-gradient(90deg, var(--noir-red) 0 5px, transparent 5px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 36%),
    var(--noir-charcoal);
  border: 1px solid var(--noir-brass-deep);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--noir-ink);
  clip-path: polygon(0 0, 92% 0, 100% 24%, 100% 100%, 6% 100%, 0 82%);
  color: var(--noir-paper);
  font-family: var(--noir-display);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .section-button:hover,
.app[data-theme="noir"] .section-button.active {
  background:
    linear-gradient(90deg, var(--noir-red) 0 7px, transparent 7px),
    var(--noir-paper);
  border-color: var(--noir-brass);
  color: var(--noir-ink);
  transform: translateX(3px);
}

.app[data-theme="noir"] .section-button.active {
  box-shadow:
    4px 4px 0 var(--noir-red),
    7px 7px 0 var(--noir-ink);
}

.app[data-theme="noir"] .section-button.active strong {
  color: var(--noir-ink);
}

.app[data-theme="noir"] .section-count {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  color: var(--noir-bone);
  font-family: var(--mono);
}

.app[data-theme="noir"] .sheet-pane-head h2,
.app[data-theme="noir"] .inspector-head h2 {
  color: var(--noir-bone);
  font-family: var(--noir-display);
  font-size: 19px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .sheet-pane-head::after {
  color: var(--noir-brass);
  content: "CASE INDEX / CITY 08";
  font: 650 6px/1 var(--mono);
  letter-spacing: 0.12em;
}

.app[data-theme="noir"] .search-box {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass-deep);
  border-left: 5px solid var(--noir-red);
  border-radius: 0;
  box-shadow: inset 0 -1px rgba(201, 166, 91, 0.26);
  color: var(--noir-bone);
}

.app[data-theme="noir"] .sheet-card {
  background:
    linear-gradient(90deg, var(--noir-red) 0 4px, transparent 4px),
    linear-gradient(125deg, rgba(201, 166, 91, 0.07), transparent 30%),
    var(--noir-charcoal);
  border: 1px solid var(--noir-brass-deep);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--noir-ink);
  clip-path: polygon(0 0, 96% 0, 100% 12%, 100% 100%, 4% 100%, 0 88%);
  color: var(--noir-paper);
  padding-left: 14px;
}

.app[data-theme="noir"] .sheet-card:hover {
  border-color: var(--noir-brass);
  box-shadow:
    5px 5px 0 var(--noir-ink),
    7px 7px 0 var(--noir-red);
  transform: translate(-2px, -2px);
}

.app[data-theme="noir"] .sheet-card.active {
  background:
    linear-gradient(90deg, var(--noir-red) 0 7px, transparent 7px),
    repeating-linear-gradient(0deg, transparent 0 20px, rgba(17, 17, 15, 0.045) 20px 21px),
    var(--noir-paper);
  border-color: var(--noir-brass);
  box-shadow:
    5px 5px 0 var(--noir-red),
    8px 8px 0 var(--noir-ink);
  color: var(--noir-ink);
}

.app[data-theme="noir"] .sheet-card.active p,
.app[data-theme="noir"] .sheet-card.active .sheet-meta,
.app[data-theme="noir"] .sheet-card.active .sheet-word-count {
  color: #4f493d;
}

.app[data-theme="noir"] .sheet-card strong {
  font-family: var(--noir-display);
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .sheet-card p {
  font-family: Georgia, "Times New Roman", serif;
}

.app[data-theme="noir"] .sheet-card .status-pill {
  border-radius: 0;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .status-to-write {
  color: var(--noir-brass);
}

.app[data-theme="noir"] .status-draft {
  color: var(--noir-red-hot);
}

.app[data-theme="noir"] .status-revising {
  color: #9eb0aa;
}

.app[data-theme="noir"] .status-done {
  color: var(--noir-bone);
}

.app[data-theme="noir"] .editor-pane {
  background:
    linear-gradient(90deg, rgba(201, 166, 91, 0.055) 1px, transparent 1px) 0 0 / 72px 100%,
    linear-gradient(180deg, rgba(181, 31, 45, 0.1), transparent 18%),
    var(--noir-ink);
  padding: 13px;
}

.app[data-theme="noir"] .editor-shell {
  background:
    linear-gradient(90deg, rgba(110, 84, 39, 0.2) 1px, transparent 1px) 36px 0 / calc(100% - 72px) 100%,
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(27, 26, 23, 0.055) 31px 32px),
    var(--noir-paper);
  border: 2px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    inset 0 0 0 7px var(--noir-ink),
    inset 0 0 0 8px var(--noir-brass-deep),
    8px 8px 0 var(--noir-red),
    13px 13px 0 rgba(0, 0, 0, 0.8);
  clip-path: polygon(0 0, 98% 0, 100% 3%, 100% 100%, 2% 100%, 0 97%);
  color: var(--noir-ink);
  isolation: isolate;
  margin: 4px auto 18px;
  padding: 45px clamp(32px, 6vw, 78px) 38px;
  position: relative;
  transform: none;
}

.app[data-theme="noir"] .editor-shell::before {
  color: var(--noir-paper);
  content: "NEGOTIATION FILE / 08";
  font: 800 7px/1 var(--mono);
  left: 17px;
  letter-spacing: 0.13em;
  pointer-events: none;
  position: absolute;
  top: 17px;
  z-index: 0;
}

.app[data-theme="noir"] .editor-shell::after {
  border-bottom: 4px double var(--noir-brass);
  border-top: 1px solid var(--noir-red);
  color: var(--noir-brass);
  content: "STATEMENT RECORDED / MEMORY VERIFIED";
  font: 700 6px/1 var(--mono);
  height: 12px;
  letter-spacing: 0.12em;
  pointer-events: none;
  position: absolute;
  right: 18px;
  text-align: right;
  top: 14px;
  width: 48%;
  z-index: 0;
}

.app[data-theme="noir"] .mode-switch {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--noir-red);
  clip-path: polygon(0 0, 97% 0, 100% 25%, 100% 100%, 3% 100%, 0 75%);
}

.app[data-theme="noir"] .mode-switch button {
  border-radius: 0;
  color: var(--noir-brass);
  font-family: var(--noir-display);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .mode-switch button.active {
  background: var(--noir-red);
  box-shadow:
    inset 0 -4px var(--noir-ink),
    inset 0 -5px var(--noir-brass);
  color: var(--noir-bone);
}

.app[data-theme="noir"] .sheet-title-input {
  border-bottom: 4px double var(--noir-red);
  color: var(--noir-ink);
  font-family: var(--noir-display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 950;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .editor-meta {
  color: #5f5749;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .composer-toolbar {
  border-bottom: 1px solid var(--noir-brass-deep);
  border-top: 1px solid var(--noir-brass-deep);
}

.app[data-theme="noir"] .composer-toolbar button {
  border-radius: 0;
  color: #4f493d;
  font-family: var(--noir-display);
  font-weight: 800;
}

.app[data-theme="noir"] .composer-toolbar button:hover,
.app[data-theme="noir"] .composer-toolbar button.active,
.app[data-theme="noir"] .composer-toolbar button[aria-pressed="true"] {
  background: var(--noir-ink);
  color: var(--noir-paper);
}

.app[data-theme="noir"] .composer-toolbar .composer-add-lore {
  border: 1px solid var(--noir-brass-deep);
  box-shadow: 2px 2px 0 rgba(7, 7, 6, 0.25);
}

.app[data-theme="noir"] .composer-toolbar .composer-add-lore[data-selection-ready="true"] {
  background: var(--noir-red);
  border-color: var(--noir-ink);
  color: var(--noir-bone);
}

.app[data-theme="noir"] .sheet-title-input,
.app[data-theme="noir"] .sheet-body {
  color: var(--noir-ink);
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="noir"] .preview-body,
.app[data-theme="noir"] .outline-body {
  color: var(--noir-ink);
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="noir"] .sheet-body,
.app[data-theme="noir"] .preview-body {
  caret-color: var(--noir-red);
  font-family: var(--composer-font);
}

.app[data-theme="noir"] .sheet-body h1,
.app[data-theme="noir"] .sheet-body h2,
.app[data-theme="noir"] .preview-body h1,
.app[data-theme="noir"] .preview-body h2 {
  color: var(--noir-ink);
  font-family: var(--noir-display);
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .editor-footer {
  border-top-color: var(--noir-red);
  color: #5d5548;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .inspector-head {
  border-bottom: 4px double var(--noir-brass-deep);
}

.app[data-theme="noir"] .inspector-head::after {
  color: var(--noir-red-hot);
  content: "INSTRUMENT PANEL";
  font: 650 6px/1 var(--mono);
  letter-spacing: 0.12em;
}

.app[data-theme="noir"] .inspector-stack label {
  color: var(--noir-brass);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .inspector-stack textarea,
.app[data-theme="noir"] .inspector-stack input,
.app[data-theme="noir"] .inspector-stack select {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass-deep);
  border-left: 4px solid var(--noir-red);
  border-radius: 0;
  color: var(--noir-bone);
}

.app[data-theme="noir"] .ghost-button,
.app[data-theme="noir"] .primary-button,
.app[data-theme="noir"] .danger-button,
.app[data-theme="noir"] .icon-button {
  border-radius: 0;
  font-family: var(--noir-display);
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .primary-button {
  background: var(--noir-red);
  border: 1px solid var(--noir-bone);
  box-shadow: 3px 3px 0 var(--noir-brass-deep);
  color: var(--noir-bone);
}

.app[data-theme="noir"] .ghost-button,
.app[data-theme="noir"] .icon-button {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass);
  color: var(--noir-bone);
}

.app[data-theme="noir"] .danger-button {
  background: var(--noir-red);
  border: 1px solid var(--noir-bone);
  color: var(--noir-bone);
}

body[data-theme="noir"] .project-library-backdrop,
body[data-theme="noir"] .settings-backdrop {
  background:
    linear-gradient(rgba(7, 7, 6, 0.84), rgba(7, 7, 6, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 60px, rgba(201, 166, 91, 0.08) 60px 61px);
  backdrop-filter: blur(3px) grayscale(0.4);
}

body[data-theme="noir"] .project-library-panel {
  background: var(--noir-black);
  border: 2px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    9px 9px 0 var(--noir-red),
    14px 14px 0 rgba(0, 0, 0, 0.82);
  clip-path: polygon(0 0, 98.5% 0, 100% 2.5%, 100% 100%, 1.5% 100%, 0 97.5%);
  max-width: min(1500px, calc(100vw - 36px));
}

body[data-theme="noir"] .project-library-panel::before {
  background:
    repeating-linear-gradient(90deg, var(--noir-red) 0 14%, var(--noir-brass) 14% 15%, var(--noir-ink) 15% 25%);
  content: "";
  height: 7px;
  inset: 0 0 auto;
  position: absolute;
  z-index: 4;
}

body[data-theme="noir"] .project-library-panel::after {
  bottom: 12px;
  color: rgba(201, 166, 91, 0.56);
  content: "CITY MEMORY ARCHIVE";
  font: 850 clamp(26px, 4vw, 56px)/0.85 var(--noir-display);
  letter-spacing: 0.07em;
  pointer-events: none;
  position: absolute;
  right: 24px;
  text-transform: uppercase;
  z-index: 2;
}

body[data-theme="noir"] .project-library-head {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.045), transparent 34%),
    var(--noir-charcoal);
  border-bottom: 4px double var(--noir-brass);
  padding: 38px 42px 28px;
}

body[data-theme="noir"] .project-library-head .eyebrow {
  background: var(--noir-red);
  border: 1px solid var(--noir-bone);
  color: var(--noir-bone);
  font-family: var(--mono);
  letter-spacing: 0.14em;
  padding: 5px 10px;
}

body[data-theme="noir"] .project-library-head h2 {
  color: var(--noir-bone);
  font-family: var(--noir-display);
  font-size: clamp(3rem, 7vw, 6.8rem);
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 0.84;
  text-shadow:
    5px 5px 0 var(--noir-red),
    8px 8px 0 var(--noir-ink);
  text-transform: uppercase;
}

body[data-theme="noir"] .project-library-count {
  color: var(--noir-brass);
  font-family: var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

body[data-theme="noir"] .project-library-actions {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass);
  box-shadow: 5px 5px 0 var(--noir-red);
  gap: 9px;
  padding: 9px;
}

body[data-theme="noir"] .project-library-backup,
body[data-theme="noir"] .project-library-trash,
body[data-theme="noir"] .project-library-close {
  background: var(--noir-charcoal);
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  color: var(--noir-bone);
}

body[data-theme="noir"] .project-library-backup {
  color: var(--noir-brass);
}

body[data-theme="noir"] .project-library-trash {
  color: var(--noir-red-hot);
}

body[data-theme="noir"] .project-library-close {
  background: var(--noir-red);
  border-color: var(--noir-bone);
}

body[data-theme="noir"] .project-library-shelf-head {
  background: var(--noir-paper);
  border-bottom: 3px solid var(--noir-red);
  color: var(--noir-ink);
  font-family: var(--mono);
  font-weight: 850;
  letter-spacing: 0.13em;
}

body[data-theme="noir"] .project-library-grid {
  background:
    linear-gradient(90deg, transparent 0 5%, rgba(201, 166, 91, 0.05) 5% 5.2%, transparent 5.2% 94.8%, rgba(201, 166, 91, 0.05) 94.8% 95%, transparent 95%),
    repeating-linear-gradient(
      0deg,
      transparent 0 172px,
      var(--noir-brass-deep) 172px 175px,
      #1d1b17 175px 187px,
      var(--noir-ink) 187px 191px
    ),
    repeating-linear-gradient(90deg, transparent 0 154px, rgba(201, 166, 91, 0.055) 154px 155px),
    #0b0b09;
  grid-template-columns: repeat(auto-fill, minmax(142px, 158px));
  justify-content: start;
  padding: 18px 30px 70px;
  position: relative;
  z-index: 1;
}

body[data-theme="noir"] .project-cartridge-card:hover,
body[data-theme="noir"] .project-cartridge-card:focus-visible {
  background: rgba(201, 166, 91, 0.08);
  box-shadow:
    inset 0 0 0 1px var(--noir-brass),
    4px 4px 0 var(--noir-red);
}

body[data-theme="noir"] .project-cartridge-card.active {
  background: rgba(181, 31, 45, 0.13);
  box-shadow:
    inset 0 0 0 2px var(--noir-red),
    4px 4px 0 var(--noir-brass-deep);
}

body[data-theme="noir"] .project-cartridge-shell {
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(201, 166, 91, 0.1) 12% 14%, transparent 14% 86%, rgba(0, 0, 0, 0.28) 86% 89%, transparent 89%),
    linear-gradient(145deg, #34332f, #181815 50%, #070706);
  border: 2px solid var(--noir-brass);
  box-shadow:
    inset 0 0 0 3px var(--noir-ink),
    inset 0 0 0 4px var(--noir-brass-deep),
    0 7px 0 var(--noir-ink),
    0 10px 0 var(--noir-red);
  clip-path: polygon(0 14%, 9% 14%, 9% 5%, 18% 5%, 23% 0, 77% 0, 82% 5%, 91% 5%, 91% 14%, 100% 14%, 100% 92%, 91% 92%, 86% 100%, 14% 100%, 9% 92%, 0 92%);
}

body[data-theme="noir"] .project-cartridge-label {
  background:
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(7, 7, 6, 0.08) 14px 15px),
    var(--noir-paper);
  border: 2px solid var(--noir-ink);
  box-shadow:
    inset 4px 0 var(--noir-red),
    0 0 0 1px var(--noir-brass);
  color: var(--noir-ink);
}

body[data-theme="noir"] .project-cartridge-kicker,
body[data-theme="noir"] .project-cartridge-meta {
  color: #5e5139;
}

body[data-theme="noir"] .project-cartridge-name {
  font-family: var(--noir-display);
  font-weight: 950;
  letter-spacing: 0.035em;
}

body[data-theme="noir"] .project-cartridge-key {
  background: var(--noir-red);
  border-color: var(--noir-bone);
}

body[data-theme="noir"] .project-cartridge-contacts {
  background: repeating-linear-gradient(90deg, var(--noir-brass) 0 6px, transparent 6px 9px);
}

body[data-theme="noir"] .project-cartridge-item.active::before {
  background: var(--noir-red);
  border: 1px solid var(--noir-bone);
  color: var(--noir-bone);
  content: "ACTIVE FILE";
  font: 800 6px/1 var(--mono);
  left: 12px;
  letter-spacing: 0.1em;
  padding: 4px 6px;
  position: absolute;
  top: 8px;
  z-index: 4;
}

body[data-theme="noir"] .project-trash-window,
body[data-theme="noir"] .project-delete-dialog {
  background: var(--noir-charcoal);
  border: 2px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    7px 7px 0 var(--noir-red),
    12px 12px 0 rgba(0, 0, 0, 0.72);
}

body[data-theme="noir"] .project-trash-head,
body[data-theme="noir"] .project-delete-dialog h3 {
  color: var(--noir-bone);
  font-family: var(--noir-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

body[data-theme="noir"] .deleted-project-item {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass-deep);
  border-left: 5px solid var(--noir-red);
  border-radius: 0;
}

body[data-theme="noir"] .settings-dialog {
  background:
    linear-gradient(90deg, rgba(201, 166, 91, 0.04) 1px, transparent 1px) 0 0 / 54px 100%,
    var(--noir-charcoal);
  border: 2px solid var(--noir-brass);
  border-radius: 0;
  box-shadow:
    8px 8px 0 var(--noir-red),
    13px 13px 0 rgba(0, 0, 0, 0.8);
  clip-path: polygon(0 0, 97% 0, 100% 5%, 100% 100%, 3% 100%, 0 95%);
}

body[data-theme="noir"] .settings-head {
  border-bottom: 4px double var(--noir-brass);
}

body[data-theme="noir"] .settings-head h2,
body[data-theme="noir"] .settings-section-copy h3 {
  color: var(--noir-bone);
  font-family: var(--noir-display);
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body[data-theme="noir"] .settings-section {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass-deep);
  border-left: 6px solid var(--noir-red);
  border-radius: 0;
}

body[data-theme="noir"] .settings-section-index {
  color: var(--noir-brass);
  font-family: var(--noir-display);
}

body[data-theme="noir"] .settings-action {
  background: var(--noir-charcoal);
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  color: var(--noir-bone);
}

body[data-theme="noir"] .settings-action-danger {
  background: var(--noir-red);
  border-color: var(--noir-bone);
}

body[data-theme="noir"] .auth-dialog {
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(201, 166, 91, 0.055) 10% 10.2%, transparent 10.2% 89.8%, rgba(201, 166, 91, 0.055) 89.8% 90%, transparent 90%),
    var(--noir-charcoal);
  border: 2px solid var(--noir-brass);
  box-shadow:
    inset 0 0 0 5px var(--noir-ink),
    7px 7px 0 var(--noir-red),
    13px 13px 0 rgba(0, 0, 0, 0.78);
  clip-path: polygon(0 0, 96% 0, 100% 5%, 100% 100%, 4% 100%, 0 95%);
}

body[data-theme="noir"] .auth-dialog h1 {
  font-family: var(--noir-display);
  font-weight: 950;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

body[data-theme="noir"] .auth-dialog input {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass-deep);
  border-left: 5px solid var(--noir-red);
  border-radius: 0;
}

body[data-theme="noir"] .compact-toolbar {
  background:
    repeating-linear-gradient(90deg, var(--noir-red) 0 58px, var(--noir-brass) 58px 61px, var(--noir-ink) 61px 92px) left bottom / 100% 4px no-repeat,
    var(--noir-charcoal);
  border-bottom: 1px solid var(--noir-brass);
}

.app[data-theme="noir"] .compact-nav-button,
.app[data-theme="noir"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--noir-brass);
  font-family: var(--noir-display);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="noir"] .compact-surface-nav button.active {
  background: var(--noir-red);
  border-color: var(--noir-bone);
  color: var(--noir-bone);
}

body[data-theme="noir"] * {
  scrollbar-color: var(--noir-red) var(--noir-ink);
}

@media (max-width: 820px) {
  body[data-theme="noir"] .project-library-grid {
    gap: 0 16px;
    grid-template-columns: repeat(auto-fill, minmax(142px, 154px));
    padding-inline: 22px;
  }
}

@media (max-width: 767px) {
  .app[data-theme="noir"] .editor-pane {
    padding: 9px;
  }

  .app[data-theme="noir"] .editor-shell {
    box-shadow:
      5px 5px 0 var(--noir-red),
      8px 8px 0 var(--noir-ink);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding: 36px 20px 24px;
  }

  .app[data-theme="noir"] .editor-mode-panel,
  .app[data-theme="noir"] #write-panel,
  .app[data-theme="noir"] .sheet-body,
  .app[data-theme="noir"] .preview-body,
  .app[data-theme="noir"] .outline-body {
    max-width: 100%;
    min-width: 0;
  }

  .app[data-theme="noir"] .composer-toolbar {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
}

@media (max-width: 640px) {
  body[data-theme="noir"] .project-library-head {
    align-items: stretch;
    flex-direction: column;
    padding: 28px 20px 20px;
  }

  body[data-theme="noir"] .project-library-actions {
    display: grid;
    grid-template-columns: 76px 76px 44px;
    justify-content: end;
    width: 100%;
  }

  body[data-theme="noir"] .project-library-grid {
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 12px 56px;
  }
}

@media (max-width: 420px) {
  .app[data-theme="noir"] .editor-shell::before {
    content: "FILE / 08";
    font-size: 6px;
  }

  .app[data-theme="noir"] .editor-shell::after {
    content: "MEMORY VERIFIED";
    font-size: 5px;
  }

  .app[data-theme="noir"] .mode-switch button {
    letter-spacing: 0.05em;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app[data-theme="noir"] .project-eject,
  .app[data-theme="noir"] .project-new,
  .app[data-theme="noir"] .project-library-open,
  .app[data-theme="noir"] .section-button,
  .app[data-theme="noir"] .sheet-card {
    transition: none;
  }
}

/* HEIST — kinetic editorial collage */

body[data-theme="heist"] {
  color-scheme: dark;
  --surface-canvas: #090808;
  --surface-sidebar: #151111;
  --surface-raised: #251719;
  --surface-overlay: #31191c;
  --surface-selected: rgba(223, 24, 43, 0.22);
  --text-primary: #fff5df;
  --text-secondary: #d8c9bc;
  --text-disabled: #b9a7a0;
  --border-subtle: rgba(255, 245, 223, 0.26);
  --bg: var(--surface-canvas);
  --panel: var(--surface-sidebar);
  --panel-soft: var(--surface-raised);
  --panel-strong: var(--surface-overlay);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: #df182b;
  --accent-strong: #ff4b55;
  --accent-soft: rgba(223, 24, 43, 0.18);
  --selection: #fff5df;
  --selection-soft: rgba(255, 245, 223, 0.16);
  --heist-red: #df182b;
  --heist-red-hot: #ff3347;
  --heist-red-deep: #8e101d;
  --heist-paper: #fff5df;
  --heist-paper-deep: #e5d7c4;
  --heist-black: #090808;
  --heist-ink: #171313;
  --heist-gray: #847a76;
  --heist-signal: #f4c541;
  --heist-display: "Arial Black", Impact, Haettenschweiler, sans-serif;
  --heist-copy: "Avenir Next", "Trebuchet MS", Arial, sans-serif;
  --warn: var(--heist-signal);
  --warn-soft: rgba(244, 197, 65, 0.16);
  --shadow:
    8px 8px 0 var(--heist-red),
    13px 13px 0 rgba(0, 0, 0, 0.76);
  --glow: 0 0 0 3px rgba(223, 24, 43, 0.24);
  --screen-grid: transparent;
  --scanline: transparent;
  --text-glow: none;
  --font-ui: var(--heist-copy);
  background:
    radial-gradient(circle at 5% 11%, rgba(255, 245, 223, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 7% 14%, rgba(223, 24, 43, 0.9) 0 6px, transparent 7px),
    radial-gradient(circle at 91% 9%, rgba(255, 245, 223, 0.48) 0 3px, transparent 4px),
    radial-gradient(circle at 94% 13%, rgba(223, 24, 43, 0.72) 0 9px, transparent 10px),
    repeating-radial-gradient(circle at 82% 72%, rgba(255, 245, 223, 0.055) 0 1px, transparent 1px 7px),
    linear-gradient(118deg, transparent 0 58%, rgba(223, 24, 43, 0.09) 58% 67%, transparent 67%),
    var(--surface-canvas);
}

body[data-theme="heist"] ::selection {
  background: var(--heist-red);
  color: var(--heist-paper);
}

.app[data-theme="heist"] {
  background:
    linear-gradient(122deg, transparent 0 68%, rgba(223, 24, 43, 0.05) 68% 69%, transparent 69%),
    transparent;
}

.app[data-theme="heist"] .library-pane,
.app[data-theme="heist"] .sheet-pane,
.app[data-theme="heist"] .inspector-pane {
  background:
    radial-gradient(circle, rgba(255, 245, 223, 0.035) 0 1px, transparent 1.5px) 0 0 / 11px 11px,
    linear-gradient(155deg, rgba(223, 24, 43, 0.09), transparent 38%),
    rgba(21, 17, 17, 0.98);
  border-color: var(--heist-black);
  box-shadow: inset -1px 0 rgba(255, 245, 223, 0.08);
}

.app[data-theme="heist"] .library-pane {
  border-right: 4px solid var(--heist-red);
}

.app[data-theme="heist"] .sheet-pane {
  border-right: 4px solid var(--heist-paper);
}

.app[data-theme="heist"] .inspector-pane {
  border-left: 4px solid var(--heist-red);
}

.app[data-theme="heist"] .app-identity {
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.12) 0 1px, transparent 1.5px) 0 0 / 7px 7px,
    var(--heist-paper);
  border: 3px solid var(--heist-black);
  box-shadow:
    7px 7px 0 var(--heist-red),
    11px 11px 0 var(--heist-black);
  clip-path: polygon(0 6%, 96% 0, 100% 88%, 89% 100%, 4% 95%);
  color: var(--heist-black);
  margin: 4px 7px 24px 1px;
  padding: 12px 11px 15px;
  position: relative;
  transform: rotate(-0.65deg);
}

.app[data-theme="heist"] .app-identity::after {
  background: var(--heist-black);
  bottom: -2px;
  color: var(--heist-paper);
  content: "CASE / NOTES / LIVE";
  font: 900 7px/1 var(--mono);
  letter-spacing: 0.13em;
  padding: 4px 8px;
  position: absolute;
  right: 9px;
  transform: rotate(2deg);
}

.app[data-theme="heist"] .brand-mark {
  background: var(--heist-red);
  border: 3px solid var(--heist-black);
  border-radius: 50% 42% 55% 38%;
  box-shadow: 3px 3px 0 var(--heist-black);
  transform: rotate(-8deg);
}

.app[data-theme="heist"] .brand-mark svg {
  color: var(--heist-paper);
  filter: drop-shadow(2px 1px 0 var(--heist-black));
}

.app[data-theme="heist"] .app-identity strong {
  font-family: var(--heist-display);
  font-size: 18px;
  font-style: italic;
  letter-spacing: -0.07em;
  line-height: 0.86;
  text-transform: uppercase;
}

.app[data-theme="heist"] .app-identity div span {
  color: #4e4140;
  font: 900 8px/1.25 var(--mono);
  letter-spacing: 0.04em;
  margin-top: 7px;
  text-transform: uppercase;
}

.app[data-theme="heist"] .command-trigger {
  background: var(--heist-black);
  border: 2px solid var(--heist-red);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--heist-paper);
  color: var(--heist-paper);
  transform: rotate(5deg);
}

.app[data-theme="heist"] .command-trigger:hover,
.app[data-theme="heist"] .command-trigger:focus-visible {
  background: var(--heist-red);
  border-color: var(--heist-black);
  color: var(--heist-paper);
  outline: 2px solid var(--heist-paper);
  transform: rotate(-5deg) scale(1.05);
}

.app[data-theme="heist"] .eyebrow,
.app[data-theme="heist"] .project-title-field,
.app[data-theme="heist"] .search-box span,
.app[data-theme="heist"] .inspector-stack > label,
.app[data-theme="heist"] .field-grid > label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .eyebrow {
  background: var(--heist-red);
  box-shadow: 3px 3px 0 var(--heist-black);
  clip-path: polygon(4% 0, 100% 7%, 96% 100%, 0 87%);
  color: var(--heist-paper);
  display: inline-block;
  margin: 0 0 7px -2px;
  padding: 4px 10px 3px;
  transform: rotate(-1.5deg);
}

.app[data-theme="heist"] .pane-header {
  border-bottom: 4px solid var(--heist-black);
  min-height: 52px;
  padding-bottom: 8px;
  position: relative;
}

.app[data-theme="heist"] .pane-header::after {
  background:
    linear-gradient(102deg, var(--heist-red) 0 58%, var(--heist-paper) 58% 68%, transparent 68%);
  bottom: -7px;
  clip-path: polygon(0 30%, 100% 0, 92% 100%, 3% 72%);
  content: "";
  height: 12px;
  pointer-events: none;
  position: absolute;
  right: -2px;
  width: 92px;
}

.app[data-theme="heist"] .pane-header h2,
.app[data-theme="heist"] .inspector-head h2 {
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-size: 20px;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .project-switcher {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 0 0 22px;
  padding: 0;
  transform: none;
}

.app[data-theme="heist"] .project-switcher:hover,
.app[data-theme="heist"] .project-switcher:focus-visible {
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}

.app[data-theme="heist"] .project-selector-label {
  background: var(--heist-red);
  border: 2px solid var(--heist-black);
  box-shadow: 3px 3px 0 var(--heist-paper);
  clip-path: polygon(0 0, 96% 5%, 100% 82%, 4% 100%);
  color: var(--heist-paper);
  display: inline-block;
  margin: 0 0 8px 2px;
  padding: 4px 10px 3px;
  transform: rotate(-1deg);
}

.app[data-theme="heist"] .project-title-input,
.app[data-theme="heist"] .inspector-stack textarea,
.app[data-theme="heist"] .inspector-stack input,
.app[data-theme="heist"] .inspector-stack select,
.app[data-theme="heist"] .search-box {
  background: var(--heist-black);
  border: 2px solid rgba(255, 245, 223, 0.58);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--heist-red-deep);
  color: var(--heist-paper);
}

.app[data-theme="heist"] .search-box {
  clip-path: polygon(0 0, 96% 0, 100% 28%, 98% 100%, 3% 95%);
  margin: 13px 5px 15px 0;
}

.app[data-theme="heist"] .search-box:focus-within,
.app[data-theme="heist"] .project-title-input:focus,
.app[data-theme="heist"] .inspector-stack textarea:focus,
.app[data-theme="heist"] .inspector-stack input:focus,
.app[data-theme="heist"] .inspector-stack select:focus {
  border-color: var(--heist-paper);
  box-shadow:
    4px 4px 0 var(--heist-red),
    -2px -2px 0 var(--heist-paper);
  outline: 0;
}

.app[data-theme="heist"] .ghost-button,
.app[data-theme="heist"] .icon-button,
.app[data-theme="heist"] .compact-command-trigger {
  background: var(--heist-black);
  border: 2px solid var(--heist-paper);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--heist-red);
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
  text-transform: uppercase;
}

.app[data-theme="heist"] .ghost-button:hover,
.app[data-theme="heist"] .icon-button:hover,
.app[data-theme="heist"] .compact-command-trigger:hover {
  background: var(--heist-paper);
  border-color: var(--heist-black);
  box-shadow: 5px 5px 0 var(--heist-red);
  color: var(--heist-black);
  transform: translate(-2px, -2px) rotate(-1deg);
}

.app[data-theme="heist"] .primary-button {
  background: var(--heist-red);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow:
    4px 4px 0 var(--heist-paper),
    7px 7px 0 var(--heist-black);
  clip-path: polygon(0 5%, 96% 0, 100% 83%, 91% 100%, 3% 94%);
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .primary-button:hover {
  background: var(--heist-paper);
  color: var(--heist-black);
  transform: translate(-2px, -2px) rotate(1deg);
}

.app[data-theme="heist"] .danger-button {
  background: var(--heist-red);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
  text-transform: uppercase;
}

.app[data-theme="heist"] .section-list {
  gap: 10px;
}

.app[data-theme="heist"] .section-button,
.app[data-theme="heist"] .sheet-card {
  background:
    linear-gradient(116deg, rgba(223, 24, 43, 0.13), transparent 42%),
    var(--heist-ink);
  border: 2px solid var(--heist-black);
  border-left: 6px solid var(--heist-red);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(255, 245, 223, 0.16);
  clip-path: polygon(0 0, 93% 0, 100% 14%, 98% 100%, 4% 96%);
  color: var(--heist-paper);
  position: relative;
}

.app[data-theme="heist"] .section-button::before,
.app[data-theme="heist"] .sheet-card::before {
  background: var(--heist-paper);
  clip-path: polygon(0 30%, 100% 0, 89% 100%, 3% 82%);
  content: "";
  height: 5px;
  left: 11px;
  position: absolute;
  top: -2px;
  transform: rotate(-1deg);
  width: 42px;
}

.app[data-theme="heist"] .section-button:hover,
.app[data-theme="heist"] .sheet-card:hover {
  background:
    linear-gradient(112deg, rgba(255, 245, 223, 0.09), transparent 44%),
    var(--heist-red-deep);
  box-shadow:
    5px 5px 0 var(--heist-red),
    -2px -2px 0 var(--heist-paper);
  transform: translate(-2px, -2px) rotate(-0.35deg);
}

.app[data-theme="heist"] .section-button.active,
.app[data-theme="heist"] .sheet-card.active {
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.1) 0 1px, transparent 1.5px) 0 0 / 7px 7px,
    var(--heist-paper);
  border-color: var(--heist-black);
  border-left-color: var(--heist-red);
  box-shadow:
    6px 6px 0 var(--heist-red),
    10px 10px 0 var(--heist-black);
  color: var(--heist-black);
  transform: rotate(-0.55deg);
}

.app[data-theme="heist"] .section-button.active strong,
.app[data-theme="heist"] .section-button.active span,
.app[data-theme="heist"] .sheet-card.active strong,
.app[data-theme="heist"] .sheet-card.active p,
.app[data-theme="heist"] .sheet-card.active .sheet-card-footer {
  color: var(--heist-black);
}

.app[data-theme="heist"] .section-button strong,
.app[data-theme="heist"] .sheet-card strong {
  font-family: var(--heist-display);
  font-style: italic;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .section-count {
  background: var(--heist-black);
  border: 2px solid var(--heist-red);
  border-radius: 0;
  color: var(--heist-paper);
  font: 900 9px/1 var(--mono);
}

.app[data-theme="heist"] .section-button.active .section-count {
  background: var(--heist-red);
  border-color: var(--heist-black);
  color: var(--heist-paper);
}

.app[data-theme="heist"] .sheet-card-footer {
  font: 800 8px/1.3 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .context-trigger {
  border-radius: 50%;
}

.app[data-theme="heist"] .context-trigger:hover,
.app[data-theme="heist"] .context-trigger:focus-visible {
  background: var(--heist-red);
  border-color: var(--heist-black);
  color: var(--heist-paper);
}

.app[data-theme="heist"] .status-dot {
  border: 1px solid var(--heist-black);
  border-radius: 50%;
}

.app[data-theme="heist"] .status-to-write {
  background: var(--heist-gray);
}

.app[data-theme="heist"] .status-draft {
  background: var(--heist-red);
}

.app[data-theme="heist"] .status-revising {
  background: var(--heist-signal);
}

.app[data-theme="heist"] .status-done {
  background: var(--heist-paper);
}

.app[data-theme="heist"] .editor-pane {
  background:
    radial-gradient(circle at 8% 14%, var(--heist-paper) 0 3px, transparent 4px),
    radial-gradient(circle at 11% 11%, var(--heist-red) 0 7px, transparent 8px),
    radial-gradient(circle at 93% 16%, rgba(255, 245, 223, 0.46) 0 4px, transparent 5px),
    repeating-radial-gradient(circle at 92% 78%, rgba(255, 245, 223, 0.055) 0 1px, transparent 1px 7px),
    linear-gradient(126deg, transparent 0 67%, rgba(223, 24, 43, 0.22) 67% 75%, transparent 75%),
    var(--heist-black);
  padding: 16px;
}

.app[data-theme="heist"] .editor-shell {
  background:
    linear-gradient(90deg, transparent 0 7%, rgba(223, 24, 43, 0.045) 7% 7.2%, transparent 7.2%),
    radial-gradient(circle, rgba(9, 8, 8, 0.04) 0 1px, transparent 1.3px) 0 0 / 9px 9px,
    var(--heist-paper);
  border: 4px solid var(--heist-black);
  box-shadow:
    11px 11px 0 var(--heist-red),
    -6px -6px 0 var(--heist-paper-deep),
    17px 17px 0 rgba(0, 0, 0, 0.72);
  clip-path: polygon(0 2%, 97% 0, 100% 6%, 99% 96%, 95% 100%, 3% 98%, 0 91%);
  color: var(--heist-black);
  height: calc(100% - 10px);
  isolation: isolate;
  margin: 5px auto;
  max-width: 960px;
  padding: 36px clamp(25px, 5vw, 74px) 22px;
  position: relative;
  transform: none;
}

.app[data-theme="heist"] .editor-shell::before {
  background: var(--heist-red);
  border: 3px solid var(--heist-black);
  box-shadow: 4px 4px 0 var(--heist-paper);
  clip-path: polygon(0 7%, 97% 0, 100% 84%, 7% 100%);
  color: var(--heist-paper);
  content: "MAKE YOUR MOVE";
  font: italic 950 9px/1 var(--heist-display);
  left: clamp(20px, 4vw, 58px);
  letter-spacing: 0.02em;
  padding: 6px 12px 5px;
  pointer-events: none;
  position: absolute;
  top: 8px;
  transform: rotate(-1.4deg);
  z-index: 0;
}

.app[data-theme="heist"] .editor-shell::after {
  background:
    repeating-linear-gradient(135deg, var(--heist-black) 0 6px, var(--heist-paper) 6px 9px, var(--heist-red) 9px 15px);
  clip-path: polygon(0 12%, 100% 0, 93% 100%, 5% 78%);
  content: "";
  height: 12px;
  pointer-events: none;
  position: absolute;
  right: 7%;
  top: 11px;
  transform: rotate(1.6deg);
  width: 94px;
  z-index: 0;
}

.app[data-theme="heist"] .mode-switch,
.app[data-theme="heist"] .editor-composer-head,
.app[data-theme="heist"] .editor-mode-panel,
.app[data-theme="heist"] .editor-footer {
  position: relative;
  z-index: 1;
}

.app[data-theme="heist"] .mode-switch {
  background: var(--heist-black);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  clip-path: polygon(0 0, 98% 0, 100% 18%, 98% 100%, 2% 96%);
  gap: 3px;
  padding: 4px;
}

.app[data-theme="heist"] .mode-switch button {
  border-radius: 0;
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-size: 10px;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .mode-switch button:hover {
  background: var(--heist-red-deep);
}

.app[data-theme="heist"] .mode-switch button.active {
  background: var(--heist-red);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--heist-paper);
  clip-path: polygon(0 5%, 96% 0, 100% 84%, 7% 100%);
  color: var(--heist-paper);
  transform: rotate(-1deg);
}

.app[data-theme="heist"] .composer-inspector-toggle {
  background: var(--heist-black);
  border: 3px solid var(--heist-red);
  border-radius: 50% 41% 52% 45%;
  box-shadow: 3px 3px 0 var(--heist-paper);
  color: var(--heist-paper);
  transform: rotate(4deg);
}

.app[data-theme="heist"] .composer-inspector-toggle:hover,
.app[data-theme="heist"] .composer-inspector-toggle:focus-visible {
  background: var(--heist-red);
  border-color: var(--heist-black);
  color: var(--heist-paper);
  outline: 2px solid var(--heist-black);
}

.app[data-theme="heist"] .composer-inspector-toggle[aria-pressed="true"] {
  background: var(--heist-red);
  border-color: var(--heist-black);
  box-shadow:
    3px 3px 0 var(--heist-paper),
    6px 6px 0 var(--heist-red);
  color: var(--heist-paper);
  transform: rotate(-5deg);
}

.app[data-theme="heist"] .sheet-title-input,
.app[data-theme="heist"] .sheet-body {
  color: var(--heist-black);
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="heist"] .preview-body,
.app[data-theme="heist"] .outline-body {
  color: var(--heist-black);
  pointer-events: auto;
  position: relative;
  user-select: text;
  z-index: 2;
}

.app[data-theme="heist"] .sheet-title-input {
  border-bottom: 5px solid var(--heist-red);
  font-family: var(--heist-display);
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.065em;
  line-height: 0.9;
  text-decoration: none;
}

.app[data-theme="heist"] .sheet-body,
.app[data-theme="heist"] .preview-body {
  caret-color: var(--heist-red);
  font-family: var(--composer-font);
}

.app[data-theme="heist"] .sheet-title-input:focus-visible,
.app[data-theme="heist"] .sheet-body:focus-visible {
  outline: 3px solid var(--heist-red);
  outline-offset: 5px;
}

.app[data-theme="heist"] .editor-meta,
.app[data-theme="heist"] .editor-footer {
  color: #625652;
  font: 850 8px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .editor-meta span[data-state="saving"] {
  color: var(--heist-red);
}

.app[data-theme="heist"] .editor-meta span[data-state="error"] {
  color: var(--heist-red-deep);
}

.app[data-theme="heist"] .composer-toolbar {
  border-bottom: 3px solid var(--heist-black);
  border-top: 3px solid var(--heist-black);
}

.app[data-theme="heist"] .composer-toolbar button {
  border-radius: 0;
  color: #524744;
  font-family: var(--heist-display);
  font-style: italic;
  font-weight: 900;
}

.app[data-theme="heist"] .composer-toolbar button:hover,
.app[data-theme="heist"] .composer-toolbar button.active,
.app[data-theme="heist"] .composer-toolbar button[aria-pressed="true"] {
  background: var(--heist-black);
  color: var(--heist-paper);
  transform: skewX(-5deg);
}

.app[data-theme="heist"] .composer-toolbar .composer-add-lore {
  border: 2px solid var(--heist-black);
  box-shadow: 3px 3px 0 var(--heist-gray);
}

.app[data-theme="heist"] .composer-toolbar .composer-add-lore[data-selection-ready="true"] {
  background: var(--heist-red);
  border-color: var(--heist-black);
  box-shadow: 4px 4px 0 var(--heist-black);
  color: var(--heist-paper);
}

.app[data-theme="heist"] .editor-footer {
  border-top: 3px solid var(--heist-red);
  padding-top: 10px;
}

.app[data-theme="heist"] .outline-item {
  background: rgba(223, 24, 43, 0.08);
  border: 2px solid var(--heist-black);
  border-left: 8px solid var(--heist-red);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(9, 8, 8, 0.2);
  clip-path: polygon(0 0, 98% 0, 100% 14%, 98% 100%, 2% 96%);
  color: var(--heist-black);
}

.app[data-theme="heist"] .composer-focus-toggle {
  background: var(--heist-red);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--heist-paper);
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
}

.app[data-theme="heist"] .inspector-head {
  border-bottom: 4px solid var(--heist-red);
}

.app[data-theme="heist"] .inspector-head::after {
  color: var(--heist-paper);
  content: "INTEL / LIVE";
  font: 900 7px/1 var(--mono);
  letter-spacing: 0.13em;
}

.app[data-theme="heist"] .inspector-stack label {
  color: var(--heist-paper);
}

.app[data-theme="heist"] .project-device {
  --project-case: var(--heist-red);
  --project-case-edge: var(--heist-black);
  --project-case-highlight: var(--heist-red-hot);
  --project-case-shadow: #500a12;
  --project-screen: #100d0e;
  --project-screen-text: var(--heist-paper);
  --project-screen-muted: #ff5562;
  --project-screen-line: rgba(223, 24, 43, 0.28);
  --project-control: var(--heist-paper);
  --project-control-edge: var(--heist-black);
  --project-control-text: var(--heist-black);
  --project-slot: var(--heist-black);
  --cartridge-shell: var(--heist-red);
  --cartridge-shell-deep: #630b15;
  --cartridge-edge: var(--heist-black);
  --cartridge-label: var(--heist-paper);
  --cartridge-label-text: var(--heist-black);
  --cartridge-accent: var(--heist-paper);
  --cartridge-contacts: #dbb85f;
  --shelf-surface: #110d0e;
  --shelf-edge: var(--heist-red);
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.12) 0 1px, transparent 1.4px) 0 0 / 8px 8px,
    linear-gradient(148deg, var(--heist-red-hot), var(--heist-red) 45%, var(--heist-red-deep));
  border: 4px solid var(--heist-black);
  border-radius: 0;
  box-shadow:
    inset 4px 4px rgba(255, 245, 223, 0.16),
    inset -7px -7px rgba(9, 8, 8, 0.28),
    7px 7px 0 var(--heist-black),
    11px 11px 0 var(--heist-paper);
  clip-path: polygon(0 0, 94% 0, 100% 7%, 98% 96%, 91% 100%, 3% 98%, 0 88%);
  padding: 16px 14px 15px;
  transform: rotate(0.25deg);
}

.app[data-theme="heist"] .project-device::before {
  background: var(--heist-paper);
  border-radius: 0;
  clip-path: polygon(0 25%, 100% 0, 94% 100%, 4% 78%);
  height: 5px;
  left: 29%;
  right: 23%;
  top: 6px;
}

.app[data-theme="heist"] .project-device::after {
  color: var(--heist-black);
  content: "CASE FILE // 09";
  font: 900 6px/1 var(--mono);
  letter-spacing: 0.12em;
  position: absolute;
  right: 13px;
  text-transform: uppercase;
  top: 9px;
}

.app[data-theme="heist"] .project-device-fastener {
  background: var(--heist-paper);
  border: 2px solid var(--heist-black);
  border-radius: 50%;
}

.app[data-theme="heist"] .project-device-screen {
  background:
    radial-gradient(ellipse at 50% 44%, transparent 25%, rgba(0, 0, 0, 0.72) 100%),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(223, 24, 43, 0.22) 4px 5px),
    repeating-radial-gradient(circle at 50% 40%, rgba(255, 245, 223, 0.045) 0 1px, transparent 1px 6px),
    var(--project-screen);
  border: 4px solid var(--heist-black);
  border-radius: 41% 45% 38% 44% / 12% 10% 14% 11%;
  box-shadow:
    inset 0 0 24px #000,
    0 0 0 3px var(--heist-paper);
  min-height: 148px;
  transform: rotate(-0.45deg);
}

.app[data-theme="heist"] .project-device-screen::after {
  background: var(--heist-red);
  bottom: 8px;
  clip-path: polygon(0 20%, 100% 0, 94% 100%, 4% 80%);
  content: "";
  height: 4px;
  position: absolute;
  right: 13px;
  width: 48px;
}

.app[data-theme="heist"] .project-device .project-title-field {
  color: var(--heist-red-hot);
  font-weight: 900;
}

.app[data-theme="heist"] .project-device .project-title-input {
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--heist-red);
  box-shadow: none;
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-size: 13px;
  font-style: italic;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.app[data-theme="heist"] .project-device .project-progress div {
  background: rgba(255, 245, 223, 0.04);
  border: 2px solid var(--heist-red);
  border-radius: 0;
  clip-path: polygon(0 0, 92% 0, 100% 18%, 97% 100%, 4% 96%);
  color: var(--heist-red-hot);
}

.app[data-theme="heist"] .project-device .project-progress strong {
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-size: 14px;
  font-style: italic;
}

.app[data-theme="heist"] .project-device .meter {
  background: var(--heist-black);
  border: 2px solid var(--heist-paper);
  border-radius: 0;
  transform: rotate(-1deg);
}

.app[data-theme="heist"] .project-device .meter span {
  background: var(--heist-red);
  box-shadow: 4px 0 0 var(--heist-paper);
}

.app[data-theme="heist"] .project-device-slot-line {
  background: var(--heist-black);
  border: 3px solid var(--heist-paper);
  border-radius: 50% 45% 48% 39%;
  box-shadow:
    inset 0 4px 5px #000,
    3px 3px 0 var(--heist-black);
  height: 12px;
  transform: rotate(-1deg);
}

.app[data-theme="heist"] .project-eject,
.app[data-theme="heist"] .project-new,
.app[data-theme="heist"] .project-library-open {
  --button-tilt: -0.6deg;
  --project-button-face: var(--heist-paper);
  --project-button-shadow: var(--heist-black);
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.09) 0 1px, transparent 1.5px) 0 0 / 7px 7px,
    linear-gradient(180deg, color-mix(in srgb, var(--project-button-face) 86%, #fff) 0 8%, var(--project-button-face) 9% 63%, color-mix(in srgb, var(--project-button-face) 78%, #000) 100%);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.34),
    inset 0 -5px 0 rgba(9, 8, 8, 0.24),
    0 6px 0 var(--heist-black),
    4px 9px 0 var(--heist-red-deep);
  clip-path: polygon(0 5%, 93% 0, 100% 18%, 98% 92%, 88% 100%, 3% 96%);
  color: var(--heist-black);
  font-family: var(--heist-display);
  font-size: 10px;
  font-style: italic;
  letter-spacing: -0.015em;
  transform: translateY(0) rotate(var(--button-tilt));
}

.app[data-theme="heist"] .project-eject {
  --button-tilt: -0.8deg;
  --project-button-face: var(--heist-paper);
}

.app[data-theme="heist"] .project-new {
  --button-tilt: 0.7deg;
  --project-button-face: var(--heist-red);
  color: var(--heist-paper);
}

.app[data-theme="heist"] .project-library-open {
  --button-tilt: -0.35deg;
  --project-button-face: var(--heist-black);
  border-color: var(--heist-paper);
  color: var(--heist-paper);
}

.app[data-theme="heist"] .project-eject::before,
.app[data-theme="heist"] .project-new::before,
.app[data-theme="heist"] .project-library-open::before {
  align-items: center;
  background: var(--heist-black);
  border-radius: 50%;
  color: var(--heist-paper);
  content: "↗";
  display: inline-flex;
  font: 900 10px/1 var(--mono);
  height: 18px;
  justify-content: center;
  margin-right: 6px;
  transform: rotate(-8deg);
  width: 18px;
}

.app[data-theme="heist"] .project-new::before {
  content: "+";
}

.app[data-theme="heist"] .project-library-open::before {
  background: var(--heist-red);
  content: "▤";
}

.app[data-theme="heist"] .project-eject:hover:not(:disabled),
.app[data-theme="heist"] .project-new:hover,
.app[data-theme="heist"] .project-library-open:hover {
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.38),
    inset 0 -5px 0 rgba(9, 8, 8, 0.22),
    0 8px 0 var(--heist-black),
    6px 11px 0 var(--heist-red);
  filter: brightness(1.06);
  transform: translate(-1px, -2px) rotate(calc(var(--button-tilt) - 0.7deg));
}

.app[data-theme="heist"] .project-eject:active:not(:disabled),
.app[data-theme="heist"] .project-new:active,
.app[data-theme="heist"] .project-library-open:active {
  box-shadow:
    inset 0 4px 0 rgba(9, 8, 8, 0.28),
    0 2px 0 var(--heist-black),
    2px 4px 0 var(--heist-red-deep);
  transform: translateY(5px) rotate(var(--button-tilt));
}

.app[data-theme="heist"] .project-eject:focus-visible,
.app[data-theme="heist"] .project-new:focus-visible,
.app[data-theme="heist"] .project-library-open:focus-visible {
  filter: brightness(1.08);
  outline: 3px solid var(--heist-paper);
  outline-offset: 3px;
}

.app[data-theme="heist"] .project-picker-cartridge {
  transform-origin: top center;
}

body[data-theme="heist"] .project-library-backdrop,
body[data-theme="heist"] .command-palette-backdrop,
body[data-theme="heist"] .ux-metrics-backdrop,
body[data-theme="heist"] .settings-backdrop,
body[data-theme="heist"] .lore-backdrop,
body[data-theme="heist"] .tenant-admin-backdrop {
  background:
    radial-gradient(circle, rgba(255, 245, 223, 0.055) 0 1px, transparent 1.5px) 0 0 / 12px 12px,
    linear-gradient(117deg, rgba(223, 24, 43, 0.2), transparent 54%),
    rgba(9, 8, 8, 0.88);
  backdrop-filter: blur(7px) saturate(0.7);
}

body[data-theme="heist"] .project-library-panel,
body[data-theme="heist"] .project-delete-dialog,
body[data-theme="heist"] .command-palette-dialog,
body[data-theme="heist"] .ux-metrics-dialog,
body[data-theme="heist"] .settings-dialog,
body[data-theme="heist"] .lore-panel,
body[data-theme="heist"] .lore-decision-dialog,
body[data-theme="heist"] .tenant-admin-dialog,
body[data-theme="heist"] .toast,
body[data-theme="heist"] .context-menu {
  background:
    radial-gradient(circle, rgba(255, 245, 223, 0.035) 0 1px, transparent 1.5px) 0 0 / 10px 10px,
    linear-gradient(132deg, rgba(223, 24, 43, 0.12), transparent 39%),
    var(--heist-ink);
  border: 4px solid var(--heist-black);
  border-radius: 0;
  box-shadow:
    11px 11px 0 var(--heist-red),
    -7px -7px 0 var(--heist-paper),
    0 36px 88px rgba(0, 0, 0, 0.66);
  clip-path: polygon(0 1%, 98% 0, 100% 4%, 99% 98%, 94% 100%, 2% 99%, 0 94%);
}

body[data-theme="heist"] .project-library-panel {
  background:
    radial-gradient(circle at 93% 13%, rgba(255, 245, 223, 0.62) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(255, 245, 223, 0.035) 0 1px, transparent 1.5px) 0 0 / 10px 10px,
    linear-gradient(123deg, rgba(223, 24, 43, 0.14), transparent 44%),
    var(--heist-ink);
  isolation: isolate;
  max-width: min(1520px, calc(100vw - 36px));
}

body[data-theme="heist"] .project-library-panel::before {
  background:
    linear-gradient(90deg, var(--heist-red) 0 63%, var(--heist-paper) 63% 75%, var(--heist-black) 75%);
  clip-path: polygon(0 20%, 100% 0, 99% 100%, 0 78%);
  content: "";
  height: 10px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 4;
}

body[data-theme="heist"] .project-library-panel::after {
  bottom: 9px;
  color: rgba(255, 245, 223, 0.32);
  content: "THE TAKE / STORY ARCHIVE";
  font-family: var(--heist-display);
  font-size: clamp(18px, 3vw, 42px);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.04em;
  pointer-events: none;
  position: absolute;
  right: 24px;
  text-transform: uppercase;
  transform: rotate(-1deg);
  z-index: 2;
}

body[data-theme="heist"] .project-library-head {
  align-items: center;
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.12) 0 1px, transparent 1.5px) 0 0 / 8px 8px,
    linear-gradient(112deg, var(--heist-red) 0 67%, var(--heist-paper) 67%);
  border-bottom: 5px solid var(--heist-black);
  min-height: 148px;
  padding: 30px 34px 25px;
  position: relative;
}

body[data-theme="heist"] .project-library-head::after {
  background: var(--heist-black);
  bottom: -5px;
  clip-path: polygon(0 25%, 100% 0, 97% 100%, 2% 78%);
  content: "";
  height: 13px;
  left: 0;
  position: absolute;
  width: 73%;
}

body[data-theme="heist"] .project-library-heading {
  align-content: start;
  display: grid;
  justify-items: start;
}

body[data-theme="heist"] .project-library-head .eyebrow {
  background: var(--heist-black);
  border: 2px solid var(--heist-paper);
  box-shadow: 4px 4px 0 var(--heist-paper);
  clip-path: polygon(0 5%, 96% 0, 100% 86%, 6% 100%);
  color: var(--heist-paper);
  display: inline-block;
  font: 900 8px/1 var(--mono);
  letter-spacing: 0.12em;
  margin: 0 0 11px 3px;
  padding: 5px 11px 4px;
  text-transform: uppercase;
  transform: rotate(-1.3deg);
}

body[data-theme="heist"] .project-library-head h2,
body[data-theme="heist"] .ux-metrics-head h2 {
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-size: clamp(40px, 6vw, 76px);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.075em;
  line-height: 0.78;
  text-shadow:
    5px 5px 0 var(--heist-black),
    8px 8px 0 rgba(255, 245, 223, 0.22);
  text-transform: uppercase;
}

body[data-theme="heist"] .project-library-count {
  background: var(--heist-paper);
  border: 2px solid var(--heist-black);
  box-shadow: 4px 4px 0 var(--heist-black);
  clip-path: polygon(2% 0, 100% 7%, 96% 100%, 0 90%);
  color: var(--heist-black);
  display: inline-block;
  font: 900 8px/1 var(--mono);
  letter-spacing: 0.1em;
  margin-top: 15px;
  padding: 6px 11px 5px;
  text-transform: uppercase;
  transform: rotate(1deg);
}

body[data-theme="heist"] .project-library-actions {
  align-items: center;
  background: var(--heist-black);
  border: 3px solid var(--heist-paper);
  box-shadow: 6px 6px 0 var(--heist-red-deep);
  clip-path: polygon(0 5%, 96% 0, 100% 15%, 98% 95%, 7% 100%);
  gap: 8px;
  padding: 9px;
}

body[data-theme="heist"] .project-library-backup,
body[data-theme="heist"] .project-library-trash {
  background: var(--heist-black);
  border: 3px solid var(--heist-paper);
  border-radius: 0;
  color: var(--heist-paper);
  height: 76px;
  padding: 7px;
  width: 76px;
}

body[data-theme="heist"] .project-library-backup {
  color: var(--heist-paper);
  display: grid;
  place-items: center;
}

body[data-theme="heist"] .project-library-trash {
  color: var(--heist-red-hot);
  display: grid;
  place-items: center;
}

body[data-theme="heist"] .project-library-backup svg,
body[data-theme="heist"] .project-library-trash svg {
  height: 36px;
  stroke-width: 2.2;
  width: 36px;
}

body[data-theme="heist"] .project-library-trash::after {
  content: none;
}

body[data-theme="heist"] .project-library-backup:hover,
body[data-theme="heist"] .project-library-backup:focus-visible,
body[data-theme="heist"] .project-library-trash:hover,
body[data-theme="heist"] .project-library-trash:focus-visible {
  background: var(--heist-paper);
  border-color: var(--heist-black);
  box-shadow: 5px 5px 0 var(--heist-black);
  color: var(--heist-red);
  outline: 0;
  transform: translate(-2px, -2px) rotate(-1deg);
}

body[data-theme="heist"] .project-library-trash:hover::after,
body[data-theme="heist"] .project-library-trash:focus-visible::after {
  color: var(--heist-black);
}

body[data-theme="heist"] .project-library-close {
  background: var(--heist-red);
  border: 3px solid var(--heist-black);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--heist-paper);
  color: var(--heist-paper);
  height: 46px;
  transform: rotate(6deg);
  width: 46px;
}

body[data-theme="heist"] .project-library-close:hover,
body[data-theme="heist"] .project-library-close:focus-visible {
  background: var(--heist-paper);
  color: var(--heist-black);
  outline: 2px solid var(--heist-black);
  transform: rotate(-6deg) scale(1.03);
}

body[data-theme="heist"] .project-library-shelf-head {
  background: var(--heist-paper);
  border-bottom: 4px solid var(--heist-red);
  border-top: 3px solid var(--heist-black);
  color: var(--heist-black);
  font: 900 8px/1 var(--mono);
  letter-spacing: 0.12em;
  min-height: 40px;
  padding: 11px 30px 10px;
}

body[data-theme="heist"] .project-library-shelf-head span:first-child::before {
  color: var(--heist-red);
  content: "09 / ";
}

body[data-theme="heist"] .project-library-grid {
  background:
    radial-gradient(circle, rgba(255, 245, 223, 0.045) 0 1px, transparent 1.5px) 0 0 / 12px 12px,
    repeating-linear-gradient(
      0deg,
      transparent 0 172px,
      var(--heist-red) 172px 176px,
      var(--heist-paper) 176px 180px,
      var(--heist-black) 180px 193px
    ),
    linear-gradient(107deg, transparent 0 77%, rgba(223, 24, 43, 0.08) 77%),
    #100c0d;
  gap: 0 22px;
  grid-auto-rows: 193px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 166px));
  justify-content: start;
  padding: 16px 30px 68px;
  position: relative;
}

body[data-theme="heist"] .project-library-grid::after {
  bottom: 58px;
  color: rgba(255, 245, 223, 0.07);
  content: "PLAN / WRITE / VANISH";
  font-family: var(--heist-display);
  font-size: clamp(28px, 4vw, 52px);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.07em;
  line-height: 0.78;
  pointer-events: none;
  position: absolute;
  right: 28px;
  text-align: right;
  text-transform: uppercase;
  transform: rotate(-1.4deg);
  white-space: nowrap;
  z-index: 0;
}

body[data-theme="heist"] .project-folder-item.project-cartridge-item {
  align-self: end;
  height: 184px;
  overflow: visible;
  position: relative;
  width: 100%;
  z-index: 1;
}

body[data-theme="heist"] .project-cartridge-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  clip-path: none;
  overflow: visible;
  padding: 20px 10px 18px;
}

body[data-theme="heist"] .project-cartridge-card:hover,
body[data-theme="heist"] .project-cartridge-card:focus-visible {
  background: rgba(223, 24, 43, 0.14);
  box-shadow:
    inset 0 0 0 3px var(--heist-paper),
    5px 5px 0 var(--heist-red);
  clip-path: polygon(0 0, 93% 0, 100% 12%, 97% 100%, 4% 96%);
  outline: 0;
  transform: translate(-2px, -4px) rotate(-0.55deg);
}

body[data-theme="heist"] .project-cartridge-card.active {
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.09) 0 1px, transparent 1.5px) 0 0 / 7px 7px,
    var(--heist-paper);
  box-shadow:
    inset 0 0 0 3px var(--heist-black),
    6px 6px 0 var(--heist-red);
  clip-path: polygon(0 0, 91% 0, 100% 13%, 97% 100%, 5% 97%, 0 86%);
}

body[data-theme="heist"] .project-cartridge-item.active::before {
  background: var(--heist-red);
  border: 2px solid var(--heist-black);
  box-shadow: 3px 3px 0 var(--heist-paper);
  color: var(--heist-paper);
  content: "IN PLAY";
  font: italic 950 8px/1 var(--heist-display);
  left: 6px;
  letter-spacing: 0.02em;
  padding: 4px 8px 3px;
  position: absolute;
  text-transform: uppercase;
  top: 2px;
  transform: rotate(-3deg);
  z-index: 4;
}

body[data-theme="heist"] .project-cartridge-item.active::after {
  background: var(--heist-red);
  border: 2px solid var(--heist-black);
  border-radius: 50%;
  bottom: 6px;
  box-shadow: 0 0 0 2px var(--heist-paper);
  content: "";
  height: 10px;
  position: absolute;
  right: 7px;
  width: 10px;
  z-index: 4;
}

body[data-theme="heist"] .project-cartridge-shell {
  background:
    radial-gradient(circle at 13px 14px, var(--heist-paper) 0 2px, var(--heist-black) 3px 5px, transparent 6px),
    radial-gradient(circle, rgba(9, 8, 8, 0.11) 0 1px, transparent 1.5px) 0 0 / 8px 8px,
    linear-gradient(145deg, var(--heist-red-hot), var(--heist-red) 52%, var(--heist-red-deep));
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow:
    inset 4px 0 rgba(255, 245, 223, 0.13),
    inset -7px 0 rgba(9, 8, 8, 0.28),
    0 7px 0 #4a0910,
    6px 11px 0 rgba(9, 8, 8, 0.68);
  clip-path: polygon(0 8%, 7% 8%, 11% 0, 79% 0, 86% 7%, 100% 7%, 98% 92%, 89% 100%, 13% 98%, 5% 91%);
  height: 138px;
  width: 126px;
}

body[data-theme="heist"] .project-cartridge-card:hover .project-cartridge-shell,
body[data-theme="heist"] .project-cartridge-card:focus-visible .project-cartridge-shell {
  filter: brightness(1.08) saturate(1.08);
  transform: translateY(-4px) rotate(-1deg);
}

body[data-theme="heist"] .project-cartridge-label {
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.08) 0 1px, transparent 1.5px) 0 0 / 7px 7px,
    var(--heist-paper);
  border: 3px solid var(--heist-black);
  bottom: 22px;
  box-shadow: inset 0 -5px rgba(223, 24, 43, 0.1);
  clip-path: polygon(0 4%, 94% 0, 100% 14%, 97% 100%, 5% 97%);
  left: 12px;
  padding: 8px 8px 7px;
  right: 12px;
  top: 24px;
}

body[data-theme="heist"] .project-cartridge-kicker,
body[data-theme="heist"] .project-cartridge-meta {
  color: #5b4d49;
}

body[data-theme="heist"] .project-cartridge-name {
  color: var(--heist-black);
  font-family: var(--heist-display);
  font-size: 11px;
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 0.92;
  text-transform: uppercase;
}

body[data-theme="heist"] .project-cartridge-key {
  background: var(--heist-black);
  border: 2px solid var(--heist-paper);
  box-shadow: 2px 2px 0 var(--heist-red-deep);
}

body[data-theme="heist"] .project-cartridge-item .project-context-trigger {
  background: var(--heist-black);
  border: 2px solid var(--heist-paper);
  border-radius: 50%;
  color: var(--heist-paper);
}

body[data-theme="heist"] .project-cartridge-item .project-context-trigger:hover,
body[data-theme="heist"] .project-cartridge-item .project-context-trigger:focus-visible {
  background: var(--heist-red);
  border-color: var(--heist-black);
  color: var(--heist-paper);
}

body[data-theme="heist"] .project-trash-window {
  background:
    radial-gradient(circle, rgba(255, 245, 223, 0.04) 0 1px, transparent 1.5px) 0 0 / 11px 11px,
    var(--heist-ink);
}

body[data-theme="heist"] .project-trash-head {
  background: var(--heist-red);
  border-bottom: 6px solid var(--heist-black);
}

body[data-theme="heist"] .project-trash-head h2 {
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
  text-shadow: 4px 4px 0 var(--heist-black);
  text-transform: uppercase;
}

body[data-theme="heist"] .project-trash-close {
  background: var(--heist-paper);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--heist-black);
  color: var(--heist-black);
  font-family: var(--heist-display);
  font-style: italic;
  text-transform: uppercase;
}

body[data-theme="heist"] .deleted-project-item {
  background:
    linear-gradient(105deg, rgba(223, 24, 43, 0.16), transparent 42%),
    var(--heist-ink);
  border: 2px solid rgba(255, 245, 223, 0.34);
  border-left: 8px solid var(--heist-red);
  border-radius: 0;
  box-shadow: 5px 5px 0 rgba(223, 24, 43, 0.4);
  clip-path: polygon(0 0, 97% 0, 100% 17%, 98% 100%, 3% 96%);
}

body[data-theme="heist"] .deleted-project-item strong {
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
  text-transform: uppercase;
}

body[data-theme="heist"] .deleted-project-actions .ghost-button {
  background: var(--heist-paper);
  border: 2px solid var(--heist-black);
  border-radius: 0;
  color: var(--heist-black);
}

body[data-theme="heist"] .deleted-project-actions .danger-button {
  background: var(--heist-red);
  border: 2px solid var(--heist-paper);
  border-radius: 0;
  color: var(--heist-paper);
}

body[data-theme="heist"] .settings-dialog {
  background:
    radial-gradient(circle, rgba(255, 245, 223, 0.04) 0 1px, transparent 1.5px) 0 0 / 9px 9px,
    linear-gradient(124deg, rgba(223, 24, 43, 0.16), transparent 44%),
    var(--heist-ink);
}

body[data-theme="heist"] .settings-head {
  background: var(--heist-red);
  border-bottom: 5px solid var(--heist-black);
  clip-path: polygon(0 0, 100% 0, 98% 91%, 3% 100%);
}

body[data-theme="heist"] .settings-head h2 {
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
  letter-spacing: -0.05em;
  text-shadow: 4px 4px 0 var(--heist-black);
  text-transform: uppercase;
}

body[data-theme="heist"] .settings-head .eyebrow {
  background: var(--heist-paper);
  color: var(--heist-black);
}

body[data-theme="heist"] .settings-close {
  background: var(--heist-black);
  border: 2px solid var(--heist-paper);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--heist-paper);
  color: var(--heist-paper);
}

body[data-theme="heist"] .settings-section {
  background: rgba(9, 8, 8, 0.48);
  border: 2px solid rgba(255, 245, 223, 0.28);
  border-left: 8px solid var(--heist-red);
  border-radius: 0;
  clip-path: polygon(0 0, 98% 0, 100% 12%, 98% 100%, 2% 97%);
}

body[data-theme="heist"] .settings-device-section {
  grid-column: 1 / -1;
}

body[data-theme="heist"] .settings-section-index {
  color: var(--heist-red-hot);
  font-family: var(--heist-display);
  font-style: italic;
}

body[data-theme="heist"] .settings-action {
  background: var(--heist-paper);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--heist-red);
  color: var(--heist-black);
  font-family: var(--heist-display);
  font-style: italic;
  text-transform: uppercase;
}

body[data-theme="heist"] .settings-action-danger {
  background: var(--heist-red);
  border-color: var(--heist-paper);
  color: var(--heist-paper);
}

body[data-theme="heist"] .auth-dialog {
  background:
    radial-gradient(circle, rgba(9, 8, 8, 0.07) 0 1px, transparent 1.5px) 0 0 / 8px 8px,
    var(--heist-paper);
  border: 4px solid var(--heist-black);
  box-shadow:
    9px 9px 0 var(--heist-red),
    15px 15px 0 var(--heist-black);
  clip-path: polygon(0 3%, 96% 0, 100% 8%, 98% 96%, 90% 100%, 3% 97%);
  color: var(--heist-black);
}

body[data-theme="heist"] .auth-dialog::before {
  background: var(--heist-red);
  clip-path: polygon(0 20%, 100% 0, 93% 100%, 4% 78%);
  content: "";
  height: 11px;
  left: 24px;
  position: absolute;
  right: 21%;
  top: 10px;
}

body[data-theme="heist"] .auth-dialog h1 {
  color: var(--heist-black);
  font-family: var(--heist-display);
  font-style: italic;
  font-weight: 950;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

body[data-theme="heist"] .auth-dialog input {
  background: var(--heist-black);
  border: 3px solid var(--heist-red);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--heist-gray);
  color: var(--heist-paper);
}

body[data-theme="heist"] .compact-toolbar {
  background:
    linear-gradient(100deg, var(--heist-red) 0 62%, var(--heist-paper) 62% 72%, var(--heist-black) 72%) left bottom / 100% 6px no-repeat,
    var(--heist-ink);
  border-bottom: 2px solid var(--heist-black);
}

.app[data-theme="heist"] .compact-nav-button,
.app[data-theme="heist"] .compact-surface-nav button {
  border-radius: 0;
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-size: 9px;
  font-style: italic;
  font-weight: 950;
  text-transform: uppercase;
}

.app[data-theme="heist"] .compact-surface-nav button.active {
  background: var(--heist-red);
  color: var(--heist-paper);
  clip-path: polygon(0 5%, 96% 0, 100% 86%, 5% 100%);
}

body[data-theme="heist"] .command-palette-search {
  background: var(--heist-paper);
  border: 3px solid var(--heist-black);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--heist-red);
}

body[data-theme="heist"] .command-palette-search input {
  color: var(--heist-black);
}

body[data-theme="heist"] .command-palette-item {
  border-radius: 0;
}

body[data-theme="heist"] .command-palette-item:hover,
body[data-theme="heist"] .command-palette-item.active {
  background: var(--heist-red);
  clip-path: polygon(0 0, 98% 0, 100% 17%, 98% 100%, 2% 96%);
  color: var(--heist-paper);
}

body[data-theme="heist"] .toast {
  border-left: 8px solid var(--heist-red);
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
}

body[data-theme="heist"] * {
  scrollbar-color: var(--heist-red) var(--heist-black);
}

@media (max-width: 820px) {
  body[data-theme="heist"] .project-library-grid {
    gap: 0 16px;
    grid-template-columns: repeat(auto-fill, minmax(142px, 156px));
    padding-inline: 22px;
  }
}

@media (max-width: 767px) {
  .app[data-theme="heist"] .editor-pane {
    padding: 9px;
  }

  .app[data-theme="heist"] .editor-shell {
    box-shadow:
      6px 6px 0 var(--heist-red),
      10px 10px 0 var(--heist-black);
    height: calc(100% - 6px);
    margin: 3px auto;
    padding: 38px 20px 24px;
  }

  .app[data-theme="heist"] .editor-mode-panel,
  .app[data-theme="heist"] #write-panel,
  .app[data-theme="heist"] .sheet-body,
  .app[data-theme="heist"] .preview-body,
  .app[data-theme="heist"] .outline-body {
    max-width: 100%;
    min-width: 0;
  }

  .app[data-theme="heist"] .composer-toolbar {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
}

@media (max-width: 640px) {
  body[data-theme="heist"] .project-library-head {
    align-items: stretch;
    background: var(--heist-red);
    flex-direction: column;
    padding: 28px 20px 22px;
  }

  body[data-theme="heist"] .project-library-actions {
    display: grid;
    grid-template-columns: 76px 76px 46px;
    justify-content: end;
    width: 100%;
  }

  body[data-theme="heist"] .project-library-grid {
    gap: 0 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 12px 58px;
  }
}

@media (max-width: 420px) {
  .app[data-theme="heist"] .editor-shell::before {
    content: "MAKE / MOVE";
    font-size: 7px;
  }

  .app[data-theme="heist"] .editor-shell::after {
    width: 58px;
  }

  .app[data-theme="heist"] .mode-switch button {
    font-size: 9px;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app[data-theme="heist"] .project-eject,
  .app[data-theme="heist"] .project-new,
  .app[data-theme="heist"] .project-library-open,
  .app[data-theme="heist"] .section-button,
  .app[data-theme="heist"] .sheet-card,
  body[data-theme="heist"] .project-cartridge-card {
    transition: none;
  }
}

/* Compact composer architecture
   The scroll surface spans the editor while the manuscript keeps a readable measure. */

.editor-pane {
  --composer-gutter: clamp(20px, 3.6vw, 52px);
  --composer-measure: 820px;
}

.app[data-theme] .editor-shell {
  container-type: inline-size;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  height: calc(100% - 12px);
  margin: 6px auto;
  max-width: none;
  overflow: hidden;
  padding: 34px 0 0;
  position: relative;
  width: calc(100% - 12px);
}

.editor-mode-bar,
.composer-toolbar,
.editor-composer-head {
  margin-inline: auto;
  width: min(calc(100% - (var(--composer-gutter) * 2)), var(--composer-measure));
}

.composer-document-status-rail {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  left: 50%;
  max-width: calc(100% - (var(--composer-gutter) * 2));
  position: absolute;
  top: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
  width: max-content;
  z-index: 4;
}

.editor-mode-bar {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-bottom: 22px;
  margin-top: 0;
  min-height: 38px;
  grid-row: 1;
  z-index: 3;
}

.editor-mode-bar:has(+ .composer-toolbar:not([hidden])) {
  margin-bottom: 7px;
}

.editor-mode-bar .mode-switch {
  flex: 1 1 0;
  margin: 0;
  max-width: 360px;
  min-width: 0;
  overflow: hidden;
}

.editor-mode-bar .mode-switch button {
  min-width: 0;
}

.composer-context-action {
  flex: 0 0 auto;
  margin-left: 5px;
  position: relative;
}

.composer-context-action::before {
  background: var(--line);
  content: "";
  height: 22px;
  left: -9px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
}

.composer-utility-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  margin-left: auto;
}

.composer-format-toggle,
.editor-mode-bar .composer-add-lore {
  align-items: center;
  display: inline-flex;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 760;
  gap: 5px;
  height: 38px;
  justify-content: center;
  letter-spacing: 0.025em;
  min-width: 38px;
  padding: 0 10px;
  transition:
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.editor-mode-bar .composer-add-lore {
  background: color-mix(in srgb, var(--panel-soft) 76%, transparent);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
}

.editor-mode-bar .composer-add-lore:hover,
.editor-mode-bar .composer-add-lore:focus-visible {
  background: var(--panel-soft);
  border-color: var(--accent);
  box-shadow: var(--glow);
  color: var(--text);
  outline: 0;
}

.composer-format-toggle:disabled,
.editor-mode-bar .composer-add-lore:disabled {
  cursor: default;
  opacity: 0.42;
}

.editor-mode-bar .composer-add-lore {
  min-width: 74px;
}

.editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  animation: composer-add-lore-wobble 720ms ease-in-out 2;
  background: var(--accent);
  border-color: var(--accent-strong);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--accent-strong) 72%, #000);
  color: var(--surface-canvas);
}

.editor-mode-bar .composer-add-lore[data-selection-ready="true"]:hover,
.editor-mode-bar .composer-add-lore[data-selection-ready="true"]:focus-visible {
  background: var(--accent-strong);
  color: var(--surface-canvas);
}

.editor-mode-bar .composer-inspector-toggle,
.editor-mode-bar .composer-focus-toggle {
  flex: 0 0 38px;
  height: 38px;
  position: static;
  right: auto;
  top: auto;
  width: 38px;
  z-index: auto;
}

.editor-mode-bar .composer-focus-toggle {
  opacity: 1;
}

.composer-control-label {
  display: none;
}

.composer-toolbar {
  border-bottom: 1px solid var(--line);
  display: flex;
  grid-row: 2;
  margin-bottom: 18px;
  min-height: 34px;
  overflow-x: auto;
  padding: 0 0 5px;
  scrollbar-width: none;
  z-index: 2;
}

.composer-toolbar::-webkit-scrollbar {
  display: none;
}

.composer-toolbar[hidden] {
  display: none;
}

.editor-composer-head {
  display: grid;
  grid-row: 3;
  grid-template-rows: auto;
  margin-bottom: -36px;
  padding: clamp(56px, 6cqi, 72px) 0 7px;
  position: relative;
  z-index: 2;
}

.composer-toolbar:not([hidden]) + .editor-composer-head {
  padding-top: 26px;
}

.app[data-theme] .sheet-title-input {
  field-sizing: content;
  font-size: clamp(28px, 3.2cqi, 42px);
  height: 44px;
  line-height: 1.03;
  max-height: 44px;
  min-height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  transform: translateY(-36px);
  padding: 0;
  white-space: nowrap;
}

.editor-meta,
.composer-document-status-rail {
  align-items: center;
  display: flex;
}

.composer-document-stats {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: nowrap;
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  gap: 0;
  justify-content: flex-end;
  letter-spacing: 0.045em;
  padding-bottom: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.composer-document-stats span {
  align-items: center;
  display: inline-flex;
}

.composer-document-stats span + span::before {
  color: var(--muted);
  content: "·";
  margin: 0 7px;
  opacity: 0.62;
}

.editor-mode-panel,
#write-panel {
  grid-row: 4;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  width: 100%;
}

.editor-mode-panel > .sheet-body,
.editor-mode-panel > .preview-body,
.editor-mode-panel > .outline-body {
  min-width: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  width: 100%;
}

.sheet-body,
.preview-body,
.outline-body {
  padding-bottom: 34px;
  padding-top: 7px;
}

.structured-composer .ProseMirror {
  margin-inline: auto;
  min-height: 100%;
  width: min(calc(100% - (var(--composer-gutter) * 2)), var(--composer-measure));
}

.app[data-theme] .sheet-title-input:focus,
.app[data-theme] .sheet-title-input:focus-visible,
.app[data-theme] .sheet-body:focus,
.app[data-theme] .sheet-body:focus-visible,
.app[data-theme] .sheet-body:focus-within,
.app[data-theme] .structured-composer:focus,
.app[data-theme] .structured-composer:focus-visible,
.app[data-theme] .structured-composer:focus-within {
  border-color: transparent;
  box-shadow: none;
  outline: none;
}

.app[data-theme="neon"] .sheet-title-input {
  text-decoration: none;
}

.preview-body,
.outline-body {
  padding-left: max(var(--composer-gutter), calc((100% - var(--composer-measure)) / 2));
  padding-right: max(var(--composer-gutter), calc((100% - var(--composer-measure)) / 2));
}

/* The document status now lives beside the title, never beneath the writing surface. */
.editor-footer {
  display: none;
}

/* Skin-specific contextual actions retain each visual language without changing geometry. */
.app[data-theme="frontier"] .editor-mode-bar .composer-add-lore {
  background: var(--surface-raised);
  border-color: rgba(52, 61, 59, 0.28);
  color: var(--text-secondary);
}

.app[data-theme="frontier"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--selection);
  border-color: var(--accent-strong);
  color: #fffdf4;
}

.app[data-theme="sprypnt"] .editor-mode-bar .composer-add-lore {
  background: var(--spray-ink);
  border: 2px solid var(--spray-pink);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--spray-purple);
  color: #fff7e9;
}

.app[data-theme="sprypnt"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--spray-yellow);
  border-color: var(--spray-ink);
  box-shadow: 3px 3px 0 var(--spray-pink);
  color: var(--spray-ink);
}

.app[data-theme="olde"] .editor-mode-bar .composer-add-lore {
  background: var(--olde-ink);
  border: 2px solid var(--olde-gold);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--olde-rubric);
  color: var(--olde-page);
}

.app[data-theme="olde"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--olde-rubric);
  border-color: var(--olde-ink);
  box-shadow: inset 0 0 0 2px var(--olde-gold), 0 3px 0 var(--olde-ink);
  color: var(--olde-page);
}

.app[data-theme="neon"] .editor-mode-bar .composer-add-lore {
  background: var(--neon-violet-deep);
  border: 2px solid var(--neon-acid);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--neon-orange);
  clip-path: polygon(0 0, 92% 0, 100% 25%, 96% 100%, 4% 100%, 0 78%);
  color: var(--neon-acid);
}

.app[data-theme="neon"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--neon-acid);
  border-color: var(--neon-black);
  color: var(--neon-black);
}

.app[data-theme="gem"] .editor-mode-bar .composer-add-lore {
  background: #070a09;
  border: 1px solid rgba(214, 173, 85, 0.48);
  border-radius: 2px;
  color: var(--text-secondary);
}

.app[data-theme="gem"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: linear-gradient(135deg, #6c3c92, #493264);
  border-color: rgba(214, 173, 85, 0.75);
  color: #fff9e8;
}

.app[data-theme="moby"] .editor-mode-bar .composer-add-lore {
  background: rgba(255, 252, 242, 0.4);
  border: 1px solid var(--moby-ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(86, 55, 35, 0.16);
  color: var(--moby-ink);
}

.app[data-theme="moby"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--moby-ink);
  box-shadow: inset 0 -3px var(--moby-wood);
  color: var(--moby-paper);
}

.app[data-theme="noir"] .editor-mode-bar .composer-add-lore {
  background: var(--noir-ink);
  border: 1px solid var(--noir-brass);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--noir-red);
  color: var(--noir-brass);
  font-family: var(--noir-display);
}

.app[data-theme="noir"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--noir-red);
  border-color: var(--noir-ink);
  color: var(--noir-bone);
}

.app[data-theme="heist"] .editor-mode-bar .composer-add-lore {
  background: var(--heist-black);
  border: 3px solid var(--heist-red);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--heist-paper);
  clip-path: polygon(0 5%, 96% 0, 100% 84%, 7% 100%);
  color: var(--heist-paper);
  font-family: var(--heist-display);
  font-style: italic;
}

.app[data-theme="heist"] .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
  background: var(--heist-red);
  border-color: var(--heist-black);
  color: var(--heist-paper);
}

@container (max-width: 680px) {
  .composer-control-label {
    display: none;
  }

  .composer-format-toggle {
    padding-inline: 8px;
  }
}

@container (max-width: 520px) {
  .editor-mode-bar {
    gap: 6px;
  }

  .editor-mode-bar .mode-switch {
    flex-basis: 0;
  }

  .editor-mode-bar .composer-add-lore {
    min-width: 64px;
    padding-inline: 7px;
  }

  .composer-utility-actions {
    gap: 4px;
  }

  .composer-document-stats span + span::before {
    margin-inline: 5px;
  }

  .composer-document-status-rail {
    gap: 8px;
  }
}

@media (max-width: 767px) {
  .app[data-theme] .editor-shell {
    height: calc(100% - 8px);
    margin: 4px auto;
    padding: 24px 0 0;
    width: calc(100% - 8px);
  }

  .editor-pane {
    --composer-gutter: 18px;
  }

  .editor-mode-bar {
    margin-bottom: 16px;
  }

  .editor-mode-bar:has(+ .composer-toolbar:not([hidden])) {
    margin-bottom: 5px;
  }

  .composer-toolbar {
    margin-bottom: 12px;
  }

  .editor-composer-head {
    margin-bottom: -24px;
    padding-top: 38px;
  }

  .app[data-theme] .sheet-title-input {
    transform: translateY(-24px);
  }

  .composer-toolbar:not([hidden]) + .editor-composer-head {
    padding-top: 18px;
  }

  .editor-mode-bar .composer-inspector-toggle,
  .editor-mode-bar .composer-focus-toggle,
  .composer-format-toggle {
    flex-basis: 40px;
    height: 40px;
    min-height: 40px;
    min-width: 40px;
    width: 40px;
  }

  .sheet-body,
  .preview-body,
  .outline-body {
    font-size: 17px;
  }
}

@container (max-width: 460px) {
  .composer-document-stats #reading-time,
  .composer-document-stats #sheet-goal {
    display: none;
  }

  .editor-mode-bar .mode-switch button {
    font-size: 8px;
    padding-inline: 4px;
  }

  .editor-mode-bar .composer-add-lore {
    font-size: 9px;
    min-width: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-mode-bar .composer-add-lore[data-selection-ready="true"] {
    animation: none;
  }
}
