:root {
  color-scheme: dark;
  --bg: #101310;
  --panel: #181c19;
  --text: #f1f4e9;
  --soft: #a6afa3;
  --quiet: #8f9a8d;
  --accent: #c8ff60;
  --line: #343b32;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.site-header { border-bottom: 1px solid #2b322a; }
.header-inner, main { width: min(1024px, calc(100% - clamp(40px, 10vw, 140px))); margin: auto; }
.header-inner, .header-actions, .wordmark, .local, .editor-toolbar, .editor-tools, .editor-toolbar h2, .editor-foot, .legend, .output-head, #copy-all { display: flex; align-items: center; }
.header-inner { height: 62px; justify-content: space-between; }
.wordmark { gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: -.04em; }
.brand-glyph { display: grid; place-items: center; background: var(--accent); color: #17200d; height: 27px; width: 32px; border-radius: 5px; font: 800 italic 16px/1 var(--mono); letter-spacing: -2px; padding-right: 3px; }
.header-actions { gap: 24px; font-size: 12px; }
.local { gap: 8px; color: var(--soft); }
.status-lamp { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
#focus-input { display: flex; align-items: center; gap: 9px; color: var(--soft); padding: 4px 0; font-size: 12px; background: transparent; border: 0; }
kbd { min-width: 18px; line-height: 17px; text-align: center; font-family: var(--mono); font-size: 12px; border: 1px solid #485042; border-radius: 3px; color: #c0c9ba; }
main { padding-bottom: 46px; }
.hero { display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; column-gap: 22px; min-height: 186px; padding: 25px 0 22px; }
h1, h2, p, pre, ol { margin: 0; }
h1 { font-size: clamp(45px, 5.3vw, 69px); line-height: 1.13; font-weight: 720; letter-spacing: -.065em; }
.prompt-cursor { display: inline-block; width: .35em; height: .095em; background: var(--accent); margin-left: .13em; vertical-align: -.045em; }
.intro p { color: var(--soft); font-size: 15px; line-height: 1.75; margin-top: 13px; }
.scope-figure { height: 136px; min-width: 0; }
#signal { width: 100%; height: 100%; display: block; }
.editor-shell { --pad-x: 22px; border: 1px solid #475140; background: var(--panel); border-radius: 9px; overflow: hidden; transition: border-color .18s, box-shadow .18s; }
.editor-shell:focus-within { border-color: #889f65; box-shadow: 0 0 0 2px #c8ff6009; }
.editor-toolbar { justify-content: space-between; padding: 0 var(--pad-x); height: 43px; background: #20251f; border-bottom: 1px solid #343b32; }
.editor-toolbar h2 { font-size: 14px; font-weight: 600; gap: 9px; }
.terminal-mark { color: var(--accent); font: 700 18px/1 var(--mono); letter-spacing: -2px; margin-right: 1px; }
.editor-tools { gap: 13px; height: 100%; }
.editor-tools button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--soft); height: 100%; padding: 0 2px; font-size: 12px; }
.editor-tools button:hover, #focus-input:hover { color: var(--accent); }
.tool-rule { height: 12px; width: 1px; background: #4a5146; }
.replay-icon { font: 17px/1 var(--sans); }
.edit-area { position: relative; height: 133px; background: var(--panel); isolation: isolate; }
#mirror, #source { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 15px var(--pad-x) 8px; margin: 0; font: 15px/1.75 var(--mono), var(--sans); letter-spacing: 0; white-space: pre-wrap; overflow-wrap: break-word; tab-size: 4; overflow: auto; border-radius: 0; scrollbar-width: thin; scrollbar-color: #526047 transparent; font-variant-ligatures: none; }
#mirror { pointer-events: none; background: transparent; color: #e2e7dc; }
#source { background: transparent; outline: none; resize: none; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--accent); }
#source::placeholder { color: var(--quiet); -webkit-text-fill-color: var(--quiet); opacity: 1; }
#source::selection { background: #aebd9955; }
.url-token { color: var(--accent); background: transparent; }
.url-token.duplicate { color: #b0a58d; text-decoration: line-through; text-decoration-color: #aa9879; }
.url-token.trace-active { background: #c8ff6026; color: #deff9d; outline: 1px solid #c8ff605f; border-radius: 2px; }
.url-token.duplicate.trace-active { text-decoration-color: #daff8f; }
.editor-foot { justify-content: space-between; padding: 4px var(--pad-x) 12px; font: 12px/1.2 var(--mono), var(--sans); color: var(--quiet); }
.legend { gap: 6px; font: 12px/1.2 var(--sans); }
.match-dot, .repeat-dot { display: inline-block; width: 10px; height: 2px; background: var(--accent); }
.repeat-dot { margin-left: 7px; background: #ad9c7e; }
.duplicate-legend { display: inline-flex; align-items: center; gap: 6px; }
main:has(#dedupe:not(:checked)) .duplicate-legend { display: none; }
.scan-line { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: linear-gradient(180deg, transparent 0%, #c8ff600a 88%, #c8ff603d 99.5%, transparent); }
.scan-active .scan-line { animation: scan-field .48s ease-out both; }
@keyframes scan-field { 0% { transform: translateY(-100%); opacity: 0; } 15% { opacity: .9; } 90% { opacity: .65; } 100% { transform: translateY(0); opacity: 0; } }
.edit-area { overflow: hidden; }
.output-section { margin-top: 29px; }
.output-head { justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.output-head h2 { font-size: 22px; font-weight: 650; letter-spacing: -.045em; }
.output-actions { display: flex; align-items: center; gap: 19px; }
.dedupe-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--soft); white-space: nowrap; cursor: pointer; }
#dedupe { appearance: none; position: relative; width: 30px; height: 17px; margin: 0; border: 1px solid #697263; border-radius: 12px; background: #232823; cursor: pointer; transition: background .18s, border-color .18s; }
#dedupe::before { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; background: #b4beb0; border-radius: 50%; transition: transform .18s; }
#dedupe:checked { background: #344025; border-color: #71864f; }
#dedupe:checked::before { background: var(--accent); transform: translateX(13px); }
#dedupe:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (forced-colors: active) {
  #dedupe { appearance: auto; }
  #dedupe::before { display: none; }
}
#summary, #empty { color: var(--soft); font-size: 13px; margin-top: 4px; }
#copy-all { flex-shrink: 0; justify-content: center; gap: 9px; border: 1px solid transparent; background: var(--accent); color: #172009; min-height: 37px; border-radius: 5px; padding: 0 15px; font-size: 14px; font-weight: 650; transition: transform .14s ease, background .14s; }
#copy-all:hover:not(:disabled) { background: #daff92; }
#copy-all:active:not(:disabled), .row-copy:active { transform: translateY(1px); }
.copy-glyph { position: relative; width: 14px; height: 14px; display: inline-block; }
.copy-glyph::before, .copy-glyph::after { content: ""; position: absolute; width: 9px; height: 10px; border-radius: 2px; border: 1.5px solid currentColor; background: var(--accent); }
.copy-glyph::before { top: 0; left: 0; } .copy-glyph::after { right: 1px; bottom: 0; }
#results { list-style: none; padding: 0; }
.result-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 48px; padding: 5px 9px 5px 2px; border-top: 1px solid var(--line); transition: background-color .15s; }
.result-row:last-child { border-bottom: 1px solid var(--line); }
.result-row:hover, .result-row:focus-within { background-color: #c8ff6007; }
.result-row.trace-active { box-shadow: inset 2px 0 var(--accent); background-color: #c8ff600a; }
.result-row.trace-active .ordinal { color: var(--accent); padding-left: 4px; }
.row-copy.copied { color: var(--accent); }
#copy-all.copied .copy-glyph::before { display: none; }
#copy-all.copied .copy-glyph::after { width: 12px; height: 6px; border: 0 solid currentColor; border-width: 0 0 2px 2px; border-radius: 0; background: transparent; transform: translateY(-5px) rotate(-45deg); }
.result-row.reveal { animation: resolve-row .38s backwards; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes resolve-row { from { opacity: 0; transform: translateY(6px); background-color: #c8ff601c; } to { opacity: 1; transform: translateY(0); background-color: transparent; } }
.ordinal { font: 12px/1 var(--mono); color: var(--quiet); font-variant-numeric: tabular-nums; }
.url-text { min-width: 0; overflow-wrap: anywhere; font: 16px/1.5 var(--mono); letter-spacing: -.025em; }
.row-copy { border: 0; border-radius: 4px; background: transparent; color: var(--quiet); font-size: 12px; padding: 8px; }
.row-copy:hover, .row-copy:focus-visible { color: var(--accent); background: #c8ff600b; }
#empty { margin: 0; border-top: 1px solid var(--line); padding: 20px 0; }
.usage-notes { margin-top: 22px; color: var(--soft); font-size: 14px; line-height: 1.75; }
.usage-notes summary { width: fit-content; padding: 8px 0; cursor: pointer; }
.usage-notes summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.usage-notes p { max-width: 54em; margin: 8px 0; }
.usage-notes code { color: var(--text); font-family: var(--mono); }
.script-hint { color: var(--text); margin-bottom: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .header-inner, main { width: calc(100% - 40px); }
  .header-inner { height: 54px; }
  .hero { grid-template-columns: 1fr minmax(90px, .52fr); min-height: 153px; gap: 8px; }
  .scope-figure { height: 93px; }
  .intro p { font-size: 13px; line-height: 1.6; }
  .editor-shell { --pad-x: 14px; }
  #mirror, #source { font-size: 16px; }
  .edit-area { height: 160px; }
  .header-actions { gap: 14px; }
  .result-row { grid-template-columns: 22px minmax(0,1fr) auto; gap: 6px; }
  .url-text { font-size: 14px; }
}
@media (max-width: 470px) {
  .hero { grid-template-columns: minmax(0,1fr) minmax(72px, 35%); gap: 0 8px; padding: 20px 0; min-height: 144px; }
  .intro { display: contents; }
  h1 { font-size: 42px; }
  .scope-figure { grid-area: 1 / 2; height: 60px; }
  .intro p { grid-area: 2 / 1 / 3 / -1; margin-top: 0; }
  .edit-area { height: 196px; }
  .editor-toolbar { height: 43px; }
  .output-head h2 { font-size: 20px; }
  .output-head { flex-wrap: wrap; gap: 4px 10px; }
  .output-actions { margin-left: auto; gap: 10px; }
  .output-section { margin-top: 23px; }
  .header-actions { gap: 12px; }
  .row-copy { min-height: 42px; padding: 5px; }
}
@media (pointer: coarse) {
  #copy-all, #focus-input, .row-copy { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
