:root {
  --bg: #111113;
  --surface: #1a1a1e;
  --surface-2: #222227;
  --line: #2a2a30;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --coral: #ff8a5c;
  --rose: #e2457e;
  --violet: #6a2fe0;
  --brand: linear-gradient(135deg, var(--coral), var(--rose) 55%, var(--violet));
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--coral); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 !important; }

header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(17, 17, 19, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; text-decoration: none; color: var(--text); }
.logo img { width: 32px; height: 32px; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a.link { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav a.link:hover { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
  font: 600 16px/1.2 inherit; font-family: inherit; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 28px rgba(226, 69, 126, .35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 34px rgba(226, 69, 126, .45); }
.btn-light { background: #fff; color: #111113; min-height: 52px; font-size: 17px; }
.btn-light:hover { transform: translateY(-1px); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn:focus-visible, .link-btn:focus-visible, summary:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

.eyebrow {
  display: inline-block; margin-bottom: 12px;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.grad { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 { font-size: clamp(34px, 6vw, 58px); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 16px; }
h2 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 14px; }
h3 { font-size: 19px; margin: 0 0 6px; }
p, li { color: #d4d4d8; }
.lead { color: var(--muted); font-size: clamp(17px, 2.2vw, 20px); margin: 0 0 28px; max-width: 640px; }

/* Tool */
.hero { padding: 48px 0 24px; text-align: center; }
.hero .lead { margin-left: auto; margin-right: auto; }
.tool {
  scroll-margin-top: 80px;
  max-width: 760px; margin: 0 auto; padding: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 230px; padding: 28px 20px; text-align: center; cursor: pointer;
  border: 2px dashed #3a3a42; border-radius: var(--radius); background: var(--bg);
  transition: border-color .15s ease, background .15s ease;
}
.drop:hover, .drop.drag { border-color: var(--rose); background: #17141a; }
.drop svg { width: 44px; height: 44px; }
.drop-title { font-size: 21px; font-weight: 700; color: var(--text); }
.drop-sub { color: var(--muted); font-size: 14px; }
.drop .btn { margin: 6px 0 2px; pointer-events: none; }
#file:focus-visible + .drop { outline: 2px solid var(--coral); outline-offset: 3px; }
.touch-only { display: none; }
@media (hover: none) { .mouse-only { display: none; } .touch-only { display: inline; } }

.status { margin: 12px 4px 0; padding: 0; color: var(--muted); font-size: 15px; }
.status.err { color: #ffb4a0; background: #2a1815; border: 1px solid #5a2a22; border-radius: 10px; padding: 12px 14px; }

.stage {
  display: grid; place-items: center; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); min-height: 160px;
  background: #0d0d0f;
}
.stage img {
  background-color: #e8e8ec;
  background-image: linear-gradient(45deg, #cfcfd6 25%, transparent 25%, transparent 75%, #cfcfd6 75%), linear-gradient(45deg, #cfcfd6 25%, transparent 25%, transparent 75%, #cfcfd6 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px;
}
.stage img { max-height: min(56vh, 520px); width: auto; max-width: 100%; object-fit: contain; }
#result.working .stage { opacity: .45; }
#result.working .btn-light, #result.working .dl-row .btn { pointer-events: none; opacity: .5; }
.meta-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 14px 2px 14px; }
.meta-row b { display: block; word-break: break-word; }
.meta-row span { color: var(--muted); font-size: 14px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--coral); font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; margin: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.seg label { display: block; }
.seg span { display: block; text-align: center; padding: 11px 8px; min-height: 44px; border-radius: 999px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px #3a3a42; }
.seg input:focus-visible + span { outline: 2px solid var(--coral); outline-offset: 2px; }
.hint { margin: 12px 4px 0; color: var(--muted); font-size: 14px; }
.quality { display: flex; align-items: center; gap: 14px; margin: 14px 4px 0; color: var(--muted); font-size: 14px; }
.quality label { white-space: nowrap; }
.quality input { flex: 1; min-width: 0; accent-color: var(--rose); height: 32px; }
#download { width: 100%; margin-top: 18px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.size { margin: 10px 4px 0; color: var(--muted); font-size: 14px; text-align: center; }

.cta-card { margin-top: 18px; padding: 18px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cta-card b { display: block; font-size: 17px; color: var(--text); }
.cta-card span { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; margin-top: 2px; }

.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.trust li { padding: 6px 12px; border-radius: 999px; font-size: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }

/* Content */
.content { max-width: 760px; margin: 0 auto; padding: 24px 24px 8px; }
.content section { margin-top: 56px; }
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 52px; margin: 0 0 22px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 2px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 16px;
}
ol.steps p { margin: 0; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--surface); }
td { color: #d4d4d8; }
td:first-child { color: var(--text); font-weight: 600; }
details { border-bottom: 1px solid var(--line); padding: 16px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--text); }
details p { margin: 10px 0 0; }
.guides { display: grid; gap: 10px; padding: 0; margin: 14px 0 0; list-style: none; }
.guides a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; }
.guides a:hover { border-color: #3a3a42; }
.guides small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }

.final { text-align: center; margin: 72px auto 0; max-width: 760px; padding: 40px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.final h2 { margin-top: 0; }
.final p { color: var(--muted); margin: 0 0 22px; }

footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 36px 0 48px; color: var(--muted); font-size: 14px; }
.foot { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }
.legal { margin-top: 18px; font-size: 12.5px; color: #71717a; max-width: 760px; }

@media (max-width: 860px) { .nav a.link { display: none; } }
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  body { font-size: 16.5px; }
  .hero { padding-top: 32px; }
  .tool { padding: 10px; border-radius: 16px; }
  .drop { min-height: 210px; }
  .stage { min-height: 120px; padding: 8px; }
  .stage img { max-height: 32vh; }
  .content { padding: 16px 16px 8px; }
  .cta-card { flex-direction: column; align-items: stretch; text-align: left; }
  .cta-card .btn { width: 100%; }
  .final .btn { width: 100%; }
  ol.steps > li { padding-left: 46px; }
}
@media (prefers-reduced-motion: reduce) { .btn, .drop { transition: none; } }

/* Hub */
.hub-cat { margin-top: 40px; }
.hub-cat h2 { font-size: 22px; }
.guides small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }

.btn-ghost { border: 1px solid #3a3a42; color: var(--text); background: transparent; min-height: 52px; font-size: 17px; }
.btn-ghost:hover { background: var(--surface-2); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.dl-row .btn { width: 100%; }
.dl-row.single { grid-template-columns: 1fr; }
.settings { margin: 14px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.settings summary { padding: 12px 14px; }
.settings .body { padding: 0 14px 14px; display: grid; gap: 14px; }
.field label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.field select, .field input[type="text"], .field input[type="number"] { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid #3a3a42; background: var(--surface); color: var(--text); font: inherit; }
.field input[type="file"] { width: 100%; color: var(--muted); font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; color: #d4d4d8; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--rose); }
@media (max-width: 560px) { .dl-row { grid-template-columns: 1fr; } }

/* Layer list */
.layer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 4px 2px 10px; }
.layer-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.layer { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; padding: 8px 12px 8px calc(12px + var(--depth, 0) * 18px); border-bottom: 1px solid var(--line); }
.layer:last-child { border-bottom: 0; }
.layer .chk { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.layer .chk input { width: 20px; height: 20px; accent-color: var(--rose); flex: none; }
.layer .lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.layer .lmeta { grid-column: 1; color: var(--muted); font-size: 13px; padding-left: 30px; }
.layer .link-btn { grid-row: 1 / span 2; grid-column: 2; align-self: center; min-height: 44px; padding: 0 6px; }
.layer.dim { opacity: .55; }
#preview-box { margin-top: 14px; }
#preview-box .meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 2px 0; color: var(--muted); font-size: 14px; }
#build { width: 100%; margin-top: 16px; }
#build:disabled { opacity: .5; cursor: not-allowed; }
#download-zip { width: 100%; margin-top: 10px; }

/* Shortcuts */
kbd { font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 4px 7px; border-radius: 6px; border: 1px solid #3a3a42; border-bottom-width: 2px; background: var(--surface); color: var(--text); white-space: nowrap; display: inline-block; }
.field input[type="search"] { width: 100%; min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 1px solid #3a3a42; background: var(--bg); color: var(--text); font: inherit; font-size: 17px; }
.field input[type="search"]:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.tool .field + .seg { margin-top: 12px; }
body[data-os="win"] .mac, body[data-os="mac"] .win { display: none; }
.sc-table td:first-child small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.sc-table td.win, .sc-table td.mac { white-space: nowrap; }
.sc-group { margin-top: 36px; }
.sc-group h3 { font-size: 20px; margin-bottom: 4px; }
.top-sc { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.sc-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sc-card b { color: var(--text); }
.sc-table { min-width: 0; }
.sc-table td.win, .sc-table td.mac { white-space: nowrap; }
@media (max-width: 560px) { .sc-table th, .sc-table td { padding: 10px 8px; } .sc-table td:first-child { min-width: 120px; } }

/* Blend playground */
.tool-wide { max-width: 920px; }
.bl-stage { border: 1px solid var(--line); border-radius: var(--radius); background: #0d0d0f; padding: 8px; display: grid; place-items: center; }
.bl-stage canvas { width: 100%; max-width: 640px; height: auto; aspect-ratio: 8 / 5; border-radius: 8px; display: block; }
.bl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.pick-own { display: inline-block; margin-top: 6px; font-size: 14px; }
.grid-title { margin: 26px 2px 10px; font-size: 18px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.mode-thumb { appearance: none; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; text-align: center; display: grid; gap: 6px; }
.mode-thumb canvas { width: 100%; height: auto; aspect-ratio: 8 / 5; border-radius: 6px; display: block; }
.mode-thumb:hover { border-color: #3a3a42; }
.mode-thumb.on { border-color: var(--rose); box-shadow: 0 0 0 1px var(--rose) inset; }
.mode-thumb:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
@media (max-width: 560px) { .bl-row { grid-template-columns: 1fr; } .mode-grid { grid-template-columns: repeat(2, 1fr); } }

dl.modes { margin: 0 0 8px; }
dl.modes dt { font-weight: 700; color: var(--text); margin-top: 18px; }
dl.modes dd { margin: 4px 0 0; color: #d4d4d8; }
code { font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 2px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: #e4e4e7; }
.content h3 { margin: 32px 0 6px; font-size: 21px; }

#panel-develop .field { margin: 14px 2px 0; }
.field input[type="range"] { width: 100%; accent-color: var(--rose); height: 32px; }
#hdr-panel { margin-bottom: 14px; }
#hdr-panel .seg { margin-top: 12px; }

/* EXIF */
.notice { margin: 14px 0; padding: 14px 16px; border-radius: var(--radius); border: 1px solid #5a3a22; background: #2a1d15; color: #ffd9bf; font-size: 15px; }
.notice.ok { border-color: #1f4a35; background: #13251c; color: #c8f1db; }
.notice ul { margin: 6px 0 0 18px; padding: 0; color: inherit; }
.notice li { color: inherit; }
.notice a { color: #ffb48a; }
.tags-box { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.tags-box summary { padding: 12px 14px; }
#tags { padding: 0 14px 14px; }
#tags h4 { margin: 18px 0 6px; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#tags table { min-width: 0; font-size: 14px; }
#tags td { word-break: break-word; }
#tags td:first-child { width: 38%; color: var(--muted); font-weight: 500; }
.pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #3a2218; color: #ffb48a; border: 1px solid #5a3a22; white-space: nowrap; }
.clean-box { margin-top: 14px; display: grid; gap: 12px; }
.clean-box .btn { width: 100%; }
#stage[hidden] { display: none; }

/* Palette and picker */
.seg.four { grid-template-columns: repeat(4, 1fr); }
.pick-stage { cursor: crosshair; }
.pick-stage canvas { width: 100%; max-height: min(60vh, 560px); object-fit: contain; touch-action: none; border-radius: 8px; display: block; }
.picked { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.chip { width: 52px; height: 52px; border-radius: 12px; border: 1px solid #3a3a42; flex: none; }
.picked-text { display: grid; gap: 2px; min-width: 0; flex: 1; font-size: 14px; color: var(--muted); }
.picked-text b { font-size: 20px; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.swatch { appearance: none; border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 14px; min-height: 110px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; text-align: left; cursor: pointer; font: inherit; font-size: 13px; }
.swatch b { font-size: 17px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.swatch:hover { transform: translateY(-2px); }
.swatch:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
textarea.code { width: 100%; margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px solid #3a3a42; background: var(--bg); color: #e4e4e7; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }

/* DPI calculator */
.tool-compact .drop { min-height: 120px; padding: 16px; gap: 6px; }
.tool-compact .drop svg { width: 32px; height: 32px; }
.tool-compact .drop-title { font-size: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.field input[type="number"] { appearance: textfield; }
.results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.card { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); display: grid; gap: 4px; align-content: start; }
.card.big { grid-column: 1 / -1; background: var(--surface-2); }
.card span { color: var(--muted); font-size: 14px; }
.card strong { font-size: 22px; line-height: 1.25; color: var(--text); }
.card.big strong { font-size: clamp(26px, 5vw, 36px); }
.card small { color: var(--muted); font-size: 13px; line-height: 1.45; }
@media (max-width: 700px) { .field-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .results { grid-template-columns: 1fr; } }
.field-grid.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 480px) { .field-grid.two { grid-template-columns: 1fr; } }
.tool .field + .field-grid, .tool .field-grid + .check { margin-top: 14px; }
.check + .seg { margin-top: 14px; }
