/* Ootle Crowdfund demo — visual layer, third pass.
 *
 * TARI IDENTITY, verified from official sources (2026-11-15):
 * - The gem/"T" mark is the official Tari design mark: path data copied
 *   verbatim and unaltered from the wordmark SVG served by tari.com
 *   itself (viewBox 0 0 121 38), rendered in Tari lime on Tari
 *   violet-black — the exact treatment of tari.com/favicon.png.
 * - Tari violet #813BF5 appears in tari.com source; the Ootle docs
 *   (ootle.tari.com, Starlight theme) use #8158F5. The accent ramp
 *   below is darkened from that violet only where WCAG AA demands it.
 * - Tari lime #c2ff28 and violet-black #160c25 are the two dominant
 *   colors of the official favicon, measured from the file itself.
 * Descriptive use only: the mark sits beside "Built on Tari Ootle"
 * and never pretends this demo IS Tari. The layout, copy, and
 * composition are our own — no other entry's design is copied.
 *
 * The page is an APP, not a document: brand bar, one short headline,
 * the workspace, campaigns, history, walkthrough. Explanation lives in
 * the collapsed "About" section; judging notes live separately in
 * the collapsed "Read before judging" section.
 * No external assets; the page works fully offline. All class/id
 * hooks used by app.js are preserved; this file only changes how
 * things look, never what they do.
 *
 * Contrast (WCAG AA, verified by script against the shipped CSS):
 * every text/background pair below exceeds 4.5:1, including white
 * on the accent button (7.10:1) and the lime mark on the dark bar
 * (15.83:1, decorative). */

:root {
  --bar: #160c25;
  --lime: #c2ff28;
  --violet: #813bf5;
  --paper: #f7f5fc;
  --surface: #ffffff;
  --surface-2: #efecf7;
  --ink: #1c1330;
  --text: #2a2140;
  --secondary: #5d5670;
  --bar-secondary: #a89cc9;
  --line: #e4def2;
  --line-strong: #c9c0dd;
  --accent: #6d28d9;
  --accent-deep: #5b21b6;
  --accent-soft: #f0eafd;
  --ok: #1f7a54;
  --warn: #8a6100;
  --bad: #b3382e;
  --error-bg: #fbeeea;
  --error-line: #ecc9bf;
  --error-text: #8f2f22;
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }

/* Skip link: invisible until keyboard-focused, then a clear target. */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--bar);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 150ms ease;
}
.skip-link:focus { top: 12px; color: #fff; }

/* Honest no-JS notice (only rendered when scripts are off). */
.noscript {
  margin: 24px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 24px; }
main.wrap { padding-bottom: 64px; }

/* ---------- Typography ---------- */

h1 {
  margin: 0 0 14px;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--ink);
}
h1 .accent-word { color: var(--accent); }
h2 { margin: 0 0 6px; font-size: 1.3rem; line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); }
h3 { margin: 0; font-size: 1.3rem; line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); }

.muted { color: var(--secondary); }
.small { font-size: 0.9rem; }

code {
  font-family: var(--mono);
  background: var(--surface-2);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.section-head h2 { margin-bottom: 0; }
.section-head p { margin: 0; }

/* ---------- Splash screen ---------- */

/* Brief identity moment on load (pattern only — the mark and wordmark
 * are our own + Tari identity, never another app's). Removed from the
 * DOM after the fade; it can never intercept input. */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: opacity 450ms ease;
}
.splash-hidden { opacity: 0; pointer-events: none; }
.splash-inner {
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 24px;
  animation: splash-in 450ms ease both;
}
@keyframes splash-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.splash-mark { line-height: 0; fill: var(--violet); display: block; }
.splash-word {
  margin: 24px 0 0;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  text-align: center;
}
.splash-rule {
  width: 48px;
  height: 3px;
  margin-top: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), var(--lime));
}
.splash-sub { margin: 12px 0 0; color: var(--secondary); font-size: 0.95rem; }

/* ---------- Top bar + navigation ---------- */

/* Sticky app header: brand lockup, section nav, and the honest
 * simulation note stay reachable while scrolling. */
.topbar {
  background: var(--bar);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  min-height: 66px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.brand-mark { line-height: 0; flex: none; }
.brand-mark svg { fill: var(--lime); display: block; }
.brand-text {
  display: grid;
  line-height: 1.2;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand-text small {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--bar-secondary);
  letter-spacing: 0;
}
.topbar-note { margin: 0; font-size: 0.9rem; color: var(--bar-secondary); }

/* Desktop section nav: a second row inside the sticky bar, so six
 * honest section links fit without crowding the brand lockup. */
.mainnav { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.mainnav-inner { display: flex; gap: 2px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.mainnav a {
  color: #d9d2ea;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 11px;
  border-radius: 8px;
  white-space: nowrap;
}
.mainnav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.mainnav a:focus-visible, .menu-btn:focus-visible, .mobilenav a:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* Mobile menu button: hamburger that morphs into an X. Hidden on
 * wide screens; the panel below only exists under the breakpoint. */
.menu-btn {
  display: none;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.menu-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.4); }
.menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform 160ms ease, opacity 120ms ease;
}
.menu-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.is-open span:nth-child(2) { opacity: 0; }
.menu-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobilenav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bar);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
  z-index: 60;
}
.mobilenav.open { display: block; }
.mobilenav a {
  display: block;
  padding: 15px 24px;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}
.mobilenav a:last-child { border-bottom: none; }
.mobilenav a:hover { background: rgba(255, 255, 255, 0.06); }

/* Restrained Tari motif: one 3px violet-to-lime hairline under the bar. */
.motif {
  height: 3px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--violet) 55%, var(--lime) 100%);
}

/* ---------- Intro ---------- */

.intro {
  padding: 52px 0 4px;
  background: radial-gradient(560px 240px at 88% 0%, rgba(129, 59, 245, 0.10), rgba(129, 59, 245, 0) 70%);
}
.lede { max-width: 52ch; font-size: 1.16rem; line-height: 1.55; margin: 0; color: var(--text); }

/* Anchor destinations clear the sticky header (two rows on desktop). */
section, details { scroll-margin-top: 130px; }

/* ---------- Entry cards ---------- */

/* First-paint routing: one bold line, one quiet subline, an arrow.
 * Each card does something real (see the page script). */
.entry-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 32px 0 0;
}
.entry-card {
  display: grid;
  gap: 6px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-height: 0;
  box-shadow: 0 1px 2px rgba(28, 19, 48, 0.04), 0 10px 28px rgba(109, 40, 217, 0.05);
  cursor: pointer;
  font: inherit;
}
.entry-card:hover:not(:disabled) { background: var(--surface); border-color: var(--accent); }
.entry-card:active:not(:disabled) { background: var(--surface-2); }
.entry-title { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.entry-arrow { color: var(--accent); display: inline-block; transition: transform 150ms ease; }
.entry-card:hover .entry-arrow { transform: translateX(4px); }
.entry-sub { font-size: 0.92rem; font-weight: 400; color: var(--secondary); }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 1px 2px rgba(28, 19, 48, 0.04), 0 10px 28px rgba(109, 40, 217, 0.05);
}

/* ---------- Workspace ---------- */

.workspace {
  margin: 36px 0 0;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.05fr auto;
  gap: 28px;
}
/* Skip-link target: programmatic focus only, no focus ring on the card. */
.workspace:focus { outline: none; }
.ws-group { min-width: 0; }
.ws-group + .ws-group { border-left: 1px solid var(--line); padding-left: 28px; }
.ws-label { margin: 0 0 12px; font-weight: 650; color: var(--ink); font-size: 0.95rem; }

/* Vertical account-switcher list: roomy at every width, one clear
 * active row. Buttons stay .persona-btn with .active + data-persona.
 * (Higher specificity than .row, which sets a horizontal alignment.) */
.workspace .persona-row { gap: 2px; background: var(--surface-2); border-radius: 12px; padding: 4px; display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.persona-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 9px;
  border: none;
  background: transparent;
  border-radius: 9px;
  min-height: 48px;
  text-align: left;
}
.persona-btn:hover:not(.active) { background: rgba(255, 255, 255, 0.6); }
.persona-btn.active { background: var(--surface); box-shadow: 0 1px 3px rgba(28, 19, 48, 0.14); }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  flex: none;
}
.persona-btn.active .avatar { background: var(--accent); color: #fff; }
.persona-label { display: grid; line-height: 1.25; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.persona-label small { color: var(--secondary); font-size: 0.78rem; font-weight: 400; }

.wallets { list-style: none; padding: 0; margin: 0; display: grid; }
.wallets li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.wallets li:last-child { border-bottom: none; }
.wallet-name { color: var(--secondary); }
.wallets strong { font-variant-numeric: tabular-nums; color: var(--ink); }

.epoch-line { margin: 0 0 12px; }
.epoch-line strong {
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.epoch-line .muted { font-size: 0.95rem; }

.workspace .epoch-actions { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }

.ws-reset { display: flex; flex-direction: column; align-items: flex-start; }

/* ---------- Buttons & inputs ---------- */

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }

button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  min-height: 46px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: background-color 120ms ease, border-color 120ms ease;
}
button:hover:not(:disabled) { background: var(--surface-2); border-color: #a79ec2; }
button:active:not(:disabled) { background: #e6e1f2; }
button:disabled {
  background: var(--surface);
  color: #8a84a0;
  border-color: var(--line);
  cursor: not-allowed;
}
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-primary:active:not(:disabled) { background: var(--accent-deep); }

label { display: grid; gap: 7px; font-size: 0.92rem; font-weight: 600; color: var(--ink); }
input {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  min-height: 46px;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}
input::placeholder { color: var(--secondary); }

/* ---------- Campaign cards ---------- */

.campaigns-section { margin: 52px 0 0; }
.campaign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.campaign { margin: 0; display: flex; flex-direction: column; }

.campaign-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.meta { margin: 7px 0 0; font-size: 0.92rem; }
.meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Status: a small dot plus plain text. No pill, no fill. The dot color
 * is the only semantic color on the card; the text stays secondary. */
.status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--secondary);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--secondary);
  flex: none;
}
.status[data-state="open"]::before { background: var(--accent); }
.status[data-state="open-funded"]::before { background: var(--warn); }
.status[data-state="settled-funded"]::before { background: var(--ok); }
.status[data-state="settled-failed"]::before { background: var(--bad); }
.status[data-state="claimed"]::before { background: var(--ok); }
.status[data-state="completed"]::before { background: var(--ok); }
.status[data-state="vetoed"]::before { background: var(--bad); }
.status[data-state="abandoned"]::before { background: var(--warn); }

.status-note { margin: 8px 0 0; font-size: 0.92rem; }

.raised { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.raised .total { font-size: 1.85rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.raised-goal { color: var(--secondary); font-variant-numeric: tabular-nums; }
.pct-badge {
  margin-left: auto;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 350ms ease;
}

.mine-line { margin: 14px 0 0; font-size: 0.95rem; color: var(--secondary); }
.mine-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* v2 mechanism lines: same quiet secondary voice as .mine-line, no new
 * colors. The promise is the creator's words; the bond line states the
 * locked amount and its state; the veto line shows the live tally. */
.promise { margin: 16px 0 0; font-size: 0.95rem; color: var(--text); overflow-wrap: anywhere; }
.promise-label { font-weight: 650; color: var(--ink); }
.promise-note { margin: 2px 0 0; }
.bond-line { margin: 12px 0 0; font-size: 0.95rem; color: var(--secondary); }
.bond-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.veto-line { margin: 12px 0 0; font-size: 0.95rem; color: var(--secondary); }
.veto-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Tranche progress: one quiet line plus three segments. Segment state
 * is carried by the state word and a restrained fill/border — the text
 * alone states the meaning, color only reinforces it. */
.tranches { margin-top: 14px; }
.tranche-line { margin: 0 0 8px; }
.tranche-segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: grid;
  gap: 1px;
  background: var(--surface);
  min-width: 0;
}
.seg-amt { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.seg-meta, .seg-state { font-size: 0.78rem; line-height: 1.35; color: var(--secondary); }
.seg-released { background: var(--accent-soft); border-color: var(--line-strong); }
.seg-pending { border-color: var(--accent); }
.seg-frozen, .seg-closed { background: var(--surface-2); }

.campaign .row { margin-top: 20px; }
/* The label grows into the row's slack so the balance hint below the
 * input stays on one line; the buttons keep their natural width. */
.campaign .row label { flex: 1 0 118px; }
.campaign .row input.amount { width: 100%; }

/* Balance hint under each Amount field: the acting persona's demo
 * balance, shown where the pledge decision is made — the workspace
 * wallets sit far above the cards on mobile. Quiet secondary text;
 * the same pair as .muted on white, already AA-verified. */
.balance-hint {
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 400;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.error {
  color: var(--error-text);
  font-weight: 600;
  background: var(--error-bg);
  border: 1px solid var(--error-line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 18px 0 0;
}

/* ---------- Create form ---------- */

.create { margin-top: 52px; }
#create-form {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
  margin-top: 14px;
}

/* The promise field spans the full row under title/goal/deadline; the
 * submit button is pinned to the first row so the v1 layout is kept. */
.field-promise { grid-column: 1 / -1; }
#create-form button[type="submit"] { grid-column: 4; grid-row: 1; }

/* Bond hint: same quiet voice as the goal hint. Appears as soon as the
 * goal parses, so the cost of creating is visible before committing. */
.bond-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.88rem;
  color: var(--secondary);
}

/* Goal hint: quiet, full-width, never an error. Appears only when the
 * entered goal exceeds the demo wallets' combined balance. */
.goal-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.88rem;
  color: var(--secondary);
}

/* ---------- Transaction history ---------- */

/* Designed history list, not a log dump: every simulated action is one
 * row (type, campaign, actor, epoch, deterministic demo hash, outcome).
 * Rows are buttons: selecting one opens the simulated block view.
 * The hashes are deterministic from the simulated call — never random. */
.history-card { margin-top: 52px; }
.history-note { margin: -6px 0 16px; }
.history {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  max-height: 340px;
}
/* Empty state: pure CSS, adds no DOM nodes, so the entry count stays honest. */
.history:empty::after {
  content: "No transactions yet — pledge, claim, or create a campaign.";
  display: block;
  padding: 14px 16px;
  color: var(--secondary);
}
.hist-row { border-bottom: 1px solid var(--line); }
.hist-row:last-child { border-bottom: none; }
.hist-entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 0;
  background: var(--surface);
  text-align: left;
  min-height: 0;
  font-weight: 400;
}
.hist-entry:hover:not(:disabled) { background: var(--paper); }
.hist-entry:active:not(:disabled) { background: var(--surface-2); }
.hist-main { display: grid; gap: 3px; min-width: 0; }
.hist-title { font-weight: 650; color: var(--ink); font-size: 0.98rem; }
.hist-meta { font-size: 0.86rem; color: var(--secondary); }
.hist-hash { font-family: var(--mono); font-size: 0.84rem; white-space: nowrap; }
.hist-error { font-size: 0.86rem; color: var(--error-text); overflow-wrap: anywhere; }
.hist-side { display: grid; justify-items: end; gap: 3px; flex: none; }
.hist-amount { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-status { font-size: 0.86rem; font-weight: 650; white-space: nowrap; }
.hist-ok .hist-status { color: var(--ok); }
.hist-reject .hist-status, .hist-reject .hist-amount { color: var(--bad); }

/* ---------- Simulated block view ---------- */

/* In-app explorer detail: the epoch is the block-height analog, the
 * block hash is derived deterministically from the epoch's entries.
 * Simulated only — never linked to any real external explorer. */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(22, 12, 37, 0.55);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(640px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-head h2 { margin: 0; font-size: 1.4rem; }
.modal-close {
  flex: none;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.modal-honest { margin: 6px 0 0; }
.block-facts {
  margin: 20px 0 0;
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.block-facts .fact {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.block-facts .fact:last-child { border-bottom: none; }
.fact dt { color: var(--secondary); flex: none; }
.fact dd { margin: 0; color: var(--ink); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.fact dd.mono { font-family: var(--mono); font-weight: 400; font-size: 0.86rem; }
.fact dd.ok { color: var(--ok); }
.fact dd.bad { color: var(--bad); }
.block-sub { font-size: 1.02rem; font-weight: 650; color: var(--ink); margin: 24px 0 10px; }
.block-call {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--text);
}
.block-events { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.block-events li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.block-events .ev-topic { color: var(--accent); font-weight: 650; }
.sibling-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sibling-btn {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  font-weight: 600;
}
.sibling-btn .sib-hash { font-family: var(--mono); font-size: 0.84rem; font-weight: 400; color: var(--secondary); }
.sibling-btn[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Collapsible sections ---------- */

.disclosure { margin-top: 52px; }
.disclosure summary {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
  padding-right: 30px;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 12px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--secondary);
  border-bottom: 2px solid var(--secondary);
  transform: rotate(45deg);
  flex: none;
  transition: transform 160ms ease;
}
.disclosure[open ] summary::after { transform: rotate(225deg); }
.summary-title { font-size: 1.3rem; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.steps-progress { color: var(--secondary); font-size: 0.95rem; white-space: nowrap; }
.steps-progress span { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.disclosure > :not(summary) { margin-top: 16px; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li {
  position: relative;
  counter-increment: step;
  padding: 12px 0 12px 46px;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--secondary);
  font-weight: 650;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.steps li.done { color: var(--text); }
.steps li.done::before {
  content: "✓";
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* "About": the dedicated home for system explanation. Subsections are
 * separated blocks with generous spacing; the How-it-works list reads
 * in two scannable columns on wide screens. "Read before judging"
 * (#limits) holds only the honest-limits list, same compact style. */
#about h3 { font-size: 1.05rem; margin-top: 28px; }
#about h3:first-of-type { margin-top: 20px; }
#about h3:not(:first-of-type) { border-top: 1px solid var(--line); padding-top: 22px; }
#about h3 + p, #about h3 + ul { margin-top: 8px; }
#about p { margin-bottom: 0; }
.detail-list { margin: 0; padding-left: 20px; }
.detail-list li { margin: 12px 0; line-height: 1.6; }
.detail-list li::marker { color: var(--accent); }
@media (min-width: 700px) {
  .how-grid { columns: 2; column-gap: 32px; }
  .how-grid li { break-inside: avoid; }
}

/* ---------- Proof ---------- */

.proof-section { margin-top: 52px; }
.proof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.proof-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 1px 2px rgba(28, 19, 48, 0.04), 0 10px 28px rgba(109, 40, 217, 0.05);
}
.proof-num {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.proof-unit { font-size: 1rem; font-weight: 650; }
.proof-label { margin: 6px 0 0; font-weight: 650; color: var(--ink); }
.proof-sub { margin: 4px 0 0; }
.proof-commands { margin-top: 16px; }
.proof-commands h3 { font-size: 1.05rem; margin-bottom: 12px; }
.proof-commands pre {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--text);
}
.proof-commands pre code { background: none; padding: 0; font-size: 1em; }
.proof-links { margin: 16px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.proof-links a {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  text-decoration: none;
}
.proof-links a:hover { background: var(--surface-2); color: var(--accent-deep); }

/* ---------- Live mode + footer ---------- */

.live { margin-top: 52px; border-top: 1px solid var(--line); padding-top: 22px; color: var(--secondary); font-size: 0.95rem; }
.live p { margin: 0; }
.live strong { color: var(--ink); }

footer { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 22px; }
footer p { margin: 0; }

/* ---------- Responsive ---------- */

/* Nav switch: inline links need room; under 960px the bar keeps the
 * brand + note and navigation moves behind the menu button. */
@media (max-width: 960px) {
  .mainnav { display: none; }
  .menu-btn { display: flex; }
}
@media (min-width: 961px) {
  .mobilenav { display: none !important; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr 1fr; gap: 28px; }
  .ws-group + .ws-group { border-left: none; padding-left: 0; }
  .ws-group:nth-child(3), .ws-group:nth-child(4) { border-top: 1px solid var(--line); padding-top: 24px; }
  #create-form { grid-template-columns: 1fr 1fr; }
  #create-form .field-title { grid-column: 1 / -1; }
  #create-form button[type="submit"] { grid-column: 1 / -1; grid-row: auto; justify-self: start; }
  .entry-cards { grid-template-columns: 1fr; }
  .proof-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .intro { padding-top: 38px; background: radial-gradient(340px 180px at 100% 0%, rgba(129, 59, 245, 0.10), rgba(129, 59, 245, 0) 70%); }
  section, details { scroll-margin-top: 124px; }
  .workspace { grid-template-columns: 1fr; gap: 24px; margin-top: 30px; }
  .ws-group:nth-child(2) { border-top: 1px solid var(--line); padding-top: 24px; }
  .campaign-grid { grid-template-columns: 1fr; }
  .campaigns-section, .create, .history-card, .disclosure, .proof-section, .live { margin-top: 40px; }
  .card { padding: 22px 18px; }
  #create-form { grid-template-columns: 1fr; }
  #create-form button { justify-self: start; }
  .campaign .row label { flex: 1 1 100%; }
  .campaign .row button { flex: 1 1 28%; padding-left: 10px; padding-right: 10px; }
  .topbar-note { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
