/* World layers in cascade order: V189 material refinements, functional control polish,
   V190 Hearts and Bows motifs, the five V190 study worlds, then V192 shared geometry. */

/* V189 — material refinements for the eight existing worlds.
   Paint stays in the established environment / slab / grain / frame layers.
   Authored artwork, rail fitting, lantern mounts, content geometry, and ruled
   writing phases continue to be owned by their original implementations. */

body[data-visual-theme='pastel-princess'] {
  --world-paper-grain-opacity: .24;
  --world-paper-light: rgb(255 249 234 / .28);
  --world-contact-ink: 82 44 59;
  --world-desk-wash: rgb(255 250 238 / .65);
}
body[data-visual-theme='pastel-princess'][data-princess-motif='strawberry'] {
  --princess-paper: #fffaf1;
  --princess-paper-alt: #fff6ee;
  --princess-rule: #d68ba0;
  --princess-chalk-surface: #675462;
  --world-paper-grain-opacity: .27;
  --princess-desk-pattern:
    linear-gradient(90deg, rgb(196 106 125 / .075) 50%, transparent 50%),
    linear-gradient(0deg, rgb(196 106 125 / .065) 50%, transparent 50%),
    repeating-linear-gradient(90deg, rgb(255 249 236 / .18) 0 1px, transparent 1px 4px);
  --princess-desk-pattern-size: 40px 40px, 40px 40px, 4px 4px;
}

body[data-visual-theme='pastel-princess'][data-princess-motif='cherry-ribbon'] {
  --princess-paper: #fffaf0;
  --princess-paper-alt: #fff5ec;
  --princess-rule: #d2778e;
  --princess-chalk-surface: #644d59;
  --world-paper-grain-opacity: .21;
  --world-contact-ink: 89 39 52;
  --world-desk-wash: rgb(255 247 235 / .71);
  --princess-desk-pattern:
    repeating-linear-gradient(90deg, rgb(177 74 90 / .12) 0 1px, transparent 1px 4px, rgb(177 74 90 / .075) 4px 5px, transparent 5px 32px),
    linear-gradient(0deg, rgb(255 248 231 / .13) 50%, transparent 50%);
  --princess-desk-pattern-size: 32px 32px, 32px 32px;
}

/* The fabric remains patterned; the old full-strength texture no longer
   puts dark speckles across every square inch of the surrounding desk. */
body[data-visual-theme='pastel-princess'] .editor-scroll {
  background-image:
    var(--princess-desk-pattern),
    linear-gradient(var(--world-desk-wash), var(--world-desk-wash)),
    var(--world-paper-grain),
    linear-gradient(180deg, var(--princess-workspace), var(--princess-shell));
  background-size: var(--princess-desk-pattern-size), 100% 100%, 256px 256px, 100% 100%;
  background-position: 0 0;
  background-repeat: repeat;
}

body[data-visual-theme='field-journal'] {
  --world-paper-grain-opacity: .30;
  --world-paper-light: rgb(255 246 213 / .19);
  --world-contact-ink: 41 45 29;
  --world-season-light: 247 239 206;
  --world-season-shade: 92 118 71;
  --world-desk-grain-wash: .79;
}
body[data-visual-theme='field-journal'][data-field-season='spring'] {
  --field-workspace: #ceddbb;
  --field-paper-base: #fff9e9;
  --field-paper-ruled: #fbf4e2;
  --field-paper-dots: #f6f5e5;
  --field-paper-grid: #f1f2df;
  --world-paper-grain-opacity: .25;
  --world-season-light: 255 247 218;
  --world-season-shade: 128 153 101;
  --world-paper-light: rgb(255 249 222 / .24);
}
body[data-visual-theme='field-journal'][data-field-season='summer'] {
  --field-workspace: #c9d0a9;
  --field-paper-base: #fff3db;
  --field-paper-ruled: #fbefd6;
  --field-paper-dots: #f7efda;
  --field-paper-grid: #f2ead3;
  --world-paper-grain-opacity: .32;
  --world-season-light: 255 230 176;
  --world-season-shade: 92 118 65;
  --world-paper-light: rgb(255 235 190 / .22);
}
body[data-visual-theme='field-journal'][data-field-season='autumn'] {
  --field-workspace: #c6ab80;
  --field-paper-base: #fcedd6;
  --field-paper-ruled: #f7e6ca;
  --field-paper-dots: #f8ead2;
  --field-paper-grid: #f1e2c8;
  --world-paper-grain-opacity: .34;
  --world-season-light: 255 219 161;
  --world-season-shade: 125 83 48;
  --world-paper-light: rgb(255 223 166 / .22);
}
body[data-visual-theme='field-journal'][data-field-season='winter'] {
  --field-workspace: #c7d7d5;
  --field-paper-base: #f7f9f2;
  --field-paper-ruled: #f0f4eb;
  --field-paper-dots: #f3f7ef;
  --field-paper-grid: #edf3ec;
  --world-paper-grain-opacity: .20;
  --world-season-light: 237 248 242;
  --world-season-shade: 107 137 140;
  --world-paper-light: rgb(229 245 245 / .27);
  --world-desk-grain-wash: .86;
}

/* Continuous ambient light belongs to the desk. No new side illustration,
   decorative rectangle, plaque, or competing perimeter is introduced. */
body[data-visual-theme='field-journal'] .editor-scroll {
  background-image:
    radial-gradient(ellipse at 18% 6%, rgb(var(--world-season-light) / .32), transparent 62%),
    linear-gradient(180deg, rgb(var(--world-season-shade) / 0), rgb(var(--world-season-shade) / .08)),
    linear-gradient(color-mix(in srgb, var(--field-workspace) calc(var(--world-desk-grain-wash) * 100%), transparent), color-mix(in srgb, var(--field-workspace) calc(var(--world-desk-grain-wash) * 100%), transparent)),
    var(--world-paper-grain);
  background-size: 100% 100%, 100% 100%, 100% 100%, 256px 256px;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
}
body[data-visual-theme='field-journal'][data-theme='dark'] {
  /* Seasonal light paper overrides must never leak into the night workspace. */
  --field-paper-base: var(--field-dark-paper);
  --field-paper-ruled: color-mix(in srgb, var(--field-dark-paper) 94%, var(--field-gold));
  --field-paper-dots: color-mix(in srgb, var(--field-dark-paper) 94%, var(--field-eucalyptus));
  --field-paper-grid: color-mix(in srgb, var(--field-dark-paper) 93%, var(--field-lake));
  --world-paper-grain-opacity: .23;
  --world-paper-light: rgb(var(--field-lantern-glow) / .035);
  --world-contact-ink: 5 15 11;
}
body[data-visual-theme='field-journal'][data-theme='dark'] .editor-scroll {
  background-image:
    radial-gradient(ellipse at 19% 25%, rgb(var(--field-lantern-glow) / .045), transparent 45%),
    linear-gradient(color-mix(in srgb, var(--field-dark-workspace) 86%, transparent), color-mix(in srgb, var(--field-dark-workspace) 86%, transparent)),
    var(--world-chalk-grain);
  background-size: 100% 100%, 100% 100%, 256px 256px;
  background-repeat: no-repeat, no-repeat, repeat;
}

body:is([data-visual-theme='pastel-princess'], [data-visual-theme='field-journal']):not([data-paper='chalkboard']) .theme-material-grain {
  opacity: var(--world-paper-grain-opacity);
  background-image: linear-gradient(118deg, var(--world-paper-light), transparent 47%), var(--world-paper-grain);
  background-size: 100% 100%, 256px 256px;
}
body:is([data-visual-theme='pastel-princess'], [data-visual-theme='field-journal']) .theme-board-underlay {
  box-shadow: 0 1px 2px rgb(var(--world-contact-ink) / .14), 0 8px 16px -7px rgb(var(--world-contact-ink) / .21);
}
body:is([data-visual-theme='pastel-princess'], [data-visual-theme='field-journal']) .theme-frame {
  /* One silhouette shadow avoids doubled darkness where corner and rail join. */
  filter: drop-shadow(0 1px .65px rgb(var(--world-contact-ink) / .14));
}
body[data-visual-theme='pastel-princess'] .theme-frame-bow {
  filter: drop-shadow(0 1px .6px rgb(var(--world-contact-ink) / .13)) drop-shadow(0 3px 2px rgb(var(--world-contact-ink) / .11));
}

/* Fine planning grids keep their exact original spacing and major divisions;
   a small intersection mark helps the larger squares read at a glance. */
body[data-visual-theme='pastel-princess'][data-paper='grid'] .note-editor {
  background-image:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--world-rule) 48%, transparent) 0 1.1px, transparent 1.4px),
    linear-gradient(180deg, color-mix(in srgb, var(--world-rule) 25%, transparent) 0 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--world-rule) 25%, transparent) 0 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--world-rule) 44%, transparent) 0 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--world-rule) 44%, transparent) 0 1px, transparent 1px);
  background-size: 120px 120px, 24px 24px, 24px 24px, 120px 120px, 120px 120px;
}
body[data-visual-theme='field-journal'][data-paper='grid'] .note-editor {
  background-image:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--world-rule) 53%, transparent) 0 1.1px, transparent 1.4px),
    linear-gradient(180deg, color-mix(in srgb, var(--world-rule) 28%, transparent) 0 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--world-rule) 28%, transparent) 0 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--world-rule) 47%, transparent) 0 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--world-rule) 47%, transparent) 0 1px, transparent 1px);
  background-size: 150px 150px, 30px 30px, 30px 30px, 150px 150px, 150px 150px;
}
body[data-visual-theme='field-journal'][data-paper='dots'] .note-editor {
  background-image: var(--field-dot-pattern), radial-gradient(circle at center, color-mix(in srgb, var(--world-rule) 69%, transparent) 0 1.05px, transparent 1.4px);
}
body:is([data-visual-theme='pastel-princess'], [data-visual-theme='field-journal'])[data-paper='chalkboard'] .theme-material-grain {
  opacity: .33;
}
body:is([data-visual-theme='pastel-princess'], [data-visual-theme='field-journal'])[data-paper='chalkboard'] .chalk-dust-layer {
  opacity: .35;
}
/* A dark writing slab needs chalk ink even when the surrounding UI is light.
   Theme rules formerly gave Field text boxes a separate dark paper ink. */
body[data-visual-theme='field-journal'][data-paper='chalkboard'] .note-editor :is(.text-box-editor, .guided-content) {
  color: #f4eedc;
}
body[data-visual-theme='field-journal'][data-paper='chalkboard'] .text-box-editor:empty::before {
  color: #d7dfcd;
}

/* Loose illustrations have become user-placed stickers. Reclaim the former
   mobile vignette gap while keeping the independent focal above the sheet. */
@media (max-width: 600px) {
  body[data-visual-theme='pastel-princess'] .ink-stage { margin-top: 62px; }
  body[data-visual-theme='field-journal'] .ink-stage { margin-top: 46px; }
}

@media print {
  body:is([data-visual-theme='pastel-princess'], [data-visual-theme='field-journal']) .theme-frame { filter: none; }
}

/* Functional stationery polish. World art, writing geometry and printed work
   remain owned by their existing stylesheets. These tokens follow each world. */
@media screen {
  body {
    --ui-control-ink: var(--ink);
    --ui-control-paper: var(--paper);
    --ui-control-line: color-mix(in oklab, var(--ink) 22%, var(--paper));
    --ui-control-hover: color-mix(in oklab, var(--accent-ui) 8%, var(--paper));
    --ui-active-surface: color-mix(in oklab, var(--accent-ui) 13%, var(--paper));
    --ui-action-paper: var(--c30);
    --ui-action-ink: var(--paper);
    --ui-control-radius: 3px;
    --ui-panel-radius: 14px;
    --ui-series-0: #28688a;
    --ui-series-1: #b34e25;
    --ui-series-2: #347448;
    --ui-series-3: #855297;
  }
  body[data-visual-theme="pastel-princess"] {
    --ui-control-ink: var(--princess-control-ink);
    --ui-control-paper: var(--princess-pearl);
    --ui-control-line: color-mix(in oklab, var(--princess-control-ink) 24%, var(--princess-pearl));
    --ui-control-hover: var(--princess-control-hover);
    --ui-active-surface: color-mix(in oklab, color-mix(in oklab, var(--princess-control-ink) 80%, var(--accent-ui)) 12%, var(--princess-pearl));
    --ui-action-paper: var(--princess-deep-berry);
    --ui-action-ink: var(--princess-pearl);
    --ui-control-radius: 12px;
    --ui-panel-radius: 18px;
    --ui-series-0: #a33f70;
    --ui-series-1: #9c591f;
    --ui-series-2: #307966;
    --ui-series-3: #6655a0;
  }
  body[data-visual-theme="field-journal"] {
    --ui-action-paper: #29463d;
    --ui-action-ink: #fff7e9;
    --ui-control-radius: 6px;
    --ui-panel-radius: 12px;
    --ui-series-0: #356e65;
    --ui-series-1: #a94e2c;
    --ui-series-2: #456c9b;
    --ui-series-3: #895778;
  }
  body[data-theme="dark"] {
    --ui-series-0: #82bfe0;
    --ui-series-1: #f3b18e;
    --ui-series-2: #a1d0a8;
    --ui-series-3: #d2b1e7;
  }
  body[data-visual-theme="field-journal"][data-theme="dark"] {
    --ui-action-paper: #dce5ce;
    --ui-action-ink: #20372f;
    --ui-series-0: #a4cbb4;
    --ui-series-1: #eec096;
    --ui-series-2: #a6c8e8;
    --ui-series-3: #d4b6d0;
  }
  /* Keep compact reference text legible against Field Journal's dark paper. */
  body[data-visual-theme="field-journal"][data-theme="dark"] #reference-tools .calc-result:not(.calc-error) {
    color: var(--ui-action-paper);
  }
  body[data-visual-theme="field-journal"][data-theme="dark"] #reference-tools .formula-category-tab[aria-selected="true"] {
    color: var(--ui-action-ink);
    background: var(--ui-action-paper);
    border-color: var(--ui-action-paper);
  }
  body:is([data-visual-theme=""], [data-visual-theme="pastel-princess"], [data-visual-theme="field-journal"]) #reference-tools .formula-item > span {
    color: var(--ui-control-ink);
  }
  #theme-readability-note:not([hidden]) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0 0 12px;
    color: var(--ink);
    font-size: .9rem;
  }
  #show-selected-theme { min-height: 44px; }
  #visual-theme-options [data-visual-theme-option="personal-web"] .theme-preview-copy strong {
    white-space: normal;
    text-wrap: balance;
    overflow: visible;
    text-overflow: clip;
  }
  /* Formula context sits behind a quiet info icon, with the full explanation
     available below its own card only when requested. */
  #formula-list .reference-item-row.has-formula-info {
    grid-template-columns: minmax(0, 1fr) 30px 30px;
    gap: 4px;
    margin-bottom: 6px;
  }
  #formula-list .has-formula-info > .formula-item { margin-bottom: 0; }
  #formula-list .formula-info-button,
  #formula-list .has-formula-info > .reference-pin {
    width: 30px;
    min-height: 30px;
    padding: 0;
    justify-self: center;
  }
  #formula-list .formula-info-button {
    display: grid;
    place-items: center;
    color: var(--ui-control-ink);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
  }
  #formula-list .formula-info-button svg { width: 17px; height: 17px; pointer-events: none; }
  #formula-list .formula-info-button:is(:hover, [aria-expanded="true"]) { background: var(--ui-control-hover); }
  #formula-list .formula-info-panel {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 11px 12px;
    color: var(--ui-control-ink);
    background: var(--ui-control-paper);
    border: 1px solid var(--ui-control-line);
    border-radius: var(--ui-control-radius, var(--r-tight));
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  #formula-list .formula-info-panel[hidden] { display: none; }
  #formula-list .formula-info-panel p { margin: 0 0 .65em; }
  #formula-list .formula-info-panel ul { margin: 0 0 .65em; padding-left: 1.4em; }
  #formula-list .formula-info-panel a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
  #formula-list .formula-info-panel small { font-size: var(--t-control); }

  @media (max-width: 820px), (hover: none) and (pointer: coarse) {
    #formula-list .formula-info-button,
    #formula-list .has-formula-info > .reference-pin { width: 44px; min-height: 44px; }
  }
  @media (max-width: 600px) {
    #formula-list .reference-item-row.has-formula-info { grid-template-columns: minmax(0, 1fr) 44px 44px; }
  }

  /* Quiet document actions; the current editing tools retain a tactile edge. */
  body[data-visual-theme][data-theme] .toolbar :is(.tool-button, .icon-button) {
    border-color: transparent;
    background: transparent;
    border-radius: var(--ui-control-radius, var(--r-tight));
    box-shadow: none;
  }
  body[data-visual-theme][data-theme] .toolbar :is(.tool-button, .icon-button):hover {
    color: var(--ui-control-ink);
    background: var(--ui-control-hover);
    border-color: var(--ui-control-line);
  }
  body[data-visual-theme][data-theme] #save-document {
    background: var(--ui-active-surface);
    border-color: transparent;
    font-weight: 650;
  }
  body[data-visual-theme][data-theme] :is(.workspace-toolbar > .chip, .tool-library-actions > .chip, .secondary-button, .biology-secondary-button, .biology-close-button):where(:not(.primary-button, .chip-primary)) {
    color: var(--ui-control-ink);
    border-color: var(--ui-control-line);
    background: var(--ui-control-paper);
    border-radius: var(--ui-control-radius, var(--r-tight));
    box-shadow: 0 1px 1px rgb(var(--shade) / .035);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 550;
    line-height: 1.3;
  }
  body[data-visual-theme][data-theme] :is(.workspace-toolbar > .chip, .tool-library-actions > .chip, .secondary-button, .biology-secondary-button, .biology-close-button):where(:not(.primary-button, .chip-primary)):hover:not(:disabled) {
    color: var(--ui-control-ink);
    border-color: color-mix(in oklab, var(--ui-control-ink) 45%, var(--ui-control-paper));
    background: var(--ui-control-hover);
  }
  body[data-visual-theme][data-theme] :is(.workspace-toolbar > .chip.active, .workspace-toolbar > .chip[aria-pressed="true"], .workspace-toolbar > .chip[aria-expanded="true"]:not(.chip-toggle)) {
    background: var(--ui-active-surface);
    border-color: var(--ui-control-ink);
    box-shadow: inset 0 -2px var(--ui-control-ink);
  }
  body .secondary-button { min-height: 36px; padding: 8px 13px; }
  body :is(.toolbar-actions, .workspace-toolbar) > button > svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    stroke-width: 1.75px;
  }
  body[data-visual-theme][data-theme] #use-selected {
    color: var(--ui-control-ink);
    border-color: var(--ui-control-line);
    background: var(--ui-active-surface);
    box-shadow: none;
    border-radius: var(--ui-control-radius, var(--r-tight));
  }

  /* Reference stationery uses the selected motif, independently of the user's
     writing pen. Earlier Princess rules used fixed Strawberry pink here. */
  body[data-visual-theme="pastel-princess"] #reference-tools :is(.scientific-calculator, .formula-view, .periodic-view) {
    background: linear-gradient(135deg, var(--princess-pane), var(--ui-control-paper) 65%, var(--princess-pane));
  }
  body[data-visual-theme="pastel-princess"] #reference-tools :is(.pane-bar, .right-pane-tabs, .calc-toolbar, .calc-precision-details, .calculator-keypad) { border-color: var(--ui-control-line); }
  body[data-visual-theme="pastel-princess"] #calculator-keypad { border-color: var(--ui-control-line); }
  body[data-visual-theme="pastel-princess"] #reference-tools :is(.calc-row math-field, .formula-item, .formula-section, .formula-guides, .chem-reference-group, .calc-mini, .angle-mode, .formula-search, .formula-category-tab) {
    border-color: var(--ui-control-line);
    background-color: var(--ui-control-paper);
  }
  body[data-visual-theme="pastel-princess"] #reference-tools :is(.calc-mini, .angle-mode, .formula-category-tab) { color: var(--ui-control-ink); }
  body[data-visual-theme="pastel-princess"] #reference-tools .calc-row:hover { border-color: var(--ui-control-line); background: var(--ui-control-hover); }
  body[data-visual-theme="pastel-princess"] #reference-tools .calc-row.is-active { border-color: var(--ui-control-ink); background: var(--ui-active-surface); }
  body[data-visual-theme="pastel-princess"] #reference-tools .calc-row math-field:focus-within { border-color: var(--ui-control-ink); box-shadow: 0 0 0 2px color-mix(in oklab, var(--ui-control-ink) 15%, transparent); }
  body[data-visual-theme="pastel-princess"] #reference-tools .calc-index { color: color-mix(in oklab, var(--ui-control-ink) 85%, var(--ui-control-paper)); }
  body[data-visual-theme="pastel-princess"] #reference-tools .calc-result:not(.calc-error) { color: var(--ui-control-ink); }
  body[data-visual-theme="pastel-princess"] #reference-tools :is(.calc-mini, .angle-mode, .formula-item, .formula-category-tab):hover { background-color: var(--ui-control-hover); border-color: var(--ui-control-ink); }
  body[data-visual-theme="pastel-princess"] #reference-tools :is(.calc-mini.active, .formula-category-tab[aria-selected="true"]) { color: var(--ui-control-ink); background: var(--ui-active-surface); border-color: var(--ui-control-ink); }
  body[data-visual-theme="pastel-princess"] #reference-tools .formula-section > summary { background-color: var(--ui-active-surface); }
  body[data-visual-theme="pastel-princess"] #reference-tools #calculator-keypad .key {
    color: var(--ui-control-ink);
    border-color: var(--ui-control-line);
    background-color: var(--ui-control-paper);
  }
  body[data-visual-theme="pastel-princess"] #reference-tools #calculator-keypad :is(.key-function, .key-utility) { background-color: color-mix(in oklab, var(--ui-control-ink) 5%, var(--ui-control-paper)); }
  body[data-visual-theme="pastel-princess"] #reference-tools #calculator-keypad .key-operator { background-color: var(--ui-active-surface); }
  body[data-visual-theme="pastel-princess"] #reference-tools #calculator-keypad .key:hover { background-color: var(--ui-control-hover); border-color: var(--ui-control-ink); }
  body[data-visual-theme="pastel-princess"] #reference-tools #calculator-keypad .key-equals { color: var(--ui-action-ink); border-color: var(--ui-action-paper); background-color: var(--ui-action-paper); }
  body[data-visual-theme="pastel-princess"] #reference-tools #calculator-keypad .key-equals:hover { background-color: color-mix(in oklab, var(--ui-action-paper) 93%, var(--ui-action-ink)); }

  /* Explicit committing actions remain visually stronger than Cancel or Close.
     Graph and Table currently render their commit as the final footer action. */
  body[data-visual-theme][data-theme] :is(.primary-button, .biology-primary-button, .statistics-primary),
  body #statistics-dialog .statistics-primary,
  body[data-visual-theme][data-theme] .graph-studio .science-actions > button:last-child,
  body[data-visual-theme][data-theme] .table-studio .science-actions > button:last-child {
    color: var(--ui-action-ink);
    border-color: var(--ui-action-paper);
    background: var(--ui-action-paper);
    border-radius: var(--ui-control-radius, var(--r-tight));
    box-shadow: 0 1px 2px rgb(var(--shade) / .12);
    font-weight: 650;
  }
  body[data-visual-theme][data-theme] :is(.primary-button, .biology-primary-button, .statistics-primary):hover:not(:disabled),
  body #statistics-dialog .statistics-primary:hover:not(:disabled),
  body[data-visual-theme][data-theme] .graph-studio .science-actions > button:last-child:hover:not(:disabled),
  body[data-visual-theme][data-theme] .table-studio .science-actions > button:last-child:hover:not(:disabled) {
    color: var(--ui-action-ink);
    border-color: var(--ui-action-paper);
    background: color-mix(in oklab, var(--ui-action-paper) 93%, var(--ui-action-ink));
    filter: none;
  }
  body :is(.secondary-button, .biology-primary-button, .biology-secondary-button):disabled {
    cursor: not-allowed;
    opacity: .5;
    box-shadow: none;
  }

  /* Index tabs have a paper face and a clear ink edge. No ornamental pseudo-
     elements are used, so short viewports and horizontal scrolling stay intact. */
  body[data-visual-theme][data-theme] :is(.tool-library-tabs > button, .help-subject-tabs > button, .help-tab, .science-tab, .biology-mode-tab, .biology-reference-tab, .statistics-tabs > button, .right-pane-tab),
  body #statistics-dialog .statistics-tabs > button {
    color: var(--ui-control-ink);
    border: 1px solid transparent;
    border-radius: var(--ui-control-radius, var(--r-tight)) var(--ui-control-radius, var(--r-tight)) 4px 4px;
    background: transparent;
    box-shadow: none;
    font-weight: 550;
    line-height: 1.3;
  }
  body[data-visual-theme][data-theme] :is(.tool-library-tabs > button, .help-subject-tabs > button, .help-tab, .science-tab, .biology-mode-tab, .biology-reference-tab, .statistics-tabs > button, .right-pane-tab):hover:not(:disabled),
  body #statistics-dialog .statistics-tabs > button:hover:not(:disabled) {
    color: var(--ui-control-ink);
    background: var(--ui-control-hover);
  }
  body[data-visual-theme][data-theme] :is(.tool-library-tabs > button, .help-subject-tabs > button, .help-tab, .science-tab, .biology-mode-tab, .biology-reference-tab, .statistics-tabs > button, .right-pane-tab):is([aria-selected="true"], .active),
  body #statistics-dialog .statistics-tabs > button[aria-selected="true"] {
    color: var(--ui-control-ink);
    border-color: var(--ui-control-line);
    background: var(--ui-active-surface);
    box-shadow: inset 0 -2px var(--ui-control-ink);
    font-weight: 700;
  }
  body .right-pane-tabs { gap: 3px; box-shadow: none; }
  body :is(.help-subject-tabs, .science-tabs, .statistics-tabs) { gap: 5px; }

  /* Shared margins and calmer section surfaces make the studios feel related. */
  body[data-visual-theme][data-theme] :is(.science-studio, .biology-studio, .modal),
  body #statistics-dialog {
    border-radius: var(--ui-panel-radius, var(--r-soft));
    border-color: var(--ui-control-line);
  }
  body :is(.science-studio-header, .biology-studio-header, .statistics-dialog-header) {
    gap: 12px;
    background: color-mix(in oklab, var(--ui-control-paper) 96%, var(--ui-control-ink));
  }
  body :is(.science-studio-header, .biology-studio-header, .statistics-dialog-header, .modal-header) > :last-child:is(button) { flex: 0 0 auto; }
  body :is(.science-studio-footer, .biology-studio-footer, .statistics-dialog-footer, .modal-footer) {
    gap: 12px;
    border-top: 1px solid var(--ui-control-line);
    background: color-mix(in oklab, var(--ui-control-paper) 96%, var(--ui-control-ink));
  }
  body :is(.science-actions, .statistics-footer-actions) { gap: 8px; flex-shrink: 0; }
  body :is(.science-status, #statistics-validation, .modal-footer > span) { min-width: 0; overflow-wrap: anywhere; }
  body :is(.science-field, .biology-field, .statistics-field) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    color: var(--ink);
    background-color: var(--paper);
    border-color: var(--ui-control-line);
    border-radius: var(--ui-control-radius, var(--r-tight));
  }
  body :is(.science-field, .biology-field, .statistics-field) :is(input, select, textarea):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }
  body :is(.science-description, .science-note, .biology-editor-heading > p, .statistics-note) { line-height: 1.6; }
  body .science-description { margin-block: 0 6px; }
  body :is(.graph-branch, .graph-parameter, .science-handoff-preview, .biology-analysis-band) { border-radius: var(--ui-control-radius, var(--r-tight)); }
  body .science-result-heading { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
  body :is(.science-values, .statistics-metrics) { font-variant-numeric: tabular-nums; }
  body .science-values { margin-block: 14px; padding: 12px; background: color-mix(in oklab, var(--ui-control-ink) 5%, var(--ui-control-paper)); border-radius: var(--ui-control-radius, var(--r-tight)); }
  body .science-values dd { line-height: 1.5; }
  body .science-assumptions { border-left-color: var(--ui-control-line); background: color-mix(in oklab, var(--ui-control-ink) 3%, var(--ui-control-paper)); }
  body .science-warnings { border-left-color: var(--flag-warn-deep); background: color-mix(in oklab, var(--flag-warn-deep) 5%, var(--ui-control-paper)); }
  body .science-legend { gap: 8px 18px; line-height: 1.5; }
  body .science-legend > span { display: inline-flex; align-items: center; gap: 6px; }
  body .science-legend > span::before { content: ''; width: 18px; border-top: 2px solid currentColor; flex: 0 0 auto; }
  body .science-legend > .science-series-1::before { border-top-style: dashed; }
  body .science-legend > .science-series-2::before { border-top-style: dotted; }
  body .science-legend > .science-series-3::before { border-top-style: dashed; }
  body[data-theme] .science-curve-0 { stroke: var(--ui-series-0); }
  body[data-theme] .science-curve-1 { stroke: var(--ui-series-1); stroke-dasharray: 7 3; }
  body[data-theme] .science-curve-2 { stroke: var(--ui-series-2); stroke-dasharray: 2 3; }
  body[data-theme] .science-curve-3 { stroke: var(--ui-series-3); stroke-dasharray: 9 3 2 3; }
  body[data-theme] .science-series-0 { color: var(--ui-series-0); }
  body[data-theme] .science-series-1 { color: var(--ui-series-1); }
  body[data-theme] .science-series-2 { color: var(--ui-series-2); }
  body[data-theme] .science-series-3 { color: var(--ui-series-3); }
  body .science-table th, body .statistics-table-scroll th { color: var(--ink); background: var(--ui-active-surface); }
  body .science-table { color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
  body .science-table :is(th, td) { padding: 9px 10px; }
  body .science-table tbody tr:nth-child(even) > td:not(.table-range-selected) { background: color-mix(in oklab, var(--paper) 97%, var(--ink)); }
  body .table-data-grid .table-range-selected { color: var(--ink); background: var(--ui-active-surface); }
  body .table-data-grid .table-range-selected:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
  body[data-visual-theme][data-theme] :is(.glossary-link, .help-tool-directory a, .glossary-index a, .tool-help-article a, .glossary-definition a) {
    color: var(--ui-control-ink);
    text-underline-offset: .18em;
  }
  body[data-visual-theme][data-theme] :is(.glossary-link, .help-tool-directory a, .glossary-index a, .tool-help-article a, .glossary-definition a):hover { text-decoration-thickness: 2px; }

  /* Short, quiet feedback; no new moving decorations or saved-document state. */
  body :is(.secondary-button, .biology-primary-button, .biology-secondary-button, .biology-close-button, .science-tab, .help-tab, .help-subject-tabs > button, .tool-library-tabs > button, .statistics-tabs > button) {
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 90ms ease;
  }
  body :is(.secondary-button, .biology-primary-button, .biology-secondary-button):active:not(:disabled) { transform: translateY(1px); }
  body .save-state { transition: color 160ms ease; }
  body :is(.science-studio, .biology-studio, #statistics-dialog, #help-dialog, .tool-library) :is(button, a[href], select, input, textarea, summary):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }
  body[data-readability="high"] :is(.science-studio, .biology-studio, #statistics-dialog, #help-dialog, .tool-library) :is(button, a[href], select, input, textarea, summary):focus-visible { outline-width: 4px; }
}

@media screen and (min-width: 821px) and (pointer: fine) {
  body .workspace-toolbar > :is(.chip, .graph-button) { height: 36px; }
  body .toolbar .tool-button { height: 36px; }
}
@media screen and (max-width: 600px) {
  body[data-visual-theme][data-theme] :is(.science-studio, .biology-studio) { border-radius: 0; }
  body :is(.science-studio-header, .biology-studio-header, .statistics-dialog-header) { padding: 10px 12px; }
  body :is(.science-studio-footer, .biology-studio-footer, .statistics-dialog-footer) { gap: 8px; padding: 10px 12px; }
  body :is(.science-studio, .biology-studio, #statistics-dialog) :is(.secondary-button, .biology-primary-button, .biology-secondary-button, .biology-close-button, .science-tab, .statistics-tabs > button) { min-height: 44px; }
  body .science-studio-header h1 { font-size: 1.15rem; }
  body .science-tabs { padding-inline: 12px; }
  body .science-tab { flex: 1 1 0; padding-inline: 10px; }
  body .science-table :is(th, td) { padding: 8px; }
  body .science-values { padding: 10px; grid-template-columns: minmax(85px, 1fr) minmax(100px, 1.5fr); gap: 8px 12px; }
  body .modal-footer { gap: 8px; }
}
@media screen and (pointer: coarse) {
  body .science-studio :is(.secondary-button, .science-tab) { min-height: 44px; }
}
@media screen and (max-height: 500px) {
  body :is(.science-studio-header, .biology-studio-header, .statistics-dialog-header) { padding: 6px 12px; }
  body :is(.science-studio-footer, .biology-studio-footer, .statistics-dialog-footer) { padding: 6px 12px; }
  body .science-studio-header h1 { font-size: 1.05rem; }
  body .science-tab { padding-block: 5px; }
}
@media screen and (prefers-reduced-motion: reduce) {
  body :is(.tool-button, .icon-button, .chip, .secondary-button, .biology-primary-button, .biology-secondary-button, .biology-close-button, .science-tab, .help-tab, .help-subject-tabs > button, .tool-library-tabs > button, .statistics-tabs > button, .save-state) {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* V190: the three approved Hearts and Bows additions. Existing motifs retain their V189 rules. */
#princess-theme-settings .theme-option-grid { display: flex; flex-wrap: wrap; gap: 6px; }
#princess-theme-settings .theme-option-grid > button { flex: 0 0 auto; min-width: 44px; min-height: 44px; }

body[data-visual-theme='pastel-princess'][data-princess-motif='honey-tea'] {
  --princess-paper: #fffbee;
  --princess-paper-alt: #fff5de;
  --princess-rule: #c4a05e;
  --princess-dot: #b98d3e;
  --princess-chalk-surface: #615039;
  --princess-deep-berry: #62401d;
  --princess-control-ink: #735029;
  --princess-raspberry: #ba8a3d;
  --princess-candy-pink: #ba8a3d;
  --princess-strawberry: #dfc89b;
  --princess-lavender: #f5e9d2;
  --princess-aqua: #f8efd8;
  --princess-pearl: #fffbee;
  --princess-control-line: #dfc89b;
  --princess-control-line-strong: #ba8a3d;
  --princess-control-hover: #fff1d3;
  --princess-shell: #f5e9d2;
  --princess-toolbar: #fff8e9;
  --princess-toolbar-end: #f8efd8;
  --princess-workspace: #e9d5ac;
  --princess-pane: #fbf1df;
  --paper: #fffbee;
  --panel: #fbf1df;
  --canvas: #f5e9d2;
  --line: #dfc89b;
  --muted: #735029;
  --world-paper-grain-opacity: .25;
  --world-desk-wash: rgb(255 250 232 / .67);
  --world-contact-ink: 87 62 32;
  --princess-desk-pattern: linear-gradient(90deg, rgb(188 134 49 / .10) 50%, transparent 50%), linear-gradient(0deg, rgb(188 134 49 / .09) 50%, transparent 50%);
  --princess-desk-pattern-size: 40px 40px,40px 40px;
  --world-focal: url('./assets/worlds/honey-tea/focal.png');
  --princess-primary-motif: url('./assets/worlds/honey-tea/focal.png');
  --princess-secondary-motif: none;
  --world-rail-top: url('./assets/worlds/honey-tea/rail-top.svg');
  --world-rail-bottom: url('./assets/worlds/honey-tea/rail-bottom.svg');
  --world-rail-left: url('./assets/worlds/honey-tea/rail-left.svg');
  --world-rail-right: url('./assets/worlds/honey-tea/rail-right.svg');
  --world-corner-tl: url('./assets/worlds/honey-tea/corner-tl.svg');
  --world-corner-tr: url('./assets/worlds/honey-tea/corner-tr.svg');
  --world-corner-br: url('./assets/worlds/honey-tea/corner-br.svg');
  --world-corner-bl: url('./assets/worlds/honey-tea/corner-bl.svg');
}
body[data-visual-theme='pastel-princess']:is([data-princess-motif='honey-tea']) :is(.brand-mark,.document-meta input,.divider,.course-card-sheet) { border-color: var(--princess-control-line); }
body[data-visual-theme='pastel-princess'][data-princess-motif='honey-tea']:not([data-paper='chalkboard']) .theme-material-grain { background-image: radial-gradient(ellipse at 12% 0%, rgb(255 226 167 / .38), transparent 68%), var(--world-paper-grain); background-size: 100% 100%, 256px 256px; background-repeat: no-repeat, repeat; }
@media screen {
 body[data-visual-theme='pastel-princess'][data-paper='chalkboard']:is([data-princess-motif='honey-tea']) .note-editor {
  --world-writing-ink: #fff9ec; --princess-control-ink: #fff9ec; --ink: #fff9ec; --muted: #e7dbc8; --pen: #f7e4b2;
  --ui-series-0: #f7e4b2; --ui-series-1: #f2b6ba; --ui-series-2: #bbdcb9; --ui-series-3: #e5cff1;
 }
 body[data-visual-theme='pastel-princess'][data-paper='chalkboard'][data-princess-motif='honey-tea'] .note-editor .science-table { --ink: var(--princess-deep-berry); }
 body[data-visual-theme='pastel-princess'][data-paper='chalkboard']:is([data-princess-motif='honey-tea']) .note-editor :is(.text-box-editor,.guided-content,.ruled-writing-layer,.inline-math math-field) { color: var(--world-writing-ink); --caret-color: var(--world-writing-ink); }
 body[data-visual-theme='pastel-princess'][data-paper='chalkboard']:is([data-princess-motif='honey-tea']) .text-box-editor:empty::before { color: #e7dbc8; }
}

/* V190: five complete study worlds, using the shared physical frame and editing
   layers. Material tokens are deliberately separate from the student's pen. */
body[data-world-family] {
  --nw-paper: var(--nw-day-paper);
  --nw-panel: var(--nw-day-panel);
  --nw-shell: var(--nw-day-shell);
  --nw-workspace: var(--nw-day-workspace);
  --nw-ink: var(--nw-day-ink);
  --nw-muted: color-mix(in srgb, var(--nw-day-muted) 62%, var(--nw-day-ink));
  --nw-accent: var(--nw-day-accent);
  --nw-rule: var(--nw-day-rule);
  --nw-chalk: var(--nw-day-chalk);
  --nw-action-ink: #fffdf6;
  --nw-fiber-opacity: .23;
  --paper: var(--nw-panel);
  --depth: var(--nw-ink);
  --ink: var(--nw-ink);
  --muted: var(--nw-muted);
  --accent-text: color-mix(in srgb, var(--nw-accent) 80%, var(--nw-ink));
  --accent: var(--nw-accent);
  --focus: var(--nw-accent);
  --accent-ui: var(--nw-accent);
  --canvas: var(--nw-workspace);
  --sheet: var(--world-surface);
  --world-surface: var(--nw-paper);
  --world-rule: var(--nw-rule);
  --world-writing-ink: var(--nw-ink);
  --world-paper-grain: url('assets/sketch-worlds/paper-grain.png');
  --world-chalk-grain: url('assets/sketch-worlds/chalk-grain.png');
  --ui-control-ink: var(--nw-ink);
  --ui-control-paper: var(--nw-panel);
  --ui-control-line: color-mix(in srgb, var(--nw-ink) 25%, var(--nw-panel));
  --ui-control-hover: color-mix(in srgb, var(--nw-accent) 9%, var(--nw-panel));
  --ui-active-surface: color-mix(in srgb, var(--nw-accent) 15%, var(--nw-panel));
  --ui-action-paper: var(--nw-accent);
  --ui-action-ink: var(--nw-action-ink);
  --ui-series-0: var(--nw-accent);
  --ui-control-radius: 7px;
  --ui-panel-radius: 13px;
  color: var(--nw-ink);
  background: var(--nw-shell);
}
body[data-world-family][data-theme='dark'] {
  --nw-paper: var(--nw-night-paper);
  --nw-panel: var(--nw-night-panel);
  --nw-shell: var(--nw-night-shell);
  --nw-workspace: var(--nw-night-workspace);
  --nw-ink: var(--nw-night-ink);
  --nw-muted: color-mix(in srgb, var(--nw-night-muted) 85%, var(--nw-night-ink));
  --nw-accent: var(--nw-night-accent);
  --nw-rule: var(--nw-night-rule);
  --nw-chalk: var(--nw-night-chalk);
  --nw-action-ink: var(--nw-night-workspace);
  --nw-fiber-opacity: .16;
}

/* Each surrounding desk has its own construction, with a quiet writing slab.
   These are textures and continuous light, never automatic loose stickers. */
body[data-world-family] .editor-scroll {
  background-color: var(--nw-workspace);
  background-image: linear-gradient(120deg, color-mix(in srgb, var(--nw-shell) 28%, transparent), transparent 66%);
  background-attachment: local;
}
body[data-world-family='observatory'] .editor-scroll {
  background-image:
    radial-gradient(circle at 36px 48px, color-mix(in srgb, var(--nw-rule) 46%, transparent) 0 1px, transparent 1.4px),
    radial-gradient(circle at 154px 116px, color-mix(in srgb, var(--nw-rule) 33%, transparent) 0 .8px, transparent 1.2px),
    linear-gradient(135deg, color-mix(in srgb, var(--nw-shell) 40%, transparent), transparent 58%);
}
body[data-world-family='tidepool'] .editor-scroll {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 4px, color-mix(in srgb, var(--nw-ink) 2%, transparent) 4px 5px),
    radial-gradient(ellipse at 22% 0, color-mix(in srgb, var(--nw-shell) 60%, transparent), transparent 75%);
}
body[data-world-family='heirloom-library'] .editor-scroll {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 2px, color-mix(in srgb, var(--nw-ink) 5%, transparent) 2px 3px),
    repeating-linear-gradient(90deg, transparent 0 2px, color-mix(in srgb, var(--nw-shell) 14%, transparent) 2px 3px),
    linear-gradient(105deg, color-mix(in srgb, var(--nw-shell) 12%, transparent), transparent 70%);
}
body[data-world-family='art-room'] {
  --nw-fiber-opacity: .30;
  --ui-control-radius: 5px;
}
body[data-world-family='art-room'] .editor-scroll {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 5px, color-mix(in srgb, var(--nw-ink) 3%, transparent) 5px 6px),
    repeating-linear-gradient(90deg, transparent 0 6px, color-mix(in srgb, var(--nw-shell) 26%, transparent) 6px 7px),
    linear-gradient(135deg, color-mix(in srgb, var(--nw-shell) 35%, transparent), transparent 65%);
}
body[data-world-family='personal-web'] {
  --nw-fiber-opacity: .07;
  --ui-control-radius: 6px;
  --ui-panel-radius: 10px;
}
body[data-world-family='personal-web'] .editor-scroll {
  background-image:
    linear-gradient(116deg, transparent 18%, color-mix(in srgb, var(--nw-shell) 54%, transparent) 42%, transparent 67%),
    linear-gradient(180deg, color-mix(in srgb, var(--nw-accent) 9%, transparent), transparent 32%);
}
body[data-world-family='personal-web'][data-world-motif='pixel-diary'] .editor-scroll {
  background-image:
    conic-gradient(from 90deg, color-mix(in srgb, var(--nw-shell) 26%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--nw-shell) 26%, transparent) 0 75%, transparent 0);
  background-size: 16px 16px;
}
body[data-world-family='personal-web'][data-world-motif='midnight-profile'] .editor-scroll {
  background-image:
    radial-gradient(ellipse at 0 30%, color-mix(in srgb, var(--nw-accent) 12%, transparent), transparent 54%),
    linear-gradient(110deg, color-mix(in srgb, #b3a3e3 9%, transparent), transparent 55%);
}

body[data-world-family] .theme-board-underlay {
  box-shadow: 0 1px 2px rgb(18 23 29 / .19), 0 9px 17px -7px rgb(18 23 29 / .22);
}
body[data-world-family] .theme-frame {
  filter: drop-shadow(0 1px .65px rgb(18 23 29 / .19));
}
body[data-world-family] .theme-frame-bow { display: none; }
body[data-world-family] :is(.theme-frame-companion, .theme-atmosphere-accent) { display: none; }
body[data-world-family] .theme-material-grain {
  opacity: var(--nw-fiber-opacity);
  background: var(--world-paper-grain) 0 0 / 256px 256px repeat;
}
body[data-world-family] .note-editor {
  color: var(--world-writing-ink);
  caret-color: var(--world-writing-ink);
  background-color: var(--world-surface);
  background-image: none;
}
body[data-world-family] .note-editor :is(.text-box-editor, .guided-content, .ruled-writing-layer) { color: var(--world-writing-ink); }
body[data-world-family] .text-box-editor:empty::before { color: var(--nw-muted); }

/* Scientific series keep their established blue/red/green/amber order. The
   display palette follows the writing ground, including chalk in light UI. */
body[data-world-family] :is(.note-editor, .graph-studio-preview) {
  --world-graph-0: var(--nw-accent);
  --world-graph-1: #b13e35;
  --world-graph-2: #237348;
  --world-graph-3: #976413;
  --world-graph-label: var(--nw-muted);
}
body[data-world-family]:is([data-theme='dark'], [data-paper='chalkboard']) .note-editor,
body[data-world-family][data-theme='dark'] .graph-studio-preview {
  --world-graph-0: var(--nw-night-accent);
  --world-graph-1: #f2aaa1;
  --world-graph-2: #a5d4b5;
  --world-graph-3: #ebcd8c;
  --world-graph-label: #c9d9d4;
}
/* Explorer uses its panel ground, even when the board itself is chalk. */
body[data-world-family] .graph-studio-preview { --world-writing-ink: var(--nw-ink); }
body[data-world-family] .graph-studio input::placeholder { color: var(--nw-muted); opacity: 1; }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-curve-0 { stroke: var(--world-graph-0); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-curve-1 { stroke: var(--world-graph-1); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-curve-2 { stroke: var(--world-graph-2); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-curve-3 { stroke: var(--world-graph-3); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-vector-head-0 { fill: var(--world-graph-0); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-vector-head-1 { fill: var(--world-graph-1); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-vector-head-2 { fill: var(--world-graph-2); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-vector-head-3 { fill: var(--world-graph-3); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-tick-label { fill: var(--world-graph-label); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-axis { stroke: color-mix(in srgb, var(--world-writing-ink) 68%, transparent); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) :is(.graph-grid, .graph-polar-ring) { stroke: color-mix(in srgb, var(--world-writing-ink) 19%, transparent); }
body[data-world-family] :is(.note-editor, .graph-studio-preview) .graph-polar-spoke { stroke: color-mix(in srgb, var(--world-writing-ink) 14%, transparent); }

/* The ruled origin, writing layer baseline and native 32px rhythm remain the
   same. Surface decoration never changes saved object coordinates. */
body[data-world-family][data-paper='blank'] { --world-surface: var(--nw-paper); }
body[data-world-family][data-paper='ruled'] { --world-surface: color-mix(in srgb, var(--nw-paper) 97%, var(--nw-accent)); }
body[data-world-family][data-paper='dots'] { --world-surface: color-mix(in srgb, var(--nw-paper) 97%, var(--nw-rule)); }
body[data-world-family][data-paper='grid'] { --world-surface: color-mix(in srgb, var(--nw-paper) 94%, var(--nw-rule)); }
body[data-world-family][data-paper='ruled'] .note-editor {
  --ruled-line-step: 32px;
  --ruled-writing-margin: 64px;
  --ruled-baseline-offset: 10px;
  background-image:
    linear-gradient(90deg, transparent 0 53px, color-mix(in srgb, var(--world-rule) 54%, transparent) 53px 54px, transparent 54px),
    repeating-linear-gradient(180deg, transparent 0 31px, color-mix(in srgb, var(--world-rule) 39%, transparent) 31px 32px);
  background-size: 100% 100%, 100% 32px;
  background-position: 0 0, 0 26px;
  background-origin: padding-box;
}
body[data-world-family][data-paper='dots'] .note-editor {
  background-image: radial-gradient(circle at center, color-mix(in srgb, var(--world-rule) 65%, transparent) 0 1px, transparent 1.3px);
  background-size: 24px 24px;
  background-position: 0 0;
  background-origin: padding-box;
}
body[data-world-family='personal-web'][data-paper='dots'] .note-editor {
  background-image: conic-gradient(at 1.5px 1.5px, transparent 270deg, color-mix(in srgb, var(--world-rule) 54%, transparent) 0);
  background-size: 24px 24px;
  background-position: 12px 12px;
}
body[data-world-family][data-paper='grid'] .note-editor {
  background-image:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--world-rule) 53%, transparent) 0 1.1px, transparent 1.4px),
    linear-gradient(180deg, color-mix(in srgb, var(--world-rule) 25%, transparent) 0 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--world-rule) 25%, transparent) 0 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--world-rule) 45%, transparent) 0 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--world-rule) 45%, transparent) 0 1px, transparent 1px);
  background-size: 120px 120px, 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  background-position: 0 0;
  background-origin: padding-box;
}
body[data-world-family='observatory'][data-paper='grid'] .note-editor,
body[data-world-family='art-room'][data-paper='grid'] .note-editor {
  background-size: 150px 150px, 30px 30px, 30px 30px, 150px 150px, 150px 150px;
}
body[data-world-family][data-paper='chalkboard'] {
  --world-surface: var(--nw-chalk);
  --world-writing-ink: #f2f4e7;
}
body[data-world-family][data-paper='chalkboard'] .note-editor {
  background-color: var(--world-surface);
  background-image: radial-gradient(ellipse at 28% 22%, rgb(241 247 228 / .045), transparent 65%);
}
body[data-world-family][data-paper='chalkboard'] .theme-material-grain {
  opacity: .29;
  background-image: var(--world-chalk-grain);
}
body[data-world-family][data-paper='chalkboard'] .chalk-dust-layer { opacity: .33; }
body[data-world-family][data-paper='chalkboard'] .text-box-editor:empty::before { color: #c9d9d4; }
body[data-world-family][data-paper='chalkboard'] .note-editor .inline-math math-field { color: var(--world-writing-ink); --caret-color: var(--world-writing-ink); }

@media screen {
  body[data-world-family] :is(.toolbar, .workspace-toolbar, .graph-pane, .notebook-tabs) { background-color: var(--nw-shell); border-color: var(--ui-control-line); }
  body[data-world-family] .toolbar { background-image: none; box-shadow: 0 1px 0 color-mix(in srgb, var(--nw-ink) 12%, transparent); }
  body[data-world-family] :is(.pane-bar, .right-pane-tabs, .scientific-calculator, .formula-view, .periodic-view, .modal, .command-palette, .tool-library) {
    color: var(--nw-ink);
    border-color: var(--ui-control-line);
    background-color: var(--nw-panel);
  }
  body[data-world-family] :is(.right-pane-tab, .tool-library-tab, .help-tab, .help-tool-subject-tab) { color: var(--nw-muted); }
  body[data-world-family] :is(.right-pane-tab, .tool-library-tab, .help-tab, .help-tool-subject-tab):is(.active, [aria-selected='true']) {
    color: var(--nw-ink);
    background-color: var(--ui-active-surface);
    border-color: var(--nw-accent);
  }
  body[data-world-family] :is(.workspace-tab.active, .formula-section > summary, .table-cell.column-header, .table-cell.row-header) {
    color: var(--nw-ink);
    background-color: var(--ui-active-surface);
  }
  body[data-world-family] .workspace-tab.active { border-color: var(--ui-control-line); box-shadow: inset 0 3px var(--nw-accent); }
  body[data-world-family] .calc-fab { color: var(--nw-action-ink); background: var(--nw-accent); }
  body[data-world-family] :is(.new-tab, .notebook-index-toggle) { color: var(--nw-accent); }
  body[data-world-family] #reference-tools :is(.calc-row math-field, .formula-item, .formula-section, .formula-guides, .chem-reference-group, .calc-mini, .angle-mode, .formula-search, .formula-category-tab) {
    border-color: var(--ui-control-line);
    background-color: var(--nw-panel);
  }
  body[data-world-family] #reference-tools :is(.calc-mini, .angle-mode, .formula-search, .formula-category-tab, .calc-result:not(.calc-error)) { color: var(--nw-ink); }
  body[data-world-family] #reference-tools .formula-search::placeholder { color: var(--nw-muted); }
  body[data-world-family] #reference-tools :is(.formula-item > span, .formula-intro) { color: var(--nw-muted); }
  body[data-world-family] #reference-tools .calc-row.is-active { border-color: var(--nw-accent); background: var(--ui-active-surface); }
  body[data-world-family] #reference-tools .calc-index { color: var(--nw-muted); }
  body[data-world-family] #reference-tools #calculator-keypad .key { color: var(--nw-ink); border-color: var(--ui-control-line); background-color: var(--nw-panel); }
  body[data-world-family] #reference-tools #calculator-keypad :is(.key-function, .key-utility) { background-color: color-mix(in srgb, var(--nw-ink) 5%, var(--nw-panel)); }
  body[data-world-family] #reference-tools #calculator-keypad .key-operator { background-color: var(--ui-active-surface); }
  body[data-world-family] #reference-tools #calculator-keypad .key-equals { color: var(--nw-action-ink); background-color: var(--nw-accent); }
  body[data-world-family] :is(button, input, select, textarea, [tabindex]):focus-visible { outline-color: var(--nw-accent); }
  body[data-world-family='heirloom-library'] :is(.modal, .tool-library, .right-pane-tabs) { border-radius: 7px; }
  body[data-world-family='observatory'] .right-pane-tabs { border-radius: 6px; }
  body[data-world-family='personal-web'] .workspace-toolbar { background-image: linear-gradient(180deg, color-mix(in srgb, var(--nw-panel) 65%, transparent), transparent 45%); }
  body[data-world-family='personal-web'] :is(.right-pane-tab, .tool-library-tab, .help-tab):is(.active, [aria-selected='true']) {
    background-image: linear-gradient(180deg, color-mix(in srgb, var(--nw-panel) 76%, transparent), transparent 53%);
    box-shadow: inset 0 1px color-mix(in srgb, var(--nw-ink) 13%, transparent), inset 0 -1px color-mix(in srgb, var(--nw-ink) 17%, transparent);
    border-radius: 5px;
  }
  body[data-world-family='personal-web'][data-world-motif='pixel-diary'] :is(.workspace-tab, .right-pane-tab, .tool-library-tab, .help-tab) { border-radius: 2px; }
}

/* Complete, locally hosted previews remain legible in every active theme. */
.world-preview-palette { display: flex; overflow: hidden; }
.world-preview-palette > span { flex: 1; }
#world-theme-settings[hidden], .world-motif-options[hidden] { display: none; }
.world-motif-options { flex-wrap: wrap; gap: 6px; }
[data-visual-theme-option]:is([data-visual-theme-option='observatory'], [data-visual-theme-option='tidepool'], [data-visual-theme-option='heirloom-library'], [data-visual-theme-option='art-room'], [data-visual-theme-option='personal-web']) .theme-preview-mark { visibility: hidden; }
.world-motif-button {
  min-height: 38px;
  color: var(--ink);
  border: 1px solid var(--n78);
  border-radius: 7px;
  background: var(--paper);
  padding: 8px 11px;
  font: inherit;
  font-size: 12px;
}
.world-motif-button:is(.active, [aria-pressed='true']) { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 12%, var(--paper)); box-shadow: inset 0 -2px var(--focus); }

@container world-desk (max-width: 700px) {
  body[data-world-family][data-paper='ruled'] .note-editor { background-position: 0 0, 0 18px; }
}
@media (max-width: 600px) {
  body[data-world-family] .ink-stage { margin-top: 62px; }
  body[data-world-family] .theme-frame-bow { display: none; }
  body[data-world-family][data-paper='ruled'] .note-editor {
    --ruled-writing-margin: 46px;
    background-image:
      linear-gradient(90deg, transparent 0 35px, color-mix(in srgb, var(--world-rule) 54%, transparent) 35px 36px, transparent 36px),
      repeating-linear-gradient(180deg, transparent 0 31px, color-mix(in srgb, var(--world-rule) 39%, transparent) 31px 32px);
  }
  .world-motif-button { min-height: 44px; }
}
@media print {
  body[data-world-family] { --world-writing-ink: #000 !important; }
  body[data-world-family] .note-editor {
    --world-graph-0: var(--nw-day-accent) !important;
    --world-graph-1: #b13e35 !important;
    --world-graph-2: #237348 !important;
    --world-graph-3: #976413 !important;
    --world-graph-label: #37424a !important;
  }
  body[data-world-family] .theme-frame { filter: none; }
  body[data-world-family] :is(.note-editor, .print-board-content) { color: #000 !important; background: #fff !important; }
  body[data-world-family] .note-editor :is(.text-box-editor, .guided-content, .ruled-writing-layer) { color: #000 !important; }
}

/* Generated motif materials: build-new-world-frames.cjs owns the block below. */
body[data-world-family='observatory'][data-world-motif='lunar-atlas'] {
  --nw-day-paper: #f9f4e7;
  --nw-day-panel: #f5f1e8;
  --nw-day-shell: #e2e7e8;
  --nw-day-workspace: #c6d0d8;
  --nw-day-ink: #263950;
  --nw-day-muted: #526175;
  --nw-day-accent: #345b86;
  --nw-day-rule: #8296ab;
  --nw-day-chalk: #27384d;
  --nw-night-paper: #202d40;
  --nw-night-panel: #273446;
  --nw-night-shell: #192537;
  --nw-night-workspace: #0e1929;
  --nw-night-ink: #eff0e5;
  --nw-night-muted: #b1b6b3;
  --nw-night-accent: #a9c8e4;
  --nw-night-rule: #85a0b9;
  --nw-night-chalk: #1f2e41;
}
body[data-world-family='observatory'][data-world-motif='constellation-study'] {
  --nw-day-paper: #f6f3fa;
  --nw-day-panel: #f2eff7;
  --nw-day-shell: #e7e1ed;
  --nw-day-workspace: #cfcada;
  --nw-day-ink: #333151;
  --nw-day-muted: #635d78;
  --nw-day-accent: #665596;
  --nw-day-rule: #a498bb;
  --nw-day-chalk: #302c48;
  --nw-night-paper: #282338;
  --nw-night-panel: #2f2a3f;
  --nw-night-shell: #221d32;
  --nw-night-workspace: #181428;
  --nw-night-ink: #f2ebfa;
  --nw-night-muted: #b5afc0;
  --nw-night-accent: #c8b5ed;
  --nw-night-rule: #9e8fbe;
  --nw-night-chalk: #28243e;
}
body[data-world-family='observatory'][data-world-motif='solar-observatory'] {
  --nw-day-paper: #fff4df;
  --nw-day-panel: #faefd9;
  --nw-day-shell: #f1e5cc;
  --nw-day-workspace: #e4c79e;
  --nw-day-ink: #533d27;
  --nw-day-muted: #766246;
  --nw-day-accent: #965c29;
  --nw-day-rule: #b5a078;
  --nw-day-chalk: #36332b;
  --nw-night-paper: #362b21;
  --nw-night-panel: #3d3227;
  --nw-night-shell: #2e251c;
  --nw-night-workspace: #231b15;
  --nw-night-ink: #fff0cf;
  --nw-night-muted: #c3b59b;
  --nw-night-accent: #efc48b;
  --nw-night-rule: #bf9c6f;
  --nw-night-chalk: #302b24;
}
body[data-world-family='tidepool'][data-world-motif='sea-glass'] {
  --nw-day-paper: #f9fbef;
  --nw-day-panel: #f4f8ec;
  --nw-day-shell: #e5f0e5;
  --nw-day-workspace: #c6dfd5;
  --nw-day-ink: #264a4a;
  --nw-day-muted: #59756d;
  --nw-day-accent: #28736e;
  --nw-day-rule: #81aba0;
  --nw-day-chalk: #234441;
  --nw-night-paper: #203b3b;
  --nw-night-panel: #274241;
  --nw-night-shell: #1a3435;
  --nw-night-workspace: #102a2b;
  --nw-night-ink: #e9f5ec;
  --nw-night-muted: #adbdb7;
  --nw-night-accent: #a4d8cb;
  --nw-night-rule: #82afa6;
  --nw-night-chalk: #1d3c3a;
}
body[data-world-family='tidepool'][data-world-motif='kelp-forest'] {
  --nw-day-paper: #f4f4e3;
  --nw-day-panel: #edf0dd;
  --nw-day-shell: #dfe5ca;
  --nw-day-workspace: #a9bea1;
  --nw-day-ink: #354a35;
  --nw-day-muted: #627353;
  --nw-day-accent: #557341;
  --nw-day-rule: #8ea17e;
  --nw-day-chalk: #2b4033;
  --nw-night-paper: #283d30;
  --nw-night-panel: #2f4336;
  --nw-night-shell: #20362b;
  --nw-night-workspace: #152c24;
  --nw-night-ink: #edf1d9;
  --nw-night-muted: #b2bba6;
  --nw-night-accent: #bfcea2;
  --nw-night-rule: #98a884;
  --nw-night-chalk: #243a2e;
}
body[data-world-family='tidepool'][data-world-motif='coral-study'] {
  --nw-day-paper: #fff5e9;
  --nw-day-panel: #fff0e2;
  --nw-day-shell: #f4e3d3;
  --nw-day-workspace: #e7c7b7;
  --nw-day-ink: #57403c;
  --nw-day-muted: #82675f;
  --nw-day-accent: #a24f48;
  --nw-day-rule: #c19986;
  --nw-day-chalk: #3a3938;
  --nw-night-paper: #3b302e;
  --nw-night-panel: #423734;
  --nw-night-shell: #32292a;
  --nw-night-workspace: #251f24;
  --nw-night-ink: #fbebda;
  --nw-night-muted: #c1b3a6;
  --nw-night-accent: #efb7a6;
  --nw-night-rule: #c09487;
  --nw-night-chalk: #333132;
}
body[data-world-family='heirloom-library'][data-world-motif='oxblood-ivory'] {
  --nw-day-paper: #fcf1da;
  --nw-day-panel: #f5e8d0;
  --nw-day-shell: #ddd0b4;
  --nw-day-workspace: #ae9295;
  --nw-day-ink: #4d3037;
  --nw-day-muted: #786159;
  --nw-day-accent: #783747;
  --nw-day-rule: #ac9078;
  --nw-day-chalk: #3a3033;
  --nw-night-paper: #35272b;
  --nw-night-panel: #3c2e31;
  --nw-night-shell: #2d2126;
  --nw-night-workspace: #20181e;
  --nw-night-ink: #f8e9ce;
  --nw-night-muted: #beaf9d;
  --nw-night-accent: #e7b7bc;
  --nw-night-rule: #b99296;
  --nw-night-chalk: #32282c;
  --world-rail-top: url('assets/worlds/oxblood-ivory/rail-top.svg');
  --world-rail-bottom: url('assets/worlds/oxblood-ivory/rail-bottom.svg');
  --world-rail-left: url('assets/worlds/oxblood-ivory/rail-left.svg');
  --world-rail-right: url('assets/worlds/oxblood-ivory/rail-right.svg');
  --world-corner-tl: url('assets/worlds/oxblood-ivory/corner-tl.svg');
  --world-corner-tr: url('assets/worlds/oxblood-ivory/corner-tr.svg');
  --world-corner-br: url('assets/worlds/oxblood-ivory/corner-br.svg');
  --world-corner-bl: url('assets/worlds/oxblood-ivory/corner-bl.svg');
}
body[data-world-family='heirloom-library'][data-world-motif='midnight-library'] {
  --nw-day-paper: #f3f1e6;
  --nw-day-panel: #ebeadf;
  --nw-day-shell: #d3d7d9;
  --nw-day-workspace: #9aabba;
  --nw-day-ink: #293b52;
  --nw-day-muted: #5d6a78;
  --nw-day-accent: #3e5487;
  --nw-day-rule: #8e9cac;
  --nw-day-chalk: #253342;
  --nw-night-paper: #273445;
  --nw-night-panel: #2e3b4a;
  --nw-night-shell: #202c3c;
  --nw-night-workspace: #151f2e;
  --nw-night-ink: #f1efde;
  --nw-night-muted: #b4b7b0;
  --nw-night-accent: #b9cee8;
  --nw-night-rule: #93a6be;
  --nw-night-chalk: #202d3c;
  --world-rail-top: url('assets/worlds/midnight-library/rail-top.svg');
  --world-rail-bottom: url('assets/worlds/midnight-library/rail-bottom.svg');
  --world-rail-left: url('assets/worlds/midnight-library/rail-left.svg');
  --world-rail-right: url('assets/worlds/midnight-library/rail-right.svg');
  --world-corner-tl: url('assets/worlds/midnight-library/corner-tl.svg');
  --world-corner-tr: url('assets/worlds/midnight-library/corner-tr.svg');
  --world-corner-br: url('assets/worlds/midnight-library/corner-br.svg');
  --world-corner-bl: url('assets/worlds/midnight-library/corner-bl.svg');
}
body[data-world-family='heirloom-library'][data-world-motif='forest-bookcloth'] {
  --nw-day-paper: #f7f0dc;
  --nw-day-panel: #ece8d1;
  --nw-day-shell: #d5dac1;
  --nw-day-workspace: #a1b397;
  --nw-day-ink: #304936;
  --nw-day-muted: #67765a;
  --nw-day-accent: #3f6c49;
  --nw-day-rule: #8a9b76;
  --nw-day-chalk: #293b2e;
  --nw-night-paper: #283b2e;
  --nw-night-panel: #2f4134;
  --nw-night-shell: #223328;
  --nw-night-workspace: #18281f;
  --nw-night-ink: #f2edcf;
  --nw-night-muted: #b5b89f;
  --nw-night-accent: #c2d2a3;
  --nw-night-rule: #9aab85;
  --nw-night-chalk: #243529;
  --world-rail-top: url('assets/worlds/forest-bookcloth/rail-top.svg');
  --world-rail-bottom: url('assets/worlds/forest-bookcloth/rail-bottom.svg');
  --world-rail-left: url('assets/worlds/forest-bookcloth/rail-left.svg');
  --world-rail-right: url('assets/worlds/forest-bookcloth/rail-right.svg');
  --world-corner-tl: url('assets/worlds/forest-bookcloth/corner-tl.svg');
  --world-corner-tr: url('assets/worlds/forest-bookcloth/corner-tr.svg');
  --world-corner-br: url('assets/worlds/forest-bookcloth/corner-br.svg');
  --world-corner-bl: url('assets/worlds/forest-bookcloth/corner-bl.svg');
}
body[data-world-family='art-room'][data-world-motif='gouache-garden'] {
  --nw-day-paper: #fcf8e9;
  --nw-day-panel: #f5f3e3;
  --nw-day-shell: #e6e8d3;
  --nw-day-workspace: #ccd2b3;
  --nw-day-ink: #374a3a;
  --nw-day-muted: #66745a;
  --nw-day-accent: #397553;
  --nw-day-rule: #95ab83;
  --nw-day-chalk: #304238;
  --nw-night-paper: #2b3b31;
  --nw-night-panel: #324137;
  --nw-night-shell: #25352c;
  --nw-night-workspace: #1b2b25;
  --nw-night-ink: #f3f1d9;
  --nw-night-muted: #b7baa7;
  --nw-night-accent: #b9d2ad;
  --nw-night-rule: #94ab8d;
  --nw-night-chalk: #293b32;
  --world-rail-top: url('assets/worlds/gouache-garden/rail-top.svg');
  --world-rail-bottom: url('assets/worlds/gouache-garden/rail-bottom.svg');
  --world-rail-left: url('assets/worlds/gouache-garden/rail-left.svg');
  --world-rail-right: url('assets/worlds/gouache-garden/rail-right.svg');
  --world-corner-tl: url('assets/worlds/gouache-garden/corner-tl.svg');
  --world-corner-tr: url('assets/worlds/gouache-garden/corner-tr.svg');
  --world-corner-br: url('assets/worlds/gouache-garden/corner-br.svg');
  --world-corner-bl: url('assets/worlds/gouache-garden/corner-bl.svg');
}
body[data-world-family='art-room'][data-world-motif='blue-pencil'] {
  --nw-day-paper: #f8faf5;
  --nw-day-panel: #f0f4f2;
  --nw-day-shell: #dee7ea;
  --nw-day-workspace: #bcced7;
  --nw-day-ink: #2d4659;
  --nw-day-muted: #5e7889;
  --nw-day-accent: #386a9b;
  --nw-day-rule: #91acbf;
  --nw-day-chalk: #293d4d;
  --nw-night-paper: #293a49;
  --nw-night-panel: #30414f;
  --nw-night-shell: #213240;
  --nw-night-workspace: #152733;
  --nw-night-ink: #eff5ed;
  --nw-night-muted: #b4bdbc;
  --nw-night-accent: #b4d6eb;
  --nw-night-rule: #90adc1;
  --nw-night-chalk: #233645;
  --world-rail-top: url('assets/worlds/blue-pencil/rail-top.svg');
  --world-rail-bottom: url('assets/worlds/blue-pencil/rail-bottom.svg');
  --world-rail-left: url('assets/worlds/blue-pencil/rail-left.svg');
  --world-rail-right: url('assets/worlds/blue-pencil/rail-right.svg');
  --world-corner-tl: url('assets/worlds/blue-pencil/corner-tl.svg');
  --world-corner-tr: url('assets/worlds/blue-pencil/corner-tr.svg');
  --world-corner-br: url('assets/worlds/blue-pencil/corner-br.svg');
  --world-corner-bl: url('assets/worlds/blue-pencil/corner-bl.svg');
}
body[data-world-family='art-room'][data-world-motif='terracotta-studio'] {
  --nw-day-paper: #fff4e5;
  --nw-day-panel: #f7ecd9;
  --nw-day-shell: #e9dcc7;
  --nw-day-workspace: #d5bda2;
  --nw-day-ink: #534034;
  --nw-day-muted: #806953;
  --nw-day-accent: #9a593a;
  --nw-day-rule: #b79778;
  --nw-day-chalk: #40362e;
  --nw-night-paper: #3d3028;
  --nw-night-panel: #44372e;
  --nw-night-shell: #342922;
  --nw-night-workspace: #261e1a;
  --nw-night-ink: #fff0d5;
  --nw-night-muted: #c5b6a1;
  --nw-night-accent: #eec69d;
  --nw-night-rule: #c09f7f;
  --nw-night-chalk: #382e28;
  --world-rail-top: url('assets/worlds/terracotta-studio/rail-top.svg');
  --world-rail-bottom: url('assets/worlds/terracotta-studio/rail-bottom.svg');
  --world-rail-left: url('assets/worlds/terracotta-studio/rail-left.svg');
  --world-rail-right: url('assets/worlds/terracotta-studio/rail-right.svg');
  --world-corner-tl: url('assets/worlds/terracotta-studio/corner-tl.svg');
  --world-corner-tr: url('assets/worlds/terracotta-studio/corner-tr.svg');
  --world-corner-br: url('assets/worlds/terracotta-studio/corner-br.svg');
  --world-corner-bl: url('assets/worlds/terracotta-studio/corner-bl.svg');
}
body[data-world-family='personal-web'][data-world-motif='chrome-candy'] {
  --nw-day-paper: #faf6ff;
  --nw-day-panel: #f4f1fc;
  --nw-day-shell: #e3e0f1;
  --nw-day-workspace: #c4c8e3;
  --nw-day-ink: #393a61;
  --nw-day-muted: #696585;
  --nw-day-accent: #6652a3;
  --nw-day-rule: #aba5cd;
  --nw-day-chalk: #30364f;
  --nw-night-paper: #2a2843;
  --nw-night-panel: #312f49;
  --nw-night-shell: #23233c;
  --nw-night-workspace: #181b32;
  --nw-night-ink: #f6eefb;
  --nw-night-muted: #b9b3c4;
  --nw-night-accent: #cfbbf3;
  --nw-night-rule: #a495c5;
  --nw-night-chalk: #282d46;
}
body[data-world-family='personal-web'][data-world-motif='pixel-diary'] {
  --nw-day-paper: #fff4fd;
  --nw-day-panel: #f9eefa;
  --nw-day-shell: #eee0f1;
  --nw-day-workspace: #d4bfe1;
  --nw-day-ink: #523d68;
  --nw-day-muted: #796486;
  --nw-day-accent: #7152a7;
  --nw-day-rule: #b695c8;
  --nw-day-chalk: #3d2e51;
  --nw-night-paper: #342640;
  --nw-night-panel: #3b2d47;
  --nw-night-shell: #2c2039;
  --nw-night-workspace: #20172f;
  --nw-night-ink: #f8e8fc;
  --nw-night-muted: #bdaec4;
  --nw-night-accent: #dfbdef;
  --nw-night-rule: #b396c2;
  --nw-night-chalk: #342746;
}
body[data-world-family='personal-web'][data-world-motif='midnight-profile'] {
  --nw-day-paper: #eef5ff;
  --nw-day-panel: #e5eef9;
  --nw-day-shell: #d0dff1;
  --nw-day-workspace: #a8bedc;
  --nw-day-ink: #273953;
  --nw-day-muted: #546d8c;
  --nw-day-accent: #366bc0;
  --nw-day-rule: #8aa4cb;
  --nw-day-chalk: #22324d;
  --nw-night-paper: #222d45;
  --nw-night-panel: #29344c;
  --nw-night-shell: #1b253b;
  --nw-night-workspace: #111a2b;
  --nw-night-ink: #e7f3ff;
  --nw-night-muted: #acb8c7;
  --nw-night-accent: #a8ccff;
  --nw-night-rule: #85a3cf;
  --nw-night-chalk: #1d2a42;
}

/* V192 identity rebuild. Shared geometry only; each family owns its composition.
   THESIS: five complete study environments with independent structures, marks,
   typography and night behavior. A decorative object cannot carry a world.
   OWN-WORLD: celestial chart, tidal shore, bound folio, drawing board, personal web.
   STORY: students write and use the existing tools inside their chosen environment.
   FIRST VIEWPORT: family-specific molecular branding and navigation lead to a
   clear sheet; peripheral composition occupies the surrounding desk and edges.
   FORM: the owner's pinned families supersede direction seed b96994ef.
   FINISH: unreviewed and undocumented is unfinished; this build ends with the
   finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance. */

.world-surround { display: none; }

body .right-pane-tabs { overflow-x:auto; min-width:0; max-width:100%; scrollbar-width:thin; }
body .right-pane-tab { flex:0 0 auto; white-space:nowrap; }
@media screen {
  body[data-world-family] .world-surround {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    overflow: visible;
    pointer-events: none;
    user-select: none;
  }
  body[data-world-family] .world-surround > span {
    position: absolute;
    display: block;
    background-repeat: no-repeat;
    pointer-events: none;
  }
  /* Generated objects are available only as student-placed stickers. */
  body[data-world-family] .theme-frame-bow {
    display: none;
    background: none;
    width: 0;
    height: 0;
  }
  body[data-world-family] .theme-frame-companion { display: none; }
}
@media print {
  .world-surround, .world-night-light { display: none !important; }
}
@media (forced-colors: active) {
  body .world-surround { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .world-surround, .world-surround * {
    animation: none !important;
    transition: none !important;
  }
}

/* Chemistry formula actions: Use in work and Add to flashcards share one row under the card. */
#formula-list .formula-row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
#formula-list .formula-row-actions > button {
  min-height: 30px; padding: 4px 10px; color: var(--ui-control-ink, var(--c39)); border: 1px solid var(--ui-control-line, var(--c87));
  border-radius: 999px; background: var(--ui-control-paper, var(--paper)); font: inherit; font-size: var(--t-control); cursor: pointer;
}
#formula-list .formula-row-actions > button:is(:hover, :focus-visible) { background: var(--ui-control-hover, var(--n96)); }
#formula-list .formula-guide-symbols { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0 0 .65em; }
#formula-list .formula-guide-symbols dd { margin: 0; }
#formula-list .formula-guide-derivation { margin: 0 0 .65em; padding-left: 1.4em; }
#formula-list .formula-guide-derivation li { margin: 0 0 .45em; }
#formula-list .formula-guide-derivation li > div { overflow-x: auto; max-width: 100%; }
@media (max-width: 820px), (hover: none) and (pointer: coarse) {
  #formula-list .formula-row-actions > button { min-height: 44px; }
}
