/* partner-demo v2 — green-phosphor CRT terminal.
   Phosphor green on near-black, amber highlights, scanlines + glow + flicker + vignette.
   No external fonts (CSP-safe). All motion disabled under prefers-reduced-motion. */

:root {
  --phos: #33ff77;
  --phos-dim: #1f9c4a;
  --phos-faint: #0e3d20;
  --amber: #ffb000;
  --red: #ff5555;
  --bg: #060a06;
  --bg-panel: #0a0f0a;
  --glow: 0 0 4px rgba(51, 255, 119, .55), 0 0 11px rgba(51, 255, 119, .28);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.crt {
  margin: 0;
  background: var(--bg);
  color: var(--phos);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  text-shadow: var(--glow);
  letter-spacing: .02em;
  overflow-x: hidden;
}

/* scanlines + vignette + flicker as fixed overlays over everything */
body.crt::before {
  /* scanlines */
  content: "";
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, .28) 3px,
    rgba(0, 0, 0, .28) 4px
  );
  mix-blend-mode: multiply;
}
body.crt::after {
  /* vignette + phosphor haze + flicker */
  content: "";
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background:
    radial-gradient(120% 120% at 50% 50%, rgba(51,255,119,.04) 0%, rgba(0,0,0,0) 55%),
    radial-gradient(140% 140% at 50% 45%, rgba(0,0,0,0) 60%, rgba(0,0,0,.55) 100%);
  animation: flicker 5.5s steps(30) infinite;
}

@keyframes flicker {
  0%,100% { opacity: 1; }
  4% { opacity: .93; }
  6% { opacity: 1; }
  40% { opacity: .97; }
  42% { opacity: 1; }
  73% { opacity: .94; }
  75% { opacity: 1; }
}

.terminal {
  position: relative; z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 34px 18px 72px;
  min-height: 100%;
}

/* header / boot line */
.masthead { margin-bottom: 20px; }
.masthead h1 {
  font-size: 20px; font-weight: 700; margin: 0;
  letter-spacing: .06em; text-transform: uppercase; color: var(--amber);
  text-shadow: 0 0 4px rgba(255,176,0,.6), 0 0 12px rgba(255,176,0,.3);
}
.masthead .sub { color: var(--phos-dim); font-size: 12.5px; margin-top: 4px; }
.rule { border: 0; height: 1px; background: var(--phos-faint); margin: 14px 0; box-shadow: 0 0 6px rgba(51,255,119,.25); }

/* ASCII-box panels */
.panel {
  border: 1px solid var(--phos-dim);
  background: linear-gradient(rgba(51,255,119,.02), rgba(51,255,119,0));
  padding: 16px 18px;
  margin: 16px 0;
  box-shadow: 0 0 10px rgba(51,255,119,.10) inset, 0 0 14px rgba(51,255,119,.06);
  position: relative;
}
.panel__title {
  position: absolute; top: -.72em; left: 14px;
  background: var(--bg); padding: 0 8px;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--amber);
}

/* the connect prompt */
.prompt { font-size: 16px; margin: 6px 0 18px; }
.prompt .path { color: var(--phos-dim); }
.cursor {
  display: inline-block; width: .62ch; height: 1.05em; margin-left: 2px;
  background: var(--phos); transform: translateY(.18em);
  box-shadow: var(--glow); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.lede { color: var(--phos-dim); max-width: 62ch; margin: 0 0 20px; font-size: 13.5px; }

/* buttons — chunky terminal look */
.btn {
  display: inline-block; font: inherit; cursor: pointer;
  color: var(--bg); background: var(--phos);
  border: 1px solid var(--phos); border-radius: 0;
  padding: 9px 20px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  text-shadow: none; box-shadow: 0 0 10px rgba(51,255,119,.5);
  text-decoration: none;
}
.btn:hover { background: #5cff92; box-shadow: 0 0 16px rgba(51,255,119,.8); }
.btn.ghost {
  color: var(--phos); background: transparent; box-shadow: none;
  text-shadow: var(--glow); border-color: var(--phos-dim);
}
.btn.ghost:hover { border-color: var(--phos); background: rgba(51,255,119,.06); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.row-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.hint { color: var(--phos-dim); font-size: 12px; }

/* status meta line (scoped key etc.) */
.meta { font-size: 12.5px; color: var(--phos-dim); }
.meta b { color: var(--phos); }
.ok { color: var(--phos); }
.tag { color: var(--amber); }

/* printed data rows */
.rows { margin: 4px 0 0; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  padding: 3px 0; white-space: nowrap; overflow: hidden;
}
.row .label { overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--phos-dim); font-size: 12px; }
.amount { font-variant-numeric: tabular-nums; }
.amount.crdt { color: var(--phos); }
.amount.dbit { color: var(--amber); }
.dim { color: var(--phos-dim); }

/* line-by-line print reveal */
.printing .row { opacity: 0; transform: translateY(2px); }
.printing .row.printed { animation: print .22s ease-out forwards; }
@keyframes print { to { opacity: 1; transform: none; } }

/* boot sequence lines */
.boot { color: var(--phos-dim); font-size: 13px; margin-bottom: 2px; min-height: 1.5em; }
.boot .done { color: var(--phos); }

/* raw json */
details.raw { margin-top: 14px; }
details.raw summary { cursor: pointer; color: var(--amber); font-size: 12.5px; letter-spacing: .06em; }
details.raw pre {
  margin-top: 10px; padding: 12px; font-size: 11.5px; color: var(--phos-dim);
  background: #050805; border: 1px solid var(--phos-faint); overflow-x: auto; text-shadow: none;
}

/* dimmed modal backdrop while the popup is open */
.backdrop {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(2,6,2,.82); backdrop-filter: blur(1px);
  align-items: center; justify-content: center;
}
.backdrop.is-open { display: flex; }
.modal {
  border: 1px solid var(--phos-dim); background: var(--bg-panel);
  padding: 24px 30px; max-width: 420px; text-align: center;
  box-shadow: 0 0 24px rgba(51,255,119,.18), 0 0 10px rgba(51,255,119,.12) inset;
}
.modal .spin { color: var(--amber); font-size: 22px; letter-spacing: .3em; }
.modal .msg { margin-top: 12px; color: var(--phos); }
.modal .msg small { display: block; color: var(--phos-dim); font-size: 12px; margin-top: 8px; }
.modal .spin span { animation: sweep 1.1s steps(4) infinite; opacity: .3; }
.modal .spin span:nth-child(2){animation-delay:.14s}
.modal .spin span:nth-child(3){animation-delay:.28s}
.modal .spin span:nth-child(4){animation-delay:.42s}
@keyframes sweep { 40%,100%{opacity:.3} 0%{opacity:1} }

/* the popup close page */
.closepage { display: grid; place-items: center; min-height: 100vh; text-align: center; }

.footnote { margin-top: 30px; color: var(--phos-faint); font-size: 11.5px; border-top: 1px solid var(--phos-faint); padding-top: 12px; }
.footnote b { color: var(--phos-dim); }

@media (prefers-reduced-motion: reduce) {
  body.crt::after { animation: none; }
  .cursor { animation: none; }
  .printing .row { opacity: 1; transform: none; }
  .printing .row.printed { animation: none; }
  .modal .spin span { animation: none; opacity: 1; }
}

@media (max-width: 520px) {
  body.crt { font-size: 14px; }
  .row { grid-template-columns: 1fr; }
  .row .amount { justify-self: start; }
}
