/* url.xqly.me · same framed-sheet layout and tokens as ip.xqly.me.
   Tokens, shell, buttons and the score ring are adapted from xqly/egress-observatory (GPL-3.0), styles.css.
   A tinted frame holds the 48px top bar and an 8px margin; the work sits on one sheet with a 1px edge and 16px corners. */

/* ---------- tokens: light (default) and dark ---------- */
:root {
  color-scheme: light;
  --ground: #f7f7fa;
  --surface: #ffffff;
  --raised: #f4f5f8;
  --active: #ebecf0;
  --border: #e8e9ed;
  --rule: #f0f1f4;
  --control: #cdced3;
  --text: #131416;
  --text-2: #3d3f44;
  --muted: #5d5f63;
  --faint: #67696e;
  --accent: #6d28d9;
  --accent-ink: #ffffff;
  --primary: #131416;
  --primary-ink: #ffffff;
  --positive: #1e7b4f;
  --ok: #4d7c0f;
  --negative: #c4242a;
  --warning: #92400e;
  --info: #1d5f9e;
  --orange: #b45309;
  --pill-positive-bg: #dcfae5;
  --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea;
  --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;
  --pill-warning-ink: #92400e;
  --pill-warning-edge: #fde68a;
  --pill-neutral-bg: #ebecf0;
  --pill-neutral-ink: #353739;
  --t-good: #1e7b4f; --t-teal: #0f766e; --t-sky: #1d5f9e; --t-warn: #92400e; --t-orange: #b45309;
  --t-violet: #6d28d9; --t-slate: #4f46e5; --t-muted: #5d5f63; --t-bad: #c4242a;
  --float-shadow: 0 4px 12px rgba(19, 20, 22, .08);
  --tint: 10%;
  /* gradient ends on data only: grade pairs deep -> bright, each end 3:1 or more on white */
  --ring-good-1: #0f6e52; --ring-good-2: #18a06a; --ring-ok-1: #3f6b0c; --ring-ok-2: #689a12;
  --ring-warn-1: #9a3412; --ring-warn-2: #c26a06; --ring-bad-1: #9f1239; --ring-bad-2: #e0445a;
  --progress-1: #6d28d9; --progress-2: #8b5cf6;
  --gauge-orange: #ea580c; --gauge-yellow: #c26a06; --gauge-lime: #689a12;

  --font: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: 11px; --fs-small: 12px; --fs-meta: 13px; --fs-body: 14px; --fs-section: 16px; --fs-title: 22px; --fs-kpi: 28px;
  --radius-chip: 4px; --radius-control: 6px; --radius-card: 8px; --radius-sheet: 16px; --radius-pill: 999px;
  --sheet-inset: 8px; --gap: 24px; --pad: 24px; --card-pad: 20px;
  --control-height: 32px; --hit: 44px; --row-height: 48px; --topbar: 48px;
  --ease: cubic-bezier(.2, .8, .2, 1); --dur: 180ms;

  /* legacy names the existing rules use, mapped onto the roles above */
  --bg: var(--ground); --panel: var(--surface); --panel-2: var(--raised); --panel-3: var(--active);
  --line: var(--border); --line-2: var(--control); --soft: var(--text-2); --dim: var(--faint);
  --accent-strong: var(--accent);
  --good: var(--positive); --warn: var(--warning); --bad: var(--negative);
  --good-bg: var(--pill-positive-bg); --warn-bg: var(--pill-warning-bg); --bad-bg: var(--pill-negative-bg);
  --radius: var(--radius-card);
}

/* ---------- tokens: dark (the existing palette) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0b0c0f;
  --surface: #131419;
  --raised: #191a21;
  --active: #20212a;
  --border: #24252d;
  --rule: #1c1d24;
  --control: #3a3c47;
  --text: #ebecf1;
  --text-2: #c4c6cf;
  --muted: #a3a6b1;
  --faint: #8a8d99;
  --accent: #a78bfa;
  --accent-ink: #160f2b;
  --primary: #ebecf1;
  --primary-ink: #0b0c0f;
  --positive: #34d399;
  --ok: #a3e635;
  --negative: #f87171;
  --warning: #fbbf24;
  --info: #7dd3fc;
  --orange: #fb923c;
  --pill-positive-bg: #12261e;
  --pill-positive-ink: #34d399;
  --pill-negative-bg: #2a1719;
  --pill-negative-ink: #fca5a5;
  --pill-warning-bg: #2a2212;
  --pill-warning-ink: #fde68a;
  --pill-warning-edge: #5c4a1a;
  --pill-neutral-bg: #20212a;
  --pill-neutral-ink: #c4c6cf;
  --t-good: #34d399; --t-teal: #2dd4bf; --t-sky: #7dd3fc; --t-warn: #fbbf24; --t-orange: #fb923c;
  --t-violet: #c4b5fd; --t-slate: #a5b4fc; --t-muted: #8a8d99; --t-bad: #f87171;
  --float-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  --tint: 14%;
  --ring-good-1: #138a6a; --ring-good-2: #5fe3a8; --ring-ok-1: #2f9f73; --ring-ok-2: #b9e05a;
  --ring-warn-1: #c2662b; --ring-warn-2: #f5c84c; --ring-bad-1: #a92a4a; --ring-bad-2: #f77f91;
  --progress-1: #8b5cf6; --progress-2: #a78bfa;
  --gauge-orange: #fb923c; --gauge-yellow: #fbbf24; --gauge-lime: #a3e635;
}


* { box-sizing: border-box; }
html { background: var(--ground); color: var(--text); font: var(--fs-body)/1.5 var(--font); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; font-variant-numeric: tabular-nums; }
html.theme-fade, html.theme-fade * { transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease) !important; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-chip); padding: 0 .35em; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; display: inline-flex; align-items: center; min-height: var(--hit); background: var(--primary); color: var(--primary-ink); padding: 0 12px; border-radius: var(--radius-control); z-index: 40; text-decoration: none; }
.skip-link:focus { top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main a, .footer a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
main a:hover, .footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

.progress-track { position: fixed; inset: var(--topbar) 0 auto; height: 2px; z-index: 30; pointer-events: none; }
.progress-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--progress-1), var(--progress-2)); transition: width 400ms var(--ease), opacity var(--dur) var(--ease) .18s; }
.progress-track.done i { opacity: 0; }

/* ---------- shell ---------- */
.topbar { position: relative; height: var(--topbar); padding: 0 calc(var(--sheet-inset) + var(--pad) - 6px); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: var(--hit); text-decoration: none; font-weight: 650; }
.brand svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.brand em { font-style: normal; color: var(--muted); font-weight: 500; padding-left: 2px; }
.topbar nav { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.topbar nav a { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 10px; color: var(--muted); text-decoration: none; border-radius: var(--radius-control); }
.topbar nav a:hover { color: var(--text); }
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: inline; }

.wrap { margin: 0 var(--sheet-inset) var(--sheet-inset); min-height: calc(100vh - var(--topbar) - var(--sheet-inset)); padding: var(--pad); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); display: grid; grid-template-columns: minmax(0, 1376px); justify-content: center; align-content: start; gap: var(--gap); }
.wrap > * { min-width: 0; }
#status:empty, #report:empty { display: none; }

/* ---------- buttons: a 44px box with the sheet's 32px control drawn inside ---------- */
button { cursor: pointer; min-height: var(--hit); min-width: var(--hit); padding: 0 12px; border: solid transparent; border-width: 6px 0; background: var(--surface); background-clip: padding-box; box-shadow: inset 0 0 0 1px var(--control); border-radius: var(--radius-control) / calc(var(--radius-control) + 6px); transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
button:hover { background-color: var(--raised); }
button:active { background-color: var(--active); }
button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.accent { background-color: var(--primary); color: var(--primary-ink); box-shadow: none; font-weight: 650; }
button.accent:hover { background-color: color-mix(in srgb, var(--primary) 86%, var(--surface)); }
button.accent:focus-visible { box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 4px var(--surface); }
button.small { padding: 0 10px; font-size: 12px; border-width: 8px 0; }
button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; margin-right: 6px; }
button[data-done]::after { content: " · " attr(data-done); font-weight: 400; }
.chip-btn { padding: 0 10px; font-size: 12px; border-width: 8px 0; border-radius: var(--radius-pill); color: var(--text-2); }

/* ---------- the query ---------- */
.intro h1 { font-size: 24px; line-height: 1.3; font-weight: 700; }
.intro p { margin-top: 6px; color: var(--text-2); max-width: 78ch; }
.query { display: flex; gap: 8px; margin-top: 16px; max-width: 860px; }
.query input { flex: 1; min-width: 0; min-height: var(--hit); padding: 0 14px; border: 1px solid var(--control); border-radius: var(--radius-card); background: var(--surface); font-size: 15px; }
.query input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.query button { padding: 0 20px; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-card); font-size: 13px; line-height: 1.6; }
.notice.bad { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.notice.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); border: 1px solid var(--pill-warning-edge); }
.notice.info { background: var(--raised); color: var(--text-2); }
.notice a { color: inherit; text-decoration: underline; }
.loading { display: grid; gap: 6px; padding: 18px 0; color: var(--muted); }
.loading strong { color: var(--text); font-weight: 650; }

/* ---------- summary ---------- */
.summary { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--gap) calc(var(--gap) * 1.5); padding-top: var(--gap); border-top: 1px solid var(--border); }
.score-row { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: var(--gap); align-items: start; }
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
.score-ring { --p: 0; --g1: var(--control); --g2: var(--control); position: relative; width: 128px; height: 128px; transition: --p 240ms var(--ease); }
.score-ring[data-tone="good"] { --g1: var(--ring-good-1); --g2: var(--ring-good-2); }
.score-ring[data-tone="ok"] { --g1: var(--ring-ok-1); --g2: var(--ring-ok-2); }
.score-ring[data-tone="warn"] { --g1: var(--ring-warn-1); --g2: var(--ring-warn-2); }
.score-ring[data-tone="bad"] { --g1: var(--ring-bad-1); --g2: var(--ring-bad-2); }
.ring-track { position: absolute; inset: 0; border-radius: 50%;
  background: var(--active);
  -webkit-mask: radial-gradient(closest-side, transparent calc(78.33% - .5px), #000 78.33%, #000 95%, transparent calc(95% + .5px));
  mask: radial-gradient(closest-side, transparent calc(78.33% - .5px), #000 78.33%, #000 95%, transparent calc(95% + .5px)); }
.ring-arc { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--g1), var(--g2) calc(var(--p) * 3.6deg), transparent 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(78.33% - .5px), #000 78.33%, #000 95%, transparent calc(95% + .5px));
  mask: radial-gradient(closest-side, transparent calc(78.33% - .5px), #000 78.33%, #000 95%, transparent calc(95% + .5px)); }
.ring-cap { position: absolute; left: 45.833%; top: 2.5%; width: 8.333%; height: 8.333%; border-radius: 50%; background: var(--g1); transform-origin: 50% 570%; }
.ring-cap.ring-tip { background: var(--g2); transform: rotate(calc(var(--p) * 3.6deg)); }
.score-ring:not(.has-score) .ring-arc, .score-ring:not(.has-score) .ring-cap { display: none; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text strong { font-size: 40px; line-height: 1; font-weight: 700; }
.ring-text strong.wide { font-size: 34px; letter-spacing: -.02em; }
.score-ring:not(.has-score) .ring-text strong { font-size: 22px; color: var(--faint); }
.ring-text span { font-size: 13px; margin-top: 4px; color: var(--muted); font-weight: 600; }
.tone-good { color: var(--good) !important; }
.tone-ok { color: var(--ok) !important; }
.tone-warn { color: var(--warn) !important; }
.tone-bad { color: var(--bad) !important; }
.verdict { display: grid; gap: 8px; min-width: 0; }
.verdict-label { font-size: 20px; font-weight: 700; }
.target-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.target-line strong { color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.findings { display: grid; gap: 2px; margin-top: 6px; font-size: 13px; }
.findings li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 4px 0; color: var(--text-2); }
.findings b { text-align: right; font-weight: 700; }
.findings .neg b { color: var(--bad); }
.findings .pos b { color: var(--good); }
.findings .cap b { color: var(--warn); font-size: 12px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-content: start; }
.fact { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); min-width: 0; }
.fact dt { font-size: 12px; color: var(--muted); }
.fact dd { margin-top: 2px; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.fact dd small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }

/* ---------- section cards ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 calc(var(--gap) * 1.5); }
.card { padding: var(--gap) 0; border-top: 1px solid var(--border); min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h2 { font-size: 15px; font-weight: 650; margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card h2 small { font-size: 12px; font-weight: 400; color: var(--muted); }
.kv { display: grid; }
.kv > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; min-height: 38px; padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.kv dd .sub { color: var(--muted); font-size: 12px; }
.kv dd .stack { display: grid; gap: 2px; width: 100%; }
.unknown { color: var(--faint); }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; border-radius: var(--radius-pill); padding: 1px 8px; white-space: nowrap; flex: none; line-height: 18px; }
.pill-good { color: var(--pill-positive-ink); background: var(--pill-positive-bg); }
.pill-warn { color: var(--pill-warning-ink); background: var(--pill-warning-bg); }
.pill-bad { color: var(--pill-negative-ink); background: var(--pill-negative-bg); }
.pill-muted, .pill-neutral { color: var(--pill-neutral-ink); background: var(--pill-neutral-bg); }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--control); border-radius: var(--radius-chip); padding: 0 5px; white-space: nowrap; }
.chain { display: grid; gap: 4px; width: 100%; }
.chain li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; font-size: 12.5px; }
.chain li b { font-family: var(--mono); color: var(--muted); font-weight: 600; }
.chain li span { font-family: var(--mono); overflow-wrap: anywhere; }
.landing-note { margin-top: 10px; }
.tags-line { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
details.raw { margin-top: 8px; font-size: 12px; }
details.raw summary { cursor: pointer; min-height: var(--hit); display: flex; align-items: center; color: var(--text-2); }
details.raw summary:hover { color: var(--text); }
details.raw pre { margin: 0; max-height: 420px; overflow: auto; padding: 12px; background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-card); font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th { font-size: 12px; font-weight: 600; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 12px; }
tr:last-child td { border-bottom: 0; }

/* ---------- score breakdown ---------- */
.formula { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.formula b { color: var(--text); }
.breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px calc(var(--gap) * 1.5); }
.group h3 { font-size: 13px; font-weight: 650; display: flex; justify-content: space-between; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.group h3 small { font-weight: 400; color: var(--muted); }
.group ul { display: grid; }
.group li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.group li:last-child { border-bottom: 0; }
.group li span { color: var(--muted); font-size: 12px; display: block; }
.group li b { white-space: nowrap; }
.group li b.neg { color: var(--bad); }
.group li b.pos { color: var(--good); }
.group .empty { color: var(--faint); font-size: 12.5px; padding: 7px 0; }

/* ---------- about and footer ---------- */
.about { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); padding-top: var(--gap); border-top: 1px solid var(--border); }
.about h2 { font-size: 14px; font-weight: 650; margin-bottom: 6px; }
.about p, .about li { font-size: 13px; color: var(--text-2); line-height: 1.65; }
.about ul { display: grid; gap: 2px; }
.about .note { margin-top: 6px; }
.about li::before { content: "·"; color: var(--accent); margin-right: 6px; font-weight: 700; }
.footer { display: grid; gap: 6px; padding-top: var(--gap); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.6; }
.footer a { color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .summary { grid-template-columns: 1fr; }
  .breakdown { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) { .brand em { display: none; } }
@media (max-width: 620px) {
  .topbar { padding: 0 8px 0 12px; }
  .topbar nav .nav-link { display: none; }
  .theme-toggle .theme-label { display: none; }
  .theme-toggle svg { margin-right: 0; }
  .wrap { margin: 0; border: 0; border-radius: 0; padding: 16px; min-height: calc(100vh - var(--topbar)); }
  .intro h1 { font-size: 20px; }
  .query { flex-wrap: wrap; }
  .query input { flex-basis: 100%; }
  .query button { flex: 1; }
  .score-row { grid-template-columns: 104px minmax(0, 1fr); gap: 16px; }
  .score-ring { width: 104px; height: 104px; }
  .ring-text strong { font-size: 32px; }
  .ring-text strong.wide { font-size: 27px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .kv > div { grid-template-columns: 92px minmax(0, 1fr); }
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 400px) { .facts { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
