:root {
  --bg: #f4f2fb;
  --panel: #ffffff;
  --ink: #1c1740;
  --muted: #5f5980;
  --line: #e3dff2;
  --soft: #eeeaff;
  --ghost: rgba(28, 23, 64, .06);
  --accent: #5b3df5;
  --on-accent: #ffffff;
  --ok: #187a4a;
  --warn: #8c5200;
  --bad: #b42318;
  --shadow: 0 1px 2px rgba(28, 23, 64, .06), 0 10px 30px rgba(28, 23, 64, .07);
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  --bg: #110f1d;
  --panel: #1a1730;
  --ink: #f1eeff;
  --muted: #aaa4cc;
  --line: #2c2850;
  --soft: #26214a;
  --ghost: rgba(241, 238, 255, .08);
  --accent: #9b8cff;
  --on-accent: #120e30;
  --ok: #5fd39a;
  --warn: #f2b45a;
  --bad: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; padding-bottom: 66px; }
a { color: inherit; }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--bg); padding: 10px 14px; z-index: 100; border-radius: 10px; }
.skip:focus { top: 8px; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.top .in { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); height: 56px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 800; letter-spacing: -.04em; font-size: 20px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.brand i { width: 26px; height: 26px; border-radius: 9px; background: linear-gradient(135deg, #ff9ac2, var(--accent)); display: inline-block; }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a, .icon-btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; text-decoration: none; font-weight: 600; font-size: 14px; }
.top nav a:hover, .icon-btn:hover { background: var(--ghost); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }

.stepper { position: sticky; top: 56px; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
.stepper ol { list-style: none; margin: 0 auto; padding: 0 var(--gutter); max-width: 1240px; display: grid; grid-template-columns: repeat(4, 1fr); }
.stepper button { width: 100%; min-height: 52px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.stepper button b { width: 22px; height: 22px; border-radius: 50%; background: var(--ghost); display: grid; place-items: center; font-size: 12px; }
.stepper button[aria-current="step"] { color: var(--ink); border-bottom-color: var(--accent); }
.stepper button[aria-current="step"] b { background: var(--accent); color: var(--on-accent); }

.page { max-width: 1240px; margin: 0 auto; padding: 18px var(--gutter) 0; }
.heading { margin: 4px 0 18px; }
.heading h1 { font-size: clamp(30px, 8vw, 44px); line-height: 1.04; letter-spacing: -.04em; font-weight: 800; margin: 0 0 6px; }
.heading p { margin: 0; color: var(--muted); max-width: 56ch; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }

.studio { display: flex; flex-direction: column; gap: 14px; }
.left { display: contents; }
.card { background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; }
.card h2 { font-size: 15px; letter-spacing: -.01em; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 14px 0 8px; }
.lbl { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--muted); }
.in-text {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 17px; min-height: 48px; transition: border-color .15s, box-shadow .15s;
}
textarea.in-text { resize: vertical; min-height: 96px; line-height: 1.4; }
.in-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--soft); }
.fieldgap { margin-top: 12px; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--ghost); border-radius: 12px; padding: 3px; gap: 2px; width: 100%; }
.seg button { min-height: 44px; border: 0; background: transparent; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(28, 23, 64, .18); }

.rail { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; margin: 0 -2px; }
.chipb { flex: none; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--panel); font-size: 16px; white-space: nowrap; transition: border-color .15s, background .15s; }
.chipb:hover { border-color: var(--accent); }
.chipb[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); }
.chipb.small { font-size: 13px; font-weight: 600; }

.preview-wrap { display: grid; gap: 12px; }
.counters { display: grid; gap: 10px; }
.ctr .row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.ctr .row span:last-child { font-variant-numeric: tabular-nums; }
.ctr.over .row span:last-child { color: var(--bad); }
.ctr .bar { height: 6px; border-radius: 6px; background: var(--ghost); overflow: hidden; }
.ctr .bar i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 6px; transition: width .25s var(--ease); }
.ctr.over .bar i { background: var(--bad); }
.ctr .note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.x-line { font-size: 12px; color: var(--muted); }
.x-line.over { color: var(--bad); font-weight: 600; }

.pcard { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #fff; color: #111; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.pcard .ghost { opacity: .5; }
.pcard .av { border-radius: 50%; background: linear-gradient(135deg, #ffc2d9, #b9a8ff); flex: none; display: grid; place-items: center; font-size: 28px; }
.pcard .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.pcard.ig { padding: 16px; }
.ig .head { display: flex; align-items: center; gap: 18px; }
.ig .av { width: 72px; height: 72px; }
.ig .stats { display: flex; gap: 16px; text-align: center; flex: 1; justify-content: space-around; font-size: 12px; color: #555; }
.ig .stats b { display: block; font-size: 16px; color: #111; }
.ig .nm { font-weight: 700; font-size: 14px; margin-top: 12px; overflow-wrap: anywhere; }
.ig .txt { font-size: 14px; line-height: 1.35; margin-top: 2px; }
.ig .btns { display: flex; gap: 6px; margin-top: 14px; }
.ig .btns span { flex: 1; text-align: center; background: #efefef; border-radius: 8px; padding: 7px 0; font-weight: 600; font-size: 13px; }
.ig .btns span:first-child { background: #4a5cf9; color: #fff; }
.pcard.tt { padding: 22px 18px 18px; text-align: center; }
.tt .av { width: 92px; height: 92px; margin: 0 auto; font-size: 36px; }
.tt .nm { font-weight: 700; font-size: 17px; margin-top: 10px; overflow-wrap: anywhere; }
.tt .handle { font-size: 13px; color: #666; }
.tt .stats { display: flex; justify-content: center; gap: 22px; margin: 12px 0; font-size: 12px; color: #666; }
.tt .stats b { display: block; font-size: 16px; color: #111; }
.tt .follow { display: inline-block; background: #e8365a; color: #fff; font-weight: 700; padding: 9px 38px; border-radius: 6px; font-size: 14px; }
.tt .txt { font-size: 14px; margin-top: 12px; line-height: 1.35; }
.pcard.dc { background: #232428; color: #f2f3f5; border-color: #1e1f22; }
.dc .banner { height: 64px; background: linear-gradient(90deg, #c9a3ff, #ffb3d1); }
.dc .body { padding: 0 14px 14px; }
.dc .av { width: 76px; height: 76px; margin-top: -38px; border: 6px solid #232428; }
.dc .nm { font-weight: 700; font-size: 20px; margin-top: 8px; overflow-wrap: anywhere; }
.dc .handle { font-size: 13px; color: #b5bac1; }
.dc .about { background: #1a1b1e; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.dc .about h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: #dbdee1; }
.dc .txt { font-size: 14px; line-height: 1.4; color: #dbdee1; }
.plainline { font-size: 12px; color: var(--muted); margin-top: 8px; }

.actions { display: grid; gap: 10px; }
.btn-primary { min-height: 52px; border-radius: 26px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px; padding: 0 24px; transition: transform .15s var(--ease), filter .15s; box-shadow: 0 6px 18px rgba(91, 61, 245, .28); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { min-height: 46px; border-radius: 10px; border: 0; background: var(--ghost); font-weight: 600; font-size: 15px; padding: 0 18px; }
.btn-ghost:hover { background: var(--soft); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.switchrow { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; background: transparent; border: 0; padding: 0; font-size: 14px; font-weight: 500; }
.switch .track { width: 40px; height: 24px; border-radius: 24px; background: var(--line); position: relative; transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .track::after { transform: translateX(16px); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.recent { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.recent:empty { display: none; }
.recent .chip { flex: none; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--bg); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.right h2 { font-size: 15px; font-weight: 700; margin: 0; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chipb { font-size: 13px; font-weight: 600; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
.tile:hover { box-shadow: var(--shadow); }
.tile.sel { border-color: var(--accent); background: var(--soft); }
.tile .main { all: unset; box-sizing: border-box; cursor: pointer; display: block; padding: 12px 12px 4px; min-height: 100px; border-radius: 16px; }
.tile .main:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .tname { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tile .tname i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.tile .tname i.r1 { background: var(--warn); }
.tile .tname i.r2 { background: var(--bad); }
.tile .tpv { font-size: 20px; line-height: 1.3; margin-top: 8px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tpv.ghost { opacity: .55; }
.tile .tfoot { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 2px 12px; font-size: 11px; color: var(--muted); }
.tile .tfoot .warn { color: var(--bad); font-weight: 700; }
.tile .tbtns { display: flex; }
.tile .tbtns button { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; }
.tile .tbtns button:hover { background: var(--ghost); }
.tile .tbtns svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile .tbtns .fav[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }
.ad-cell { grid-column: 1 / -1; }
.ad { display: grid; place-items: center; height: 100px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; background: transparent; }
.ad.tall { height: 250px; }
.ad-slot { margin-top: 14px; }
.anchor-ad { position: fixed; left: 0; right: 0; bottom: 0; height: 50px; z-index: 60; display: grid; place-items: center; background: var(--panel); border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }

.stepnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.stepnav .btn-ghost, .stepnav .btn-primary { flex: 1; }

.explain { margin-top: 16px; background: var(--panel); border-radius: 14px; padding: 4px 16px; box-shadow: var(--shadow); }
.explain summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.explain p { margin: 0 0 14px; color: var(--muted); }

.prose { max-width: 66ch; margin: 36px 0 0; }
.prose h2, .faq h2, .related h2 { font-size: 26px; letter-spacing: -.035em; font-weight: 800; margin: 0 0 12px; line-height: 1.1; }
.prose p { margin: 0 0 14px; }
.faq { max-width: 66ch; margin: 26px 0 0; }
.faq details { background: var(--panel); border-radius: 14px; padding: 0 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.faq summary { min-height: 52px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.faq p { margin: 0 0 14px; color: var(--muted); }
.related { margin: 26px 0 0; }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-flex; min-height: 44px; align-items: center; padding: 0 16px; border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); text-decoration: none; font-weight: 600; font-size: 14px; }
.related a:hover { background: var(--soft); }

footer { margin-top: 36px; border-top: 1px solid var(--line); padding: 20px var(--gutter) 30px; font-size: 13px; color: var(--muted); }
footer div { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }

#toast { position: fixed; left: 50%; bottom: 74px; transform: translate(-50%, 12px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 22px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 70; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 899px) {
  body:not([data-step]) .step { display: block; }
  body[data-step] .step { display: none; }
  body[data-step="1"] .step[data-step~="1"],
  body[data-step="2"] .step[data-step~="2"],
  body[data-step="3"] .step[data-step~="3"],
  body[data-step="4"] .step[data-step~="4"] { display: block; }
  body[data-step]:not([data-step="1"]) .heading p { display: none; }
  body[data-step]:not([data-step="1"]) .heading { margin-bottom: 12px; }
  .dockb { display: contents; }
}

@media (min-width: 900px) {
  :root { --gutter: 28px; }
  body { padding-bottom: 0; }
  .anchor-ad { display: none; }
  #toast { bottom: 28px; }
  .stepper { display: none; }
  .stepnav { display: none; }
  .heading { margin: 14px 0 22px; }
  .studio { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 22px; align-items: stretch; }
  .left { display: flex; flex-direction: column; gap: 14px; }
  .dockb { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .btn-row { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
