/* AI Detector (/detect). Builds on site.css + pages.css tokens; nothing here overrides the shared components. */
.det { max-width: 1180px; }
[hidden] { display: none !important; }   /* the components below set display, which would otherwise beat the hidden attribute */
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: 13px; }
:root { --ai: #f2994a; --hu: #3ba4ff; --syn-kw: #c792ea; --syn-str: #c3e88d; --syn-num: #f78c6c; --syn-com: #7f8792; --syn-fn: #82aaff;
  --syn-tag: #f07178; --syn-attr: #ffcb6b; --syn-prop: #89ddff; --ed-bg: #17181b; }
:root[data-theme="light"] { --ai: #c2410c; --hu: #1d6fd1; --syn-kw: #7c3aed; --syn-str: #15803d; --syn-num: #c2410c; --syn-com: #6b7280; --syn-fn: #1d4ed8;
  --syn-tag: #b91c1c; --syn-attr: #a16207; --syn-prop: #0e7490; --ed-bg: #f8fafc; }

/* ---- tabs */
.det-tabs { display: flex; gap: 6px; padding: 5px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--deck);
  overflow-x: auto; scrollbar-width: none; }
.det-tabs::-webkit-scrollbar { display: none; }
.det-tabs a { display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 16px; border-radius: 10px; color: var(--muted);
  text-decoration: none; font: 600 14.5px/1 var(--body); white-space: nowrap; transition: background-color .15s, color .15s; }
.det-tabs a svg { width: 18px; height: 18px; flex: none; }
.det-tabs a:hover { color: var(--runway); background: var(--panel); }
.det-tabs a[aria-current="page"] { color: var(--amber-ink); background: var(--amber); }
.pg .det-tabs a { color: var(--muted); } .pg .det-tabs a[aria-current="page"] { color: var(--amber-ink); }

/* ---- input */
.det-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.det-input-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.det-input-head p { margin: 2px 0 0; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font: 600 12.5px/1 var(--body);
  background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); white-space: nowrap; }
.chip.ghost { background: var(--panel); color: var(--muted); }
.chip svg { width: 14px; height: 14px; }
.code-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sel { position: relative; }
.sel select { width: auto; min-width: 210px; height: 40px; padding: 0 36px 0 12px; appearance: none; background: var(--sky); border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.sel::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.drop { position: relative; border-radius: 12px; }
.drop-hint { display: none; position: absolute; inset: 0; border-radius: 12px; border: 2px dashed var(--amber); background: color-mix(in srgb, var(--amber) 10%, var(--deck));
  place-items: center; font-weight: 700; color: var(--amber); }
.drop.over .drop-hint { display: grid; }
.det-ta { min-height: 340px; font-size: 15.5px; }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 4px; }
.det-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.det-actions .btn-amber { margin-top: 0; }
.det-actions .hbtn { height: 48px; border-radius: 12px; }
.upload { position: relative; }
.save { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; margin-left: auto; }
.save input { width: 18px; height: 18px; accent-color: var(--amber); }
.save-note { font-size: 13px; margin-left: auto; }
.save:not([hidden]) + .save-note { margin-left: 0; }
.det-side h2 { margin-bottom: 12px; }
.how { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 10px; font-size: 14.5px; }
.how li { line-height: 1.5; color: var(--muted); } .how b { color: var(--runway); }
.det-side .notice { margin: 0 0 12px; font-size: 14px; }

/* ---- code editor: a transparent textarea over a highlighted <pre>, same metrics */
.code-ed { display: grid; grid-template-columns: auto minmax(0, 1fr); height: 420px; border: 1px solid var(--line); border-radius: 12px; background: var(--ed-bg); overflow: hidden; }
.code-ed:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 22%, transparent); }
.code-ed, .codeview { --code-font: 500 13.5px/1.65 var(--mono); }
.gutter { padding: 14px 10px 14px 14px; overflow: hidden; text-align: right; color: color-mix(in srgb, var(--muted) 60%, transparent); font: var(--code-font);
  font-variant-numeric: tabular-nums; user-select: none; border-right: 1px solid var(--line); min-width: 48px; white-space: pre; }
.ed-wrap { position: relative; min-width: 0; }
.ed-wrap pre, .ed-wrap textarea { position: absolute; inset: 0; margin: 0; padding: 14px 16px; border: 0; font: var(--code-font); tab-size: 4; white-space: pre;
  overflow: auto; letter-spacing: 0; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.ed-wrap pre { color: var(--runway); pointer-events: none; overflow: hidden; }
.ed-wrap textarea { resize: none; background: transparent; color: transparent; caret-color: var(--amber); outline: none; box-shadow: none; border-radius: 0; z-index: 1; }
.ed-wrap textarea::placeholder { color: var(--muted); }
.ed-wrap textarea::selection { background: color-mix(in srgb, var(--amber) 35%, transparent); color: transparent; }
.ed-wrap.plain textarea { color: var(--runway); }
.t-kw { color: var(--syn-kw); } .t-str { color: var(--syn-str); } .t-num { color: var(--syn-num); } .t-com { color: var(--syn-com); font-style: italic; }
.t-fn { color: var(--syn-fn); } .t-tag { color: var(--syn-tag); } .t-attr { color: var(--syn-attr); } .t-prop { color: var(--syn-prop); } .t-pun { color: var(--muted); }

/* ---- progress */
.det-progress { text-align: center; padding: 48px 24px; position: relative; overflow: hidden; }
.det-progress h2 { font-size: 20px; margin: 14px 0 16px; }
.pbar { height: 8px; max-width: 420px; margin: 0 auto; border-radius: 999px; background: var(--panel); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--accent-2)); transition: width .35s ease-out; }
.pbar.indet i { width: 35%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
.scanline { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; background: color-mix(in srgb, var(--amber) 14%, transparent); position: relative; overflow: hidden; }
.scanline::before { content: ""; position: absolute; inset: 16px 14px; border-radius: 4px;
  background: repeating-linear-gradient(180deg, color-mix(in srgb, var(--amber) 70%, transparent) 0 3px, transparent 3px 7px); opacity: .55; }
.scanline i { position: absolute; left: 8px; right: 8px; height: 2px; top: 10px; background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: sweep 1.4s ease-in-out infinite alternate; }
@keyframes sweep { to { top: 52px; } }

/* ---- result */
.res { display: grid; gap: 16px; }
.res > * { animation: rise .45s cubic-bezier(.16, 1, .3, 1) both; }
.res > *:nth-child(2) { animation-delay: .05s; } .res > *:nth-child(3) { animation-delay: .1s; } .res > *:nth-child(4) { animation-delay: .15s; } .res > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 60%; height: 180%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--vc) 16%, transparent), transparent); }
.hero > * { position: relative; }
.v-likely_ai { --vc: var(--ai); } .v-possibly_ai { --vc: var(--warn); } .v-inconclusive { --vc: var(--muted); } .v-likely_human { --vc: var(--hu); }
.gauge { width: 176px; height: 176px; position: relative; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .trk { stroke: var(--panel); } .gauge .val { stroke: var(--ai); transition: stroke-dashoffset 1.1s cubic-bezier(.16, 1, .3, 1); }
.gauge .hum { stroke: var(--hu); opacity: .9; transition: stroke-dashoffset 1.1s cubic-bezier(.16, 1, .3, 1); }
.gauge .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge b { font: 700 46px/1 var(--display); letter-spacing: -.03em; }
.gauge span { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.verdict-k { font: 700 12px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--vc); display: flex; align-items: center; gap: 8px; }
.verdict-k i { width: 9px; height: 9px; border-radius: 50%; background: var(--vc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--vc) 22%, transparent); }
.hero h2 { font-size: clamp(26px, 3.4vw, 36px); margin: 10px 0 8px; }
.hero p.lede { margin: 0; color: var(--muted); max-width: 64ch; }
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 18px 0 8px; background: var(--panel); max-width: 520px; }
.split i { display: block; height: 100%; transition: width 1s cubic-bezier(.16, 1, .3, 1); }
.split .a { background: var(--ai); } .split .h { background: var(--hu); }
.split-legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.split-legend b { color: var(--runway); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.stats4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--deck); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.stat span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat b { display: block; font: 700 22px/1.2 var(--display); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .conf-bars { display: inline-flex; gap: 3px; margin-left: 10px; vertical-align: 2px; }
.conf-bars i { display: inline-block; width: 6px; height: 14px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 30%, transparent); }
.conf-bars i.on { background: var(--amber); }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.why { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.why li { line-height: 1.55; }
.sig-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.sig-filter button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 13px/1 var(--body); cursor: pointer; }
.sig-filter button[aria-pressed="true"] { background: var(--panel); color: var(--runway); border-color: var(--amber); }
.sigs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sig { border: 1px solid var(--line); border-radius: 12px; background: var(--sky); }
.sig > button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 4px 14px; padding: 12px 14px; cursor: pointer; border-radius: 12px; }
.sig > button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sig .nm { font-weight: 650; font-size: 14.5px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.sig .nm em { font-style: normal; font: 700 10.5px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border-radius: 5px; background: var(--panel); color: var(--muted); flex: none; }
.sig .nm em.k-model { background: color-mix(in srgb, var(--blue) 20%, transparent); color: var(--runway); }
.sig .vl { grid-column: 1; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lean { grid-row: span 2; align-self: center; }
.lean .tr { position: relative; height: 8px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--hu) 35%, var(--panel)), var(--panel) 45% 55%, color-mix(in srgb, var(--ai) 35%, var(--panel))); }
.lean .tr::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.lean .kn { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--runway); border: 3px solid var(--deck); box-shadow: 0 0 0 1px var(--line); z-index: 1; }
.lean .kn.a { background: var(--ai); } .lean .kn.h { background: var(--hu); } .lean .kn.z { background: var(--muted); }
.lean small { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 5px; font-weight: 600; }
.sig .more { padding: 0 14px 14px; font-size: 14px; color: var(--muted); display: grid; gap: 8px; }
.sig .more p { margin: 0; line-height: 1.55; } .sig .more p.sum { color: var(--runway); }
.sig .ev { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.sig .ev li { font: 500 12.5px/1.5 var(--mono); background: var(--panel); border-radius: 8px; padding: 6px 9px; overflow-wrap: anywhere; color: var(--runway); }
.sig .ev li a { color: inherit; text-decoration: none; } .sig .ev li a:hover { color: var(--amber); }
.sig .ev .ln { color: var(--muted); margin-right: 8px; }
.sig[data-w="0"] .nm { color: var(--muted); }
.nm-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); } .nm-list b { color: var(--runway); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 2px 0 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 3px; }
.res-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.res-actions .btn-amber { margin-top: 0; }
.res-actions .hbtn { height: 48px; border-radius: 12px; }

/* highlighted views */
.viewer { max-height: 640px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--ed-bg); }
.textview { padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; font-size: 15px; }
mark.hl { color: inherit; border-radius: 4px; padding: 1px 0; cursor: help; transition: background-color .15s; }
mark.s-strong { background: color-mix(in srgb, var(--ai) 42%, transparent); box-shadow: inset 0 -2px 0 var(--ai); }
mark.s-moderate { background: color-mix(in srgb, var(--ai) 26%, transparent); }
mark.s-weak { background: color-mix(in srgb, var(--ai) 13%, transparent); box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--ai) 60%, transparent); }
mark.l-human { background: color-mix(in srgb, var(--hu) 22%, transparent); box-shadow: inset 0 -1px 0 var(--hu); }
mark.hl:hover, mark.hl.pulse { background: color-mix(in srgb, var(--amber) 45%, transparent); }
.codeview { font: var(--code-font); tab-size: 4; min-width: max-content; padding: 10px 0; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.codeview .ln { display: grid; grid-template-columns: 56px 6px minmax(0, 1fr); align-items: stretch; }
.codeview .no { text-align: right; padding-right: 10px; color: color-mix(in srgb, var(--muted) 55%, transparent); user-select: none; font-variant-numeric: tabular-nums; }
.codeview .mk { border-radius: 2px; }
.codeview .tx { white-space: pre; padding: 0 16px 0 10px; }
.codeview .ln.f { cursor: help; }
.codeview .ln.f-strong { background: color-mix(in srgb, var(--ai) 16%, transparent); } .codeview .ln.f-strong .mk { background: var(--ai); }
.codeview .ln.f-moderate { background: color-mix(in srgb, var(--ai) 10%, transparent); } .codeview .ln.f-moderate .mk { background: color-mix(in srgb, var(--ai) 75%, transparent); }
.codeview .ln.f-weak .mk { background: color-mix(in srgb, var(--ai) 45%, transparent); } .codeview .ln.f-weak { background: color-mix(in srgb, var(--ai) 5%, transparent); }
.codeview .ln.f-human { background: color-mix(in srgb, var(--hu) 9%, transparent); } .codeview .ln.f-human .mk { background: var(--hu); }
.codeview .ln.pulse { animation: pulse 1.2s ease-out; }
@keyframes pulse { 0%, 40% { background: color-mix(in srgb, var(--amber) 35%, transparent); } }
.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.flags li button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 11px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.flags li button:hover, .flags li button:focus-visible { background: var(--panel); outline: none; }
.flags .where { font: 600 12px/1.6 var(--mono); color: var(--muted); white-space: nowrap; }
.flags .bar { width: 4px; align-self: stretch; border-radius: 2px; }
.flags .row { display: flex; gap: 10px; }
.tip { position: fixed; z-index: 90; max-width: 320px; padding: 9px 12px; border-radius: 10px; background: var(--flap); color: var(--runway); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.45; box-shadow: 0 12px 30px rgba(0,0,0,.45); pointer-events: none; }
:root[data-theme="light"] .tip { background: #fff; }
.tip b { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.tip ul { margin: 0; padding-left: 16px; }

/* ---- history */
.hist-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .tg { width: 46px; height: 26px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); position: relative; transition: background-color .2s; flex: none; }
.switch .tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .2s, background-color .2s; }
.switch input:checked + .tg { background: color-mix(in srgb, var(--amber) 40%, var(--panel)); border-color: var(--amber); }
.switch input:checked + .tg::after { transform: translateX(20px); background: var(--amber); }
.switch input:focus-visible + .tg { outline: 2px solid var(--amber); outline-offset: 2px; }
.hist { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.hist li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--sky);
  transition: border-color .15s, transform .15s; }
.hist li:hover { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.hist .sc { width: 64px; height: 64px; border-radius: 16px; display: grid; place-content: center; text-align: center; background: color-mix(in srgb, var(--vc) 16%, transparent); color: var(--vc); }
.hist .sc b { font: 700 22px/1 var(--display); } .hist .sc small { font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.hist .bd { min-width: 0; }
.hist .bd b { display: block; font-size: 15px; }
.hist .bd p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .bd .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hist .acts { display: flex; gap: 6px; }
.hist .acts .hbtn { height: 38px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--amber); margin: 0 auto 10px; display: block; }
.confirm { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; margin-top: 12px;
  background: color-mix(in srgb, var(--red) 10%, transparent); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); }
.confirm span { flex: 1; min-width: 200px; }
.hbtn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.hbtn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }

@media (max-width: 1020px) {
  .det-grid, .cols { grid-template-columns: minmax(0, 1fr); }
  .stats4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; }
  .hero p.lede, .split { margin-left: auto; margin-right: auto; } .split-legend, .verdict-k { justify-content: center; }
  .gauge { width: 150px; height: 150px; } .gauge b { font-size: 38px; }
  .det-actions .btn-amber { flex: 1 1 100%; justify-content: center; }
  .save, .save-note { margin-left: 0; }
  .code-ed { height: 340px; }
  .sig > button { grid-template-columns: minmax(0, 1fr) 84px; }
  .hist li { grid-template-columns: 52px minmax(0, 1fr); } .hist .sc { width: 52px; height: 52px; } .hist .acts { grid-column: 1 / -1; }
  .det-tabs a { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .res > *, .codeview .ln.pulse { animation: none; }
  .gauge .val, .gauge .hum, .split i, .pbar i { transition: none; }
  .pbar.indet i, .scanline i { animation: none; }
}
