/* Passkey Lab — dark "diagnostic console" identity.
   Cool near-black, hairline rules, one teal signal accent. Two-column bench layout. */

:root {
  --bg:         #0D1117;
  --panel:      #151B23;
  --panel-2:    #1B222B;
  --ink:        #E7ECF3;
  --ink-2:      #9BA7B4;
  --ink-3:      #8A94A3;
  --rule:       #2A323C;
  --rule-soft:  #202730;
  --accent:     #3FBAC2;   /* teal signal, tuned for dark */
  --accent-ink: #7AD6DC;
  --accent-deep:#0F5C63;
  --accent-wash:#12333A;
  --warn:       #E0A458;
  --bad:        #E5606A;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px) 0 0 / 100% 40px,
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.frame {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 2.4rem) clamp(1rem, 3vw, 2rem) 3rem;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}

/* ---------- masthead ---------- */
.masthead {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--rule);
}
.mark {
  font-family: var(--display); font-weight: 600; font-size: 1.35rem;
  letter-spacing: -0.02em; color: var(--ink);
}
.mark span { color: var(--accent); }
.role { margin: 0; font-family: var(--mono); font-size: .72rem; color: var(--ink-2); }

/* ---------- signature readout ---------- */
.readout {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 1rem;
  align-items: stretch;
  margin: 1.25rem 0;
}
.readout-lead {
  padding: 1.25rem 1.4rem;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.eyebrow {
  margin: 0; font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .16em; color: var(--ink-3);
}
.rp {
  margin: .3rem 0 .55rem;
  font-family: var(--mono); font-weight: 500;
  font-size: clamp(1.4rem, 3.6vw, 2.3rem);
  letter-spacing: -0.01em; color: var(--accent-ink);
  word-break: break-all; line-height: 1.05;
}
.readout-note { margin: 0; max-width: 52ch; color: var(--ink-2); font-size: .88rem; }
.gauges {
  display: grid; grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 1px;
  margin: 0; background: var(--rule-soft); border: 1px solid var(--rule); border-radius: 4px;
  overflow: hidden; align-self: stretch;
}
.gauge { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gauge dt { margin-bottom: 0; }
.gauge { padding: .55rem .75rem; background: var(--panel); }
.gauge dt {
  font-family: var(--mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-3); margin-bottom: .15rem;
}
.gauge dd { margin: 0; font-size: .86rem; font-weight: 500; color: var(--ink); word-break: break-word; }

/* ---------- bench (two columns) ---------- */
.bench {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 1rem;
  align-items: stretch;
}
.col { display: flex; flex-direction: column; gap: 1rem; }

/* ---------- step panels ---------- */
.step {
  padding: 1.15rem 1.25rem 1.3rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.step .eyebrow { display: flex; align-items: center; gap: .5rem; }
.idx { font-family: var(--display); font-weight: 600; font-size: .8rem; color: var(--accent); }
.step h2 {
  font-family: var(--display); font-weight: 500; font-size: 1.2rem;
  letter-spacing: -0.015em; margin: .3rem 0 1rem;
}

/* ---------- forms ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem 1.1rem; margin-bottom: 1.1rem; }
.grid-1 { grid-template-columns: 1fr; }
label {
  display: flex; flex-direction: column; gap: .35rem; min-width: 0;
  font-family: var(--mono); font-size: .66rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--ink-2);
}
input[type="text"], select {
  width: 100%; min-width: 0;
  font-family: var(--sans); font-size: .92rem; text-transform: none; letter-spacing: 0;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 3px; padding: .55rem .65rem;
}
input[type="text"]:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
select { cursor: pointer; }
.autofill {
  width: 100%; margin-top: .8rem; font-family: var(--sans); font-size: .92rem;
  color: var(--ink); background: var(--bg);
  border: 1px dashed var(--rule); border-radius: 3px; padding: .55rem .65rem;
}

/* ---------- buttons ---------- */
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .03em;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--rule); border-radius: 3px; padding: .55rem 1rem;
  cursor: pointer; transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent-deep); border-color: var(--accent-deep); color: #EAFBFC; font-weight: 500; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #06232A; }
.btn-quiet { color: var(--ink-2); }
.btn-file { display: inline-flex; align-items: center; }

.prove-group { margin-bottom: .7rem; }
.prove-glabel {
  display: block; margin-bottom: .4rem;
  font-family: var(--mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-3);
}

.hint { margin: .9rem 0 0; max-width: 62ch; font-size: .82rem; color: var(--ink-2); }
.hint strong { color: var(--ink); font-weight: 600; }
code {
  font-family: var(--mono); font-size: .85em;
  background: var(--accent-wash); color: var(--accent-ink);
  padding: .05em .35em; border-radius: 2px;
}

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th {
  text-align: left; font-family: var(--mono); font-weight: 400; font-size: .62rem;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
  padding: .45rem .55rem; border-bottom: 1px solid var(--rule);
}
tbody td { padding: .5rem .55rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
tbody tr:hover td { background: var(--panel-2); }
td.actions { white-space: nowrap; text-align: right; }
.muted { color: var(--ink-3); }

.link {
  font-family: var(--mono); font-size: .72rem; background: none; border: 0;
  color: var(--accent); cursor: pointer; padding: 0 .1rem; margin-left: .55rem;
}
.link:first-child { margin-left: 0; }
.link:hover { color: var(--accent-ink); text-decoration: underline; }
.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- prove-it result card ---------- */
.prove-out {
  margin-top: 1rem; padding: 1rem 1.1rem;
  background: var(--panel-2); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); border-radius: 3px;
}
.prove-ok  { border-left-color: var(--accent); }
.prove-bad { border-left-color: var(--bad); }
.verdict {
  display: inline-block; font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 500;
  padding: .22rem .6rem; border-radius: 2px; margin-bottom: .7rem;
}
.verdict-ok  { background: var(--accent); color: #06232A; }
.verdict-bad { background: var(--bad); color: #22060A; }
.prove-out h3 {
  font-family: var(--display); font-weight: 500; font-size: 1rem; margin: 0 0 .75rem;
}
.prove-rows {
  margin: 0 0 .85rem; display: grid; gap: 1px;
  background: var(--rule-soft); border: 1px solid var(--rule-soft);
  border-radius: 3px; overflow: hidden;
}
.prow { display: grid; grid-template-columns: minmax(8rem, 36%) 1fr; gap: .8rem; padding: .5rem .7rem; background: var(--panel); }
.prow dt {
  margin: 0; font-family: var(--mono); font-size: .64rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-3);
}
.prow dd { margin: 0; font-size: .85rem; color: var(--ink); word-break: break-word; }
.prow.ok dd  { color: var(--accent-ink); font-weight: 600; }
.prow.bad dd { color: var(--bad); font-weight: 600; }
.cause {
  margin: 0; padding: .65rem .8rem; font-size: .9rem; line-height: 1.55;
  color: var(--ink); background: var(--bg); border-radius: 3px;
}
.cause b { color: var(--accent-ink); font-weight: 600; }
.prove-bad .cause b { color: var(--bad); }

/* ---------- explainer ---------- */
.explain {
  margin: 0 0 .85rem; padding: .8rem .95rem; font-size: .92rem; line-height: 1.5;
  background: var(--panel-2); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); border-radius: 3px; color: var(--ink);
}
.explain-ok   { border-left-color: var(--accent); }
.explain-warn { border-left-color: var(--warn); }
.explain-bad  { border-left-color: var(--bad); }

/* ---------- trace / log ---------- */
.step-trace { display: flex; flex-direction: column; flex: 1 1 auto; }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
pre#log {
  margin: 0; flex: 1;
  background: #080B0F; color: #C6D0DA;
  border: 1px solid var(--rule); border-radius: 3px;
  padding: .95rem 1.05rem; min-height: 220px; height: 0; overflow: auto;
  font-family: var(--mono); font-size: .75rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
pre#log:empty::before {
  content: "Waiting — run an action above. Requests, responses and decoded ceremony data stream here.";
  color: var(--ink-3);
}

/* ---------- colophon ---------- */
.colophon { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.colophon p { margin: 0; max-width: 78ch; font-size: .78rem; color: var(--ink-3); }

/* ---------- raw inspector modal ---------- */
.mono { font-family: var(--mono); }
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 1.5rem;
  background: rgba(6, 9, 13, .72);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 5px; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.2rem; border-bottom: 1px solid var(--rule); background: var(--panel-2);
}
.modal-head h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 1.1rem; }
.modal-body { padding: 1.1rem 1.2rem; overflow: auto; }

.insp-sec { margin-bottom: 1.3rem; }
.insp-sec > h3 {
  font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent-ink); margin: 0 0 .55rem; padding-bottom: .35rem; border-bottom: 1px solid var(--rule-soft);
}
.insp-note { margin: .5rem 0 .3rem; font-size: .78rem; color: var(--ink-3); }
.hex {
  margin: .35rem 0 0; padding: .55rem .7rem; background: #080B0F; color: #8FB0C4;
  border: 1px solid var(--rule); border-radius: 3px;
  font-family: var(--mono); font-size: .72rem; line-height: 1.5;
  white-space: pre; overflow-x: auto; word-break: normal;
}
.insp-edit {
  width: 100%; min-height: 90px; margin-top: .3rem; resize: vertical;
  font-family: var(--mono); font-size: .76rem; line-height: 1.5; color: var(--ink);
  background: var(--bg); border: 1px solid var(--rule); border-radius: 3px; padding: .6rem .7rem;
}
.insp-edit:focus-visible { outline: 2px solid var(--accent); border-color: var(--accent); }
.insp-flip {
  display: inline-flex; align-items: center; gap: .5rem; margin: .6rem 0;
  font-family: var(--mono); font-size: .74rem; text-transform: none; letter-spacing: 0; color: var(--ink-2);
}
.insp-flip input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.insp-result { margin-top: .7rem; font-size: .85rem; color: var(--ink); }
.insp-result .verdict { margin-bottom: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .readout { grid-template-columns: 1fr; gap: 1.1rem; }
  .bench { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .gauges { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
