:root {
  color-scheme: light;
  --ink: #11100f;
  --paper: #f5f2eb;
  --surface: #fbfaf6;
  --muted: #68645f;
  --line: #c9c4bb;
  --line-strong: #252321;
  --shadow: 0 18px 60px rgba(17, 16, 15, 0.11);
  --sans: "Inter", Arial, sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
  --animated-title: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

html { background: #e9e6df; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.9), transparent 32rem),
    #e9e6df;
  font-family: var(--sans);
  line-height: 1.5;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

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

#app { min-height: 100vh; }

.prototype-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
}

.prototype-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 34px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(17,16,15,.18);
  background: rgba(245,242,235,.76);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font: 700 12px/1.2 var(--type);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.brand {
  margin: 0;
  font: 400 clamp(30px, 3vw, 46px)/.96 var(--type);
  letter-spacing: -.06em;
}

.rail-copy {
  max-width: 28ch;
  margin: 22px 0 30px;
  color: var(--muted);
  font-size: 14px;
}

.screen-index {
  display: grid;
  gap: 3px;
  overflow-y: auto;
  padding-right: 6px;
}

.screen-index button, .screen-index a {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.screen-index button:hover, .screen-index a:hover { color: var(--ink); background: rgba(255,255,255,.5); }
.screen-index button[aria-current="page"], .screen-index a[aria-current="page"] {
  color: var(--ink);
  border-left-color: var(--ink);
  background: rgba(255,255,255,.72);
  font-weight: 600;
}

.rail-note {
  margin: auto 0 0;
  padding-top: 24px;
  color: var(--muted);
  font: 12px/1.45 var(--type);
}

.stage {
  min-width: 0;
  padding: 42px;
  display: grid;
  place-items: center;
}

.phone {
  position: relative;
  width: min(100%, 430px);
  height: min(880px, calc(100vh - 84px));
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.phone::before {
  content: "";
  position: absolute;
  z-index: 5;
  top: 11px;
  left: 50%;
  width: 74px;
  height: 4px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(-50%);
  opacity: .14;
}

.screen {
  height: 100%;
  padding: 54px 28px 30px;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  animation: reveal .32s ease-out both;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 34px;
}

.back, .text-button, .menu-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.menu-button { text-decoration: none; font: 700 13px var(--type); letter-spacing: .08em; text-transform: uppercase; }

.step {
  margin: 0;
  color: var(--muted);
  font: 12px var(--type);
  letter-spacing: .08em;
}

.display {
  max-width: 11ch;
  margin: 0;
  font: 400 clamp(44px, 11vw, 68px)/.95 var(--type);
  letter-spacing: -.065em;
}

.title {
  margin: 0;
  font: 400 clamp(29px, 8vw, 44px)/1.02 var(--type);
  letter-spacing: -.045em;
}

.subtitle {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 38px;
}

.choice, .primary, .secondary {
  display: block;
  width: 100%;
  min-height: 58px;
  padding: 16px 18px;
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, color .16s ease, background .16s ease;
}
.choice, .secondary { color: var(--ink); background: transparent; text-align: left; }
.primary { color: var(--paper); background: var(--ink); font-weight: 600; text-align: center; }
.choice:hover, .secondary:hover { color: var(--paper); background: var(--ink); }
.choice:hover, .primary:hover, .secondary:hover { transform: translateY(-2px); }
.choice strong { display: block; margin-bottom: 4px; font: 700 16px var(--type); }
.choice span { color: inherit; opacity: .7; font-size: 13px; }

.account-link { margin: 20px 0 0; text-align: center; font-size: 14px; }
.account-link button { min-height: 44px; border: 0; background: transparent; text-decoration: underline; cursor: pointer; }

.form { display: grid; gap: 18px; margin-top: 34px; }
.field { display: grid; gap: 7px; }
.field label { font: 700 12px var(--type); letter-spacing: .05em; text-transform: uppercase; }
.field input, .field textarea {
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
}
.field textarea { min-height: 148px; resize: vertical; line-height: 1.55; }
.field small { color: var(--muted); font-size: 12px; }

.question {
  margin: 6px 0 0;
  font: 400 clamp(27px, 7vw, 38px)/1.16 var(--type);
  letter-spacing: -.04em;
}
.question-note { margin: 16px 0 0; color: var(--muted); font: italic 15px/1.5 var(--type); }
.display[data-typewriter], .question[data-typewriter] {
  position: relative;
  font-family: var(--animated-title);
  font-weight: 400;
  letter-spacing: -.055em;
}
.display[data-typewriter] { font-size: clamp(44px, 11vw, 68px); line-height: .95; }
.question[data-typewriter] { font-size: clamp(27px, 7vw, 38px); line-height: 1.16; }
.typewriter-ghost { visibility: hidden; }
.typewriter-live { position: absolute; inset: 0; }
.typewriter-live.is-typing { border-right: 2px solid currentColor; }
.question-fields { display: grid; gap: 24px; margin-top: 38px; }
.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 0 0 28px; }
.progress span { height: 3px; background: var(--line); }
.progress span.done { background: var(--ink); }

.loading-screen { align-items: center; justify-content: center; text-align: center; }
.orbit {
  width: 146px;
  aspect-ratio: 1;
  margin-bottom: 38px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  animation: orbit 2.2s linear infinite;
}
.orbit::before, .orbit::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.orbit::after { width: 88px; height: 1px; border: 0; border-top: 1px solid var(--ink); }
@keyframes orbit { to { transform: rotate(360deg); } }

.intro-screen { justify-content: center; }
.intro-screen .display { max-width: 9ch; }
.asterisk {
  display: inline;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 5px;
  cursor: pointer;
}

.bio {
  margin: 16px 0 0;
  font: 18px/1.65 var(--type);
}
.bio-signature { margin-top: 26px; font: italic 18px var(--type); }

.universe-screen { padding: 42px 0 0; background: #11100f; color: var(--paper); }
.universe-head { padding: 10px 24px 0; }
.universe-head .menu-button { color: var(--paper); }
.universe-canvas { width: 100%; height: 535px; display: block; touch-action: none; cursor: grab; }
.universe-canvas:active { cursor: grabbing; }
.universe-caption { padding: 0 24px 30px; color: #bbb6ac; font: 13px/1.45 var(--type); }

.drawer {
  position: absolute;
  z-index: 8;
  inset: 0 0 0 14%;
  padding: 52px 26px 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: -20px 0 50px rgba(0,0,0,.3);
  overflow-y: auto;
}
.drawer[hidden] { display: none; }
.drawer-list { display: grid; gap: 4px; margin-top: 28px; }
.drawer-list button { min-height: 48px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }

.node-list, .work-list, .editor-list { display: grid; margin-top: 34px; border-top: 1px solid var(--ink); }
.node-row, .work-row, .editor-row {
  min-height: 76px;
  padding: 17px 2px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.node-row:hover, .work-row:hover, .editor-row:hover { background: #efebe3; }
.index-no { color: var(--muted); font: 13px var(--type); }
.row-title { font: 700 17px var(--type); }
.row-meta { color: var(--muted); font-size: 12px; }
.row-action { font: 12px var(--type); text-decoration: underline; }

.category-card {
  margin-top: 26px;
  padding: 24px;
  border: 1px solid var(--ink);
}
.category-card h2 { margin: 0; font: 400 27px var(--type); }
.thumbnail-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.thumbnail-strip img { width: 100%; aspect-ratio: .8; object-fit: cover; filter: grayscale(1); border: 1px solid var(--line); }

.artwork {
  width: calc(100% + 56px);
  margin: -54px -28px 28px;
  aspect-ratio: 1 / .82;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  border-bottom: 1px solid var(--ink);
}
.artwork-meta { display: flex; justify-content: space-between; gap: 18px; margin: 14px 0 28px; color: var(--muted); font: 13px var(--type); }
.description { margin: 0; font-size: 15px; }
.beneficiaries { display: grid; gap: 10px; margin-top: 28px; }
.beneficiary-chip { padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; }

.status-line { margin-top: 30px; padding: 18px 0; border-block: 1px solid var(--ink); font: 700 15px var(--type); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 28px; background: var(--line); border: 1px solid var(--line); }
.metric { padding: 18px; background: var(--surface); }
.metric strong { display: block; font: 400 26px var(--type); }
.metric span { color: var(--muted); font-size: 12px; }

.prototype-note {
  margin-top: 24px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font: 12px/1.5 var(--type);
}

@media (max-width: 860px) {
  .prototype-shell { display: block; }
  .prototype-rail {
    position: static;
    width: 100%;
    height: auto;
    padding: 22px;
    border-right: 0;
    border-bottom: 1px solid rgba(17,16,15,.18);
  }
  .brand { font-size: 32px; }
  .rail-copy, .rail-note { display: none; }
  .screen-index { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; }
  .stage { padding: 22px 14px 38px; }
  .phone { min-height: 780px; }
}

@media (max-width: 500px) {
  html, body { background: var(--surface); }
  .prototype-rail { padding: 16px; }
  .screen-index { display: none; }
  .stage { padding: 0; }
  .phone { width: 100%; height: calc(100vh - 116px); min-height: 640px; border: 0; border-radius: 0; box-shadow: none; }
}

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