/* Nestegg.
   The art direction in the brand images is INTAGLIO: engraved guilloche line work, bone ink on
   black, one emerald core. The UI is built to sit inside that rather than beside it, so the panels
   read as plate-printed cards and not as grey developer boxes.

   🔴 z-index is ignored on `position: static`, which is exactly how the mobile layout fell under
      the canvas once. Every panel stays `fixed` or `relative`. */

:root {
  --ink: #000;

  /* bone, not grey: the whole palette is warm because the engraving is */
  --paper: #ece2cd;
  --paper-2: #c9bda4;
  --paper-3: #8d8271;
  --paper-4: #5c5447;
  --rule: #2a241a;
  --rule-lit: #4a3f2c;

  --lime: #12b84c;
  --limeUp: #2ce866;
  --lime-dim: #0d7a34;

  --card: rgba(6, 5, 3, .82);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100dvh; background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-weight: 300; overflow: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* 🔴 explicit width AND height: `inset:0` alone leaves a canvas at 300x150 */
#stage { position: fixed; left: 0; top: 0; width: 100%; height: 100%; display: block; z-index: 0; }

#veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 44% 50% at 50% 46%, rgba(0,0,0,0) 32%, rgba(0,0,0,.66) 72%, rgba(0,0,0,.96) 100%),
    linear-gradient(180deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,0) 15%),
    linear-gradient(0deg, rgba(0,0,0,.96) 0%, rgba(0,0,0,.62) 18%, rgba(0,0,0,0) 34%);
}
/* The plate grain. Fine, warm and almost subliminal: it stops every flat black area from reading
   as a screenshot of a terminal. */
#veil::after {
  content: ""; position: absolute; inset: 0; opacity: .05; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--mono); font-weight: 500; font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase; }

/* ─────────────────────────────────────────────────────────────── the plate ─── */
/* One card treatment, used by every panel: a hairline in warm ink, a lit top edge like an
   embossed sheet, and an engraved field behind the content. */
.plate {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  box-shadow: inset 0 1px 0 rgba(236,226,205,.06), 0 24px 60px rgba(0,0,0,.7);
  backdrop-filter: blur(14px) saturate(.9);
}
.plate::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(
    -38deg, rgba(236,226,205,.028) 0 1px, transparent 1px 7px);
}
.plate > * { position: relative; }

h2.head {
  color: var(--paper-4); font-family: var(--mono); font-weight: 500; font-size: 9.5px;
  letter-spacing: .3em; text-transform: uppercase; padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
h2.head.second { margin-top: 26px; }

/* ────────────────────────────────────────────────────────────────── header ─── */
header { position: fixed; z-index: 3; left: 0; right: 0; top: 0;
  display: flex; align-items: flex-start; justify-content: space-between; padding: 26px 30px; }
h1 { font-size: 20px; font-weight: 200; letter-spacing: .46em; text-indent: .46em; line-height: 1;
  color: var(--paper); }
.meta { color: var(--paper-4); margin-top: 11px; }
.topright { display: flex; align-items: center; gap: 12px; }
.tag { color: var(--paper-4); border: 1px solid var(--rule); padding: 8px 12px; white-space: nowrap;
  background: rgba(6,5,3,.7); }
.tag.on { color: var(--limeUp); border-color: #1d3f28; }

/* The one glyph that is not ours to redraw. Sized to match the tag and the button beside it. */
.xlink { display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  color: var(--paper-3); border: 1px solid var(--rule); background: rgba(14,12,8,.9);
  transition: color .18s, border-color .18s, background .18s; }
.xlink svg { width: 14px; height: 14px; display: block; }
.xlink:hover { color: var(--paper); border-color: var(--rule-lit); background: rgba(24,20,13,.95); }

button {
  font-family: var(--mono); font-weight: 500; font-size: 9.5px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--paper-2); background: rgba(14,12,8,.9);
  border: 1px solid var(--rule); padding: 11px 17px; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
button:hover:not(:disabled) { color: var(--paper); border-color: var(--rule-lit); background: rgba(24,20,13,.95); }
button.primary { background: var(--lime); color: #02150a; border-color: var(--lime); font-weight: 500; }
button.primary:hover:not(:disabled) { background: var(--limeUp); border-color: var(--limeUp); color: #02150a; }
button:disabled { color: #3d382f; border-color: #1a160f; background: rgba(8,7,5,.8); cursor: not-allowed; }
button.wide { width: 100%; margin-top: 12px; }

/* ───────────────────────────────────────────────────────── your position ─── */
#me { position: fixed; z-index: 3; left: 30px; top: 106px; width: 344px; padding: 22px;
  max-height: calc(100vh - 132px); overflow-y: auto; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); }
.cell { background: rgba(10,9,6,.94); padding: 15px; display: grid; gap: 7px; }
.cell.on { background: rgba(5,20,11,.94); }
.cell .k { color: var(--paper-4); }
.big { font-size: 30px; font-weight: 200; font-variant-numeric: tabular-nums; line-height: 1;
  letter-spacing: -.01em; color: var(--paper); }
.big.lime { color: var(--limeUp); }
.sub { color: var(--paper-4); font-size: 8.5px; letter-spacing: .16em; line-height: 1.5; }

.acts { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 14px; }
#amount { background: rgba(10,9,6,.94); border: 1px solid var(--rule); color: var(--paper);
  padding: 11px 13px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: none; outline: none; min-width: 0; }
#amount::placeholder { color: #454036; }
#amount:focus { border-color: var(--rule-lit); }

.rewards { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.rewards > div { display: flex; justify-content: space-between; align-items: baseline;
  background: rgba(10,9,6,.94); padding: 9px 13px; }
.rewards .s { font-family: var(--mono); font-size: 9.5px; letter-spacing: .22em; color: var(--paper-3); }
.rewards .a { font-family: var(--mono); font-size: 11px; color: var(--paper-2); font-variant-numeric: tabular-nums; }
.rewards > div.has .s { color: var(--paper); }
.rewards > div.has .a { color: var(--limeUp); }

.hint { color: var(--paper-4); margin-top: 14px; text-transform: none; letter-spacing: .01em;
  font-family: var(--sans); font-size: 11.5px; line-height: 1.7; }

/* ──────────────────────────────────────────────────────────────── protocol ─── */
#proto { position: fixed; z-index: 3; right: 30px; top: 106px;
  width: 286px; padding: 22px; }
.rows { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  background: rgba(10,9,6,.94); padding: 10px 13px; }
.rows .k { color: var(--paper-4); }
.rows .v { font-family: var(--mono); font-size: 11px; color: var(--paper); font-variant-numeric: tabular-nums; }
.rows .v.lime { color: var(--limeUp); }
.fine { color: var(--paper-4); margin-top: 14px; text-transform: none; letter-spacing: .01em;
  font-family: var(--sans); font-size: 11.5px; line-height: 1.7; }
.fine b { color: var(--paper-2); font-weight: 400; }
.hint b { color: var(--paper-2); font-weight: 400; }

/* ────────────────────────────────────────────────────────────── the year ──── */
footer { position: fixed; z-index: 3; left: 50%; transform: translateX(-50%); bottom: 26px;
  width: clamp(300px, calc(100vw - 828px), 600px); }
.scrubhead { display: flex; justify-content: space-between; align-items: baseline;
  color: var(--paper-4); margin-bottom: 13px; gap: 14px; }
#scrubLabel { color: var(--paper-2); letter-spacing: .28em; }
#scrubDelta { color: var(--paper-3); text-transform: none; letter-spacing: .02em;
  font-family: var(--mono); font-size: 10.5px; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--rule-lit), var(--rule)); outline: none; cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%; background: var(--paper);
  box-shadow: 0 0 0 4px rgba(236,226,205,.10), 0 0 14px rgba(236,226,205,.4); cursor: grab; }
input[type=range]::-webkit-slider-thumb:active { cursor: grabbing; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%;
  background: var(--paper); box-shadow: 0 0 0 4px rgba(236,226,205,.10); }

.ticks { display: flex; justify-content: space-between; color: #3b352c; margin-top: 11px; font-size: 8.5px; }
.ticks span { position: relative; padding-top: 8px; }
.ticks span::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 4px;
  background: var(--rule-lit); }
.ticks span:first-child::before { left: 0; }
.ticks span:last-child::before { left: auto; right: 0; }

/* ─────────────────────────────────────────────────────────────── mobile ──── */
@media (max-width: 1100px) {
  html, body { height: auto; overflow-y: auto; overflow-x: hidden; }
  #veil { background:
    radial-gradient(ellipse 92% 32% at 50% 24%, rgba(0,0,0,0) 24%, rgba(0,0,0,.64) 68%, rgba(0,0,0,.94) 100%); }
  header { position: relative; z-index: 3; padding: 22px 18px 16px; flex-direction: column; gap: 16px;
    background: rgba(0,0,0,.9); }
  .topright { width: 100%; justify-content: space-between; }
  body::before { content: ""; display: block; height: 44vh; position: relative; z-index: 3; }
  /* 🔴 RESET EVERY OFFSET THE DESKTOP RULE SET, NOT JUST `transform`. Under `position: relative`
     an inherited `left: 30px` does not anchor the plate, it SHIFTS it 30px right, and `right: 30px`
     shifts the other one 30px left: the two panels drifted apart in opposite directions and one
     hung off the screen. The inherited `max-height` also turned the position panel into a tiny
     inner scroller. */
  #me, #proto { position: relative; z-index: 3; transform: none; width: auto; margin: 0 18px 16px;
    left: auto; right: auto; top: auto; max-height: none; overflow: visible;
    backdrop-filter: none; background: rgba(6,5,3,.95); }
  footer { position: relative; z-index: 3; transform: none; left: auto; bottom: auto;
    width: auto; margin: 0 18px 38px; }
}
@media (max-width: 420px) {
  .acts { grid-template-columns: 1fr; }
  .ticks span:nth-child(2), .ticks span:nth-child(4) { display: none; }
  h1 { font-size: 17px; }
}
