:root {
  --paper: #f4efe6; --card: #fbf8f2; --ink: #1c2433; --ink-2: #4c5566; --ink-3: #7d8491; --rule: #ddd4c4; --rule-2: #e8e1d4;
  --red: #c8341f; --red-ink: #a92a17; --space: #0f1724;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 3px; --bar: 60px; --gx: max(20px, 5vw);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--bar); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--sans); font-variant-numeric: tabular-nums; overflow-x: hidden; }
img { max-width: 100%; }
a { color: inherit; text-decoration-color: rgba(28,36,51,.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--red); }
h1, h2, h3 { font-weight: 400; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1260px; margin: 0 auto; padding: 0 var(--gx); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: var(--r); border: 1px solid var(--ink); background: transparent; font-weight: 600; font-size: 15.5px; white-space: nowrap; text-decoration: none; transition: background .15s, color .15s, border-color .15s; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn.line:hover { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: none; padding: 0; color: var(--ink-2); text-decoration: underline; text-decoration-color: rgba(28,36,51,.3); text-underline-offset: 3px; font-size: 15px; }
.link:hover { color: var(--ink); text-decoration-color: var(--red); }

/* ---------- the bar ---------- */
.bar { position: fixed; z-index: 50; top: 0; left: 0; right: 0; height: var(--bar); display: flex; align-items: center; gap: 28px; padding: 0 var(--gx); background: var(--paper); border-bottom: 1px solid var(--rule); }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: .06em; font-size: 15px; }
.mark-stamp { width: 28px; height: 28px; max-width: none; aspect-ratio: 1; flex: none; display: block; }
.nav { display: flex; gap: 24px; margin-left: auto; font-size: 15px; }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--ink); }
.wallet-wrap { position: relative; display: flex; align-items: center; gap: 10px; }
.wallet-btn { height: 40px; padding: 0 10px 0 14px; font-size: 14.5px; }
.xbtn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--ink); border-radius: var(--r); color: var(--ink); }
.xbtn:hover { background: var(--ink); color: var(--paper); }
.xbtn svg { width: 15px; height: 15px; }
.wb-logo { width: 20px; height: 20px; max-width: none; flex: none; border-radius: 5px; display: block; }
.wallet-btn.signed .wb-logo { display: none; }
.wallet-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 12px 30px rgba(28,36,51,.12); padding: 6px; display: grid; }
.wallet-menu[hidden] { display: none; }
.wallet-menu button, .wallet-menu a { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: var(--r); font-size: 15px; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.wallet-menu button:hover, .wallet-menu a:hover { background: var(--rule-2); }
.wallet-menu .wm-note { font-size: 13px; color: var(--ink-3); padding: 8px 12px 4px; margin: 0; }
.wallet-menu img { width: 20px; height: 20px; max-width: none; border-radius: 5px; }

/* ---------- the stage: the hero, the dive and the unrolling card ---------- */
.stage { position: relative; height: 205vh; height: 205svh; margin-top: var(--bar); }
body.diving .stage, body.static-shot .stage { height: calc(100vh - var(--bar)); height: calc(100svh - var(--bar)); }
.stage-in { position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); height: calc(100svh - var(--bar)); overflow: hidden; }
#earth { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: pan-y; cursor: grab; }
#earth.dragging { cursor: grabbing; }
body.diving #earth { cursor: default; }
.stamp-frame { position: absolute; z-index: 1; left: 0; top: 0; pointer-events: none; }
.pinlabel { position: absolute; z-index: 3; left: 0; top: 0; pointer-events: none; font-size: 13px; line-height: 1.35; color: #fff; padding: 6px 9px; background: rgba(15,23,36,.82); border-radius: var(--r); white-space: nowrap; opacity: 0; transform: translate(14px, -50%); transition: opacity .3s; }
.pinlabel.on { opacity: 1; }
.pinlabel b { font-weight: 600; }

.hero-copy { position: absolute; z-index: 4; left: var(--gx); top: 50%; transform: translateY(-52%); width: min(560px, 46vw); }
.hero-copy h1 { font-family: var(--serif); font-size: clamp(44px, 5.2vw, 76px); line-height: 1.02; letter-spacing: -.01em; }
.lede { margin: 18px 0 26px; font-size: 18.5px; line-height: 1.5; color: var(--ink-2); max-width: 31em; }
.look { display: flex; flex-wrap: wrap; gap: 10px; }
.look input { flex: 1 1 100%; min-width: 0; height: 54px; padding: 0 16px; border: 1px solid var(--ink); border-radius: var(--r); background: var(--card); font: 500 16.5px var(--sans); color: var(--ink); letter-spacing: .01em; }
.look input::placeholder { color: var(--ink-3); }
.look input.cycling::placeholder { color: var(--ink-2); }
.look .btn { flex: 0 0 auto; }
.look .btn.primary { min-width: 108px; }
.hint { margin: 14px 0 0; min-height: 24px; font-size: 15px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.err { color: var(--red-ink); }
.err a { color: var(--red-ink); font-weight: 600; }
.mail { margin: 14px 0 0; font-size: 15px; padding-left: 14px; border-left: 2px solid var(--red); }
.mail button { margin-left: 6px; }
.breathe { animation: breathe 1.4s ease-in-out 1; }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px rgba(200,52,31,.16); } }

.readout::before { content: ""; position: absolute; z-index: -1; left: -60px; right: -120px; top: -50px; bottom: -40px; background: radial-gradient(closest-side, rgba(10,16,26,.55), rgba(10,16,26,0)); }
.res-head:focus { outline: none; }
.readout { position: absolute; z-index: 4; left: var(--gx); bottom: 26px; display: grid; gap: 2px; font-size: 14px; color: #e9edf3; text-shadow: 0 1px 3px rgba(0,0,0,.6); opacity: 0; transition: opacity .3s; pointer-events: none; }
.readout .ro-a { font-size: 22px; font-weight: 500; color: #fff; }
.readout .ro-b { color: #fff; }
.readout .ro-c { color: #b9c2cf; }
body.diving .readout.on { opacity: 1; }
body.diving .hero-copy, body.diving .stamp-frame, body.diving .pinlabel { opacity: 0 !important; pointer-events: none !important; }
.hero-copy, .stamp-frame { transition: opacity .35s; }

/* the result: the postcard and what it says */
.result { position: absolute; z-index: 6; inset: 0; background: var(--paper); display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 48px; align-items: center; padding: 32px var(--gx); overflow-y: auto; }
.result[hidden] { display: none; }
.res-card { min-width: 0; }
.card-flip { position: relative; aspect-ratio: 3 / 2; perspective: 1800px; cursor: pointer; }
.card-face { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--r); box-shadow: 0 1px 2px rgba(28,36,51,.12), 0 18px 40px -12px rgba(28,36,51,.35); backface-visibility: hidden; transition: transform .7s cubic-bezier(.3,.7,.2,1); background: var(--card); }
.card-face.back { transform: rotateY(180deg); }
.card-flip.flipped .front { transform: rotateY(-180deg); }
.card-flip.flipped .back { transform: rotateY(0); }
.card-under { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; font-size: 14px; color: var(--ink-3); min-height: 22px; }
.res-info { min-width: 0; }
.res-who { margin: 0 0 10px; font-size: 14px; color: var(--ink-3); }
.res-head { font-family: var(--serif); font-size: clamp(32px, 3.1vw, 46px); line-height: 1.06; }
.res-sub { margin: 10px 0 18px; font-size: 17px; color: var(--ink-2); }
.res-data { display: grid; grid-template-columns: auto 1fr; gap: 7px 18px; margin: 0 0 22px; font-size: 15px; }
.res-data dt { color: var(--ink-3); }
.res-data dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.res-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.res-note { margin: 14px 0 0; font-size: 14.5px; color: var(--ink-2); }
.res-mail { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--rule); }
.res-mail-h { margin: 0 0 10px; font-size: 14px; color: var(--ink-3); }
.mail-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mail-chips button { border: 1px solid var(--rule); background: var(--card); border-radius: var(--r); padding: 5px 9px; font-size: 13px; line-height: 1.3; text-align: left; }
.mail-chips button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.mail-chips small { display: block; color: var(--ink-3); font-size: 12px; }

/* the unrolled Earth as a postcard */
.unroll { position: absolute; z-index: 1; left: 0; top: 0; background: var(--card); border-radius: var(--r); box-shadow: 0 1px 2px rgba(28,36,51,.1), 0 24px 50px -16px rgba(28,36,51,.32); opacity: 0; pointer-events: none; }
.unroll-top { position: absolute; z-index: 3; left: 0; top: 0; pointer-events: none; opacity: 0; }
.unroll-stamp { position: absolute; z-index: 3; height: auto; max-width: none; filter: drop-shadow(0 4px 6px rgba(28,36,51,.25)); }
.unroll-mark { position: absolute; z-index: 4; pointer-events: none; }
.unroll-copy { position: absolute; z-index: 4; left: 0; right: 0; text-align: center; margin: 0; padding: 0 var(--gx); font-family: var(--serif); font-size: clamp(24px, 2.6vw, 36px); line-height: 1.2; opacity: 0; pointer-events: none; }
.unroll-copy span { display: block; font-family: var(--sans); font-size: 15px; color: var(--ink-2); margin-top: 8px; }

/* ---------- sections ---------- */
.sect { padding: 120px 0 40px; }
.sect-head { max-width: 760px; margin-bottom: 40px; }
.sect-head h2 { font-family: var(--serif); font-size: clamp(38px, 4.2vw, 58px); line-height: 1.04; }
.sect-head p { margin: 16px 0 0; font-size: 18px; color: var(--ink-2); }
.fine { font-size: 13.5px; color: var(--ink-3); margin: 12px 0 0; }
h3 { font-family: var(--serif); font-size: 28px; line-height: 1.1; margin-bottom: 14px; }

.series { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 20px; }
.pc { margin: 0; }
.pc-img { position: relative; aspect-ratio: 3 / 2; border-radius: var(--r); overflow: hidden; background: var(--card); box-shadow: 0 1px 2px rgba(28,36,51,.1), 0 10px 24px -10px rgba(28,36,51,.3); }
.pc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.swath-cover { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.pc figcaption { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 14px; }
.pc figcaption span:last-child { color: var(--ink-3); }
.sats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin: 48px 0 0; padding-top: 28px; border-top: 1px solid var(--rule); }
.sats dt { font-weight: 600; margin-bottom: 6px; }
.sats dd { margin: 0; color: var(--ink-2); font-size: 15.5px; }

.schematic { border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); padding: 20px; overflow-x: auto; }

.schematic svg { display: block; width: 100%; min-width: 980px; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
.legend .k { display: inline-block; width: 22px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 8px; }
.legend .k.here { border-color: var(--ink); }
.legend .k.live { border-color: var(--red); }
.legend .k.launch { border-top-style: dashed; border-color: var(--ink-3); }

.holder-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 48px; align-items: center; }
.night { position: relative; aspect-ratio: 1; max-width: 620px; width: 100%; margin: 0 auto; }
#night { width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
.night-empty { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font-size: 14.5px; color: var(--ink-2); margin: 0; }
.coverage { margin: 0 0 6px; }
.cov-n { display: block; font-family: var(--serif); font-size: clamp(64px, 7vw, 96px); line-height: 1; }
.cov-l { font-size: 17px; color: var(--ink-2); }
.night-side h3 { margin-top: 40px; }
.rarity { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rarity li { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.rarity li span:nth-child(2) { color: var(--ink-2); text-align: right; }
.rarity li small { grid-column: 1 / -1; color: var(--ink-3); font-size: 13px; }
.ledger { margin-top: 64px; }
.ledger-table { display: grid; border-top: 1px solid var(--rule); font-size: 15px; }
.ledger-table .row { display: grid; grid-template-columns: 90px minmax(0, 1.4fr) minmax(0, 1fr) 120px 90px; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.ledger-table .row.head { color: var(--ink-3); font-size: 13.5px; }
.ledger-table .row a { text-decoration: none; }
.ledger-table .row a:hover { text-decoration: underline; }
.ledger-table .empty { padding: 16px 0; color: var(--ink-2); margin: 0; }
.ledger-table .dim { color: var(--ink-3); }

/* ---------- footer ---------- */
.foot { margin-top: 120px; border-top: 1px solid var(--rule); padding: 44px 0 60px; font-size: 14px; color: var(--ink-2); }
.foot-grid { display: grid; grid-template-columns: 1.1fr .7fr 1.6fr; gap: 36px; }
.foot p { margin: 0 0 10px; }
.foot-brand p { margin-top: 14px; }

/* ---------- the studio ---------- */
.studio { position: fixed; z-index: 70; inset: 0; background: var(--paper); overflow-y: auto; }
.studio[hidden] { display: none; }
.studio-in { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 44px; max-width: 1320px; margin: 0 auto; padding: 36px var(--gx) 48px; min-height: 100%; align-items: start; }
.studio-preview { display: grid; gap: 18px; position: sticky; top: 24px; }
.studio-preview canvas { width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: var(--r); box-shadow: 0 1px 2px rgba(28,36,51,.12), 0 16px 34px -12px rgba(28,36,51,.32); background: var(--card); }
.studio-ctl h2 { font-family: var(--serif); font-size: 40px; line-height: 1.05; }
.studio-note { color: var(--ink-2); font-size: 15.5px; margin: 12px 0 24px; }
.ctl { margin-bottom: 20px; }
.ctl-l { display: block; font-size: 14px; color: var(--ink-3); margin-bottom: 7px; }
.ctl select, .ctl textarea { width: 100%; border: 1px solid var(--ink); border-radius: var(--r); background: var(--card); font: 400 15.5px var(--sans); color: var(--ink); padding: 10px 12px; }
.ctl select { height: 46px; }
.ctl textarea { font-family: var(--serif); font-style: italic; font-size: 19px; resize: vertical; min-height: 92px; }
.zoom-row { display: flex; align-items: center; gap: 14px; }
.zoom-row input { flex: 1; accent-color: var(--red); }
.zoom-row span { min-width: 72px; text-align: right; font-size: 14.5px; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: none; padding: 10px 16px; font-size: 14.5px; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.seg button:disabled { opacity: .4; cursor: default; }
.ctl-d { font-size: 13.5px; color: var(--ink-3); margin: 8px 0 0; }
.studio-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 8px; }
.mint-note { margin: 14px 0 0; font-size: 14.5px; color: var(--ink-2); }

/* ---------- the transition overlay ---------- */
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 90; pointer-events: none; image-rendering: pixelated; display: none; }
#fx.on { display: block; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .result { grid-template-columns: 1fr; gap: 26px; align-items: start; padding-top: 22px; }
  .holder-grid { grid-template-columns: 1fr; }
  .studio-in { grid-template-columns: 1fr; gap: 24px; }
  .studio-preview { position: static; }
  .foot-grid { grid-template-columns: 1fr; gap: 20px; }
  .ledger-table .row { grid-template-columns: 70px minmax(0, 1fr) 90px; }
  .ledger-table .row > :nth-child(3), .ledger-table .row > :nth-child(5) { display: none; }
  .sats { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 760px) {
  :root { --bar: 54px; }
  body { font-size: 16px; }
  .nav { display: none; }
  .wallet-wrap { margin-left: auto; }
  .hero-copy { left: 16px; right: 16px; top: auto; bottom: 18px; transform: none; width: auto; }
  .hero-copy h1 { font-size: clamp(34px, 9.6vw, 46px); }
  .lede { font-size: 16px; margin: 10px 0 16px; }
  .look input { height: 50px; font-size: 15.5px; }
  .look .btn { flex: 1 1 0; height: 46px; padding: 0 12px; }
  .hint { margin-top: 10px; }
  .readout { left: 16px; bottom: 16px; }
  .readout .ro-a { font-size: 18px; }
  .sect { padding-top: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
@media (max-width: 760px) {
  .series { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .pc figcaption { font-size: 12.5px; flex-direction: column; gap: 0; margin-top: 6px; }
}

/* ---- $POSTCARD: a card under the form on wide screens, a strip above the bar on phones ---- */
.cacard { margin-top: 22px; width: min(420px, 100%); background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--red); border-radius: var(--r); padding: 14px 18px 18px; box-shadow: 0 12px 32px rgba(28, 36, 51, 0.1); }
.cacard-tk { display: block; font-family: var(--serif); font-size: 30px; line-height: 1.15; }
.cacard-ca { display: block; margin: 4px 0 14px; font-size: 12.5px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.cacard-acts { display: flex; gap: 8px; }
.cacard-acts .btn { flex: 1; height: 42px; padding: 0 12px; font-size: 14.5px; }
.cab { display: none; }
.foot-ca { word-break: break-all; }
@media (max-width: 760px) {
  .cacard { display: none; }
  body.has-cab { --bar: 86px; }
  body.has-cab .bar { top: 32px; height: 54px; }
  .cab { position: fixed; z-index: 51; top: 0; left: 0; right: 0; height: 32px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; background: var(--red); color: #fff; font-size: 12.5px; }
  .cab-tk { font-weight: 700; }
  .cab-ca { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
  .cab-btn { flex: none; color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, .6); border-radius: var(--r); padding: 2px 9px; font: inherit; font-weight: 600; text-decoration: none; }
}
