/* Workspace geometry is independent from atmosphere tokens. */
body[data-workspace-style="manuscript"] {
    --content-max-width: 740px;
    --frame-radius-lg: 2px;
    --frame-radius-md: 3px;
}
body[data-workspace-style="manuscript"] .editor-utility-bar {
    background: transparent;
    border-radius: 0;
    border-inline: 0;
    box-shadow: none;
    backdrop-filter: none;
}
body[data-workspace-style="manuscript"] #editor,
body[data-workspace-style="manuscript"] .viewer-content {
    padding: clamp(1.3rem, 4vw, 3.2rem);
    line-height: 2;
}
body[data-workspace-style="typewriter"] {
    --workspace-max-width: 1080px;
    --frame-radius-lg: 2px;
    --frame-radius-md: 2px;
}
body[data-line-spacing="compact"] #editor,
body[data-line-spacing="compact"] .viewer-content,
body[data-line-spacing="compact"] .line-spacing-preview {
    line-height: 1.6;
}
body[data-line-spacing="roomy"] #editor,
body[data-line-spacing="roomy"] .viewer-content,
body[data-line-spacing="roomy"] .line-spacing-preview {
    line-height: 2.2;
}
body[data-custom-font-size="true"] #editor,
body[data-custom-font-size="true"] .viewer-content {
    font-size: var(--custom-font-size);
}
body[data-custom-font-size="true"] .font-preview {
    font-size: var(--custom-font-size);
}
body[data-custom-width="true"] {
    --content-max-width: var(--custom-content-width);
    --workspace-max-width: var(--custom-content-width);
}
body[data-custom-width="true"][data-margin-open="true"] .editor-panel {
    max-width: min(100%, calc(var(--custom-content-width) + 300px + .85rem));
}
body[data-custom-width="true"][data-workspace-style="typewriter"] .app-header {
    width: min(100%, var(--custom-content-width));
}
body[data-custom-width="true"][data-zen-mode="true"] .editor-panel {
    max-width: min(100%, var(--custom-content-width));
}
/* A preview is a tiny writing surface, not just a color chip. */
.visual-theme-swatch-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.visual-theme-swatch {
    border-radius: 4px;
    text-align: left;
    justify-items: stretch;
    padding: .75rem;
    min-width: 0;
}
.visual-theme-swatch-disc {
    width: 100%;
    height: 48px;
    aspect-ratio: auto;
    border-radius: 2px;
}
.visual-theme-swatch-label { font-size: .8rem; line-height: 1.5; }
.theme-description { font-size: .75rem; line-height: 1.7; color: var(--text-color); }
.visual-theme-swatch[data-theme-value="quiet-pool"] .visual-theme-swatch-disc {
    background: repeating-linear-gradient(90deg, transparent 0 23px, #71939133 23px 24px), linear-gradient(173deg, #edf4ef 65%, #adcdca 66%, #dcebe6);
}
.visual-theme-swatch[data-theme-value="paper-archive"] .visual-theme-swatch-disc {
    background: repeating-linear-gradient(90deg, #e5dfd3 0 28px, #b8b3a5 28px 29px);
}
.visual-theme-swatch[data-theme-value="night-window"] .visual-theme-swatch-disc {
    background: linear-gradient(90deg, transparent 72%, #789ba777 72% 73%, transparent 73%), radial-gradient(ellipse at 100% 0, #9ebac5, #dce8e8 65%);
}
.visual-theme-swatch[data-theme-value="signal-room"] .visual-theme-swatch-disc {
    background: repeating-linear-gradient(0deg, #dbe7e4 0 7px, #789d9933 7px 8px);
}
.visual-theme-swatch[data-preview-mode="dark"]:is([data-theme-value="quiet-pool"], [data-theme-value="paper-archive"], [data-theme-value="night-window"], [data-theme-value="signal-room"]) .visual-theme-swatch-disc {
    background-blend-mode: multiply;
    background-color: #43555c;
}
.visual-theme-swatch-disc::before {
    inset: 10px 20%;
    border: 0;
    border-radius: 0;
    background: #fffdf5;
    box-shadow: 1px 1px 0 #66797744;
    transform: none;
}
.visual-theme-swatch[data-preview-mode="dark"] .visual-theme-swatch-disc::before { background: #283438; }
.visual-theme-swatch-disc::after {
    inset: 17px 28%;
    border: 0;
    border-radius: 0;
    background: repeating-linear-gradient(0deg, #86999a 0 1px, transparent 1px 6px);
    transform: none;
}
.visual-theme-swatch.is-selected { outline: 2px solid var(--accent-color); outline-offset: -2px; box-shadow: none; }
:where(button, select, input, textarea):focus-visible { outline: 2px solid var(--accent-color); outline-offset: 3px; }
@media (max-width: 768px) {
    .visual-theme-swatch-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .visual-theme-swatch-disc { width: 100%; height: 40px; }
    body[data-workspace-style="manuscript"] #editor { padding: 1.25rem; }
}
@media (max-width: 360px) {
    .visual-theme-swatch-list { grid-template-columns: 1fr; }
}
.theme-gallery summary { cursor: pointer; padding: .6rem 0; font-size: .85rem; color: var(--text-color); }
.theme-gallery[open] summary { margin-bottom: .4rem; }

/* Small, live choices explain geometry without screenshots or a separate guide. */
.setting-purpose {
    display: inline-block;
    margin-inline-start: .55em;
    font-size: .78rem;
    font-weight: 400;
    color: var(--text-color);
}
.line-spacing-preview {
    margin: .4rem 0 .2rem;
    padding: .45rem .7rem;
    border-left: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: var(--line-height);
}
body[data-workspace-style="manuscript"][data-line-spacing="default"] .line-spacing-preview {
    line-height: 2;
}
.font-preview {
    margin: .15rem 0 .25rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 1.05rem;
    line-height: 1.8;
}
.range-setting-heading,
.range-setting-footer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem 1rem;
}
.range-setting-heading output { font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--text-color); }
.font-size-setting input[type="range"],
.content-width-setting input[type="range"] { width: 100%; accent-color: var(--accent-color); }
.range-setting-footer .helper-text { margin: 0; }
.text-action { flex: none; border: 0; background: transparent; color: var(--accent-color); font: inherit; font-size: .8rem; cursor: pointer; }
.text-action:hover { text-decoration: underline; }
.text-action:disabled { opacity: .5; cursor: default; text-decoration: none; }
@media (max-width: 560px) {
    .range-setting-footer { align-items: flex-start; flex-direction: column; }
}
.workspace-previews {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .6rem;
}
.workspace-preview {
    min-width: 0;
    padding: .6rem .35rem;
    border: 1px solid transparent;
    border-bottom-color: var(--border-color);
    border-radius: 3px;
    color: var(--text-color);
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: center;
}
.workspace-preview:hover { background: var(--action-hover-bg); }
.workspace-preview[aria-pressed="true"] {
    border-color: var(--accent-color);
    background: rgba(var(--accent-rgb), .07);
}
.workspace-preview-name { display: block; font-size: .88rem; margin-top: .5rem; }
.workspace-preview-detail { display: block; font-size: .75rem; line-height: 1.5; margin-top: .2rem; }
.workspace-diagram {
    display: block;
    position: relative;
    height: 76px;
    max-width: 150px;
    margin: 0 auto;
    background: var(--surface-muted);
    color: var(--accent-color);
}
.workspace-diagram-tools {
    position: absolute;
    inset: 7px 8% auto;
    height: 5px;
    background: repeating-linear-gradient(90deg, currentColor 0 7px, transparent 7px 11px);
    opacity: .65;
}
.workspace-diagram-paper {
    position: absolute;
    inset: 18px 16% 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--editor-bg);
    transition: inset .25s ease;
}
.workspace-diagram-paper::after {
    content: "";
    position: absolute;
    inset: 8px 16%;
    background: repeating-linear-gradient(0deg, transparent 0 5px, currentColor 5px 6px);
    opacity: .45;
}
.workspace-diagram-status {
    position: absolute;
    inset: auto 30% 5px;
    height: 5px;
    border-radius: 3px;
    background: currentColor;
    opacity: .55;
}
.workspace-preview[data-style="typewriter"] .workspace-diagram-paper { inset-inline: 5%; border-radius: 0; }
.workspace-preview[data-style="typewriter"] .workspace-diagram-status { inset-inline: 5%; border-radius: 0; }
.workspace-preview[data-style="manuscript"] .workspace-diagram-paper { inset-inline: 28%; border-radius: 1px; }
.tool-caption {
    position: fixed;
    z-index: 1500;
    width: max-content;
    max-width: min(20rem, calc(100vw - 1.5rem));
    padding: .6rem .8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--editor-bg);
    color: var(--text-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    font-family: "Noto Sans JP", sans-serif;
    font-size: .8rem;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0;
    text-align: left;
}
.tool-caption[hidden] { display: none; }
.breath-example { max-width: 32rem; margin: 1.3rem auto; }
.breath-empty, .breath-example-caption { line-height: 1.8; font-size: .9rem; }
.breath-example-caption { min-height: 3.6em; max-width: 32rem; margin-inline: auto; }
.breath-example-line {
    display: block;
    width: 100%;
    padding: 1rem 0;
    min-height: 44px;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--accent-color);
}
.breath-example-line.starts-paragraph { margin-top: 1.3rem; }
.breath-example-line span {
    display: block;
    width: var(--sample-width);
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: .6;
    transition: opacity .2s ease;
}
.breath-example-line:hover span,
.breath-example-line[aria-pressed="true"] span { opacity: 1; }
.breath-example-line[aria-pressed="true"] span { animation: sample-ripple .65s ease-out; }
@keyframes sample-ripple {
    from { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .3); }
    to { box-shadow: 0 0 0 10px rgba(var(--accent-rgb), 0); }
}
@media (max-width: 768px) {
    .utility-overflow:not(.is-open) .utility-btn:not(.mobile-primary-action) { display: none; }
    .workspace-previews { gap: .3rem; }
    .workspace-diagram { height: 62px; }
    .workspace-preview { padding-inline: .2rem; }
    .workspace-preview-detail { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
    .workspace-diagram-paper, .breath-example-line span { transition: none; animation: none; }
}

.editor-utility-bar > .mode-chip-group { flex-shrink: 0; }
.mode-chip { white-space: nowrap; }
@media (min-width: 769px) {
    .editor-utility-bar { width: min(calc(100vw - 2rem), 1200px); }
    .utility-group { flex-wrap: nowrap; }
}

.settings-panel .helper-text { color: color-mix(in srgb, var(--text-color) 80%, transparent); line-height: 1.7; }
