/* Pinchu — base: tokens, material, header, controls, character.
   World: a black spring-steel binder clip on a dark desk. Matte black, brushed steel hairlines,
   paper-white numerals, one signal yellow reserved for "where the mint is now". */
:root {
  --bg: #0e0e0d;
  --glass: rgba(20, 20, 18, .68);
  --glass-hi: rgba(28, 28, 26, .78);
  --line: rgba(236, 236, 230, .11);
  --line-2: rgba(236, 236, 230, .2);
  --text: #ecece6;
  --text-2: #b4b4ac;
  --text-3: #8f8f88;
  --steel: #c6cacf;
  --steel-d: #6d7278;
  --acc: #ffd84a;
  --acc-ink: #17140a;
  --acc-soft: rgba(255, 216, 74, .12);
  --bad: #ff9a8a;
  --r: 12px;
  --r-sm: 8px;
  --display: Bahnschrift, "DIN Alternate", "D-DIN", "DIN Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --head-h: 68px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--body); font-variant-numeric: tabular-nums;
  min-height: 100vh; overflow-x: hidden;
}
::selection { background: var(--acc); color: var(--acc-ink); }
* { scrollbar-width: thin; scrollbar-color: rgba(236,236,230,.25) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(236,236,230,.22); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: rgba(236,236,230,.4); }
a:hover { text-decoration-color: var(--acc); }
b, strong { font-weight: 650; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 3.2vw, 40px); }
h2 { font-size: clamp(20px, 2vw, 24px); }
h3 { font-size: 18px; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

#desk { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
main, .foot { position: relative; z-index: 1; }

/* the material: smoked glass over the wire field */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r);
  -webkit-backdrop-filter: blur(9px) saturate(1.1);
  backdrop-filter: blur(9px) saturate(1.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 24px 48px -28px rgba(0,0,0,.8);
}

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  height: var(--head-h); padding: 0 clamp(16px, 3vw, 40px);
  background: rgba(14,14,13,.78); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: start; }
.brand-mark { width: 30px; display: block; }
.brand-word { font: 700 22px/1 var(--display); letter-spacing: -.01em; }
.brand-cn { font-size: 13px; color: var(--text-3); }
.tray { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.25); }
.tray a {
  display: grid; justify-items: center; min-width: 108px; padding: 6px 14px; border-radius: 7px;
  text-decoration: none; color: var(--text-2); line-height: 1.15; transition: background .2s, color .2s;
}
.tray a span { font: 600 15px/1.2 var(--display); }
.tray a small { font-size: 11px; color: var(--text-3); }
.tray a:hover { color: var(--text); background: rgba(236,236,230,.06); }
.tray a[aria-current="page"] { background: var(--text); color: var(--acc-ink); }
.tray a[aria-current="page"] small { color: #4a4a44; }
.top-tools { display: flex; align-items: center; gap: 8px; justify-self: end; }
.prelaunch {
  font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 8px; border: 1px dashed var(--line-2); border-radius: 6px; color: var(--text-2);
}
.tool, .wallet, .ghost, .chip {
  font: 600 14px/1 var(--body); color: var(--text); cursor: pointer;
  border: 1px solid var(--line-2); background: rgba(236,236,230,.04); border-radius: var(--r-sm);
  min-height: 40px; padding: 0 14px; transition: background .2s, border-color .2s, color .2s;
}
.tool:hover, .ghost:hover, .chip:hover { background: rgba(236,236,230,.09); border-color: rgba(236,236,230,.32); }
.tool { display: inline-flex; align-items: center; gap: 8px; }
.tool svg { width: 14px; height: 14px; fill: currentColor; }
.tool .ico-play { display: none; }
.tool[aria-pressed="true"] .ico-pause { display: none; }
.tool[aria-pressed="true"] .ico-play { display: inline; }
.wallet { background: var(--text); color: var(--acc-ink); border-color: var(--text); }
.wallet:hover { background: #fff; }
.ghost.sm, .chip { min-height: 34px; padding: 0 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--acc-ink); border-color: var(--text); }
.linkish { background: none; border: 0; padding: 0; color: var(--text); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { text-decoration-color: var(--acc); }

/* ---------- form atoms ---------- */
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.muted { color: var(--text-3); font-weight: 400; }
input[type="number"], input[type="text"] {
  font: 500 16px/1 var(--mono); color: var(--text); background: rgba(0,0,0,.35);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); min-height: 44px; padding: 0 12px; width: 100%;
  caret-color: var(--acc);
}
input::placeholder { color: var(--text-3); }
input:hover { border-color: rgba(236,236,230,.34); }
input:focus-visible { outline: 2px solid var(--acc); outline-offset: 0; border-color: transparent; }
input[aria-invalid="true"] { border-color: var(--bad); }
input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.err { color: var(--bad); font-size: 13px; min-height: 0; }
.err:not(:empty) { margin-top: 6px; }
.fine { font-size: 13px; color: var(--text-3); line-height: 1.5; }
.status { font-size: 14px; color: var(--text-2); }
.status:not(:empty) { margin-top: 10px; }
.chip-ink { font: 600 11px/1 var(--mono); letter-spacing: .04em; color: var(--text-2); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 6px; white-space: nowrap; }

.cta {
  display: grid; gap: 4px; justify-items: center; width: 100%; min-height: 60px; padding: 12px 16px;
  background: var(--acc); color: var(--acc-ink); border: 0; border-radius: 10px; cursor: pointer;
  font: 700 18px/1.1 var(--display); transition: filter .2s, transform .15s;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 10px 24px -14px rgba(255,216,74,.6);
}
.cta small { font: 500 12px/1.2 var(--body); opacity: .78; }
.cta:hover { filter: brightness(1.06); }
.cta:active { transform: translateY(1px); }
.cta:disabled { background: transparent; color: var(--text-3); border: 1px dashed var(--line-2); box-shadow: none; cursor: not-allowed; filter: none; }
.cta-sm { min-height: 48px; font-size: 16px; width: auto; padding: 0 22px; }
.cta[aria-busy="true"] { opacity: .7; }

/* feed status chip (shared) */
.feed-chip {
  display: inline-flex; align-items: center; gap: 8px; font: 600 12px/1 var(--mono);
  padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap;
}
.feed-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.feed-chip[data-mode="unconfigured"] i { background: transparent; border: 1.5px solid var(--text-3); }
.feed-chip[data-mode="loading"] i { background: var(--steel); animation: blink 1s steps(2) infinite; }
.feed-chip[data-mode="live"] { color: var(--text); border-color: rgba(255,216,74,.45); }
.feed-chip[data-mode="live"] i { background: var(--acc); box-shadow: 0 0 0 3px rgba(255,216,74,.18); }
.feed-chip[data-mode="stale"] i { background: #b9a76a; }
.feed-chip[data-mode="error"] { color: var(--bad); border-color: rgba(255,154,138,.45); }
.feed-chip[data-mode="error"] i { background: var(--bad); }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- toast / intro skip ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; max-width: min(92vw, 520px);
  background: var(--text); color: var(--acc-ink); padding: 12px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.7);
}
.skip-intro { position: fixed; right: 16px; bottom: 16px; z-index: 30; opacity: 0; pointer-events: none;
  font: 600 13px/1 var(--body); color: var(--text); background: rgba(0,0,0,.6); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; }
.intro .skip-intro { opacity: 1; pointer-events: auto; }
.skip-intro:focus-visible { opacity: 1; pointer-events: auto; }

/* ---------- character ---------- */
.pinchu { display: block; width: 100%; height: auto; overflow: visible; }
.pinchu .wire path { fill: none; stroke: var(--steel); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.pinchu .hinge { fill: var(--steel-d); }
.pinchu .body { fill: #050505; stroke: #46494d; stroke-width: 3; transition: stroke .3s; }
.pinchu .body-shine { stroke: rgba(255,255,255,.2); stroke-width: 4; stroke-linecap: round; fill: none; }
.pinchu .white { fill: #f3f3ee; }
.pinchu .pupil { fill: #070707; transition: transform .3s var(--ease); }
.pinchu .lid { fill: #050505; opacity: 0; transition: opacity .25s; }
.pinchu .flat-eyes { stroke: #f3f3ee; stroke-width: 6; stroke-linecap: round; display: none; }
[data-pinchu="doze"] .lid { opacity: 1; }
[data-pinchu="doze"] .pupil { transform: translateY(4px); }
[data-pinchu="wait"] .pupil { transform: translateY(-5px); }
[data-pinchu="wait"] .wire-r { animation: tap 1.4s var(--ease) infinite; transform-origin: 120px 96px; }
[data-pinchu="pinched"] .body { stroke: var(--acc); }
[data-pinchu="flat"] .eyes { display: none; }
[data-pinchu="flat"] .flat-eyes { display: block; }
@keyframes tap { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-6deg); } 80% { transform: rotate(2deg); } }

/* ---------- view frame ---------- */
main { max-width: 1320px; margin: 0 auto; padding: clamp(16px, 2.6vw, 32px) clamp(14px, 3vw, 40px) 64px; }
.foot { border-top: 1px solid var(--line); background: rgba(14,14,13,.8); }
.foot-in { max-width: 1320px; margin: 0 auto; padding: 24px clamp(14px, 3vw, 40px) 40px; display: flex; gap: 24px; justify-content: space-between; align-items: start; }
.foot p { font-size: 13px; color: var(--text-3); max-width: 70ch; }
.foot nav { display: flex; gap: 16px; font-size: 14px; }

/* motion off: pause and reduced motion */
.calm *, .calm *::before, .calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 900px) {
  :root { --head-h: 112px; }
  .top { grid-template-columns: 1fr auto; grid-template-rows: 56px 48px; gap: 0 8px; padding-bottom: 8px; }
  .tray { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .tray a { flex: 1; min-width: 0; padding: 5px 4px; }
  .prelaunch, .tool-label, .brand-cn { display: none; }
  .tool { width: 40px; padding: 0; justify-content: center; }
  .wallet { padding: 0 12px; font-size: 13px; }
  .foot-in { flex-direction: column; }
}
