/* Payment Core demo, in the project's own identity (see docs/assets/logo.svg):
   dark ledger green and Space Grotesk; mint for money that
   moved, blue for stored answers, coral for declines, amber for the key. */
:root {
  --surface: #0d1a16; --raised: #12221d; --sunken: #08120f;
  --line: #1e3029; --line-strong: #355247;
  --ink: #e8f2ee; --muted: #8aa69a;
  --mint: #3fd49a; --mint-hover: #62e0ae; --on-mint: #04140d;
  --blue: #8ab4ff; --coral: #ff8a7a; --amber: #f5c451;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 16px/26px var(--sans); }
a { color: var(--mint); }
a:hover { color: var(--mint-hover); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }

.bar { display: flex; align-items: center; gap: 12px; max-width: 1240px; margin: 0 auto; padding: 20px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; }
.tag { font: 500 12px/16px var(--mono); color: var(--mint); border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 10px; }
.spacer { flex: 1; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { background: none; border: 0; color: var(--muted); font: 500 12px/16px var(--mono); padding: 7px 13px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--raised); color: var(--ink); }

main { max-width: 1240px; margin: 0 auto; padding: 8px 24px 48px; }
.intro { margin: 16px 0 28px; }
h1 { font-weight: 700; font-size: 44px; line-height: 50px; letter-spacing: -0.025em; max-width: 22ch; }
h1 em { font-style: normal; color: var(--mint); }
.lead { color: var(--muted); font-size: 18px; line-height: 29px; max-width: 70ch; margin: 16px 0 0; }

.bench { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
.stage { position: relative; min-height: 520px; border: 1px solid var(--line); border-radius: 12px; background: radial-gradient(120% 90% at 50% 0%, #11261f 0%, var(--sunken) 70%); overflow: hidden; }
.stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.stage canvas:active { cursor: grabbing; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.scene-label { position: absolute; left: 0; top: 0; white-space: nowrap; font: 500 12px/16px var(--mono); color: var(--muted); background: rgba(8, 18, 15, 0.75); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.scene-label.gate { color: var(--amber); }
.scene-label.value { color: var(--ink); }
.scene-label.lock { color: var(--amber); display: none; }
.labels[data-mode="race"] .scene-label.lock { display: block; }
.labels[data-mode="race"] .scene-label.gate, .labels[data-mode="nokey"] .scene-label.gate { color: var(--muted); }
.hint { position: absolute; left: 16px; bottom: 10px; margin: 0; font: 12px/16px var(--mono); color: var(--muted); pointer-events: none; }
.no-webgl-note { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; color: var(--muted); }
.no-webgl-note[hidden] { display: none; }
.stage.no-webgl .hint { display: none; }

.controls { display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); padding: 16px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
legend, .count label { font: 500 12px/16px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.scenario { position: relative; display: grid; gap: 2px; padding: 12px 12px 12px 40px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color 140ms var(--ease), background 140ms var(--ease); }
.scenario:hover { border-color: var(--line-strong); }
.scenario:has(input:checked) { border-color: var(--mint); background: rgba(63, 212, 154, 0.06); }
.scenario input { position: absolute; left: 14px; top: 15px; accent-color: var(--mint); margin: 0; }
.scenario b { font-weight: 600; font-size: 15px; line-height: 20px; }
.scenario span { color: var(--muted); font-size: 14px; line-height: 20px; }
.scenario small { color: var(--ink); font: 12px/18px var(--mono); }
.count { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; }
.count output { font: 600 15px/20px var(--mono); }
.count input { grid-column: span 2; accent-color: var(--mint); }
.send { margin-top: auto; font: 600 15px/20px var(--sans); padding: 14px 18px; border-radius: 8px; border: 0; background: var(--mint); color: var(--on-mint); cursor: pointer; transition: background 140ms var(--ease); }
.send:hover:not(:disabled) { background: var(--mint-hover); }
.send:disabled { opacity: 0.55; cursor: progress; }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0; }
.stat { border: 1px solid var(--line); border-radius: 12px; background: var(--raised); padding: 14px 16px; min-width: 0; }
.stat b { display: block; font: 600 clamp(18px, 1.8vw, 26px)/32px var(--mono); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font: 500 11px/16px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat.moved b { color: var(--mint); }
.stat.replayed b { color: var(--blue); }
.stat.declined b { color: var(--coral); }

.message { min-height: 58px; font-size: 18px; line-height: 29px; max-width: 80ch; margin: 0 0 20px; }
.message.warn { color: var(--amber); }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--raised); padding: 16px; min-width: 0; }
.panel h2, .how-wrap h2 { font: 500 12px/16px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.log-head, .row { display: grid; grid-template-columns: 4ch 6ch 1fr 8ch; gap: 12px; font: 14px/22px var(--mono); text-align: left; }
.log-head { color: var(--muted); font-size: 12px; padding: 0 8px 6px; border-bottom: 1px solid var(--line); }
.log { max-height: 320px; overflow: auto; padding-top: 4px; }
.row { width: 100%; background: none; border: 0; border-radius: 6px; color: var(--muted); padding: 2px 8px; cursor: pointer; }
.row:hover, .row[aria-pressed="true"] { background: var(--sunken); }
.row.moved span:nth-child(3) { color: var(--mint); }
.row.replayed span:nth-child(3) { color: var(--blue); }
.row.declined span:nth-child(3), .row.error span:nth-child(3), .row.limited span:nth-child(3) { color: var(--coral); }
.row span:last-child { text-align: right; }
.inspector { margin: 0; font: 13px/20px var(--mono); color: var(--ink); white-space: pre-wrap; word-break: break-word; max-height: 344px; overflow: auto; }
.inspector.empty { color: var(--muted); font-family: var(--sans); font-size: 15px; line-height: 24px; }

.how-wrap { margin-top: 40px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how article { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 8px; align-content: start; }
.how h3 { font-size: 18px; line-height: 26px; font-weight: 600; }
.how p { margin: 0; color: var(--muted); font-size: 15px; line-height: 24px; }
.how a { font: 500 13px/20px var(--mono); }

footer { max-width: 1240px; margin: 0 auto; padding: 20px 24px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 22px; }
footer p { margin: 0 0 8px; max-width: 90ch; }
footer .links { display: flex; gap: 20px; font-family: var(--mono); font-size: 13px; }

@media (max-width: 1000px) {
  .bench, .detail { grid-template-columns: 1fr; }
  .controls { order: -1; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .how { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 32px; line-height: 38px; }
  .stage { min-height: 400px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hint { display: none; }
  .tag { display: none; }
  .scene-label { font-size: 11px; padding: 2px 6px; }
  .log-head, .row { grid-template-columns: 3ch 4ch 1fr 7ch; gap: 8px; font-size: 13px; }
  .row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  .scenario, .send { transition: none; }
}
