@layer sl-base{:where(img[data-sl-dim]){width:auto;height:auto}}
@layer imported{.cc{--bg:var(--paper);--panel:var(--paper-2);--surface:var(--card);--line:var(--rule);--fg:var(--ink);--muted:var(--ink-2);--r-sm:var(--r);--r-md:var(--r-board);--r-lg:var(--r-card);--ctl-h:var(--ctl,44px);--f-mono:var(--font-mono);--f-body:var(--font-body);
  box-sizing:border-box;width:100%;max-width:calc(var(--page) + 2*max(16px,var(--wp--style--root--padding-left,16px)));margin-inline:auto;
  padding:var(--s-6) max(16px,var(--wp--style--root--padding-right,16px)) var(--s-8) max(16px,var(--wp--style--root--padding-left,16px));
  display:grid;grid-template-columns:minmax(0,1fr);gap:var(--s-6);color:var(--fg);font-family:var(--f-body)}
.cc *,.cc *::before,.cc *::after{box-sizing:border-box}
.cc h1,.cc h2,.cc h3{margin:0;text-wrap:balance;line-height:1.15}
.cc p{margin:0}
.cc svg.i{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
[hidden]{display:none!important}
.cc-sprite{position:absolute;width:0;height:0;overflow:hidden}
.t-crumb{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:13px;color:var(--muted)}
.t-crumb svg.i{width:14px;height:14px}
.t-crumb a{color:inherit;text-decoration:none}
.t-crumb a:hover{color:var(--fg)}
.cc .lead{font-size:17px;color:var(--muted);max-width:62ch}

.t-top{display:grid;gap:14px}
.t-back{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px 0 8px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);color:var(--fg);font:14px var(--f-body);text-decoration:none;justify-self:start}
.t-back svg.i{width:16px;height:16px;transform:scaleX(-1)}
.t-back:hover{border-color:var(--accent-soft)}
.t-head{display:grid;gap:10px;max-width:760px}
.t-head h1{font-size:clamp(26px,3.4vw,38px);font-weight:600}
.t-cols{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:28px;align-items:start}
.t-body{display:grid;gap:12px;min-width:0}
.t-body h2,.t-rel h2{font-size:20px;font-weight:600;margin:0}
.t-body h2:not(:first-child){margin-top:18px}
.t-body .t-steps{display:grid;gap:10px;counter-reset:s;margin:0;padding:0;list-style:none}
.t-body .t-steps li{display:grid;grid-template-columns:30px minmax(0,1fr);gap:10px;align-items:start}
.t-body .t-steps li::before{counter-increment:s;content:counter(s);width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:var(--accent-tint);color:var(--accent);font:600 13px var(--f-mono)}
.t-body details{border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface)}
.t-body summary{list-style:none;display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;font-weight:500}
.t-body summary::-webkit-details-marker{display:none}
.t-body summary::after{content:"";flex:none;width:18px;height:18px;background:var(--muted);transition:transform .25s;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center/contain no-repeat}
.t-body details[open] summary::after{transform:rotate(45deg)}
.t-body details p{padding:0 14px 14px;color:var(--muted);font-size:14px}
.t-rel{display:grid;gap:12px;position:sticky;top:calc(var(--admin-h,0px) + 84px)}
.c-list{display:grid;gap:4px}
.c-list>span{display:contents}
.t-rel:not(:has(.c-list a))>h2,.c-list:not(:has(a)){display:none}
.c-list a{display:flex;align-items:center;gap:10px;padding:8px 6px;border-radius:8px;color:var(--fg);text-decoration:none;font-size:14px}
.c-list a:hover{background:var(--accent-tint)}
.c-list a svg.i{color:var(--muted)}
.t-all{font-size:14px;color:var(--accent);text-decoration:none}
.t-cta{display:grid;gap:8px;padding:16px;border-radius:var(--r-md);border:1px solid var(--line);background:var(--panel)}
.t-cta b{font-weight:600}
.t-cta p{font-size:14px;color:var(--muted)}
.t-cta a{display:inline-flex;align-items:center;gap:6px;color:var(--accent);font-weight:500;text-decoration:none;font-size:14px}
@media (max-width:860px){.t-cols{grid-template-columns:minmax(0,1fr)}.t-rel{position:static}}
@media (prefers-reduced-motion:reduce){.t-body summary::after{transition:none}}

/* Digotech tools: shared shell + controls. Load before any engine (<key>.css).
   Every rule is scoped to .dg-tool; local aliases map the design's token names onto the theme tokens. */
.dg-tool {
  --bg: var(--paper); --panel: var(--paper-2); --surface: var(--card); --line: var(--rule);
  --fg: var(--ink); --muted: var(--ink-2); --ctl-h: var(--ctl, 44px);
  --r-sm: var(--r); --r-md: var(--r-board); --r-lg: var(--r-card);
  --f-mono: var(--font-mono); --f-body: var(--font-body);
  --tool-shadow: 0 10px 30px -12px var(--shadow);
  font-family: var(--f-body); font-size: 15px; line-height: 1.55; color: var(--fg);
  min-width: 0;

  & *, & *::before, & *::after { box-sizing: border-box; }
  & [hidden] { display: none !important; }
  & svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  & p { margin: 0; }

  /* URL box (responsive viewer) */
  & .kc-search { position: relative; display: flex; align-items: center; }
  & .kc-search svg { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
  & .kc-search input { width: 100%; height: var(--ctl-h); padding: 0 14px 0 42px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); font: 15px var(--f-body); outline: none; }
  & .kc-search input:focus { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-tint); }

  /* Tool shell: form left, preview right */
  & .t-tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--tool-shadow); }
  & .t-form { display: grid; gap: 16px; padding: 22px; align-content: start; min-width: 0; }
  & .t-field { display: grid; gap: 6px; }
  & .t-field label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; }
  & .t-field label span { font: 500 12px var(--f-mono); color: var(--muted); }
  & .t-field label span.over { color: var(--warn); }
  & .t-field input, & .t-field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--fg); font: 14.5px/1.5 var(--f-body); outline: none; resize: vertical; }
  & .t-field textarea { field-sizing: content; min-height: 4lh; }
  & .t-field input { height: var(--ctl-h); }
  & .t-field input:focus, & .t-field textarea:focus { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-tint); }
  & .t-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
  & .t-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transition: transform .2s; }
  & .t-bar i.over { background: var(--warn); }
  & .t-prev { display: grid; gap: 14px; padding: 22px; background: var(--panel); border-left: 1px solid var(--line); align-content: start; min-width: 0; }
  & .t-seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); justify-self: start; max-width: 100%; }
  & .t-seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 13.5px var(--f-body); cursor: pointer; display: flex; align-items: center; gap: 6px; }
  & .t-seg button[aria-pressed="true"] { background: var(--accent-tint); color: var(--fg); }

  & .t-tool.dz-wide { grid-template-columns: minmax(0, .72fr) minmax(0, 1.6fr); }
  & .t-tool.dz-one { grid-template-columns: minmax(0, 1fr); }
  & .t-tool.dz-one .t-prev { border-left: 0; border-top: 1px solid var(--line); }
  @media (max-width: 860px) {
    & .t-tool, & .t-tool.dz-wide { grid-template-columns: minmax(0, 1fr); }
    & .t-prev { border-left: 0; border-top: 1px solid var(--line); }
  }
  @media (max-width: 480px) {
    & .t-form, & .t-prev { padding: 16px; }
  }

  /* Shared design-tool controls */
  & .dz-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  & .dz-num { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; font-size: 13.5px; font-weight: 500; min-width: 0; }
  & .dz-num output { font: 500 12px var(--f-mono); color: var(--muted); }
  & .dz-num input[type=range] { grid-column: 1 / -1; width: 100%; }
  /* Self-drawn range (no browser-native look) */
  & input[type=range] { appearance: none; -webkit-appearance: none; height: 22px; margin: 0; background: none; cursor: pointer; }
  & input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line); }
  & input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
  & input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; border: 2px solid var(--surface); background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  & input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  & input[type=range]:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 4px; }
  & .dz-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  & .dz-pair label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); min-width: 0; }
  & .dz-pair input, & .dz-pair select { width: 100%; min-width: 0; height: var(--ctl-h); padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--fg); font: 14px var(--f-body); outline: none; }
  & .dz-pair select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
  & .dz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--ctl-h); padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); font: 500 14px var(--f-body); cursor: pointer; }
  & .dz-btn:hover { border-color: var(--accent-soft); color: var(--accent); }
  & .dz-btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  & .dz-btn.pri:hover { color: var(--on-accent); background: var(--accent-soft); }
  & .dz-btn:disabled { opacity: .45; cursor: default; }
  & .dz-sub { font-size: 12.5px; color: var(--muted); }
  /* Copy button gets its own row above the code so it never covers text */
  & .dz-code { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; min-width: 0; }
  & .dz-code pre { grid-row: 2; margin: 0; padding: 4px 16px 14px; overflow-x: auto; overflow-y: hidden; font: 500 12.5px/1.6 var(--f-mono); color: var(--fg); white-space: pre; background: none; border: 0; }
  & .dz-code .dz-btn { grid-row: 1; justify-self: end; margin: 8px 8px 0; height: 32px; font-size: 13px; padding: 0 10px; }
  & .dz-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  & .dz-grp { display: grid; gap: 16px; }
  & .dz-lab { display: grid; gap: 6px; font-size: 13.5px; font-weight: 500; min-width: 0; }
  & .dz-in { width: 100%; min-width: 0; height: var(--ctl-h); padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--fg); font: 500 13px var(--f-mono); outline: none; }
  & .dz-in:focus, & .dz-pair select:focus, & .dz-pair input:focus { border-color: var(--accent-soft); }
  & .dz-color-row { display: grid; grid-template-columns: var(--ctl-h) minmax(0, 1fr); gap: 8px; }
  & .dz-color { width: var(--ctl-h); height: var(--ctl-h); padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); cursor: pointer; }
  & .dz-ic { display: grid; place-items: center; width: var(--ctl-h); height: var(--ctl-h); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); cursor: pointer; }
  & .dz-ic:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-soft); }
  & .dz-ic:disabled { opacity: .4; cursor: default; }
  /* Self-drawn checkbox */
  & .dz-chk { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 14px; cursor: pointer; }
  & .dz-chk input { appearance: none; -webkit-appearance: none; display: grid; place-items: center; flex: none; width: 18px; height: 18px; margin: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); cursor: pointer; }
  & .dz-chk input:checked { background: var(--accent); border-color: var(--accent); }
  & .dz-chk input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
  & .dz-chk input:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
  /* Number tiles */
  & .dz-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
  & .dz-stat { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
  & .dz-stat b { font: 600 22px/1.2 var(--f-body); color: var(--fg); font-variant-numeric: tabular-nums; }
  & .dz-stat span { font-size: 12.5px; color: var(--muted); }
  & .dz-code.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  & .dz-ok, & .dz-err { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
  & .dz-ok { color: var(--accent); }
  & .dz-err { color: var(--warn); }
  & .dz-ok svg, & .dz-err svg { margin-top: 1px; }
  /* File drop zone (label wraps a hidden file input, so a click opens the picker) */
  & .dz-drop { position: relative; display: grid; justify-items: center; gap: 4px; padding: 22px 16px; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--panel); text-align: center; cursor: pointer; }
  & .dz-drop input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
  & .dz-to svg.i { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-inline: 2px; }
  & .dz-drop svg.i { width: 24px; height: 24px; color: var(--accent); }
  & .dz-drop b { font-size: 14.5px; font-weight: 600; }
  & .dz-drop:hover, & .dz-drop.on, & .dz-drop:focus-within { border-color: var(--accent-soft); background: var(--accent-tint); }
  /* Image preview on a checkerboard so transparency shows */
  & .dz-img { display: grid; place-items: center; min-height: 180px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: conic-gradient(var(--panel) 25%, var(--surface) 0 50%, var(--panel) 0 75%, var(--surface) 0) 0 0 / 18px 18px; overflow: hidden; }
  & .dz-img img, & .dz-img canvas { display: block; max-width: 100%; max-height: 420px; height: auto; border-radius: 4px; }
  /* Strength / usage meter */
  & .dz-meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  & .dz-meter i { height: 6px; border-radius: 3px; background: var(--line); }
  & .dz-meter[data-v="1"] i:nth-child(-n+1) { background: var(--warn); }
  & .dz-meter[data-v="2"] i:nth-child(-n+2) { background: var(--warn); }
  & .dz-meter[data-v="3"] i:nth-child(-n+3) { background: var(--accent-soft); }
  & .dz-meter[data-v="4"] i { background: var(--accent); }
  @media (max-width: 560px) {
    & .dz-2 { grid-template-columns: minmax(0, 1fr); }
  }
  @media (prefers-reduced-motion: reduce) {
    & * { animation: none !important; transition: none !important; }
  }
}

/* Google result preview (needs _core.css). */
.dg-tool {
  --serp-link: oklch(45% .17 265);
  --serp-url: oklch(40% .02 190);

  & .t-serp { display: grid; gap: 3px; padding: 16px 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
  & .t-serp.mob { max-width: 360px; }
  & .t-serp .site { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
  & .t-serp .site > div { min-width: 0; }
  & .t-serp .site i { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); flex: none; }
  & .t-serp .site small { display: block; color: var(--serp-url); font-size: 12px; overflow-wrap: anywhere; }
  & .t-serp h3 { margin: 6px 0 0; color: var(--serp-link); font: 400 19px/1.3 var(--f-body); overflow-wrap: anywhere; }
  & .t-serp p { font-size: 13.5px; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
  & .t-tips { display: grid; gap: 8px; font-size: 13.5px; }
  & .t-tips div { display: flex; gap: 8px; align-items: flex-start; }
  & .t-tips svg.i { width: 16px; height: 16px; margin-top: 2px; }
  & .t-tips .ok svg { color: var(--accent); }
  & .t-tips .no svg { color: var(--warn); }
}
:root[data-mode="dark"] .dg-tool, :root[data-mode="moon"] .dg-tool {
  --serp-link: oklch(78% .1 265);
  --serp-url: oklch(78% .02 176);
}

/* Bento grid builder (needs _core.css). */
.dg-tool {
  & .bt-top { justify-content: space-between; }
  & .bt-stage { display: grid; gap: var(--bt-gap, 12px); grid-template-columns: repeat(var(--bt-cols, 4), minmax(0, 1fr)); grid-auto-rows: var(--bt-row, 88px); grid-auto-flow: dense; padding: 14px; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--surface); margin-inline: auto; width: 100%; }
  & .bt-stage.mob { max-width: 360px; }
  & .bt-tile { position: relative; display: grid; place-items: center; min-width: 0; border-radius: var(--bt-r, 16px); background: var(--accent-tint); border: 1px solid var(--accent-tint); color: var(--accent); font: 600 13px var(--f-mono); cursor: grab; user-select: none; transition: transform .2s, opacity .2s; }
  & .bt-tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
  & .bt-tile.drag { opacity: .4; }
  & .bt-tile.over { transform: scale(.96); }
  & .bt-tile small { position: absolute; bottom: 6px; right: 8px; font: 500 10.5px var(--f-mono); color: var(--muted); }
  & .bt-sel { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
  & .bt-sel b { font-size: 13.5px; }
  & .bt-sel .dz-row > .dz-sub { width: 44px; }
}

/* Multi-screen viewer (needs _core.css). */
.dg-tool {
  & .rs-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  & .rs-bar .kc-search { flex: 1; min-width: min(100%, 240px); }
  & .rs-bar .kc-search input { padding-right: 14px; }
  & .rs-bar .kc-search input[aria-invalid="true"] { border-color: var(--warn); }
  & .rs-dev { display: inline-flex; flex-wrap: wrap; gap: 6px; }
  & .rs-dev button { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); font: 14px var(--f-body); cursor: pointer; }
  & .rs-dev button[aria-pressed="true"] { color: var(--fg); border-color: var(--accent-soft); background: var(--accent-tint); }
  & .rs-stage { display: flex; justify-content: center; align-items: flex-end; gap: 18px; min-height: 200px; overflow: hidden; }
  & .rs-frame { display: grid; gap: 8px; justify-items: center; flex: none; }
  & .rs-frame > span { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px var(--f-mono); color: var(--muted); }
  & .rs-frame .dz-ic { width: 32px; height: 32px; }
  & .rs-shell { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--tool-shadow); }
  & .rs-shell iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: var(--surface); }
}

/* Fluid type / space scale (needs _core.css). */
.dg-tool {
  & .fl-list { display: grid; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  & .fl-item { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  & .fl-item:last-child { border-bottom: 0; }
  & .fl-item code { font: 500 11.5px var(--f-mono); color: var(--muted); background: none; padding: 0; }
  & .fl-item .fl-px { font: 500 11.5px var(--f-mono); color: var(--accent); }
  & .fl-item .fl-s { grid-column: 1 / -1; line-height: 1.15; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  & .fl-item .fl-bar { grid-column: 1 / -1; height: 12px; border-radius: 4px; background: var(--accent); opacity: .75; max-width: 100%; }
  & .fl-vw { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
  & .fl-vw input { width: 100%; accent-color: var(--accent); }
  & .fl-vw output { font: 500 12px var(--f-mono); color: var(--fg); }
}

/* CSS Grid / Flexbox playground (needs _core.css). */
.dg-tool {
  & .lo-stage { min-height: 320px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  & .lo-item { display: grid; place-items: center; min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--accent-tint); border: 1px solid var(--accent-tint); color: var(--accent); font: 600 13px var(--f-mono); }
}

/* Palette from one colour (needs _core.css). Swatch colours are the user's output, set inline. */
.dg-tool {
  & .pl-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  & .pl-sw { flex: 1 1 96px; display: grid; gap: 2px; align-content: end; min-height: 92px; padding: 10px; border-radius: var(--r-sm); font: 500 11.5px var(--f-mono); }
  & .pl-sw b { font: 600 13px var(--f-body); }
  & .pl-sw small { font: 500 11px var(--f-body); opacity: .85; }
  & .pl-sw.base { outline: 2px solid var(--fg); outline-offset: 2px; }
  & .pl-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  & .pl-card { display: grid; gap: 8px; justify-items: start; padding: 16px; border: 1px solid; border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5; min-width: 0; }
  & .pl-card b { font-size: 15px; }
  & .pl-badge { padding: 2px 8px; border-radius: 6px; font: 600 11.5px var(--f-body); }
  & .pl-btn { padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600; }
  @media (max-width: 560px) { & .pl-demo { grid-template-columns: 1fr; } }
}

/* Shadow + glass builder (needs _core.css). */
.dg-tool {
  & .sh-stage { display: grid; place-items: center; min-height: 300px; padding: 28px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
  & .sh-stage.glass { background: radial-gradient(circle at 22% 28%, var(--accent) 0 17%, transparent 17.5%), radial-gradient(circle at 78% 74%, var(--warn) 0 15%, transparent 15.5%), radial-gradient(circle at 74% 22%, var(--accent-soft) 0 9%, transparent 9.5%), var(--panel); }
  & .sh-card { display: grid; gap: 6px; align-content: end; width: min(280px, 100%); min-height: 170px; padding: 20px; background: var(--surface); color: var(--fg); font-size: 13.5px; line-height: 1.5; }
  & .sh-card b { font-size: 16px; }
}

/* CSS gradient builder (needs _core.css). */
.dg-tool {
  & .gr-stops { display: grid; gap: 8px; }
  & .gr-stop { display: grid; grid-template-columns: var(--ctl-h) minmax(0, 96px) minmax(0, 1fr) 38px var(--ctl-h); gap: 8px; align-items: center; }
  & .gr-stop input[type=range] { width: 100%; min-width: 0; }
  & .gr-stop output { font: 500 12px var(--f-mono); color: var(--muted); text-align: right; }
  & .gr-pre { display: flex; flex-wrap: wrap; gap: 8px; }
  & .gr-pre button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
  & .gr-pre button:hover, & .gr-pre button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
  & .gr-prev { min-height: 300px; border-radius: var(--r-md); border: 1px solid var(--line); }
  @media (max-width: 480px) { & .gr-stop { grid-template-columns: var(--ctl-h) minmax(0, 78px) minmax(0, 1fr) 34px var(--ctl-h); gap: 6px; } }
}

/* Colour converter (needs _core.css). The two contrast boxes show fixed white / dark grounds on purpose. */
.dg-tool {
  & .cv-list { display: grid; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  & .cv-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
  & .cv-row:last-child { border-bottom: 0; }
  & .cv-row b { font: 600 12px var(--f-mono); color: var(--muted); }
  & .cv-row code { font: 500 13px var(--f-mono); color: var(--fg); background: none; padding: 0; overflow-wrap: anywhere; }
  & .cv-row .dz-btn { height: 32px; padding: 0 10px; font-size: 13px; }
  & .cv-sw { min-height: 170px; border-radius: var(--r-md); border: 1px solid var(--line); }
  & .cv-ct { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  & .cv-box { display: grid; gap: 4px; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); min-width: 0; }
  & .cv-aa { font-size: 22px; font-weight: 700; }
  & .cv-box small { font-size: 12px; }
  @media (max-width: 560px) { & .cv-ct { grid-template-columns: 1fr; } }
}

/* Slug maker (needs _core.css). */
.dg-tool {
  & .sl-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  & .sl-list li { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
  & .sl-list code { font: 500 13.5px var(--f-mono); color: var(--fg); background: none; padding: 0; overflow-wrap: anywhere; }
  & .sl-list small { font-size: 12px; color: var(--muted); }
}

/* UTM link builder (needs _core.css). */
.dg-tool {
  & .ut-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  & .ut-chips button { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); font: 500 12.5px var(--f-mono); cursor: pointer; }
  & .ut-chips button:hover { color: var(--accent); border-color: var(--accent-soft); }
  & .ut-tab { display: grid; margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  & .ut-tab:empty { display: none; }
  & .ut-tab div { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
  & .ut-tab div:last-child { border-bottom: 0; }
  & .ut-tab dt { font: 500 12px var(--f-mono); color: var(--muted); }
  & .ut-tab dd { margin: 0; font: 500 13px var(--f-mono); overflow-wrap: anywhere; }
}

/* robots.txt builder (needs _core.css). */
.dg-tool {
  & .rb-chks { display: grid; gap: 4px; }
}

/* Keyword density (needs _core.css). */
.dg-tool {
  & .kd-list { display: grid; gap: 10px; }
  & .kd-list:empty { display: none; }
  & .kd-row { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
  & .kd-row.main { border-color: var(--accent-soft); }
  & .kd-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
  & .kd-h b { font-weight: 600; overflow-wrap: anywhere; }
  & .kd-h span { font: 500 12.5px var(--f-mono); color: var(--muted); }
  & .kd-row small { font-size: 12.5px; color: var(--muted); }
  & .kd-row small.kd-ok { color: var(--accent); }
  & .kd-row small.kd-high { color: var(--warn); }
  & .kd-top { display: grid; gap: 8px; }
  & .kd-top b { font-size: 13.5px; }
  & .kd-top ol { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  & .kd-top ol:empty { display: none; }
  & .kd-top li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
  & .kd-top li:last-child { border-bottom: 0; }
  & .kd-top li span { overflow-wrap: anywhere; min-width: 0; }
  & .kd-top li b { font: 500 12.5px var(--f-mono); color: var(--muted); }
}

/* FAQ schema (needs _core.css). */
.dg-tool {
  & .fq-list { display: grid; gap: 12px; }
  & .fq-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); min-width: 0; }
  & .fq-row .t-field input, & .fq-row .t-field textarea { background: var(--surface); }
  & .fq-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  & .fq-h b { font-size: 13px; color: var(--muted); font-weight: 600; }
  & .fq-h .dz-ic { width: 32px; height: 32px; }
  & .fq-h .dz-ic svg.i { width: 16px; height: 16px; }
  & .fq-add { justify-self: start; }
}

/* Word counter (needs _core.css). */
.dg-tool {
  & .ct-clear { justify-self: start; }
  /* 7 stats: word count spans the top, the other 6 fill 2 full columns. */
  &[data-tool="count"] .dz-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  &[data-tool="count"] .dz-stat:first-child { grid-column: 1 / -1; }
}

/* Text case converter (needs _core.css). */
.dg-tool {
  & .cs-seg { flex-wrap: wrap; }
}

/* Text diff (needs _core.css). */
.dg-tool {
  & .df-out { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.7; min-width: 0; min-height: 120px; }
  & .df-out ins { text-decoration: none; background: color-mix(in oklch, var(--accent) 22%, transparent); border-radius: 3px; }
  & .df-out del { color: var(--muted); background: color-mix(in oklch, var(--warn) 20%, transparent); border-radius: 3px; }
  & .df-out del + ins { margin-inline-start: 3px; }
}

/* JSON formatter (needs _core.css). */
.dg-tool {
  & .js-src { font: 500 12.5px/1.6 var(--f-mono); tab-size: 2; }
  & .js-out pre { tab-size: 2; }
}

/* PX <-> REM converter (needs _core.css). */
.dg-tool {
  & .rm-src { font: 500 12.5px/1.6 var(--f-mono); }
  & .rm-tab { display: grid; gap: 8px; }
  & .rm-tab b { font-size: 13.5px; }
  & .rm-tab table { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); font: 500 13px var(--f-mono); }
  & .rm-tab th { text-align: left; padding: 7px 14px; color: var(--muted); font: 600 12px var(--f-body); border-bottom: 1px solid var(--line); }
  & .rm-tab td { padding: 6px 14px; border-bottom: 1px solid var(--line); }
  & .rm-tab tr:last-child td { border-bottom: 0; }
}

/* CSS / JS minifier (needs _core.css). */
.dg-tool {
  & .mn-src { font: 500 12.5px/1.6 var(--f-mono); }
  & .mn-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Image compressor (needs _core.css). */
.dg-tool {
  & .wp-list { display: grid; gap: 10px; }
  & .wp-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  & .wp-row img { width: 72px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--panel); }
  & .wp-row:has(> .dz-err) { grid-template-columns: minmax(0, 1fr); }
  & .wp-meta { display: grid; gap: 2px; min-width: 0; font-size: 13.5px; }
  & .wp-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  & .wp-all { justify-self: start; }
  @media (max-width: 480px) {
    & .wp-row { grid-template-columns: 56px minmax(0, 1fr); }
    & .wp-row img { width: 56px; height: 44px; }
    & .wp-row .dz-btn { grid-column: 1 / -1; }
  }
}

/* Social image cropper (needs _core.css). */
.dg-tool {
  & .cr-size { grid-template-columns: minmax(0, 1fr); }
  & .cr-stage { display: grid; place-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: conic-gradient(var(--panel) 25%, var(--surface) 0 50%, var(--panel) 0 75%, var(--surface) 0) 0 0 / 18px 18px; }
  & .cr-stage canvas { display: block; max-width: 100%; max-height: 440px; width: auto; height: auto; border-radius: 4px; outline: 1px solid var(--accent-soft); cursor: grab; touch-action: none; }
  & .cr-stage canvas:active { cursor: grabbing; }
}

/* Image format converter: only uses _core.css parts. */

/* QR code maker (needs _core.css). */
.dg-tool {
  & .qr-box { display: grid; place-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  & .qr-box svg { display: block; width: min(100%, 300px); height: auto; border-radius: 4px; }
}

/* Social post counter (needs _core.css). */
.dg-tool {
  & .po-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  & .po-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 13.5px; }
  & .po-name { font-weight: 500; min-width: 0; }
  & .po-num { font: 500 12px var(--f-mono); color: var(--muted); text-align: right; }
  & .po-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
  & .po-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
  & .po-list li.over .po-bar i { background: var(--warn); }
  & .po-list li.over .po-num { color: var(--warn); }
  @media (max-width: 480px) {
    & .po-list li { grid-template-columns: minmax(0, 1fr); }
    & .po-num { text-align: left; }
  }
}

/* Chat link maker (needs _core.css). */
.dg-tool {
  & .ch-open { justify-self: start; text-decoration: none; }
  & .ch-open[aria-disabled="true"] { opacity: .5; pointer-events: none; }
}

/* Password generator (needs _core.css). */
.dg-tool {
  & .pw-out { font-size: 17px; letter-spacing: .02em; }
  & .pw-again { justify-self: start; }
}

/* Base64 encode / decode (needs _core.css). */
.dg-tool {
  & .b6-dl { justify-self: start; }
}

/* Hash generator (needs _core.css). */
.dg-tool {
  & .dz-code.hs-hit { border-color: var(--accent); background: var(--accent-tint); }
}

}