/* Shared workspace tokens. Palette values below also drive the setting previews. */
@font-face {
  font-family: "Zen Maru Gothic";
  src: url("fonts/zenmarugothic/ZenMaruGothic-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Zen Maru Gothic";
  src: url("fonts/zenmarugothic/ZenMaruGothic-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
:root {
  font-family: var(--ui-font);
  color: var(--text);
  background: var(--chrome);
  color-scheme: light;
  font-synthesis: none;
  --status-idle: var(--muted);
  --status-ready: #4f705e;
  --status-error: #a24f49;
  --error-border: #c98e83;
  --error-surface: #f8eae4;
  --error-text: #803e38;
  --error-button-border: #ad6f64;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --font-system: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans CJK JP", "Yu Gothic", sans-serif;
  --font-weight-strong: 700;
  --text-line-height: 1.75;
  --control-size: 44px;
  --control-radius: 6px;
  --navigation-width: 176px;
  --support-width: 320px;
}
:root, [data-font="soft"] { --ui-font: "Zen Maru Gothic", var(--font-system); }
[data-font="clear"] { --ui-font: "BIZ UDPGothic", var(--font-system); }
[data-font="system"] { --ui-font: var(--font-system); }
:root, [data-font-size="normal"] {
  --font-caption: 13px;
  --font-body: 15px;
  --font-section: 17px;
  --font-title: 24px;
}
[data-font-size="large"] {
  --font-caption: 14px;
  --font-body: 17px;
  --font-section: 19px;
  --font-title: 26px;
}
[data-font-size="larger"] {
  --font-caption: 15px;
  --font-body: 19px;
  --font-section: 21px;
  --font-title: 28px;
}
:root, [data-theme="rose"] {
  --surface: #faf6f3;
  --chrome: #f1e8e5;
  --muted: #624f56;
  --line: #decece;
  --accent: #744356;
  --hover: #f1e4e5;
  --selected: #e8d2d8;
  --selected-hover: #dfc3cc;
  --focus: #96586d;
  --text: #463a3f;
  --dialog-shadow: #45333f26;
  --dialog-backdrop: #382d394d;
}
[data-theme="sage"] {
  --surface: #f6f7f1;
  --chrome: #e9eee6;
  --muted: #4f6156;
  --line: #cbd7cb;
  --accent: #446550;
  --hover: #e9efe5;
  --selected: #d7e4d5;
  --selected-hover: #cbdcc9;
  --focus: #50755c;
  --text: #35453e;
  --dialog-shadow: #263e3026;
  --dialog-backdrop: #25382c4d;
}
[data-theme="lavender"] {
  --surface: #f8f5fa;
  --chrome: #eee8f2;
  --muted: #5d4e65;
  --line: #d7ccdf;
  --accent: #624971;
  --hover: #eee7f3;
  --selected: #e1d4eb;
  --selected-hover: #d6c6e2;
  --focus: #7b6390;
  --text: #443e50;
  --dialog-shadow: #38283f26;
  --dialog-backdrop: #32263c4d;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: var(--font-body); line-height: var(--text-line-height); }
button { min-height: var(--control-size); padding: var(--space-2) var(--space-3); border: 1px solid transparent; border-radius: var(--control-radius); font: inherit; color: var(--accent); background: transparent; cursor: pointer; }
button:not(:disabled):hover { background: var(--hover); }
button:not(:disabled):active { background: var(--selected); }
button:disabled { cursor: default; }
:is(button, a, input):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.workspace { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.app-header { min-height: calc(var(--control-size) + var(--space-6)); padding: var(--space-3) var(--space-6); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-6); border-bottom: 1px solid var(--line); background: var(--chrome); }
.identity { display: flex; align-items: center; gap: var(--space-2); }
.app-icon { display: block; }
p { margin: 0; }
.app-name { font-size: var(--font-section); font-weight: var(--font-weight-strong); letter-spacing: -.4px; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-left: auto; }
.status { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--font-caption); white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--status-idle); }
.status[data-state="ready"] .status-dot { background: var(--status-ready); }
.status[data-state="error"] .status-dot { background: var(--status-error); }
.workspace-body { display: grid; grid-template-columns: var(--navigation-width) minmax(0, 1fr) auto; min-height: 0; }
.workspace-nav { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--space-8); overflow: auto; padding: var(--space-6) var(--space-3) var(--space-4); background: var(--chrome); }
.nav-content { flex: 1; }
.nav-link { display: flex; align-items: center; min-height: var(--control-size); padding: var(--space-2) var(--space-3); border-radius: var(--control-radius); color: var(--accent); text-decoration: none; }
.nav-link:hover { background: var(--hover); }
.nav-link[aria-current="page"] { background: var(--selected); font-weight: var(--font-weight-strong); }
.nav-link[aria-current="page"]:hover { background: var(--selected-hover); }
.nav-footer { margin: var(--space-2) var(--space-3) 0; color: var(--muted); font-size: var(--font-caption); overflow-wrap: anywhere; }
.workspace-panes { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
/* Two panes of the same width with fixed roles: the left shows what to look at and choose from,
   the right edits what was chosen. Every stage keeps this split, so neither side changes its job. */
.workspace-panes:has(> .list-panel:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* The list panel is the left pane: the stage's name, its purpose, and what to look at or choose from. */
.list-panel { min-width: 0; min-height: 0; overflow: auto; padding: var(--space-6) var(--space-4); border-right: 1px solid var(--line); background: var(--surface); container: list-panel / inline-size; }
.list-panel h1:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.list-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; padding: 0; list-style: none; }
.list-row { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: var(--control-size); padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--control-radius); color: var(--text); text-align: left; }
.list-row:not(:disabled):hover { color: var(--accent); }
.list-row[aria-current="true"], .list-row[aria-current="true"]:not(:disabled):hover { color: var(--accent); background: var(--selected); font-weight: var(--font-weight-strong); box-shadow: inset 4px 0 0 var(--accent); }
.list-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-state { flex-shrink: 0; color: var(--muted); font-size: var(--font-caption); font-weight: 400; white-space: nowrap; }
.list-row-mark { flex-shrink: 0; display: grid; place-items: center; width: 14px; height: 14px; border: 1px solid var(--muted); border-radius: 50%; color: var(--surface); }
.list-row-mark svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.list-row[data-marked="true"] .list-row-mark { border-color: var(--accent); background: var(--accent); }
.list-row[data-marked="true"] .list-row-mark svg { opacity: 1; }
.list-add { align-self: flex-start; font-size: var(--font-caption); }
.list-heading { margin: var(--space-3) var(--space-3) 0; color: var(--muted); font-size: var(--font-caption); font-weight: 400; }
.list-note { margin: 0 var(--space-3); color: var(--muted); font-size: var(--font-caption); }
.list-note:empty { display: none; }
.list-panel .production-heading { margin: 0 var(--space-3) var(--space-4); }
/* Defaults for a screen's list section; a screen's own rules win. */
:where(.list-panel > [data-list-section]) { display: flex; flex-direction: column; gap: var(--space-3); }
:where(.list-panel > [data-list-section][hidden]) { display: none; }
/* The work area beside a list opens with the chosen entry's name and its own controls. */
.detail-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2) var(--space-4); min-height: calc(var(--control-size) + var(--space-2)); margin-bottom: var(--space-6); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.detail-head h2 { margin: 0; font-size: var(--font-section); overflow-wrap: anywhere; }
/* A narrow list keeps names readable by putting the state on its own line. */
@container list-panel (max-width: 240px) {
  .list-row { flex-wrap: wrap; row-gap: 0; }
  .list-row-title { flex: 1 1 0; }
  .list-row-state:not(:empty) { flex-basis: 100%; padding-left: var(--space-6); }
}
.work-area { min-width: 0; min-height: 0; overflow: auto; padding: var(--space-8); background: var(--surface); container: work-area / inline-size; }
.work-area:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.work-area h1:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.work-area-content { max-width: 1040px; margin: 0 auto; overflow-wrap: anywhere; }
.support-panel { width: var(--support-width); min-height: 0; overflow: auto; padding: var(--space-6); background: var(--chrome); }
h1 { margin: 0; font-size: var(--font-title); font-weight: var(--font-weight-strong); letter-spacing: -.4px; line-height: 1.5; }
.process-panel { display: grid; gap: var(--space-8); }
.settings-panel { display: grid; gap: var(--space-8); }
.setting-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.setting-group legend { margin-bottom: var(--space-2); padding: 0; font-size: var(--font-section); font-weight: var(--font-weight-strong); }
.settings-description, .setting-description { color: var(--muted); }
.setting-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-6); }
.setting-choice { min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--control-radius); cursor: pointer; }
.setting-choice:hover, .size-choice:hover { background: var(--hover); }
.setting-choice:has(input:checked), .size-choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--hover); }
.setting-choice-heading { display: flex; align-items: flex-start; gap: var(--space-2); }
.setting-group input { flex-shrink: 0; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--accent); }
.setting-choice-name { font-weight: var(--font-weight-strong); }
.setting-default { display: inline-block; margin-left: var(--space-2); font-size: var(--font-caption); font-weight: 400; color: var(--muted); }
.setting-description { font-size: var(--font-caption); }
.theme-preview { display: grid; grid-template-columns: 28% minmax(0, 1fr); grid-template-rows: var(--space-6) 1fr; height: 112px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); }
.theme-preview-header { grid-column: 1 / -1; background: var(--chrome); border-bottom: 1px solid var(--line); }
.theme-preview-nav { padding: var(--space-3) var(--space-2); background: var(--chrome); }
.theme-preview-nav span { display: block; height: var(--space-3); border-left: 3px solid var(--accent); border-radius: 2px; background: var(--selected); }
.theme-preview-page { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); }
.theme-preview-title { width: 50%; height: var(--space-2); margin-bottom: var(--space-1); border-radius: 2px; background: var(--accent); }
.theme-preview-line { width: 100%; height: var(--space-1); border-radius: 2px; background: var(--muted); opacity: .4; }
.theme-preview-line:last-child { width: 70%; }
.setting-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); margin-top: var(--space-6); }
.setting-reset { border-color: var(--line); }
.setting-feedback { color: var(--muted); font-size: var(--font-caption); }
.setting-feedback[data-state="error"] { color: var(--error-text); }
.font-preview { display: grid; gap: var(--space-2); padding: var(--space-3); border-radius: var(--control-radius); background: var(--chrome); font-family: var(--ui-font); }
.font-preview-characters { font-size: var(--font-caption); color: var(--muted); }
.size-choices { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
.size-choice { min-width: 0; display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-size); padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--control-radius); cursor: pointer; }
.size-choice input { margin: 0; }
.step-list { display: grid; gap: var(--space-8); list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: var(--space-8) 7em minmax(0, 1fr); gap: var(--space-2) var(--space-4); }
.step-number { grid-row: 1 / span 2; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-name { grid-row: 1 / span 2; margin: 0; font-size: var(--font-section); font-weight: var(--font-weight-strong); }
.step-summary { grid-column: 3; }
.step-io { grid-column: 3; display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: 0; font-size: var(--font-caption); }
.step-io div { display: contents; }
.step-io dt { color: var(--muted); white-space: nowrap; }
.step-io dd { margin: 0; }
.about-button { width: 100%; text-align: left; font-size: var(--font-caption); }
.panel-toggle { display: grid; place-items: center; width: var(--control-size); padding: 0; flex-shrink: 0; }
.panel-icon-fill { fill: currentColor; opacity: 0; }
.panel-toggle[aria-expanded="true"] .panel-icon-fill { opacity: .16; }
.error-panel { margin-top: var(--space-8); padding: var(--space-4); border: 1px solid var(--error-border); border-radius: var(--control-radius); background: var(--error-surface); color: var(--error-text); }
.error-panel button { margin-top: var(--space-3); border-color: var(--error-button-border); background: var(--surface); color: inherit; }
dialog { width: min(480px, calc(100% - var(--space-8))); padding: var(--space-6); border: 1px solid var(--line); border-radius: var(--control-radius); color: inherit; background: var(--surface); box-shadow: 0 24px 80px var(--dialog-shadow); }
dialog::backdrop { background: var(--dialog-backdrop); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.dialog-heading h2 { margin: 0; font-size: var(--font-section); }
.close-button { min-width: var(--control-size); padding: 0; font-size: var(--font-title); color: var(--muted); }
dialog dl { display: grid; gap: var(--space-2); margin: var(--space-6) 0; }
dialog dl div { display: flex; justify-content: space-between; gap: var(--space-4); }
dialog dt { color: var(--muted); }
dialog dd { margin: 0; }
.dialog-note { color: var(--muted); font-size: var(--font-caption); }
.noscript-notice { padding: var(--space-6); }
@container work-area (max-width: 680px) {
  .setting-choices { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: var(--space-6) minmax(0, 1fr); }
  .step-number { grid-row: auto; }
  .step-name { grid-row: auto; }
  .step-summary, .step-io { grid-column: 2; }
  .step-io { grid-template-columns: minmax(0, 1fr); }
  .step-io div + div dt { margin-top: var(--space-2); }
}
@media (max-width: 1100px) { :root { --support-width: 256px; } }
@media (max-width: 900px) {
  :root { --navigation-width: 128px; --support-width: 224px; }
  /* With the notes open there is no room for three columns: the list sits above what it shows. */
  .workspace-body:has(> .support-panel:not([hidden])) .workspace-panes:has(> .list-panel:not([hidden])) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .workspace-body:has(> .support-panel:not([hidden])) .list-panel { max-height: 35vh; padding: var(--space-4); border-right: 0; border-bottom: 1px solid var(--line); }
  .app-header { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .header-actions { gap: var(--space-3); }
  .work-area { padding: var(--space-6); }
}
@media (max-width: 600px) {
  :root { --navigation-width: 104px; }
  .header-actions { width: 100%; justify-content: space-between; }
  .workspace-body { grid-template-columns: var(--navigation-width) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .workspace-nav { grid-row: 1 / span 2; padding: var(--space-6) var(--space-2) var(--space-3); }
  .work-area { padding: var(--space-4); }
  .support-panel { grid-column: 2; width: auto; max-height: 35vh; padding: var(--space-4); }
  .workspace-panes:has(> .list-panel:not([hidden])) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .list-panel { max-height: 35vh; padding: var(--space-4); border-right: 0; border-bottom: 1px solid var(--line); }
}
