:root {
  --paper: #F3EBD8; --ticket: #FBF6EA; --ink: #141210; --red: #E0352B; --mint: #2FD39A; --amber: #F2A516; --dust: #B9B2A3;
  --disp: 'Anton', Impact, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace; --marker: 'Permanent Marker', cursive;
  --strip: 48px; --beat: 1.2s; --shake: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { background: var(--paper); color: var(--ink); font-family: var(--mono); overflow-x: hidden; }
body { background-image: var(--grain); }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ── strip ─────────────────────────────────────────────────── */
#strip { position: relative; z-index: 10; height: var(--strip); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; background: var(--paper) var(--grain); border-bottom: 6px solid var(--ink); }
#strip .l, #strip .r { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wm { font: 400 30px/1 var(--disp); letter-spacing: .01em; text-shadow: 3px 3px 0 var(--mint), -2px -2px 0 var(--red); white-space: nowrap; }
.won { display: flex; align-items: baseline; gap: 10px; padding: 0 12px; height: 36px; background: var(--amber); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); white-space: nowrap; }
.won small { font-size: 10px; letter-spacing: .14em; font-weight: 800; color: var(--ink); }
.won b { font: 400 24px/1 var(--disp); }
.won span { font-size: 12px; font-weight: 800; opacity: .8; }
.won.pop { animation: pop .3s; }
.live { display: flex; align-items: center; gap: 8px; font: 400 14px/1 var(--disp); text-decoration: none; white-space: nowrap; }
.live i { width: 10px; height: 10px; background: var(--red); display: block; transition: transform .15s; }
.live.pulse i { transform: scale(1.3); }
.live.lost i { background: var(--amber); }
.stk { height: 32px; padding: 0 12px; border: 0; background: var(--ink); color: #fff; font: 400 14px/1 var(--disp); letter-spacing: .04em; box-shadow: 3px 3px 0 var(--red); cursor: pointer; white-space: nowrap; }
.stk.on { background: var(--mint); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.catag { height: 32px; padding: 0 12px; border: 0; background: var(--red); color: var(--paper); font: 800 13px var(--mono); cursor: pointer; }
.xbtn { height: 32px; padding: 0 12px; display: flex; align-items: center; gap: 8px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 400 14px/1 var(--disp); letter-spacing: .04em; text-decoration: none; white-space: nowrap; }
.xbtn:hover { background: var(--ink); color: var(--paper); }
.mcapchip { height: 32px; padding: 6px 10px 0; display: flex; align-items: baseline; gap: 6px; border: 3px solid var(--ink); background: var(--ticket); white-space: nowrap; }
.mcapchip small { font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.mcapchip b { font: 400 18px/1 var(--disp); }
.buyst { height: 32px; padding: 0 14px; display: flex; align-items: center; background: var(--amber); color: var(--ink); font: 400 14px/1 var(--disp); text-decoration: none; box-shadow: 3px 3px 0 var(--ink); }

/* ── scene ─────────────────────────────────────────────────── */
#scene { position: relative; height: calc(100dvh - var(--strip)); min-height: 560px; overflow: hidden; background: var(--paper) var(--grain); transition: background-color .4s; }
#ink, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ink { z-index: 1; }
#fx { z-index: 4; pointer-events: none; }
#hatch { position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .4s; background: repeating-linear-gradient(45deg, rgba(224, 53, 43, .14) 0 2px, transparent 2px 14px); }

.slab { position: absolute; left: 0; top: 0; width: 100%; z-index: 2; will-change: transform; }
#mint { background: var(--mint) var(--halftone); }
#red { background: var(--red) var(--halftone); }
.slab .edge { position: absolute; left: 0; right: 0; height: 6px; background: var(--ink); display: block; }
#mint .edge { bottom: 0; }
#red .edge { top: 0; }
.slab .lab { position: absolute; display: flex; flex-direction: column; gap: 2px; font-family: var(--disp); line-height: 1; color: var(--ink); white-space: nowrap; transition: opacity .2s; }
#mint .lab { bottom: 16px; }
#red .lab { top: 16px; }
.lab.l { left: 24px; }
.lab.r { right: 24px; text-align: right; }
.lab.l b { font-weight: 400; font-size: var(--labsize, 64px); transition: font-size .2s; }
.lab small { font: 400 22px/1 var(--disp); color: var(--ink); opacity: .85; letter-spacing: .01em; }
.lab.r b { font-weight: 400; font-size: 40px; }
.lab.r b.pop { animation: pop .12s; }
@keyframes pop { 50% { transform: scale(1.15); } }
body.flood .slab .lab { opacity: 0; }

/* ── the ticket ────────────────────────────────────────────── */
.tk { position: absolute; left: 50%; transform: translateX(-50%); width: min(calc(100% - 64px), 1760px); z-index: 3; background: var(--ticket) var(--grain); border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); padding: 20px 28px; }
.tk .tank { position: absolute; left: 0; right: 0; bottom: 0; height: var(--tank, 0%); background: var(--amber) var(--halftone); opacity: .55; transition: height .8s cubic-bezier(.3, .8, .3, 1); pointer-events: none; }
.tk > *:not(.tank) { position: relative; }
.tk .hdr { font-size: 12px; font-weight: 800; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk .hdr a { text-decoration: none; }
.tk .one { display: flex; align-items: baseline; gap: .22em; font: 400 var(--one, clamp(72px, 7vw, 134px))/1 var(--disp); margin: 8px 0 10px; white-space: nowrap; }
.tk .one .blk { padding: 0 .18em; box-shadow: 6px 6px 0 var(--ink); }
.blk.liq { background: var(--red); color: var(--paper); }
.blk.pay { background: var(--mint); color: var(--ink); }
.tk .one .hp { margin-left: auto; font-size: 48px; }
.tk .one .hp b { font-weight: 400; }
.tk .row { font: 400 30px/1.1 var(--disp); white-space: nowrap; overflow: hidden; }
.row .neg { color: var(--red); }
#ticket.printing .hdr { animation: print .3s steps(14) both; }
#ticket.printing .one { animation: print .5s .3s steps(20) both; }
#ticket.printing .row { animation: print .4s .8s steps(18) both; }
@keyframes print { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.shred { pointer-events: none; transform: none; }

#survived { position: absolute; left: 32px; z-index: 3; font-weight: 800; font-size: 16px; opacity: 0; transition: opacity .4s; pointer-events: none; }
#survived.on { opacity: 1; }

/* ── takeover: stamps, count-up, lines, flash ───────────────── */
#takeover { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.stamp { position: absolute; left: 50%; top: 46%; font-family: var(--disp); line-height: .9; white-space: nowrap; transform: translate(-50%, -50%) rotate(var(--rot, -6deg)); animation: slam .15s ease-out both; }
.stamp.pay { font-size: 18vw; padding: .02em .22em; background: var(--mint); color: var(--ink); border: 4px solid var(--ink); text-shadow: 6px 6px 0 var(--paper); }
.stamp.die { font-size: 20vw; color: var(--ink); text-shadow: 6px 6px 0 var(--paper); }
.stamp.re { font-size: 14vw; top: 30%; color: var(--mint); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.stamp.out { animation: fadeout .4s forwards; }
@keyframes slam { from { transform: translate(-50%, -50%) rotate(var(--rot, -6deg)) scale(1.4); } to { transform: translate(-50%, -50%) rotate(var(--rot, -6deg)) scale(1); } }
@keyframes fadeout { to { opacity: 0; } }
.count { position: absolute; left: 50%; transform: translateX(-50%); font: 400 8vw/1 var(--disp); color: var(--amber); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.lines { position: absolute; left: 50%; top: 68%; transform: translateX(-50%); font: 400 24px/1.5 var(--mono); color: var(--paper); white-space: pre; text-align: center; }
.flash { position: absolute; inset: 0; background: var(--paper); animation: flash .08s forwards; }
.slips { position: absolute; left: 24px; right: 24px; bottom: 120px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; pointer-events: auto; }
.slip { display: inline-block; padding: 6px 10px; background: var(--amber); color: var(--ink); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 800 14px var(--mono); text-decoration: none; animation: slipfall .9s cubic-bezier(.3, .9, .4, 1.1) both; }
.slip.more { background: var(--ink); color: var(--paper); }
@keyframes slipfall { from { transform: translateY(-60vh) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.hlx { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); font: 800 14px var(--mono); color: var(--paper); text-decoration: underline; pointer-events: auto; }
.tk .hdr a, .tk .fuel a, #receipts a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
@keyframes flash { to { opacity: 0; } }
#cracks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; display: none; }
#cracks polyline { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .25s linear; }
#cracks.draw polyline { stroke-dashoffset: 0; }

/* ── danger ladder ─────────────────────────────────────────── */
body.d1 #red .edge { animation: breathe var(--beat) ease-in-out infinite alternate; }
@keyframes breathe { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
body.d2 #hatch { opacity: 1; }
body.d3 #scene { background-color: #F3E0D6; }
body.d3 #red .edge { animation: breathe6 var(--beat) ease-in-out infinite alternate; }
@keyframes breathe6 { from { transform: translateY(-6px); } to { transform: translateY(6px); } }
body.d3.fx #scene > *:not(#takeover) { animation: tremble var(--beat) steps(2) infinite; }
@keyframes tremble { 50% { translate: 0 1px; } }
body.d3.fx .slab { animation: none; }
#scene.shake { animation: shake .6s; }
@keyframes shake { 15% { transform: translate(calc(var(--shake) * -1), calc(var(--shake) * .4)); } 35% { transform: translate(var(--shake), calc(var(--shake) * -.6)); } 55% { transform: translate(calc(var(--shake) * -.6), var(--shake)); } 75% { transform: translate(calc(var(--shake) * .4), calc(var(--shake) * -.3)); } }
body.tint-mint #scene { background-color: #D9F2E6; }

/* ── the strip: the position's chart, inside the ticket ─────── */
.tk .strip { position: relative; margin-top: 12px; height: 118px; border: 3px solid var(--ink); background: var(--ticket); }
.tk .strip canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ── fuel: the margin, inside the ticket ───────────────────── */
.tk .fuel { position: relative; margin-top: 12px; height: 46px; border: 3px solid var(--ink); background: var(--ticket); overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; font: 400 24px/1 var(--disp); white-space: nowrap; }
.tk .fuel i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--fuel, 10%); background: var(--amber) var(--halftone); transition: width .6s ease-out; }
.tk .fuel span { position: relative; }
.tk .fuel .nx { font-size: 18px; opacity: .8; }
.respawnin { position: absolute; left: 50%; top: 86%; transform: translateX(-50%); font: 400 6vw/1 var(--disp); color: var(--paper); white-space: nowrap; }

/* ── below the fold ────────────────────────────────────────── */
#below { padding: 48px 24px 80px; max-width: 1400px; }
.marker { font: 400 28px/1.3 var(--marker); margin-bottom: 28px; }
.marker.small { font-size: 22px; margin-bottom: 10px; }
.totals { font: 400 40px/1 var(--disp); margin-bottom: 18px; }
#receipts { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 36px; }
#receipts li { position: relative; display: flex; align-items: center; gap: 18px; min-height: 64px; padding: 10px 18px 10px 170px; background: var(--ticket) var(--grain); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); font-size: 14px; font-weight: 800; }
#receipts li b { position: absolute; left: 18px; top: 50%; transform: translateY(-50%) rotate(-6deg); font: 400 28px/1 var(--disp); padding: 2px 10px; }
#receipts li.payday b { background: var(--mint); color: var(--ink); }
#receipts li.death b { background: var(--red); color: var(--paper); transform: translateY(-50%) rotate(-4deg); }
#receipts li.open { padding-left: 18px; }
#cablock { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 18px; background: var(--red); color: var(--paper); font-weight: 800; font-size: 16px; margin-bottom: 28px; word-break: break-all; }
#cablock .stk { box-shadow: 3px 3px 0 var(--ink); }
#cablock .mc { font: 400 22px/1 var(--disp); margin-left: auto; }
/* ── our coin ──────────────────────────────────────────────── */
#coin { margin-bottom: 44px; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); border: 4px solid var(--ink); background: var(--ticket) var(--grain); box-shadow: 6px 6px 0 var(--ink); margin-bottom: 14px; }
.stats div { padding: 14px 16px; border-right: 3px solid var(--ink); min-height: 86px; }
.stats div:last-child { border-right: 0; }
.stats small { display: block; font-size: 10px; letter-spacing: .14em; font-weight: 800; color: #5a564e; }
.stats b { display: block; font: 400 clamp(26px, 2.6vw, 40px)/1 var(--disp); margin-top: 8px; min-height: 1em; }
.coinstrip { position: relative; height: 150px; border: 4px solid var(--ink); background: var(--ticket) var(--grain); box-shadow: 6px 6px 0 var(--ink); margin-bottom: 14px; }
.coinstrip canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#coinTape { list-style: none; display: flex; flex-direction: column; gap: 3px; max-height: 330px; overflow: hidden; }
#coinTape li { display: grid; grid-template-columns: 80px 56px 1fr 1fr auto; gap: 12px; align-items: center; padding: 6px 12px; font-size: 13px; font-weight: 800; background: var(--ticket); border-left: 8px solid var(--dust); }
#coinTape li.buy { border-color: var(--mint); } #coinTape li.sell { border-color: var(--red); }
#coinTape li.buy b { color: #0d7a57; } #coinTape li.sell b { color: var(--red); }
#coinTape a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ── how it works ──────────────────────────────────────────── */
#how { margin-bottom: 44px; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.steps li { display: flex; align-items: center; gap: 18px; padding: 12px 18px; background: var(--ticket) var(--grain); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); font: 400 20px/1.25 var(--marker); }
.steps li b { flex: 0 0 56px; font: 400 44px/1 var(--disp); text-align: center; }
.steps li em { font-style: normal; font-family: var(--disp); font-size: 24px; letter-spacing: .01em; margin-right: .3em; }
.steps li b.red { color: var(--red); } .steps li b.mint { color: #0d7a57; } .steps li b.amber { color: #b47300; }
.steps.legend li { font-size: 18px; } .steps.legend li em { font-size: 20px; }

.proof, .honest { font-size: 13px; line-height: 1.7; max-width: 900px; }
.proof { margin-bottom: 18px; }
.honest { color: #5a564e; }

/* ── ?pfp=1: the scene alone, square ──────────────────────── */
body.pfp { overflow: hidden; }
body.pfp #strip, body.pfp #below, body.pfp .lab.r, body.pfp .lab small, body.pfp .tk .row, body.pfp .tk .strip, body.pfp .tk .fuel, body.pfp .tk .hp, body.pfp #survived { display: none !important; }
body.pfp #scene { height: 100vh; min-height: 0; }
body.pfp .tk { padding: 10px 14px 14px; width: calc(100% - 40px); }
body.pfp .tk .hdr { font: 400 26px/1 var(--disp); opacity: 1; letter-spacing: .02em; text-shadow: 2px 2px 0 var(--mint), -1px -1px 0 var(--red); }
body.pfp .tk .one { flex-wrap: wrap; font-size: 92px; gap: 4px 10px; margin: 4px 0 0; }
body.pfp .tk .one .blk { font-size: 40px; box-shadow: 4px 4px 0 var(--ink); }
body.pfp .lab.l b { font-size: 26px !important; }
body.pfp .stamp.die, body.pfp .stamp.pay { font-size: 86px; top: 50%; }

/* ── phone ─────────────────────────────────────────────────── */
@media (max-width: 860px) {
  :root { --strip: 72px; }
  #strip { flex-wrap: wrap; align-content: center; padding: 0 12px; gap: 6px 10px; }
  #strip .l { width: 100%; justify-content: space-between; }
  #strip .r { width: 100%; justify-content: space-between; }
  .wm { font-size: 24px; }
  .won { height: 30px; padding: 0 8px; gap: 6px; } .won b { font-size: 18px; } .won span { display: none; }
  #posline { font-size: 11px; }
  .stk, .catag, .buyst, .xbtn { height: 26px; font-size: 12px; padding: 0 9px; }
  .xbtn span, .mcapchip small { display: none; }
  .mcapchip { height: 26px; padding-top: 3px; } .mcapchip b { font-size: 14px; }
  .live { font-size: 12px; }
  .lab.l { left: 12px; } .lab.r { right: 12px; }
  .lab.l b { font-size: 34px !important; }
  .lab small { font-size: 14px; }
  .lab.l small { display: none; }
  .lab.r b { font-size: 22px; }
  #mint .lab { bottom: 12px; } #red .lab { top: 12px; }
  .tk { width: calc(100% - 24px); padding: 12px 14px; box-shadow: 6px 6px 0 var(--ink); }
  .tk .hdr { font-size: 10px; }
  .tk .one { flex-wrap: wrap; font-size: 22vw; gap: 6px 10px; margin: 6px 0; }
  .tk .one .blk { font-size: 10vw; align-self: center; box-shadow: 4px 4px 0 var(--ink); }
  .tk .one .hp { font-size: 20px; width: 100%; margin: 0; }
  .tk .row { font-size: 15px; white-space: normal; }
  #survived { left: 14px; font-size: 12px; }
  .stamp.pay, .stamp.die { font-size: 96px; }
  .stamp.re { font-size: 72px; }
  .count { font-size: 40px; }
  .lines { font-size: 15px; top: 64%; }
  .tk .strip { height: 84px; margin-top: 8px; }
  .tk .fuel { height: 34px; font-size: 15px; margin-top: 8px; padding: 0 8px; }
  .tk .fuel .nx { display: none; }
  .respawnin { font-size: 36px; }
  #below { padding: 32px 16px 60px; }
  .marker { font-size: 20px; } .totals { font-size: 26px; }
  #receipts li { padding-left: 120px; font-size: 12px; } #receipts li b { font-size: 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div { border-bottom: 3px solid var(--ink); min-height: 70px; padding: 10px 12px; }
  .stats div:nth-child(2n) { border-right: 0; }
  .stats div:nth-last-child(-n+2) { border-bottom: 0; }
  .coinstrip { height: 110px; }
  #coinTape li { grid-template-columns: 64px 44px 1fr auto; font-size: 11px; gap: 8px; } #coinTape li span:nth-child(4) { display: none; }
  .steps li { font-size: 16px; gap: 12px; padding: 10px 12px; } .steps li b { flex-basis: 36px; font-size: 30px; } .steps li em { font-size: 18px; }
}
