  :root {
    --paper: #17161a;
    --paper-2: #1f1e23;
    --ink: #e9e6ee;
    --ink-soft: #a29daa;
    --ink-faint: #6a6572;
    --violet: #9b5cff;
    --violet-hi: #d9b8ff;
    --violet-deep: #b98cff;
    --void: #07050a;
    --cream: #ece4f4;
    --rule: #4a4652;
    --sans: "Inter", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    /* spacing scale, 4px base */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
    --gutter: clamp(16px, 2.2vw, 32px);   /* side padding of every section */
    --section: clamp(48px, 6vw, 80px);    /* space above each section heading */
    --frame-max: 1440px;                  /* the page stops growing past this */
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }
  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  ::selection { background: var(--violet); color: #fff; }
  a { color: inherit; text-decoration: none; }
  .mono { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; }

  /* glitch field behind everything */
  #field { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

  .frame {
    position: relative; z-index: 1;
    width: min(var(--frame-max), calc(100% - 28px));
    margin: 14px auto;
    min-height: calc(100vh - 28px);
    border: 2px dotted var(--rule);
    border-radius: 14px;
    display: grid;
    grid-template-columns: 1fr 148px;
  }

  /* ───── sidebar ───── */
  aside {
    order: 2;
    border-left: 2px dotted var(--rule);
    position: sticky; top: 14px;
    height: calc(100vh - 28px);
    display: flex; flex-direction: column;
    padding: var(--s6) var(--s4) var(--s5);
  }
  .brand { display: flex; align-items: flex-start; justify-content: center; gap: 2px; }
  .brand b { font-weight: 600; font-size: 34px; letter-spacing: -.04em; line-height: 1; }
  .brand .mini { margin: -6px 0 0 3px; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
  .brand:hover .mini { transform: translateX(5px) rotate(-6deg); }
  .tag { text-align: center; margin-top: 16px; line-height: 1.6; color: var(--ink-soft); }
  nav { margin-top: var(--s7); display: flex; flex-direction: column; gap: var(--s5); }
  nav a { display: flex; gap: 10px; align-items: baseline; color: var(--ink-soft); transition: color .2s; }
  nav a::before {
    content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%;
    border: 1.5px solid currentColor; transform: translateY(1px);
  }
  nav a.on, nav a:hover { color: var(--violet-deep); }
  nav a.on::before { background: var(--violet); border-color: var(--violet); }
  .side-foot { margin-top: auto; text-align: center; color: var(--ink-soft); line-height: 1.7; }
  .side-foot a { display: inline-block; margin-bottom: var(--s4); color: var(--ink); }
  .side-foot a:hover { color: var(--violet-deep); }
  .pips { display: flex; justify-content: center; gap: var(--s3); margin-top: var(--s3); }
  .pips span { width: 9px; height: 11px; background: repeating-linear-gradient(0deg, var(--ink-faint) 0 1px, transparent 1px 3px); }

  /* ───── main ───── */
  main { min-width: 0; }
  .bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s5) var(--gutter) 0; color: var(--ink-soft); }
  .live { display: inline-flex; align-items: center; gap: 7px; }
  .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--ink-soft); }
  .live.pulse::before { border-color: var(--violet); background: var(--violet); animation: pulse 2.4s infinite; }
  @keyframes pulse { 50% { opacity: .25; } }

  section { padding: 0 var(--gutter); }
  .hero {
    display: grid; grid-template-columns: 1fr minmax(340px, 460px);
    gap: clamp(32px, 4vw, 64px); align-items: center;
    padding-top: var(--section); padding-bottom: var(--s6);
    border-bottom: 2px dotted var(--rule);
  }
  h1 { font-weight: 500; font-size: clamp(44px, 6.4vw, 78px); line-height: .98; letter-spacing: -.045em; }
  h1 em { font-style: normal; color: var(--violet-deep); position: relative; }
  .lede { margin-top: var(--s5); max-width: 30ch; font-size: 16px; line-height: 1.65; color: var(--ink-soft); }
  .btn {
    display: inline-flex; gap: var(--s2); margin-top: var(--s6); margin-right: var(--s4); padding: 4px 2px;
    font-family: var(--mono); font-size: 12px; color: var(--ink);
    border-left: 3px solid var(--violet); padding-left: 10px;
    transition: color .2s, letter-spacing .25s;
  }
  .btn:hover { color: var(--violet-deep); letter-spacing: .06em; }
  .hero-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--ink-soft); margin-top: var(--s5); }
  .hero-foot a { border-bottom: 1px solid var(--ink-faint); }
  .hero-foot a:hover { color: var(--violet-deep); border-color: var(--violet); }

  /* specimen card */
  .specimen {
    justify-self: center; width: 100%;
    background: var(--void); color: var(--cream);
    border-radius: 10px; overflow: hidden;
    transform: rotate(-2.2deg);
    box-shadow: 0 30px 70px -20px rgba(155, 92, 255, .35), 0 0 0 1px #2c2a31;
    transition: transform .5s cubic-bezier(.2,.8,.2,1);
  }
  .specimen:hover { transform: rotate(-.6deg) translateY(-4px); }
  .spec-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s3) var(--s4); }
  .spec-head b { font-weight: 500; color: var(--violet-hi); }
  .spec-img { position: relative; cursor: pointer; aspect-ratio: 1; overflow: hidden; }
  .spec-img img { width: 128%; height: 128%; object-fit: cover; margin: -14%; display: block; image-rendering: pixelated; }
  .spec-img::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
  }
  .spec-img.glitch img { animation: glitch .45s steps(3) 1; }
  @keyframes glitch {
    0% { transform: translate(0); filter: none; }
    20% { transform: translate(-6px, 2px); filter: hue-rotate(40deg) saturate(2); clip-path: inset(10% 0 55% 0); }
    40% { transform: translate(7px, -3px); clip-path: inset(50% 0 12% 0); }
    60% { transform: translate(-3px, 0); filter: hue-rotate(-30deg); clip-path: none; }
    100% { transform: translate(0); filter: none; }
  }

  /* chain strip */
  .chain { padding-top: var(--s6); padding-bottom: var(--s6); border-bottom: 2px dotted var(--rule); }
  .chain-top { display: flex; justify-content: space-between; color: var(--ink-soft); }
  .ca {
    margin-top: var(--s3); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap;
    font-family: var(--mono); font-size: 14px; word-break: break-all;
  }
  .ca button {
    background: none; border: 0; font: inherit; font-size: 11px; cursor: pointer;
    color: var(--ink-soft); white-space: nowrap;
  }
  .ca button:hover { color: var(--violet-deep); }
  .stats { margin-top: var(--s5); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px dashed var(--ink-faint); }
  .stat { padding: var(--s4) 0 0; }
  .stat + .stat { padding-left: var(--s4); border-left: 1px dashed var(--ink-faint); }
  .stat .k { color: var(--ink-soft); }
  .stat .v { margin-top: var(--s2); font-size: 22px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .stat .v small { font-size: 12px; color: var(--ink-faint); font-weight: 400; margin-left: 3px; }
  .chain-note { margin-top: var(--s5); display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); color: var(--ink-soft); line-height: 1.7; }

  /* headings */
  .sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); padding-top: var(--section); margin-bottom: var(--s5); }
  h2 { font-weight: 500; font-size: 30px; letter-spacing: -.035em; }
  .sec-head .mono { color: var(--ink-soft); }

  /* cards */
  .cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
  .card {
    background: var(--paper-2); border-radius: 12px; padding: var(--s5);
    box-shadow: inset 0 0 0 1px #2c2a31;
    transition: transform .3s, box-shadow .3s;
  }
  .card:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px #3a2a55, 0 16px 30px -18px rgba(155,92,255,.35); }
  .card.lit { background: #231a33; box-shadow: inset 0 0 0 1px #3a2a55; }
  .card-top { display: flex; justify-content: space-between; align-items: center; }
  .card h3 { font-weight: 500; font-size: 18px; letter-spacing: -.02em; }
  .card p { margin-top: var(--s4); font-size: 14px; line-height: 1.75; color: var(--ink-soft); }
  .card .btn { margin-top: var(--s5); }

  /* hold meter */
  .meter { margin-top: var(--s5); }
  .meter-row { display: flex; justify-content: space-between; color: var(--ink-soft); margin-bottom: 8px; }
  .cells { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
  .cells i { height: 12px; background: rgba(233,230,238,.08); }
  .cells i.f { background: var(--violet); }
  .cells i.f:last-of-type { animation: pulse 1.6s infinite; }

  /* notes */
  .notes { border-top: 2px dotted var(--rule); }
  .note {
    display: grid; grid-template-columns: 110px 1fr auto; gap: var(--s4); align-items: baseline;
    padding: var(--s5) 0; border-bottom: 2px dotted var(--rule); cursor: pointer;
  }
  .note .kind { color: var(--ink-soft); }
  .note h4 { font-weight: 500; font-size: 18px; letter-spacing: -.02em; transition: color .2s; }
  .note p { margin-top: var(--s2); font-size: 13px; color: var(--ink-soft); }
  .note .body { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
  .note .body p { font-size: 14px; line-height: 1.75; max-width: 56ch; padding-top: 12px; color: var(--ink); }
  .note.open .body { max-height: 240px; }
  .note:hover h4 { color: var(--violet-deep); }
  .note .tog { color: var(--ink-soft); white-space: nowrap; }

  footer {
    margin-top: var(--section); padding: var(--s5) var(--gutter);
    border-top: 2px dotted var(--rule);
    display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); justify-content: space-between; color: var(--ink-soft);
  }

  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
  .reveal.in { opacity: 1; transform: none; }

  /* claim panel */
  [hidden] { display: none !important; }
  .panel { background: var(--paper-2); border-radius: 12px; box-shadow: inset 0 0 0 1px #2c2a31; padding: var(--s5); display: grid; gap: var(--s6); }
  .step > p { font-size: 14px; line-height: 1.7; color: var(--ink-soft); max-width: 62ch; }
  .step > p b { color: var(--violet-deep); font-weight: 500; }
  .act {
    margin-top: 16px; background: none; border: 0; cursor: pointer; color: var(--ink);
    font: 500 12px var(--mono); padding: 6px 2px 6px 10px; border-left: 3px solid var(--violet);
    transition: color .2s, letter-spacing .25s;
  }
  .act:hover { color: var(--violet-deep); letter-spacing: .06em; }
  .act[disabled] { opacity: .5; cursor: wait; }
  .msg { margin-top: 10px; min-height: 1em; color: var(--violet-deep); }
  .msg.err { color: #ff8fa3; }
  .step > p.hint { margin-top: 12px; font-size: 11px; color: var(--ink-faint); }
  .kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s3) var(--s5); }
  .kv span { color: var(--ink-soft); }
  .kv b { font-weight: 500; color: var(--ink); word-break: break-all; }
  .fields { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4); }
  .fields label { display: grid; gap: 6px; font: 11px var(--mono); color: var(--ink-soft); }
  .fields label.wide { grid-column: 1 / -1; }
  .fields input, .fields select {
    font: 14px var(--sans); color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
    border-radius: 8px; padding: 10px 12px; width: 100%; color-scheme: dark;
  }
  .fields input:focus, .fields select:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
  .fields input[type=file] { padding: 8px; }
  .history, .returns { list-style: none; display: grid; }
  .step h4 { font-weight: 500; color: var(--ink-soft); margin-bottom: 8px; }
  .history li, .returns li { display: flex; gap: var(--s3); justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px dashed var(--ink-faint); }
  .returns { border-top: 2px dotted var(--rule); }
  .returns li { border-bottom: 2px dotted var(--rule); padding: 16px 0; }
  .returns li.empty, .history li.empty { color: var(--ink-faint); justify-content: flex-start; }
  .returns a, .history a { color: var(--violet-deep); border-bottom: 1px solid currentColor; }
  .tag-s { color: var(--ink-soft); }
  .tag-paid { color: var(--violet-deep); }
  .tag-rejected { color: #ff8fa3; }

  @media (max-width: 1100px) {
    .hero { grid-template-columns: 1fr; }
    .specimen { max-width: 440px; }
  }
  @media (max-width: 900px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .stat:nth-child(3) { padding-left: 0; border-left: 0; }
    .chain-note, .cards { grid-template-columns: 1fr; gap: var(--s4); }
  }
  @media (max-width: 680px) {
    .frame { grid-template-columns: 1fr; width: calc(100% - 16px); margin: 8px auto; }
    aside {
      order: 0; position: static; height: auto; border-left: 0; border-bottom: 2px dotted var(--rule);
      flex-direction: row; align-items: center; justify-content: space-between; padding: var(--s4) var(--gutter);
    }
    .tag, .side-foot { display: none; }
    aside { flex-wrap: wrap; gap: var(--s2); }
    nav { margin: 0; flex-direction: row; flex-wrap: wrap; gap: 0 var(--s4); }
    nav a { padding: var(--s2) 0; }  /* ~32px tall tap targets */
    nav a::before { display: none; }
    nav a span.long { display: none; }
    .sec-head { flex-direction: column; align-items: flex-start; gap: var(--s2); }
    .panel { padding: var(--s4); gap: var(--s5); }
    .card { padding: var(--s4); }
    .note { grid-template-columns: 1fr auto; }
    .note .kind { display: none; }
    .hero-foot span:first-child { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; }
  }
