/* Structure and components, reading only tokens. ptf.css comes after this one and draws the receipt world:
   the receipts, the rail, the tickets, the Z report. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font-text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--ink); color: var(--paper); }

/* ---------- type ---------- */
h1, h2, .display { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 0.95; text-wrap: balance; }
h1 { font-size: clamp(44px, 6vw, 84px); }
h2 { font-size: clamp(34px, 4vw, 54px); }
h3, .h3 { font: 700 19px/1.3 var(--font-text); letter-spacing: -0.01em; }
.accent { color: var(--accent); }
.lede { font-size: clamp(17px, 1.5vw, 19px); color: var(--ink-2); max-width: 34em; }
.lede b { color: var(--ink); font-weight: 650; }
.muted { color: var(--muted); }
.fine { font-size: 13.5px; color: var(--muted); }
.mono, .num, .label, .kicker, .chip { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kicker { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 16px; }
.kicker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.up, .down { font-family: var(--font-mono); white-space: nowrap; }
.down { color: var(--ink-2); }

/* ---------- layout ---------- */
.wrap { width: min(var(--wrap), 100% - 2 * var(--gut)); margin-inline: auto; }
.section { padding-top: clamp(64px, 8vw, 112px); }
.page-head { padding-top: clamp(36px, 5vw, 64px); padding-bottom: 26px; display: grid; gap: 14px; justify-items: start; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.section-head p { max-width: 34em; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
main { padding-bottom: 120px; min-height: 60vh; }
main.enter { animation: page-in var(--t) var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- header ---------- */
#top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.top-bar { height: var(--top-h); display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex: none; }
.lockup { display: inline-flex; align-items: center; gap: 9px; }
.lockup > svg { height: 32px; width: auto; }
.lockup .brand-word { display: inline-flex; }
.lockup .brand-word svg { height: 19px; width: auto; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--bg-2); }
.nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-strip { background: var(--rail); color: #d9d1bf; font: 12.5px/1.4 var(--font-mono); text-align: center; padding: 6px var(--gut); letter-spacing: 0.02em; }
.demo-strip b { color: var(--warn); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.tabbar { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-weight: 650; font-size: 15px; cursor: pointer; white-space: nowrap; transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.btn:hover { background: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: 0 2px 0 var(--accent-2); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.primary:active { box-shadow: 0 1px 0 var(--accent-2); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: var(--rail-2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.lg { height: 52px; padding: 0 24px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--bg-2); }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.icon { display: inline-flex; }

/* ---------- chips, banners ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--line-3); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.chip.done { color: var(--good); border-color: currentColor; }
.chip.demo { background: var(--warn); border-color: transparent; color: var(--ink); }
.chip.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.banner { margin-top: 20px; padding: 14px 18px; border-radius: var(--r); border: 1.5px solid var(--ink); background: var(--paper); }
.banner.good { border-color: var(--good); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }

/* ---------- segmented controls ---------- */
.seg { display: inline-flex; gap: 0; padding: 3px; border-radius: var(--r-sm); border: 1.5px solid var(--ink); background: var(--paper); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { height: 32px; padding: 0 12px; border-radius: 4px; border: 0; background: none; color: var(--ink-2); cursor: pointer; font: 500 13px var(--font-mono); letter-spacing: 0.02em; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 26px; }
.controls .search { margin-left: auto; width: min(320px, 100%); }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; margin-top: 18px; }
.field > .label { color: var(--ink-2); }
.input { width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line-3); background: var(--paper); font-size: 16px; }
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--ink); }
.input[aria-invalid] { border-color: var(--ink); background: color-mix(in srgb, var(--warn) 30%, var(--paper)); }
.prefix { display: flex; align-items: center; border-radius: var(--r-sm); border: 1.5px solid var(--line-3); background: var(--paper); padding-left: 14px; }
.prefix > span { font-family: var(--font-mono); color: var(--muted); }
.prefix.suffix { padding-left: 0; padding-right: 14px; }
.prefix .input { border: 0; background: none; padding-left: 4px; }
.prefix.suffix .input { padding-left: 14px; }
.prefix:focus-within { border-color: var(--ink); }
.problem { justify-self: start; font-size: 13.5px; color: var(--ink); background: linear-gradient(transparent 12%, var(--warn) 12%, var(--warn) 88%, transparent 88%); padding: 0 4px; }
.problem:empty { display: none; }
.hint { font-size: 13px; }
.drop { display: grid; place-items: center; width: 100%; min-height: 128px; border-radius: var(--r); border: 1.5px dashed var(--line-3); background: var(--paper); cursor: pointer; padding: 16px; text-align: center; }
.drop.over { border-color: var(--ink); }
.drop img { width: 104px; height: 104px; object-fit: cover; border-radius: var(--r-sm); }
.drop-inner { display: grid; gap: 6px; justify-items: center; }
details.links { margin-top: 18px; }
details.links summary { cursor: pointer; color: var(--ink-2); }

/* ---------- panels ---------- */
.card { border-radius: var(--r); border: 1px solid var(--line-2); background: var(--paper); padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.skeleton .sk { border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--bg-2), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.6s infinite linear; }
.sk-head { height: 40px; } .sk-line { height: 14px; } .sk-line.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- stats, CA box ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.stat { display: grid; gap: 2px; }
.stat-value { font: 600 24px/1.1 var(--font-mono); letter-spacing: -0.02em; }
.stat-hint { font-size: 12.5px; }
.ca { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px dashed var(--line-3); max-width: 100%; background: var(--paper); }
.ca-addr { font-size: 13px; word-break: break-all; user-select: all; }
.ca-soon { background: var(--warn); padding: 0 6px; border-radius: 3px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.ca-note { font-size: 13px; flex-basis: 100%; color: var(--muted); }
.ca.small { margin: 0; padding: 0 10px; height: 34px; flex-wrap: nowrap; border-width: 1px; }
.ca.small .label { font-size: 10px; }

/* ---------- feed ---------- */
.feed { display: grid; }
.feed-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto 80px; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--line-2); font: 13.5px/1.35 var(--font-mono); }
.feed-side { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; border: 1px solid var(--line-3); border-radius: 3px; padding: 2px 0; }
.feed-side.buy { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.feed-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-text a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-3); }
.tx { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; }
.feed-time { font-size: 12px; text-align: right; color: var(--muted); }

/* ---------- empty states ---------- */
.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 56px 16px; }
.empty h3 { font: 800 28px/1 var(--font-display); }
.more { display: grid; justify-items: center; margin-top: 24px; }

/* ---------- wallet ---------- */
.wallet-box { position: relative; }
.wallet-btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.wallet-btn:hover { background: var(--rail-2); }
.wallet-btn.on { padding: 0 12px; gap: 9px; background: var(--paper); color: var(--ink); }
.wallet-btn.on:hover { background: var(--surface); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 8px; border-radius: var(--r); border: 1.5px solid var(--ink); background: var(--paper); box-shadow: var(--shadow); display: grid; gap: 2px; z-index: 30; }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; color: var(--ink-2); }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); border: 0; background: none; text-align: left; cursor: pointer; font-size: 15px; }
.menu-item:hover { background: var(--surface); }
.wallet-list { display: grid; gap: 8px; }
.wallet-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--paper); cursor: pointer; text-align: left; }
.wallet-row:hover:not([disabled]) { border-color: var(--ink); }
.wallet-row[disabled] { opacity: 0.6; cursor: default; }
.wallet-row img { border-radius: 6px; }
.wallet-name { flex: 1; font-weight: 650; }
.wallet-tag { font: 12px var(--font-mono); color: var(--muted); }
.wallet-help { display: grid; gap: 10px; margin-top: 14px; }

/* ---------- modal, toasts ---------- */
.modal-veil { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(28, 25, 21, 0.55); animation: fade var(--t) var(--ease); }
.modal-panel { width: min(470px, 100%); max-height: calc(100svh - 32px); overflow: auto; border-radius: var(--r); background: var(--paper); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5); padding: 22px; animation: pop var(--t) var(--ease); overflow-wrap: anywhere; border-top: 6px solid var(--ink); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 30px; }
.modal-panel.locked .modal-x { visibility: hidden; }
.modal-body { display: grid; gap: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; }
.toast { padding: 9px 16px; border-radius: var(--r-sm); background: var(--ink); color: var(--paper); font: 13.5px var(--font-mono); box-shadow: var(--shadow); animation: pop var(--t) var(--ease); }
.toast.bad { background: var(--warn); color: var(--ink); }

/* ---------- footer ---------- */
#foot { background: var(--rail); color: #d9d1bf; padding: 56px 0 calc(48px + env(safe-area-inset-bottom)); }
.foot { display: grid; grid-template-columns: 1fr auto; gap: 28px; }
.foot-brand { color: var(--paper); }
.foot-brand .lockup > svg { height: 40px; }
.foot-brand .lockup .brand-word svg { height: 24px; }
.foot-brand p { margin-top: 12px; color: #b9b0a0; max-width: 30em; }
.foot-links { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 36px; align-content: start; font-size: 15px; }
.foot-links a:hover { color: var(--paper); text-decoration: underline; text-underline-offset: 3px; }
.foot-base { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font: 12.5px/1.5 var(--font-mono); padding-top: 20px; border-top: 1px dashed rgba(217, 209, 191, 0.25); color: #b9b0a0; }
.foot-base .link { color: #d9d1bf; }

/* ---------- motion switch: when off, nothing moves (the visible switch, not the OS setting, decides) ---------- */
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .nav, .top-actions .ca { display: none; }
  .tabbar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 25; display: flex; justify-content: space-around; padding: 5px; border-radius: var(--r); background: var(--rail); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5); }
  .tabbar a { padding: 9px 10px; border-radius: var(--r-sm); color: #d9d1bf; font: 500 12.5px var(--font-mono); letter-spacing: 0.02em; }
  .tabbar a[aria-current] { background: var(--paper); color: var(--ink); }
  .controls .search { margin-left: 0; width: 100%; }
  .feed-row { grid-template-columns: 50px minmax(0, 1fr) 54px; }
  .feed-row .tx { display: none; }
  #foot { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .two { grid-template-columns: 1fr; }
  .foot { grid-template-columns: 1fr; }
  .wallet-btn.on .muted { display: none; }
  .top-bar { gap: 12px; }
}
