:root {
  --ink: #191521;
  --ink-soft: #4c4558;
  --muted: #726b7e;
  --line: #e7e1ea;
  --line-strong: #d5ccdb;
  --bg: #fbf9fa;
  --card: #ffffff;
  --purple: #6d28d9;
  --purple-dark: #4c1d95;
  --purple-soft: #f1eafe;
  --green: #157f4f;
  --green-soft: #e7f7ee;
  --amber: #9a6400;
  --amber-soft: #fff4dc;
  --red: #c02f2f;
  --red-soft: #fdeaea;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(35, 17, 57, .09);
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; line-height: 1.12; margin: 0 0 .4em; }
h1 { font-size: clamp(2.3rem, 5vw, 3.9rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--purple); }
code, pre { font-family: var(--mono); font-size: .86em; }
img { max-width: 100%; }

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.1rem clamp(1rem, 4vw, 3rem);
  background: #fff; border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.brand svg { color: var(--purple); }
.brand-sub { color: var(--muted); font-weight: 500; margin-left: .3rem; font-size: .82em; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; font-size: .92rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--purple); }
.nav-cta { border: 1px solid var(--line-strong); padding: .38rem .8rem; border-radius: 8px; }

.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(120% 130% at 15% 0%, #8b3df1 0%, #5b21b6 42%, #2b0d4d 100%);
  padding: clamp(2.4rem, 6vw, 4.6rem) 1rem clamp(2.6rem, 5vw, 4rem);
}
.hero-glow {
  position: absolute; inset: -20% -10% auto auto; width: 52vw; height: 52vw; max-width: 720px; max-height: 720px;
  background: radial-gradient(closest-side, rgba(255, 138, 216, .38), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 820px; margin: 0 auto; text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 700; color: var(--purple); margin-bottom: .8rem; }
.hero .eyebrow { color: #e9d5ff; }
.hero h1 { color: #fff; }
.hero-lede { color: #e5d9f6; font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 620px; margin: 0 auto 1.8rem; }

.address-card {
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(10px); border-radius: 22px; padding: 1.15rem;
  max-width: 640px; margin: 0 auto; text-align: left;
  box-shadow: 0 24px 60px rgba(15, 4, 31, .4);
}
.address-label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: #d8c8ee; margin: 0 .2rem .55rem; }
.address-row { display: flex; gap: .5rem; align-items: center; background: #fff; border-radius: 12px; padding: .35rem .35rem .35rem 1rem; }
.address { color: var(--ink); font-size: clamp(.92rem, 2.4vw, 1.2rem); font-weight: 600; overflow-wrap: anywhere; flex: 1; }
.icon-button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  width: 38px; height: 38px; border-radius: 9px; font-size: 1.1rem; cursor: pointer;
  display: inline-grid; place-items: center; flex: none;
}
.icon-button:hover { border-color: var(--purple); color: var(--purple); }
.address-card .button { margin-top: .7rem; }
.address-foot { color: #d8c8ee; font-size: .82rem; margin: .7rem .2rem 0; }
.link-button { background: none; border: 0; color: #f0e6ff; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.link-button:hover { color: #fff; }
.hero-meta { margin: 1.5rem auto 0; color: #cbb8e6; font-size: .8rem; max-width: 560px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid transparent; border-radius: 10px; padding: .68rem 1.15rem;
  font: inherit; font-weight: 650; font-size: .92rem; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--purple); color: #fff; }
.button-primary:hover { background: var(--purple-dark); }
.button-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line-strong); }
.button-ghost:hover { border-color: var(--purple); color: var(--purple); }
.button-wide { width: 100%; }

.setup { max-width: 640px; margin: 1.6rem auto 0; text-align: left; background: rgba(16, 5, 30, .32); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; overflow: hidden; }
.setup-tabs { display: flex; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.setup-tabs button { flex: 1; background: none; border: 0; color: #cbb8e6; padding: .65rem; font: inherit; font-size: .86rem; cursor: pointer; }
.setup-tabs button[aria-selected="true"] { color: #fff; box-shadow: inset 0 -2px 0 #d8b4fe; }
.setup-panel { padding: 1rem 1.1rem; color: #e5d9f6; font-size: .86rem; }
.setup-panel p:last-child { margin-bottom: 0; }
.setup-panel .code-block { background: rgba(8, 2, 16, .5); border-color: rgba(255, 255, 255, .14); color: #f4ecff; }
.setup-panel textarea { width: 100%; background: rgba(8, 2, 16, .5); color: #f4ecff; border: 1px solid rgba(255, 255, 255, .16); border-radius: 9px; padding: .7rem; font-family: var(--mono); font-size: .78rem; resize: vertical; }
.copy-line { margin-top: .5rem; background: none; border: 0; color: #d8b4fe; text-decoration: underline; cursor: pointer; font: inherit; font-size: .78rem; padding: 0; }
.hint { color: var(--muted); font-size: .8rem; }
.setup-panel .hint { color: #c2addb; }
.paste-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .6rem; flex-wrap: wrap; }

.code-block {
  background: #12101a; color: #eee7f7; border: 1px solid #2a2436;
  border-radius: 10px; padding: .85rem 1rem; overflow-x: auto; margin: .5rem 0;
  white-space: pre;
}
.code-small { font-size: .76rem; }

.section { padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 5vw, 3rem); }
.section-alt { background: #f4eff8; }
.section-head { max-width: 720px; margin: 0 auto 2.2rem; text-align: center; }
.section-head p { color: var(--muted); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; max-width: 1100px; margin: 0 auto; }
.feature-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; }
.feature-icon { font-size: 1.5rem; margin-bottom: .5rem; }
.feature-card p { color: var(--muted); font-size: .9rem; margin: 0; }

.steps { list-style: none; margin: 0 auto; max-width: 900px; padding: 0; display: grid; gap: 1rem; }
.steps li { display: flex; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem 1.4rem; }
.steps p { color: var(--muted); margin: 0; font-size: .92rem; }
.step-num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--purple-soft); color: var(--purple); font-weight: 700; display: grid; place-items: center; }

.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { color: var(--muted); margin: .6rem 0 0; font-size: .92rem; }

.notice { border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; border: 1px solid; margin-bottom: 1rem; text-align: left; }
.notice-warning { background: var(--amber-soft); border-color: #f2d69a; color: #6d4700; }
.notice-failure { background: var(--red-soft); border-color: #f3bcbc; color: #7c1d1d; }

.site-footer { background: #17131f; color: #cfc6da; padding: 2.6rem clamp(1rem, 5vw, 3rem) 1.2rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; }
.brand-small { color: #fff; font-size: .95rem; margin-bottom: .6rem; }
.site-footer p { max-width: 380px; font-size: .85rem; color: #a99cb9; }
.footer-links { display: flex; gap: 1.2rem; font-size: .85rem; flex-wrap: wrap; }
.footer-links a { color: #cfc6da; text-decoration: none; }
.footer-links a:hover { color: #fff; }
.footer-bottom { max-width: 1100px; margin: 1.8rem auto 0; border-top: 1px solid #2a2436; padding-top: 1rem; font-size: .76rem; color: #8b7f9c; }

/* ------------------------------------------------------------------ waiting */
.center-shell { min-height: calc(100vh - 220px); display: grid; place-items: center; padding: 2.5rem 1rem; }
.waiting-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: clamp(1.4rem, 4vw, 2.6rem); max-width: 660px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.waiting-card h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.muted { color: var(--muted); }
.mini-address { display: flex; gap: .4rem; align-items: center; justify-content: center; background: var(--purple-soft); border-radius: 10px; padding: .55rem .6rem .55rem .9rem; margin: 1rem 0; }
.mini-address code { overflow-wrap: anywhere; font-weight: 600; }
.waiting-card .code-block { text-align: left; }
.waiting-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.paste-drawer { margin-top: 1rem; text-align: left; }
.paste-drawer textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: .7rem; font-family: var(--mono); font-size: .78rem; resize: vertical; }
.waiting-card .hint { margin: 1rem 0 0; }

.radar { width: 76px; height: 76px; margin: 0 auto 1.2rem; position: relative; border-radius: 50%; background: var(--purple-soft); display: grid; place-items: center; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(109, 40, 217, .35); animation: ping 2.4s cubic-bezier(0, 0, .2, 1) infinite; }
.radar span:nth-child(2) { animation-delay: .8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
.radar-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--purple); position: relative; z-index: 1; }
@keyframes ping { 0% { transform: scale(.45); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }

/* ------------------------------------------------------------------- report */
.report-shell { max-width: 1180px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.4rem) 4rem; }
.report-top { display: flex; justify-content: space-between; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.4rem; }
.report-top h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: .2rem; }
.report-top .eyebrow { margin-bottom: .3rem; }
.report-top p { margin: 0; font-size: .9rem; }
.report-top-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.score-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: clamp(1rem, 3vw, 2.2rem);
  align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: 22px; padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow);
  border-top: 5px solid var(--green);
}
.score-card.tone-warning { border-top-color: #d9a218; }
.score-card.tone-failure { border-top-color: var(--red); }
.gauge { position: relative; width: clamp(128px, 18vw, 168px); aspect-ratio: 1; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 14; stroke-linecap: round; }
.gauge-track { stroke: #efe9f3; }
.gauge-fill { stroke: var(--score-color); transition: stroke-dashoffset 1.1s ease; }
.gauge-value { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.gauge-value strong { font-family: var(--serif); font-size: clamp(2.1rem, 5vw, 2.9rem); }
.gauge-value span { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.score-kicker { font-size: .85rem; letter-spacing: .02em; color: var(--muted); margin-bottom: .25rem; }
.score-kicker strong { color: var(--ink); }
.score-copy h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin-bottom: .3rem; }
.score-copy p { margin-bottom: .8rem; font-size: .9rem; }
.score-tags { display: flex; gap: .35rem; flex-wrap: wrap; }
.tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .22rem .5rem; border-radius: 999px; background: #f2eef5; color: var(--ink-soft); }
.tag-success { background: var(--green-soft); color: var(--green); }
.tag-warning { background: var(--amber-soft); color: var(--amber); }
.tag-failure { background: var(--red-soft); color: var(--red); }
.tag-neutral { background: #f2eef5; color: var(--muted); }
.external-sa { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.external-sa h3 { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.external-sa ul { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .78rem; }
.score-meta { margin: 0; font-size: .8rem; min-width: 190px; }
.score-meta div { padding: .42rem 0; border-bottom: 1px dashed var(--line); }
.score-meta div:last-child { border-bottom: 0; }
.score-meta dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.score-meta dd { margin: .05rem 0 0; overflow-wrap: anywhere; }

.summary-nav { display: flex; gap: .45rem; flex-wrap: wrap; margin: 1.3rem 0; }
.summary-chip { display: inline-flex; gap: .4rem; align-items: center; text-decoration: none; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); padding: .42rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.summary-chip:hover { border-color: var(--purple); color: var(--purple); }
.summary-chip span { background: var(--red); color: #fff; border-radius: 999px; padding: 0 .35rem; font-size: .7rem; }
.chip-success span { background: var(--green); }

.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
.report-main { display: grid; gap: 1rem; }
.report-section { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.report-section-head { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: start; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line); background: #fdfcfe; }
.section-icon { width: 36px; height: 36px; display: grid; place-items: center; background: var(--purple-soft); border-radius: 10px; font-size: 1.05rem; }
.report-section-head h2 { font-size: 1.18rem; margin-bottom: .15rem; }
.report-section-head p { font-size: .82rem; color: var(--muted); margin: 0; }
.failure-count { grid-column: 2 / -1; font-size: .72rem; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .07em; }
.report-section.section-failure { border-color: #f0c9c9; }
.report-section.section-success .section-icon { background: var(--green-soft); }
.report-section.section-neutral .section-icon { background: #f2eef5; }

.mark { font-weight: 800; font-size: .84rem; border-radius: 999px; padding: .16rem .5rem; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.mark-zero { background: var(--green-soft); color: var(--green); }
.mark-warn { background: var(--amber-soft); color: var(--amber); }
.mark-bad { background: var(--red-soft); color: var(--red); }

.subtest-list { list-style: none; margin: 0; padding: .35rem 1.2rem 1rem; }
.subtest { padding: .85rem 0; border-bottom: 1px dashed var(--line); }
.subtest:last-child { border-bottom: 0; }
.subtest-head { display: flex; gap: .6rem; align-items: flex-start; }
.subtest-head h4 { font-size: .92rem; margin: .1rem 0 0; flex: 1; font-weight: 650; }
.subtest-desc { font-size: .8rem; color: var(--muted); margin: .35rem 0 0 1.95rem; }
.subtest-msgs { margin: .4rem 0 0 1.95rem; padding-left: 1.1rem; font-size: .8rem; color: var(--ink-soft); }
.subtest-msgs li { margin-bottom: .2rem; overflow-wrap: anywhere; }
.status-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; flex: none; }
.status-success { background: var(--green-soft); color: var(--green); }
.status-warning { background: var(--amber-soft); color: var(--amber); }
.status-failure { background: var(--red-soft); color: var(--red); }
.status-neutral { background: #f2eef5; color: var(--muted); }
.details { margin: .5rem 0 0 1.95rem; font-size: .78rem; }
.details ul { margin: 0; padding-left: 1.1rem; }
.details code { overflow-wrap: anywhere; }
.mini-table { width: 100%; border-collapse: collapse; font-size: .78rem; background: #fdfcfe; }
.mini-table th, .mini-table td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.mini-table th { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.text-bad { color: var(--red); }
.text-good { color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { background: #f5f1f8; padding: .16rem .4rem; border-radius: 6px; }
.raw-snippet { white-space: pre-wrap; overflow-wrap: anywhere; background: #faf7fc; padding: .5rem; border-radius: 8px; margin: .35rem 0 0; }
.weight-bar { height: 8px; background: #f1ebf5; border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.weight-bar span { display: block; height: 100%; background: var(--amber); }

.report-side { display: grid; gap: 1rem; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; }
.side-card h2 { font-size: 1.02rem; margin-bottom: .6rem; }
.message-facts { margin: 0; font-size: .82rem; }
.message-facts div { margin-bottom: .65rem; }
.message-facts dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .12rem; }
.message-facts dd { margin: 0; overflow-wrap: anywhere; }
.sa-score { font-family: var(--serif); font-size: 2.1rem; margin: 0; line-height: 1; }
.side-card .hint { margin: .3rem 0 0; }
.rules-list { margin-top: .6rem; font-size: .8rem; }
.rules-list summary { cursor: pointer; color: var(--purple); }
.rules-list ul { list-style: none; margin: .5rem 0 0; padding: 0; }
.rules-list li { padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.side-cta p { font-size: .85rem; color: var(--muted); }
.side-cta .button { margin-top: .2rem; }

.tabbar { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; flex-wrap: wrap; }
.tabbar button { background: none; border: 0; font: inherit; font-size: .8rem; padding: .35rem .5rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabbar button[aria-selected="true"] { color: var(--purple); border-bottom-color: var(--purple); }
.preview-pane pre { max-height: 300px; overflow: auto; font-size: .72rem; white-space: pre-wrap; overflow-wrap: anywhere; background: #faf7fc; padding: .6rem; border-radius: 8px; margin: 0; }
.preview-pane iframe { width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pad { padding: 1rem; margin: 0; }

.report-embed .report-shell { padding: .8rem; max-width: none; }
.embed-body .site-footer { display: none; }
.big-emoji { font-size: 2.6rem; margin-bottom: .5rem; }

.doc-shell { max-width: 820px; margin: 0 auto; padding: 2.5rem 1rem 4rem; }
.doc-shell h1 { font-size: 2.4rem; }
.doc-shell h2 { font-size: 1.25rem; margin-top: 1.8rem; }
.doc-shell p { color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translate(-50%, 1.4rem);
  background: #17131f; color: #fff; padding: .6rem 1rem; border-radius: 10px;
  font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 50; max-width: calc(100vw - 2rem); text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .report-grid { grid-template-columns: 1fr; }
  .score-card { grid-template-columns: auto 1fr; }
  .score-meta { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1rem; }
  .score-meta div { border-bottom: 0; }
}

@media (max-width: 640px) {
  .site-nav { gap: .8rem; font-size: .84rem; }
  .site-nav a:not(.nav-cta) { display: none; }
  .hero { padding-top: 2rem; }
  .address-card { padding: .8rem; }
  .report-top-actions { width: 100%; }
  .score-card { grid-template-columns: 1fr; text-align: center; }
  .gauge { margin: 0 auto; }
  .score-tags { justify-content: center; }
  .score-meta { text-align: left; }
  .section-icon { display: none; }
  .report-section-head { grid-template-columns: 1fr auto; }
  .footer-inner { flex-direction: column; }
}

@media print {
  .site-header, .report-top-actions, .site-footer, .summary-nav, .report-side, .hero { display: none; }
  .report-grid { display: block; }
  body { background: #fff; }
  .report-section { break-inside: avoid; }
}
