:root {
  --bg: #f3f6fb; --surface: #ffffff; --ink: #0f1b2d; --muted: #5a6b82; --line: #dde4ee;
  --accent: #2357e8; --accent-ink: #ffffff; --accent-soft: #e8efff;
  --ok: #157a3f; --ok-soft: #e5f6ec; --bad: #b42318; --bad-soft: #fdecea; --warn: #8a5300; --warn-soft: #fff4e0;
  --radius: 14px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }
.top nav a[aria-current] { font-weight: 700; }

.hero { padding: 30px 0 18px; }
.hero h1 { font-size: clamp(26px, 3.4vw, 38px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 760px; font-size: 17px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; }
.pills li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; color: var(--muted); }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "content preview" "style preview"; gap: 18px; align-items: start; padding-bottom: 36px; }
.studio-content { grid-area: content; }
.studio-preview { grid-area: preview; position: sticky; top: 16px; }
.studio-style { grid-area: style; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel-title { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 12px; }
.studio noscript p { margin: 0; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { font: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.tabs button:hover { border-color: #b8c4d6; }
.tabs button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #fff; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], textarea, select { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #c9d3e1; border-radius: 10px; padding: 9px 12px; }
textarea { resize: vertical; min-height: 44px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
[aria-invalid=true] { border-color: var(--bad) !important; }
.field-error { color: var(--bad); font-size: 14px; margin: 4px 0 0; min-height: 0; }
.field-error:empty { display: none; }
.pw { display: flex; gap: 8px; align-items: center; }
.pw input { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; margin: 4px 0 0; }
.notes { margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.notes li::before { content: "ℹ "; }
.raw { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.raw summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.raw summary span { color: var(--muted); font-weight: 400; }
.raw pre { background: #f6f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; font-size: 13px; margin: 8px 0 0; max-height: 220px; overflow: auto; }

.preview-head { display: flex; align-items: center; justify-content: space-between; }
.preview-head .panel-title { margin: 0; }
.badge { background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.preview-box { margin: 12px 0 10px; border-radius: 12px; background: #eef2f8; padding: 18px; display: grid; place-items: center; min-height: 260px; }
.preview-box svg { width: 100%; max-width: 300px; height: auto; display: block; }
.preview-box.checker { background-color: #fff; background-image: linear-gradient(45deg, #e3e8ef 25%, transparent 25%), linear-gradient(-45deg, #e3e8ef 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e3e8ef 75%), linear-gradient(-45deg, transparent 75%, #e3e8ef 75%); background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; }
.preview-empty { text-align: center; color: var(--muted); max-width: 260px; font-size: 15px; }
.meta { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.scan { font-size: 14px; font-weight: 600; border-radius: 10px; padding: 8px 12px; margin: 0 0 8px; }
.scan:empty { display: none; }
.scan.pending { background: #f1f4f8; color: var(--muted); }
.scan.ok { background: var(--ok-soft); color: var(--ok); }
.scan.bad { background: var(--bad-soft); color: var(--bad); }
.warnings { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.warnings li { border-radius: 10px; padding: 8px 12px; }
.warnings .warn { background: var(--warn-soft); color: var(--warn); }
.warnings .info { background: #f1f4f8; color: var(--muted); }
.export { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; }
.size-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600; }
.size-pick select { width: auto; }
.export-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn { font: inherit; font-size: 15px; font-weight: 700; border-radius: 10px; padding: 10px 14px; border: 1px solid #c9d3e1; background: #fff; color: var(--ink); cursor: pointer; text-align: center; display: inline-block; }
.btn:hover { border-color: #9fb0c8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1945c4; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { font: inherit; font-size: 14px; background: none; border: 0; padding: 4px 2px; color: var(--accent); cursor: pointer; text-decoration: underline; }

.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; font-size: 15px; margin-bottom: 8px; padding: 0; }
.colors { display: grid; gap: 8px; }
.color { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.color input { width: 44px; height: 34px; border: 1px solid #c9d3e1; border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.color input:disabled { opacity: 0.4; cursor: not-allowed; }
.color code { color: var(--muted); font-size: 13px; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #c9d3e1; border-radius: 10px; overflow: hidden; }
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { border-left: 1px solid #c9d3e1; }
.segmented input, .thumb input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 7px 4px; font-size: 13px; color: var(--muted); }
.segmented span b { display: block; font-size: 15px; color: var(--ink); }
.segmented input:checked + span { background: var(--ink); color: #cfd8e6; }
.segmented input:checked + span b { color: #fff; }
.segmented input:disabled + span { opacity: 0.35; cursor: not-allowed; }
.segmented input:focus-visible + span, .thumb input:focus-visible ~ svg { outline: 3px solid var(--accent); outline-offset: -3px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; display: grid; justify-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.thumb svg { width: 48px; height: 48px; border-radius: 6px; }
.thumb:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); color: var(--ink); font-weight: 700; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-name { margin: 0 0 8px; font-size: 14px; word-break: break-all; }
.range { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.range input { flex: 1; accent-color: var(--accent); }
#reset-style { margin-top: 14px; }

.guide { background: var(--surface); border-top: 1px solid var(--line); padding: 40px 0 48px; }
.guide .wrap { max-width: 820px; }
.guide h2 { font-size: 24px; line-height: 1.25; margin: 32px 0 10px; letter-spacing: -0.01em; }
.guide h2:first-child { margin-top: 0; }
.guide h3 { font-size: 18px; margin: 22px 0 6px; }
.guide p, .guide li { color: #2b3a50; }
.guide ol, .guide ul { padding-left: 22px; }
.guide table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 12px 0; }
.guide th, .guide td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.guide th { background: #f6f8fb; }
.faq details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 10px 0; background: #fbfcfe; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 8px 0 0; }
.related { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.page-plain { padding: 8px 0 48px; }
.page-plain .card { max-width: 820px; padding: 28px 30px; }
.page-plain h2 { font-size: 22px; margin: 28px 0 8px; }
.page-plain h2:first-child { margin-top: 0; }
.notfound { text-align: center; padding: 60px 20px; }
.notfound .btn { margin-top: 10px; text-decoration: none; }

footer { border-top: 1px solid var(--line); background: var(--bg); font-size: 14px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 20px; padding-bottom: 28px; align-items: center; }
footer a { color: var(--muted); }
footer .spacer { flex: 1; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.foot-links a[aria-current] { color: var(--ink); }

@media (max-width: 980px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "content" "preview" "style"; }
  .studio-preview { position: static; }
  .preview-box svg { max-width: 260px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .card { padding: 16px; border-radius: 12px; }
  .fields, .style-grid { grid-template-columns: 1fr; }
  .hero { padding: 20px 0 14px; }
  .hero p { font-size: 16px; }
  .tabs button { padding: 6px 13px; font-size: 14px; }
  .top nav { gap: 2px 12px; font-size: 13px; }
  .page-plain .card { padding: 20px 18px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: optional;
  src: url(./fonts/ibmplexsans.woff2?v=056e4e2459) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: optional;
  src: url(./fonts/ibmplexsans.woff2?v=056e4e2459) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: optional;
  src: url(./fonts/ibmplexsans.woff2?v=056e4e2459) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: optional;
  src: url(./fonts/ibmplexsans.woff2?v=056e4e2459) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* Workspace presentation. Engine, local data and existing content remain independent. */
:root { --radius: 10px; }
html { scroll-padding-top: 24px; }
body { font-size:17px; }
.wrap { max-width:1360px; padding-left:28px; padding-right:28px; }
.top .wrap { min-height:74px; gap:16px 24px; }
.brand { font-size:22px; letter-spacing:-.035em; }
.brand svg { width:34px; height:34px; }
.top nav { font-size:15px; gap:6px 20px; }
.top nav a { padding:10px 0; }
.hero { padding:36px 0 24px; }
.hero h1 { font-size:clamp(28px,3.3vw,44px); line-height:1.13; max-width:1000px; letter-spacing:-.045em; }
.hero p { font-size:17px; max-width:900px; }
.workspace-label { font-size:12px!important; font-weight:800; letter-spacing:.13em; color:var(--accent)!important; margin:0 0 12px!important; }
.workspace-note { display:flex; gap:12px; flex-wrap:wrap; margin:20px 0 0; align-items:center; font-size:14px; color:var(--muted); }
.workspace-note a { font-weight:700; text-underline-offset:4px; }
.pills { gap:8px 18px; font-size:14px; }
.pills li { padding:0; border:0; border-radius:0; background:transparent; }
.card { box-shadow:0 4px 18px #10203706; }
.card h2,.panel-title { font-size:20px; letter-spacing:-.025em; }
input:not([type=range]):not([type=color]):not([type=checkbox]):not([type=radio]),select,textarea,.btn { font-size:16px; }
.btn { min-height:44px; display:inline-flex; align-items:center; justify-content:center; text-align:center; gap:6px; }
button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
button { touch-action:manipulation; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.small,.muted.small { font-size:14px; line-height:1.55; }
.guide { margin-top:28px; padding:48px 0 64px; }
.guide .wrap { max-width:920px; }
.guide h2 { font-size:26px; scroll-margin-top:24px; }
.guide p,.guide li { line-height:1.75; }
.faq details { border-radius:6px; padding:16px 18px; }
.related { gap:10px 16px; }
.related a { text-underline-offset:4px; }
footer { font-size:14px; }
footer .wrap { padding-top:24px; padding-bottom:30px; }
.skiplink { position:absolute; left:12px; top:-100px; padding:12px 18px; background:#fff; color:#14202d; z-index:100; border:2px solid currentColor; }
.skiplink:focus { top:12px; }
main,.card,.layout>*,.workspace>* { min-width:0; }
@media(max-width:720px) {
 .wrap { padding-left:16px; padding-right:16px; }
 .top .wrap { padding-top:14px; padding-bottom:12px; gap:8px; }
 .top nav { width:100%; font-size:14px; gap:3px 16px; }
 .top nav a { padding:6px 0; }
 .hero { padding:26px 0 20px; }
 .hero h1 { font-size:30px; }
 .hero p { font-size:16px; }
 .workspace-note { margin-top:14px; gap:5px 12px; }
 .card { padding:18px; }
 .guide { margin-top:16px; padding:32px 0 40px; }
 .guide table { display:block; overflow-x:auto; }
}
@media(prefers-reduced-motion:no-preference) { .btn { transition:background .15s,border-color .15s,box-shadow .15s; } }
@media print { .workspace-note,.workspace-label,.skiplink { display:none!important; } }

:root { --font:"IBM Plex Sans",sans-serif; }

:root { --bg:#edf2f7; --ink:#16283a; --muted:#52687b; --accent:#1644ce; --accent-soft:#e8efff; --line:#cdd8e3; --radius:7px; }
.top { border-top:5px solid #1644ce; }
.hero .wrap { border-left:3px solid #1644ce; }
.studio { grid-template-columns:minmax(290px,1fr) minmax(280px,.9fr) minmax(260px,.85fr); grid-template-areas:'content preview style'; gap:16px; align-items:start; }
.studio-content,.studio-style { padding:20px; }
.studio-preview { position:static; border:1px solid #1644ce; background:#fff; padding:22px; }
.preview-box { background-color:#f8fafc; background-image:linear-gradient(45deg,#e6ebf2 25%,transparent 25%),linear-gradient(-45deg,#e6ebf2 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e6ebf2 75%),linear-gradient(-45deg,transparent 75%,#e6ebf2 75%); background-size:16px 16px; background-position:0 0,0 8px,8px -8px,-8px 0; min-height:250px; }
.tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; border:0; padding-bottom:16px; }
.tabs button { border:1px solid var(--line); border-radius:4px; text-align:left; padding:10px 9px; font-size:15px; min-height:42px; }
.tabs button[aria-selected=true] { background:var(--accent); color:#fff; }
.style-grid { display:flex; flex-direction:column; gap:18px; }
.style-grid fieldset { min-width:0; border:0; border-bottom:1px solid var(--line); padding:0 0 16px; margin:0; }
.export-buttons { display:grid; gap:8px; }
.preview-head { padding-bottom:12px; border-bottom:1px solid var(--line); }
.raw pre { white-space:pre-wrap; overflow-wrap:anywhere; }
@media(max-width:1120px) { .studio { grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-areas:'content preview' 'style style'; } .style-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:680px) { .studio { display:flex; flex-direction:column; } .studio-content,.studio-preview,.studio-style { width:100%; } .style-grid { grid-template-columns:minmax(0,1fr); } }

/* Keep the real tool within reach on phones; full guidance stays below it. */
@media(max-width:560px) {
 .hero { padding-top:18px; padding-bottom:18px; }
 .hero h1 { font-size:28px; }
 .hero .pills { display:none; }
 .hero .workspace-label { font-size:11px!important; margin-bottom:9px!important; }
 .hero .workspace-note { margin-top:12px; }
 .hero .workspace-note>span { display:none; }
 .top .wrap { min-height:0; }
}

/* Screen workbench sizing must not override the original print sheets. */
@media print {
 body { background:#fff; font-size:11pt; }
 .wrap { max-width:none; padding:0; }
 .card { box-shadow:none; }
 .workspace-label,.workspace-note,.skiplink { display:none!important; }
}

/* Cold loads: keep late fonts and module hydration from moving visible content.
   With scripting disabled noscript contains real elements, so this placeholder
   does not apply and the original explanation remains immediately readable. */
@media screen {
 html { scrollbar-gutter:stable; }
 :is(#app,#studio,.tools>.tool):has(>noscript:only-child):not(:has(>noscript>*)) {
   min-block-size:max(480px,calc(100svh - 80px));
 }
 :is(#app,#studio,.tools>.tool):has(>noscript:only-child):not(:has(>noscript>*))::before {
   content:'Loading workspace…'; display:block; grid-column:1/-1;
   padding:24px; color:var(--muted); font-size:16px;
 }
}

/* Preview geometry and async scan feedback share a stable reserved area. */
@media screen {
 .preview-box { height:382px; min-height:0; }
 .preview-box svg { width:100%; height:100%; max-height:100%; object-fit:contain; }
 .meta { min-height:4.8em; }
 .scan { min-height:84px; display:flex; align-items:center; }
 .scan:empty { display:flex; visibility:hidden; }
}

/* Same-origin navigation: keep the old page opaque until the new one fades in.
   Do not fade out to the body background or slide the whole workbench. */
@view-transition { navigation:auto; }
@keyframes workspace-page-enter { from { opacity:0; } to { opacity:1; } }
::view-transition-group(root) { animation:none; }
::view-transition-old(root) { animation:none; opacity:1; mix-blend-mode:normal; }
::view-transition-new(root) {
 animation:workspace-page-enter 180ms cubic-bezier(.2,.7,.2,1) both;
 mix-blend-mode:normal;
}
::view-transition { pointer-events:none; }
@media(prefers-reduced-motion:reduce) {
 @view-transition { navigation:none; }
 ::view-transition-old(root),::view-transition-new(root) { animation:none; }
}
