@font-face { font-family: "Inter"; src: url(fonts/Inter-var.woff2) format("woff2"); font-weight: 100 900; font-display: block; }
@font-face { font-family: "Urbanist"; src: url(fonts/Urbanist-var.woff2) format("woff2"); font-weight: 100 900; font-display: block; }
@font-face { font-family: "Spline Sans Mono"; src: url(fonts/SplineSansMono-var.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --bar: 96px;
  /* the instrument: graphite, white, one warm accent taken from the sun */
  --graphite: oklch(0.165 0.004 260);
  --graphite-2: oklch(0.22 0.005 260);
  --white: oklch(0.985 0 0);
  --quiet: oklch(0.985 0 0 / 0.5);
  --hair: oklch(0.985 0 0 / 0.14);
  --ink: oklch(0.205 0.006 260);
  --ink-quiet: oklch(0.205 0.006 260 / 0.6);
  --sun: oklch(0.78 0.155 70);
  --sans: "Urbanist", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
  --pop: cubic-bezier(0.25, 1.18, 0.4, 1);
  color-scheme: dark;
  scrollbar-color: oklch(0.42 0.004 260) var(--graphite);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--graphite); color: var(--white); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; touch-action: manipulation; font-family: var(--sans); }
::selection { background: oklch(0.78 0.155 70 / 0.42); color: inherit; }
button, a { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#page { position: absolute; inset: 0 0 var(--bar) 0; overflow: hidden; contain: strict; user-select: none; -webkit-user-select: none; }
#wall, #sky, #plaster, #orbs, #headline, #washing, #under, #over, #flows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#plaster { mix-blend-mode: multiply; background-size: 1024px 1024px; }
#orbs { will-change: opacity; }
/* The sun, low and behind the line. Not decoration: it is the one light everything answers to. */
#sky {
  opacity: 0; will-change: opacity;
  background:
    radial-gradient(circle var(--sr, 900px) at var(--sx, 80%) var(--sy, 66%), oklch(0.995 0.018 85 / 0.96) 0, oklch(0.985 0.03 80 / 0.62) 16%, oklch(0.97 0.025 78 / 0.22) 38%, oklch(0.96 0.02 78 / 0) 64%),
    linear-gradient(to top, oklch(0.965 0.014 80 / 0.55), oklch(0.965 0.014 80 / 0) 42%);
}
#headline { overflow: visible; }
.tile { position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 26px; background: linear-gradient(135deg, #a78bfa, #f472b6); box-shadow: 0 0 24px rgb(244 114 182 / .55); transform-origin: 0 0; }
.btn { position: absolute; left: 0; top: 0; }

/* Text blocks: two stacked faces per word. Fixed 40px, scaled by transform, so words never reflow. */
.flow { position: absolute; left: 0; top: 0; }
.w { position: absolute; left: 0; top: 0; font-size: 40px; line-height: 1; white-space: pre; transform-origin: 0 0; font-variant-numeric: tabular-nums; }
.w i { position: absolute; left: 0; top: 0; font-style: normal; }
.w .a { font-family: var(--a); font-weight: var(--wa); }
.w .b { font-family: var(--b); font-weight: var(--wb); opacity: 0; letter-spacing: -0.005em; }
.logo .w .b { letter-spacing: -0.02em; }

.hit { position: absolute; left: 0; top: 0; padding: 0; background: none; border: 0; cursor: pointer; pointer-events: auto; border-radius: 12px; }
.hit:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }

/* ------ the one pane of glass: the text Peg sends ------ */
#pane {
  position: absolute; left: 0; top: 0; width: 336px; padding: 14px 16px 13px 14px; visibility: hidden; opacity: 0;
  color: var(--ink); font-family: var(--sans); border-radius: 26px; transform-origin: 50% 100%;
  background: linear-gradient(to bottom, oklch(1 0 0 / 0.5), oklch(1 0 0 / 0.3));
  -webkit-backdrop-filter: blur(28px) saturate(1.7); backdrop-filter: blur(28px) saturate(1.7);
  box-shadow: inset 0 0 0 0.5px oklch(1 0 0 / 0.75), inset 0 1px 0 oklch(1 0 0 / 0.7), 0 22px 44px -20px oklch(0.25 0.03 255 / 0.28), 0 2px 6px -2px oklch(0.25 0.03 255 / 0.08);
  will-change: transform, opacity, filter; pointer-events: none;
}
#pane header { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; }
/* concentric: the pane is 26, its padding 14, so the icon in its corner is 12 */
#pane-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 12px; color: var(--white); background: linear-gradient(to bottom, oklch(0.3 0.006 260), oklch(0.18 0.006 260)); box-shadow: inset 0 0 0 0.5px oklch(1 0 0 / 0.12); }
#pane-app { flex: 1; font: 650 13.5px/1 var(--sans); letter-spacing: 0.005em; }
#pane-time { font: 500 12.5px/1 var(--sans); color: var(--ink-quiet); font-variant-numeric: tabular-nums; }
#pane-title { margin: 0; font: 650 17px/1.2 var(--sans); letter-spacing: -0.005em; }
#pane-body { margin: 3px 0 0; font: 450 14.5px/1.36 var(--sans); color: oklch(0.205 0.006 260 / 0.78); text-wrap: pretty; }
#pane-curve { margin: 12px 0 0; }
#pane-curve svg { display: block; width: 100%; height: 34px; overflow: visible; }
#pane-base { stroke: oklch(0.205 0.006 260 / 0.14); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
#pane-line { stroke: oklch(0.205 0.006 260 / 0.62); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
#pane-dot { fill: var(--sun); stroke: oklch(1 0 0 / 0.9); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#pane-curve figcaption { display: flex; justify-content: space-between; margin-top: 6px; font: 550 11.5px/1 var(--sans); color: var(--ink-quiet); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.compact #pane-curve { display: none; }
.compact#pane { padding: 11px 13px 11px 11px; border-radius: 22px; }
.compact #pane-icon { width: 26px; height: 26px; border-radius: 11px; }
.compact #pane-icon svg { width: 20px; height: 20px; }
.compact #pane header { margin-bottom: 6px; gap: 7px; }
.compact #pane-app { font-size: 12px; }
.compact #pane-time { font-size: 11px; }
.compact #pane-title { font-size: 14px; }
.compact #pane-body { font-size: 12.5px; }

/* ------ the annotation: a popover lit by the page's own light ------ */
#note { position: absolute; inset: 0 0 var(--bar) 0; pointer-events: none; opacity: 0; transition: opacity .28s var(--spring); }
#note.on { opacity: 1; }
#leader { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#leader path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#leader-case, #bracket-case { stroke: oklch(1 0 0 / .62); stroke-width: 3.5; }
#leader-line, #bracket { stroke: var(--ink); stroke-width: 1; }
#leader-dot { fill: var(--ink); }
#leader-dot-case { fill: oklch(1 0 0 / .85); }
#card {
  position: absolute; left: 0; top: 0; width: 392px; padding: 15px 20px 16px 14px;
  display: grid; grid-template-columns: 30px 1fr; column-gap: 10px;
  color: var(--ink); border-radius: 18px;
  background: oklch(0.99 0.002 260 / 0.86);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: var(--label-shadow, 0 2px 6px rgb(0 0 0 / .18)), inset 0 0 0 0.5px oklch(1 0 0 / 0.8), 0 0 0 0.5px oklch(0.2 0.01 260 / 0.1);
  will-change: transform; opacity: 0; translate: 0 8px; scale: 0.985;
  transition: opacity .3s var(--spring), translate .5s var(--spring), scale .5s var(--spring);
}
#note.on #card { opacity: 1; translate: 0 0; scale: 1; }
#card-title { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; margin: 0; font: 650 19px/1.15 var(--sans); letter-spacing: -0.01em; text-wrap: balance; }
#card-n { text-align: right; font-weight: 400; font-variant-numeric: tabular-nums; color: oklch(0.205 0.006 260 / 0.42); }
#card-delta { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; row-gap: 3px; margin: 12px 0 0; padding: 10px 0 0; border-top: 0.5px solid oklch(0.205 0.006 260 / 0.16); font: 400 11.5px/1.45 var(--mono); }
#card-delta dt { text-align: right; color: oklch(0.205 0.006 260 / 0.5); font: 500 11px/16.7px var(--sans); letter-spacing: 0.02em; }
#card-delta dd { margin: 0; min-width: 0; }
#card-delta s { color: oklch(0.205 0.006 260 / 0.52); text-decoration-thickness: 1px; text-decoration-color: oklch(0.205 0.006 260 / 0.4); }
#card-delta mark { color: var(--ink); background: linear-gradient(transparent 58%, oklch(0.78 0.155 70 / 0.5) 58%, oklch(0.78 0.155 70 / 0.5) 94%, transparent 94%); padding: 0 2px; margin: 0 -2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#card-why { grid-column: 2; margin: 10px 0 0; font: 450 14.5px/1.42 var(--sans); color: oklch(0.205 0.006 260 / 0.8); text-wrap: pretty; }

/* ------ the bar: an instrument ------ */
#bar { user-select: none; -webkit-user-select: none; position: absolute; inset: auto 0 0 0; height: var(--bar); display: grid; grid-template-columns: 136px 1fr auto; align-items: center; gap: 40px; padding: 0 24px 0 30px; background: var(--graphite); box-shadow: 0 -0.5px 0 oklch(1 0 0 / 0.1); }
#debt { display: flex; align-items: center; gap: 12px; }
#debt-n { position: relative; display: block; height: 48px; min-width: 1.15em; overflow: hidden; font: 250 48px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; color: var(--white); text-align: right; }
#debt-roll { display: block; position: relative; height: 100%; }
#debt-roll span { position: absolute; right: 0; top: 0; }
#debt-l { font: 550 12px/1.2 var(--sans); color: var(--quiet); letter-spacing: 0.01em; }
.in-up { animation: in-up .46s var(--spring) both; }
.out-up { animation: out-up .46s var(--spring) both; }
.in-down { animation: in-down .46s var(--spring) both; }
.out-down { animation: out-down .46s var(--spring) both; }
@keyframes in-up { from { transform: translateY(70%); opacity: 0; filter: blur(3px); } }
@keyframes out-up { to { transform: translateY(-70%); opacity: 0; filter: blur(3px); } }
@keyframes in-down { from { transform: translateY(-70%); opacity: 0; filter: blur(3px); } }
@keyframes out-down { to { transform: translateY(70%); opacity: 0; filter: blur(3px); } }

#rail { position: relative; height: 96px; }
#ruler { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#track { position: absolute; inset: 0 -10px; padding: 0 10px; cursor: grab; touch-action: none; border-radius: 12px; }
#track[data-drag] { cursor: grabbing; }
#thumb { position: absolute; left: 10px; top: 0; width: 0; height: 100%; pointer-events: none; will-change: transform; }
/* the knob: a capsule standing on the line, like a fader cap */
#thumb i {
  position: absolute; left: -6px; top: 28px; width: 12px; height: 32px; border-radius: 6px;
  background: linear-gradient(to bottom, oklch(1 0 0), oklch(0.9 0.003 260));
  box-shadow: inset 0 0.5px 0 oklch(1 0 0), 0 0 0 0.5px oklch(0 0 0 / 0.5), 0 3px 8px oklch(0 0 0 / 0.45), 0 10px 18px -8px oklch(0 0 0 / 0.6);
  transition: transform .42s var(--pop), box-shadow .25s var(--spring);
}
#thumb i::after { content: ""; position: absolute; left: 50%; top: 9px; bottom: 9px; width: 1px; margin-left: -0.5px; background: oklch(0.2 0 0 / 0.28); border-radius: 1px; }
#track:hover #thumb i { transform: scale(1.06); }
#track[data-drag] #thumb i { transform: scale(1.14, 1.1); box-shadow: inset 0 0.5px 0 oklch(1 0 0), 0 0 0 0.5px oklch(0 0 0 / 0.5), 0 6px 14px oklch(0 0 0 / 0.5), 0 16px 26px -10px oklch(0 0 0 / 0.6); }
#track:focus-visible { outline: none; }
#track:focus-visible #thumb i { box-shadow: inset 0 0.5px 0 oklch(1 0 0), 0 0 0 0.5px oklch(0 0 0 / 0.5), 0 3px 8px oklch(0 0 0 / 0.45), 0 0 0 4px oklch(0.78 0.155 70 / 0.55); }
#thumb.knock i { animation: knock .34s var(--spring); }
@keyframes knock { 30% { transform: scale(1.22, 0.92); } 65% { transform: scale(0.96, 1.05); } }
/* the twelve moves, numbered above the line */
#ticks { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.tick { position: absolute; top: 6px; width: 26px; height: 26px; margin-left: -13px; pointer-events: auto; cursor: pointer; background: none; border: 0; padding: 0; border-radius: 8px; color: oklch(1 0 0 / 0.38); font: 600 11.5px/26px var(--sans); font-variant-numeric: tabular-nums; text-align: center; transition: color .25s var(--spring), transform .35s var(--pop), background .2s; }
.tick.paid { color: oklch(1 0 0 / 0.92); }
.tick:hover { color: var(--white); background: oklch(1 0 0 / 0.08); transform: translateY(-1px); }
.tick:active { transform: scale(0.94); }
.tick:focus-visible { outline: 1.5px solid var(--sun); outline-offset: 0; }
#take { display: flex; gap: 8px; }
#take > * { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 15px; font: 600 13.5px/1 var(--sans); letter-spacing: 0.01em; text-decoration: none; background: none; border: 0; border-radius: 18px; cursor: pointer; transition: background .2s var(--spring), color .2s, box-shadow .2s, transform .3s var(--pop); white-space: nowrap; }
#btn-css { box-shadow: inset 0 0 0 1px var(--hair); color: oklch(1 0 0 / 0.86); }
#btn-css:hover { background: oklch(1 0 0 / 0.07); box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.24); }
#btn-css[aria-expanded="true"] { background: oklch(1 0 0 / 0.14); box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.28); }
#take > *:active { transform: scale(0.96); }
#btn-taste { background: var(--white); color: var(--ink); }
#take > #btn-taste:hover { background: oklch(1 0 0); }
.dim { color: oklch(1 0 0 / 0.46); font: 400 12px/1 var(--mono); margin-left: .3ch; display: inline-block; min-width: 6.4ch; }

/* ------ tokens ------ */
#drawer { position: absolute; right: 12px; top: 12px; bottom: calc(var(--bar) + 12px); width: min(420px, calc(100% - 24px)); display: flex; flex-direction: column; color: var(--white); border-radius: 20px; background: oklch(0.18 0.004 260 / 0.9); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); box-shadow: inset 0 0 0 0.5px oklch(1 0 0 / 0.12), 0 30px 60px -20px oklch(0 0 0 / 0.6); animation: drawer .42s var(--spring); }
@keyframes drawer { from { opacity: 0; transform: translateX(12px) scale(0.985); } }
#drawer[hidden] { display: none; }
#drawer header { display: flex; align-items: center; gap: 8px; padding: 14px 12px 12px 20px; }
#drawer h2 { flex: 1; margin: 0; font: 600 17px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.005em; }
#drawer button { height: 32px; min-width: 32px; display: grid; place-items: center; padding: 0 13px; font: 600 13px/1 var(--sans); background: oklch(1 0 0 / 0.08); border: 0; border-radius: 16px; cursor: pointer; transition: background .2s; }
#drawer button:hover { background: oklch(1 0 0 / 0.14); }
#dr-copy { background: var(--white) !important; color: var(--ink); }
#dr-close { padding: 0 !important; }
#dr-code { flex: 1; margin: 0; padding: 4px 20px 22px; overflow: auto; font: 400 12px/1.66 var(--mono); user-select: text; -webkit-user-select: text; cursor: text; white-space: pre; scrollbar-width: thin; border-radius: 0 0 20px 20px; }
#dr-code .c { color: oklch(1 0 0 / 0.45); }
#dr-code .k { color: var(--sun); }
#dr-code::-webkit-scrollbar { width: 8px; height: 8px; }
#dr-code::-webkit-scrollbar-thumb { background: oklch(1 0 0 / 0.18); border-radius: 4px; }

#toast { position: absolute; left: 50%; bottom: calc(var(--bar) + 16px); transform: translate(-50%, 10px) scale(0.97); padding: 10px 16px; font: 550 13.5px/1.3 var(--sans); color: var(--white); border-radius: 999px; background: oklch(0.18 0.004 260 / 0.88); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: inset 0 0 0 0.5px oklch(1 0 0 / 0.12), 0 12px 30px -10px oklch(0 0 0 / 0.5); opacity: 0; pointer-events: none; transition: opacity .25s var(--spring), transform .45s var(--pop); white-space: nowrap; max-width: calc(100vw - 24px); }
#toast.on { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (max-width: 720px) {
  :root { --bar: 116px; }
  #bar { grid-template-columns: auto 1fr; grid-template-rows: 70px 40px; gap: 0 14px; padding: 0 16px; align-items: start; }
  #rail { grid-column: 1 / -1; grid-row: 1; height: 70px; }
  .tick { top: 0; width: 22px; height: 22px; margin-left: -11px; font-size: 10.5px; line-height: 22px; }
  #thumb i { top: 19px; width: 12px; height: 30px; }
  #debt { grid-row: 2; gap: 8px; }
  #debt-n { font-size: 28px; height: 30px; min-width: 1.2em; }
  #debt-l { font-size: 12px; }
  #debt-l br { display: none; }
  #take { grid-row: 2; justify-self: end; }
  #take > * { height: 34px; padding: 0 13px; border-radius: 17px; }
  #card { width: auto; left: 10px !important; right: 10px; top: auto; bottom: 10px; padding: 13px 16px 14px 10px; grid-template-columns: 26px 1fr; column-gap: 8px; transform: none !important; border-radius: 18px; }
  #card-title { font-size: 17px; }
  #card-delta { margin-top: 9px; padding-top: 8px; font-size: 10.5px; row-gap: 2px; }
  #card-why { font-size: 13.5px; line-height: 1.4; margin: 7px 0 0; }
  #drawer { top: 10%; left: 10px; right: 10px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  #note, #card, #toast, .tick, #thumb i, #take > * { transition: none; }
  #drawer, #thumb.knock i, .in-up, .out-up, .in-down, .out-down { animation: none; }
}
