/* Shared foundation for the scope tool pages. Tokens come from parsemo-web (tokens.css). */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; display: flex; flex-direction: column; margin: 0; background: var(--canvas); color: var(--ink); font: 400 1rem/1.7 var(--ui); word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul, fieldset { margin: 0; }
ol, ul { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
h1, h2, h3 { text-wrap: balance; }
main { flex: 1 0 auto; }
::selection { background: var(--cobalt-tint); color: var(--ink); }
textarea, input { caret-color: var(--cobalt); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 30; background: var(--ink); color: #fff; padding: .6rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; }
.wrap { max-width: 76rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.num { font-variant-numeric: tabular-nums; }
.ico { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* app header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(245, 247, 251, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: .9rem; height: 3.75rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font: 700 1.1rem/1 var(--display); letter-spacing: -.02em; text-decoration: none; }
.mark { width: 1.25rem; height: 1.25rem; border-radius: 4px; background: linear-gradient(var(--cobalt) 0 0) 0 0 / 100% 30% no-repeat, linear-gradient(var(--cobalt) 0 0) 0 50% / 100% 30% no-repeat, linear-gradient(var(--cobalt-tint) 0 0) 0 100% / 100% 30% no-repeat; }
.top-sep { width: 1px; height: 1.1rem; background: var(--line-strong); }
.tool-name { font-weight: 700; font-size: .9375rem; }
.ver { font-size: .75rem; font-weight: 700; color: var(--ink-3); padding: .1rem .5rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.logo, .tool-name, .ver, .top-link { white-space: nowrap; }
.top-link { margin-left: auto; font-size: .875rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.top-link:hover { color: var(--ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.5rem; padding: 0 1rem; border: 0; border-radius: 10px; font: 600 .9375rem/1 var(--ui); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease, color .2s ease; }
.btn-lg { min-height: 3rem; padding: 0 1.35rem; font-size: 1rem; border-radius: var(--radius); }
.btn-primary { background: var(--cobalt); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px -8px rgba(36, 75, 214, .8); }
.btn-primary:hover { background: var(--cobalt-2); }
.btn-primary:disabled { background: var(--line-strong); box-shadow: none; cursor: progress; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 .7rem; }
.btn-quiet:hover { background: var(--surface); color: var(--ink); }
.btn:active { transform: translateY(1px); }
kbd { font: 600 .75rem/1 var(--ui); padding: .2rem .35rem; border-radius: 5px; background: rgba(255, 255, 255, .18); }
.btn-ghost kbd, .hint kbd { background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }

/* choice chips: real checkboxes and radios, styled */
.choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.1rem; padding: 0 .8rem; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: .875rem; font-weight: 500; color: var(--ink-2); transition: box-shadow .15s ease, background-color .15s ease, color .15s ease; }
.choice:hover span { box-shadow: inset 0 0 0 1px var(--ink-3); color: var(--ink); }
.choice input:checked + span { background: var(--cobalt-soft); color: var(--cobalt-2); box-shadow: inset 0 0 0 1.5px var(--cobalt); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.field-label { display: block; font-size: .8125rem; font-weight: 700; color: var(--ink-2); margin-bottom: .45rem; }
.hint { font-size: .8125rem; color: var(--ink-3); }

/* notices */
.notice { margin: 0; padding: .7rem .9rem; border-radius: 10px; font-size: .875rem; background: var(--cobalt-soft); color: var(--cobalt-2); }
.notice[data-kind="warn"] { background: var(--amber-soft); color: var(--amber); }
.notice[data-kind="error"] { background: var(--red-soft); color: var(--red-text); }

/* draft content (shared markup from draft.js) */
.d-title { font: 700 clamp(1.35rem, 2.2vw, 1.75rem)/1.35 var(--display); letter-spacing: -.025em; }
.d-summary { color: var(--ink-2); max-width: 46em; }
.d-sec h3 { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 700; color: var(--ink-2); margin-bottom: .55rem; }
.d-sec h3::before { content: ""; width: .55rem; height: .55rem; border-radius: 3px; background: var(--line-strong); flex: none; }
.s-flow h3::before { background: var(--ink); }
.s-ui h3::before { background: var(--cobalt); }
.s-data h3::before { background: var(--green); }
.s-link h3::before { background: var(--amber-line); }
.s-ai h3::before { background: var(--pink); }
.s-human h3::before { background: var(--amber); border-radius: 50%; }
.s-rule h3::before { background: var(--violet); }
.s-first h3::before { background: var(--cobalt); border-radius: 50%; }
.s-notNow h3::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); border-radius: 50%; }
.s-questions h3::before { background: var(--ink-3); border-radius: 50%; }
.d-list li { position: relative; padding: .3rem 0 .3rem 1rem; font-size: .9375rem; line-height: 1.55; }
.d-list li::before { content: ""; position: absolute; left: .1rem; top: .95rem; width: .35rem; height: 1.5px; background: var(--line-strong); }
.d-flow { counter-reset: step; }
.d-flow li { counter-increment: step; display: grid; grid-template-columns: 1.6rem 3.6rem 1fr; align-items: baseline; gap: .5rem; padding: .45rem 0; font-size: .9375rem; line-height: 1.5; }
.d-flow li::before { content: counter(step); font-size: .75rem; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.actor { justify-self: start; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; background: var(--canvas); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.a-ai .actor { background: var(--pink-soft); color: var(--pink); box-shadow: none; }
.a-human .actor { background: var(--amber-soft); color: var(--amber); box-shadow: none; }
.d-val { padding: 0 .25rem; border-radius: 4px; border-bottom: 1.5px dashed var(--tbd); color: var(--tbd); font-weight: 600; font-variant-numeric: tabular-nums; }
.d-note { margin-top: .4rem; font-size: .8125rem; color: var(--tbd); }
.d-none { font-size: .875rem; color: var(--ink-3); }
.d-wait { display: inline-flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--ink-3); }
.d-wait::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--cobalt); animation: pulse 1s var(--ease-out) infinite alternate; }
@keyframes pulse { from { opacity: .25; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }

/* actions */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); font-size: .8125rem; color: var(--ink-3); }
.foot-in { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; padding-top: 1.2rem; padding-bottom: 1.4rem; }
.foot a { color: var(--ink-2); }
.foot b { color: var(--ink-2); font-weight: 600; }

@media (max-width: 560px) {
  .top-in { gap: .6rem; }
  .top-link { display: none; }
  .actions { flex-wrap: nowrap; }
  .actions .btn-ghost { flex: 0 0 2.75rem; width: 2.75rem; padding: 0; }
  .actions .btn-ghost .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .actions .btn-primary { flex: 1 1 auto; margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  body { background: #fff; }
  .top, .foot, form, .actions, .notice, .no-print { display: none !important; }
  #result { box-shadow: none !important; padding: 0 !important; }
  .d-sec { break-inside: avoid; }
}
