:root {
  color-scheme: dark light;
  --page: #09111e;
  --panel: #101d30;
  --panel-raised: #15243a;
  --edge: #30445e;
  --ink: #f2f5fb;
  --muted: #b9c4d4;
  --mint: #81f0c5;
  --blue: #99b4ff;
  --amber: #ffdc8c;
  --red: #ffaaaa;
  --focus: #ffe081;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(ellipse at 78% -12%, #1a3553 0, transparent 36rem), var(--page);
  color: var(--ink);
  line-height: 1.58;
}

a { color: #b7cdff; text-underline-offset: .18em; }
a:hover { color: #d3e0ff; }
button, input, select, textarea { font: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  transform: translateY(-180%);
  padding: .65rem .9rem;
  color: #09111e;
  background: var(--focus);
  border-radius: .45rem;
}
.skip-link:focus { transform: none; }

.shell { width: min(100% - 2rem, 1100px); margin: 0 auto; }
.page-header { padding: clamp(2rem, 6vw, 5rem) 0 1.5rem; }
.eyebrow { margin: 0 0 .55rem; color: var(--mint); font-size: .77rem; font-weight: 750; letter-spacing: .12em; }
h1, h2, h3 { line-height: 1.18; }
h1 { max-width: 16ch; margin: 0; font: 500 clamp(2.5rem, 7vw, 4.6rem)/1.04 Georgia, "Times New Roman", serif; }
h2 { font: 500 clamp(1.55rem, 4vw, 2.35rem)/1.14 Georgia, "Times New Roman", serif; }
h3 { font-size: 1.08rem; }
.lead { max-width: 68ch; margin: 1rem 0 0; color: #d4deec; font-size: clamp(1.1rem, 2vw, 1.32rem); }

.boundary, .lab-panel, .bridge, .evidence-card, .result-card {
  border: 1px solid var(--edge);
  border-radius: 1.1rem;
  background: color-mix(in srgb, var(--panel) 95%, transparent);
}
.boundary { display: grid; grid-template-columns: auto 1fr; gap: 1rem; padding: 1.25rem; border-color: #806b36; background: #231e13; }
.boundary-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border: 1px solid var(--amber); border-radius: 50%; color: var(--amber); font-weight: 800; }
.boundary h2 { margin: 0 0 .45rem; color: var(--amber); font: 700 1.12rem/1.3 inherit; }
.boundary p { margin: 0; color: #f5e9c9; }

.flow-figure { margin: 1.6rem 0; overflow: hidden; border: 1px solid var(--edge); border-radius: 1.1rem; background: #0e192b; }
.flow-figure img { display: block; width: 100%; height: auto; }
.flow-figure figcaption { padding: .85rem 1.1rem; color: var(--muted); font-size: .92rem; }

.lab-panel { padding: clamp(1rem, 4vw, 2.2rem); box-shadow: 0 1.2rem 3rem #0004; }
.panel-heading h2 { margin: 0; }
.panel-heading > p:last-child { max-width: 70ch; color: var(--muted); }
.control-grid, .proof-source-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(12rem, .6fr); gap: 1rem; }
.field { display: grid; gap: .45rem; }
.field label { font-weight: 700; }
.field small, .muted { color: var(--muted); font-size: .9rem; }
select, input, textarea {
  width: 100%;
  border: 1px solid #516987;
  border-radius: .65rem;
  padding: .72rem .8rem;
  color: var(--ink);
  background: #0a1423;
}
textarea { resize: vertical; }
.record-field { margin-top: 1rem; }
.proof-source-grid { grid-template-columns: 1fr 1fr; margin-top: 1rem; }
.evidence-card { min-width: 0; padding: 1rem; background: var(--panel-raised); }
.evidence-card h3 { margin: 0 0 .8rem; }
.hash-list { display: grid; gap: .75rem; margin: 0; padding-left: 1.5rem; }
.hash-list li { padding-left: .2rem; }
.hash-list code, .hash-value { display: block; overflow-wrap: anywhere; color: #c7d6ff; font: .78rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.hash-value { padding: .65rem; border: 1px solid var(--edge); border-radius: .5rem; background: #0a1423; }

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.1rem 0; }
.button { min-height: 2.8rem; padding: .68rem 1rem; border: 1px solid transparent; border-radius: .7rem; cursor: pointer; font-weight: 760; }
.button.primary { color: #07170f; background: var(--mint); }
.button.primary:hover { background: #b1ffdf; }
.button.secondary { color: var(--ink); border-color: #58708f; background: #172840; }
.button.secondary:hover { background: #213653; }
.button:disabled { cursor: not-allowed; opacity: .65; }

.result-card { padding: 1rem; background: #0c1727; }
.result-card h3 { margin: 0 0 .5rem; }
.status { display: flex; align-items: flex-start; gap: .65rem; margin: 0 0 .75rem; padding: .8rem; border: 1px solid var(--edge); border-radius: .65rem; font-weight: 750; }
.status::before { flex: none; width: .72rem; height: .72rem; margin-top: .3rem; border-radius: 50%; background: currentColor; content: ""; }
.status[data-kind="match"] { color: var(--mint); border-color: #367b64; background: #0c251d; }
.status[data-kind="mismatch"] { color: var(--amber); border-color: #806b36; background: #241f14; }
.status[data-kind="unknown"] { color: #d2d8e5; border-color: #59647a; background: #1c2330; }
.proof-steps { display: grid; gap: .6rem; padding-left: 1.55rem; }
.proof-steps li { padding-left: .25rem; }
.proof-steps code { display: block; overflow-wrap: anywhere; color: #c7d6ff; font: .78rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.result-card details { margin-top: .9rem; border-top: 1px solid var(--edge); padding-top: .8rem; }
.result-card summary { color: var(--blue); font-weight: 700; cursor: pointer; }

.bridge { margin: 1.4rem 0; padding: clamp(1rem, 4vw, 2rem); }
.bridge h2 { margin: 0; }
.bridge ul { padding-left: 1.3rem; }
.bridge li + li { margin-top: .45rem; }
footer { padding: 1rem 0 3rem; color: var(--muted); font-size: .92rem; }
footer p { margin: .5rem 0; }

@media (max-width: 680px) {
  .shell { width: min(100% - 1.1rem, 1100px); }
  .control-grid, .proof-source-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .button { width: 100%; }
  .boundary { padding: 1rem; }
  .hash-list code, .hash-value, .proof-steps code { font-size: .72rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .lab-panel { animation: appear .35s ease-out both; }
  @keyframes appear { from { opacity: .45; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
