:root {
  color-scheme: dark;
  --bg: #0c0e14;
  --panel: #12151f;
  --panel-elev: #171b27;
  --field: #0e1018;
  --line: #2e3340;
  --line-soft: #222633;
  --ink: #f8f7f3;
  --muted: #b8bac4;
  --amber: #ffae57;
  --amber-light: #ffd09c;
  --accent-bg: #ffae5710;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: clip; }
body { margin: 0; overflow-x: clip; }
p, h1, h2 { margin: 0; }
a { color: var(--amber); text-underline-offset: .24em; }
a:hover { color: var(--amber-light); }
button, select, input { font: inherit; }
button:enabled, select:enabled, summary, input[type="range"], input[type="checkbox"] { cursor: pointer; }
button:disabled, select:disabled, input:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
::selection { background: var(--amber); color: #190f07; }

.wrap { width: min(100% - clamp(1.5rem, 4.5vw, 4.5rem), 76rem); margin-inline: auto; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.08em; height: 1.08em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 10; top: .5rem; left: 1rem; padding: .45rem .8rem; background: var(--bg); transform: translateY(-200%); }
.skip:focus { transform: none; }

/* Header */
.site-header { border-bottom: 1px solid #272a35; background: #111318; }
.masthead { min-height: 4.05rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem .9rem; padding-block: .55rem; }
.brand-group, .brand, .privacy, .header-meta { display: flex; align-items: center; }
.brand-group { gap: .85rem; }
.brand { gap: .55rem; font-weight: 760; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.product-label { border-inline-start: 1px solid var(--line); padding-inline-start: .85rem; color: var(--muted); font-size: .78rem; }
.header-meta { flex-wrap: wrap; justify-content: flex-end; gap: .45rem .85rem; max-width: 100%; }
.header-nav { font-size: .8rem; font-weight: 620; color: var(--muted); text-decoration: none; white-space: nowrap; }
.header-nav:hover { color: var(--amber-light); text-decoration: underline; }
.privacy { gap: .37rem; padding: .27rem .6rem; border: 1px solid #503b2b; border-radius: 99px; background: var(--accent-bg); color: var(--amber-light); font: 600 .72rem/1.3 var(--mono); max-width: 100%; }

/* Intro */
.intro { padding-block: clamp(1.85rem, 3vw, 2.7rem) clamp(1.15rem, 2.3vw, 1.65rem); }
.eyebrow, .workspace-tag, .format-tag, .file-info, .mono-val { font: 650 .74rem/1.35 var(--mono); }
.eyebrow, .workspace-tag { color: var(--amber); letter-spacing: .115em; text-transform: uppercase; }
.eyebrow { margin-block-end: .52rem; }
.eyebrow span { color: #786755; padding-inline: .22rem; }
h1 { font-size: clamp(2.15rem, 5vw, 4.35rem); font-weight: 665; letter-spacing: -.058em; line-height: 1; }
h1 em { color: var(--amber); font: italic 1.04em/1 Georgia, serif; letter-spacing: -.055em; }
.lede { max-width: 69ch; margin-block-start: .9rem; color: var(--muted); font-size: clamp(.94rem, 1.38vw, 1.06rem); }

/* Studio shell */
.editor { position: relative; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); box-shadow: 0 1.2rem 3.8rem #0006; scroll-margin-block-start: .75rem; overflow: hidden; }
.workspace-header, .toolbar, .selection-bar, .export-bar { display: flex; align-items: center; justify-content: space-between; gap: .55rem .9rem; padding: .52rem .9rem; }
.workspace-header { min-height: 3.1rem; border-bottom: 1px solid var(--line); background: var(--accent-bg); }
.workspace-tag, .file-tools, .mode-tools, .history-tools, .export-caption, .export-actions, .selection-controls { display: flex; align-items: center; }
.workspace-tag { gap: .48rem; }
.format-tag, .file-info, .mono-val { color: var(--muted); }
.format-tag { white-space: nowrap; }
.format-tag b { color: #9e754e; }
.file-tools { min-width: 0; gap: .35rem .65rem; }
.file-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24rem; }

/* Buttons */
.button, .tool-button, .chip-button, .ratio-button, .bg-swatch { display: inline-flex; align-items: center; justify-content: center; gap: .42rem; border: 1px solid transparent; border-radius: .52rem; white-space: nowrap; text-decoration: none; font-weight: 680; transition: background-color .14s ease, border-color .14s ease, color .14s ease; }
.button { min-height: 2.55rem; padding: .5rem .88rem; font-size: .84rem; }
.button-primary { background: var(--amber); color: #211409; }
.button-primary:is(a, :enabled):hover { background: #ffc181; color: #211409; }
.button-secondary { background: #161a26; border-color: #434756; color: var(--ink); }
.button-secondary:is(a, :enabled):hover { border-color: #8f6d4b; color: var(--amber-light); }
.button-quiet { min-height: 2rem; padding: .28rem .52rem; background: transparent; color: var(--ink); font-size: .77rem; }
.button-quiet:enabled:hover, .tool-button:enabled:hover { color: var(--amber-light); background: #232531; }
.tool-button { min-height: 2.15rem; padding: .3rem .58rem; background: transparent; color: var(--muted); font-size: .79rem; }
.tool-button[aria-pressed="true"] { color: var(--amber-light); border-color: #785538; background: #2d221c; }
.danger-button { color: #fca5a5; }
.danger-button:enabled:hover { color: #fecaca; background: #3b1c22; border-color: #7f2d3b; }
.key-pill { padding: .06rem .34rem; border-radius: .3rem; background: #1a1e2b; border: 1px solid #353b4e; color: var(--amber-light); font: 700 .66rem/1.3 var(--mono); }

/* Empty state */
.empty-state { display: grid; justify-items: center; align-content: center; min-height: clamp(21rem, 34vw, 25.5rem); padding: 1.5rem 1rem 1.85rem; text-align: center; background: radial-gradient(circle at 1px 1px, #343847 1px, transparent 1px) 0 0 / 19px 19px, var(--field); }
.drop-art { width: min(100%, 21.25rem); height: auto; margin-bottom: .45rem; }
.empty-state h2 { font-size: clamp(1.38rem, 2.8vw, 1.72rem); font-weight: 680; letter-spacing: -.035em; }
.empty-state p { max-width: 48ch; margin-top: .38rem; color: var(--muted); font-size: .88rem; }
kbd { display: inline-block; padding-inline: .28em; border: 1px solid #474a57; border-radius: .28em; background: #161922; font: .86em/1.45 var(--mono); color: var(--ink); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.15rem; }

/* Workspace 2-column grid */
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 22.25rem; align-items: stretch; }
.canvas-column { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.toolbar { border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mode-tools { gap: .25rem; flex-wrap: wrap; }
.history-tools { gap: .22rem; }

/* Canvas stage */
.editor-stage { flex: 1 1 auto; display: grid; place-items: center; min-height: 24rem; padding: clamp(.8rem, 2vw, 1.5rem); background: radial-gradient(circle at 1px 1px, #323646 1px, transparent 1px) 0 0 / 18px 18px, var(--field); }
.canvas-shell { display: grid; place-items: center; width: 100%; max-width: 100%; }
.canvas-shell canvas { display: block; max-width: 100%; max-height: 35rem; width: auto; height: auto; border-radius: .5rem; box-shadow: 0 0 0 1px #363b4b, 0 1rem 2.6rem #0008; touch-action: none; user-select: none; }
.editor-stage[data-bg="transparent"] .canvas-shell canvas { background: conic-gradient(#272b38 25%, #1b1e29 0 50%, #272b38 0 75%, #1b1e29 0) top left / 18px 18px; }
.editor-stage[data-tool="callout"] canvas { cursor: crosshair; }
.editor-stage[data-tool="blackout"] canvas { cursor: crosshair; }
.editor-stage[data-tool="select"] canvas { cursor: default; }
.editor-stage.is-dragging canvas { cursor: grabbing; }

/* Contextual selection bar */
.selection-bar { border-top: 1px solid var(--line); background: #151925; min-height: 3.15rem; }
.selection-controls { width: 100%; gap: .5rem; flex-wrap: wrap; }
.selected-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 1.85rem; padding-inline: .48rem; border-radius: 99px; background: var(--amber); color: #1c1005; font: 760 .76rem/1 var(--mono); }
.selected-badge.dark-badge { background: #050608; color: var(--ink); border: 1px solid #4c5266; }
.selection-meta { color: var(--muted); font: 600 .78rem/1.3 var(--mono); margin-right: auto; }
.caption-input { flex: 1 1 14rem; min-width: 0; }
.select-input { min-height: 2.15rem; padding: .28rem .5rem; border: 1px solid #3c4254; border-radius: .46rem; background: #0f121c; color: var(--ink); font-size: .8rem; }

/* Export bar */
.export-bar { min-height: 3.85rem; border-top: 1px solid var(--line); background: #121520; flex-wrap: wrap; }
.export-caption { gap: .5rem; color: var(--muted); font-size: .8rem; min-width: 0; }
.export-mark { flex: none; width: .46rem; height: .46rem; border-radius: 50%; background: var(--amber); }
.export-actions { gap: .45rem; flex-wrap: wrap; }

/* Inspector sidebar */
.inspector { display: flex; flex-direction: column; gap: 0; background: #10131d; }
.control-block { padding: .85rem .95rem; border-bottom: 1px solid var(--line-soft); display: grid; gap: .5rem; }
.control-block:last-child { border-bottom: 0; }
.control-block.is-muted { opacity: .55; }
.control-label { font: 660 .72rem/1.3 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

.segmented-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .36rem; }
.chip-button { min-height: 2.1rem; padding: .32rem .48rem; font-size: .77rem; font-weight: 630; background: #161a26; border-color: #2f3546; color: var(--muted); }
.chip-button:hover { border-color: #6b533b; color: var(--ink); }
.chip-button[aria-pressed="true"] { background: #2c211b; border-color: #9e6e40; color: var(--amber-light); }

.text-input { width: 100%; min-height: 2.15rem; padding: .35rem .62rem; border: 1px solid #383e50; border-radius: .48rem; background: #0c0f17; color: var(--ink); font-size: .82rem; }
.text-input::placeholder { color: #787f92; }
.text-input:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 2px #ffae5730; }

.bg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .36rem; }
.bg-swatch { justify-content: flex-start; min-height: 2.18rem; padding: .28rem .42rem; gap: .36rem; font-size: .73rem; font-weight: 620; background: #161a26; border-color: #2f3546; color: var(--muted); }
.bg-swatch span:last-child { white-space: nowrap; }
.bg-swatch:hover { border-color: #6b533b; color: var(--ink); }
.bg-swatch[aria-pressed="true"] { background: #2c211b; border-color: #a67443; color: var(--amber-light); }
.bg-dot { flex: none; width: 1.05rem; height: 1.05rem; border-radius: .32rem; border: 1px solid #ffffff38; }
.bg-editorial-warm { background: linear-gradient(135deg, #f7f1e6, #e5d2b5); border-color: #8c7b66; }
.bg-midnight-obsidian { background: linear-gradient(135deg, #0b0f1b, #232a42); }
.bg-sunset-amber { background: linear-gradient(135deg, #4b2012, #e2843a, #ffba6b); }
.bg-slate-mist { background: linear-gradient(135deg, #e5ecf4, #b6c6da); border-color: #77879c; }
.bg-forest-sage { background: linear-gradient(135deg, #132822, #3c6555); }
.bg-transparent { background: conic-gradient(#555b6e 25%, #2a2e3d 0 50%, #555b6e 0 75%, #2a2e3d 0) top left / 8px 8px; }

.ratio-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .36rem; }
.ratio-button { flex-direction: column; align-items: flex-start; gap: .06rem; padding: .4rem .55rem; background: #161a26; border-color: #2f3546; color: var(--ink); font-size: .78rem; }
.ratio-button small { font-size: .68rem; font-weight: 500; color: var(--muted); white-space: normal; text-align: left; line-height: 1.25; }
.ratio-button:hover { border-color: #6b533b; }
.ratio-button[aria-pressed="true"] { background: #2c211b; border-color: #a67443; color: var(--amber-light); }
.ratio-button[aria-pressed="true"] small { color: #e5bfa0; }

.slider-row { display: flex; align-items: center; justify-content: space-between; margin-top: .15rem; }
.range-input { width: 100%; accent-color: var(--amber); margin: 0 0 .35rem; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .15rem; padding-top: .45rem; border-top: 1px solid var(--line-soft); cursor: pointer; }
.toggle-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--amber); }

.summary-head { display: flex; align-items: center; justify-content: space-between; }
.inspector-tip { color: var(--muted); font-size: .78rem; line-height: 1.48; }
.inspector-tip strong { color: var(--ink); }

/* Drag overlay, status & nudge */
.drop-target { display: none; position: absolute; inset: .45rem; z-index: 6; place-content: center; grid-auto-flow: column; align-items: center; gap: .5rem; border: 1.5px dashed var(--amber); border-radius: .75rem; background: #141219f2; color: var(--amber-light); font-weight: 700; pointer-events: none; }
.editor.is-dropping .drop-target { display: grid; }
.status { padding: .53rem .9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.status:empty { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; }
.status[data-tone="error"] { color: #ffc0a6; }
.post-export-nudge { padding: .72rem .95rem; border-top: 1px solid #5d4432; background: var(--accent-bg); color: var(--muted); font-size: .83rem; line-height: 1.5; }
.post-export-nudge p { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.post-export-nudge .icon { color: var(--amber); }
.post-export-nudge a { color: var(--amber-light); font-weight: 650; }
.post-export-nudge a:hover { color: var(--ink); }
.noscript { padding: .75rem .95rem; color: var(--amber-light); }

/* Below-fold conversion & FAQ */
.safety-note { display: flex; align-items: baseline; gap: .48rem; margin-block: .75rem 1.65rem; color: var(--muted); font-size: .82rem; }
.safety-note .icon { align-self: flex-start; margin-top: .16rem; color: var(--amber); }
.safety-note strong, .conversion strong { color: var(--ink); font-weight: 670; }

.conversion { display: flex; justify-content: space-between; align-items: center; gap: 1rem 2rem; padding: clamp(1.15rem, 3.2vw, 1.85rem); border: 1px solid #5d4432; border-radius: .92rem; background: var(--accent-bg); }
.conversion h2, .faq-title h2 { font-size: clamp(1.42rem, 2.6vw, 2rem); font-weight: 670; letter-spacing: -.04em; line-height: 1.12; }
.conversion-copy p:last-child { max-width: 64ch; margin-block-start: .53rem; color: var(--muted); font-size: .9rem; }
.conversion-actions { display: grid; gap: .58rem; flex: none; }
.conversion-actions .button { justify-content: space-between; }
.conversion-links { display: flex; gap: .85rem; justify-content: space-between; flex-wrap: wrap; font-size: .79rem; }
.conversion-links a { color: var(--muted); }
.conversion-links a:hover { color: var(--amber-light); }

.faq-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1rem 2rem; padding-block: clamp(2.1rem, 5.4vw, 3.8rem); }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary { padding: .7rem .25rem .7rem 0; font-size: .92rem; font-weight: 670; }
.faq summary::marker { color: var(--amber); }
.faq summary:hover { color: var(--amber-light); }
.faq details p { max-width: 72ch; padding: 0 .25rem .85rem 1rem; color: var(--muted); font-size: .88rem; }

.site-footer { border-top: 1px solid var(--line); background: #111318; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1.2rem; padding-block: 1rem; color: var(--muted); font-size: .8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .95rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links a:first-child { color: var(--ink); font-weight: 720; }
.footer-links a:hover { color: var(--amber-light); }

/* Responsive */
@media (max-width: 60rem) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .canvas-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .editor-stage { min-height: 18rem; }
}

@media (max-width: 47rem) {
  .conversion { align-items: flex-start; flex-direction: column; }
  .conversion-actions { width: 100%; }
  .faq-section { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 39rem) {
  .masthead { min-height: 3.6rem; }
  .workspace-header, .toolbar, .selection-bar, .export-bar { padding-inline: .65rem; }
  .history-tools span { display: none; }
  .export-actions { width: 100%; }
  .export-actions .button { flex: 1 1 auto; }
}

@media (max-width: 28rem) {
  .wrap { width: min(100% - 1.25rem, 76rem); }
  .brand-group { gap: .5rem; }
  .product-label { display: none; }
  .header-meta { width: 100%; justify-content: flex-start; gap: .4rem .7rem; }
  .privacy { font-size: .67rem; padding: .24rem .5rem; }
  .workspace-header:has(#file-tools:not([hidden])) .workspace-tag { display: none; }
  .file-tools { width: 100%; justify-content: space-between; }
  .file-info { flex: 1 1 auto; min-width: 0; max-width: none; font-size: .7rem; }
  .toolbar { gap: .38rem; }
  .tool-button { padding-inline: .45rem; font-size: .75rem; }
  .key-pill { display: none; }
  .editor-stage { min-height: 14rem; padding: .6rem; }
  .export-actions .button { padding-inline: .52rem; font-size: .77rem; }
}
