:root {
  --w: #f3f3f3;
  --dim: rgba(243, 243, 243, .5);
  --line: rgba(243, 243, 243, .16);
  --f: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --m: "DM Mono", ui-monospace, Consolas, monospace;
  --pad: 28px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--w); font-family: var(--f); overflow: hidden; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
#cv { position: fixed; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.cap { text-transform: uppercase; letter-spacing: .32em; font-size: 10px; line-height: 1.6; }
.dim { color: var(--dim); }
.mono { font-family: var(--m); font-size: 11px; letter-spacing: .02em; }
.num { font-size: 26px; letter-spacing: .04em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.num.xl { font-size: 44px; letter-spacing: .02em; }
b { font-weight: 400; color: var(--w); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease; }
body.playing #hud { opacity: 1; }
#hud > * { position: absolute; }
#hud button { pointer-events: auto; }
.tl { left: var(--pad); top: var(--pad); }
.mark { height: 15px; width: auto; display: block; image-rendering: pixelated; margin-bottom: 8px; }

.tc { left: 50%; top: var(--pad); transform: translateX(-50%); width: min(440px, 40vw); }
.line { display: flex; justify-content: space-between; gap: 16px; }
.bar { position: relative; height: 1px; background: var(--line); margin: 10px 0 9px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--w); }
.bar em { position: absolute; top: -3px; width: 1px; height: 7px; background: var(--w); left: 0; }
#toast { margin-top: 18px; text-align: center; opacity: 0; transform: translateY(-4px); transition: opacity .35s, transform .35s; }
#toast.on { opacity: 1; transform: none; }

.tr { right: var(--pad); top: var(--pad); text-align: right; }
#addr { margin-top: 6px; }

.crew { right: var(--pad); top: 150px; width: 220px; }
.crew .hd { display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
#crew { list-style: none; margin: 0; padding: 0; }
#crew li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; font-size: 12px; padding: 7px 0; border-bottom: 1px solid rgba(243, 243, 243, .07); color: var(--dim); font-variant-numeric: tabular-nums; }
#crew li.me { color: var(--w); }
#crew li i { width: 6px; height: 6px; display: block; }

.stats { left: var(--pad); bottom: calc(var(--pad) + 4px); }
.kv { display: grid; grid-template-columns: auto auto; column-gap: 22px; row-gap: 5px; margin-top: 16px; align-items: baseline; font-size: 12px; font-variant-numeric: tabular-nums; }

.feed { left: 50%; bottom: calc(var(--pad) + 2px); transform: translateX(-50%); width: min(560px, 44vw); }
.feed div { display: grid; grid-template-columns: 92px 1fr 84px 54px; gap: 12px; padding: 3px 0; color: var(--dim); white-space: nowrap; overflow: hidden; transition: opacity .4s; }
.feed div .k { overflow: hidden; text-overflow: ellipsis; }
.feed div .s { text-align: right; }
.feed div.me { color: var(--w); }
.feed div.hit { color: #ffd25a; }

.btns { right: var(--pad); bottom: var(--pad); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.btns button, #start, #payGo, .x, .skin button { text-transform: uppercase; letter-spacing: .32em; font-size: 10px; padding: 9px 0 9px 14px; color: var(--dim); transition: color .2s; }
.btns button:hover, .x:hover { color: var(--w); }

/* in-world tags */
#tags, #floats { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
body:not(.playing) #tags { opacity: 0; }
.tag { position: absolute; transform: translate(-50%, -100%); font-size: 9px; letter-spacing: .28em; text-transform: uppercase; color: rgba(243, 243, 243, .72); white-space: nowrap; transition: opacity .3s; }
.tag.vault { font-size: 10px; color: var(--w); }
.ctag { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--m); font-size: 10px; color: rgba(243, 243, 243, .8); white-space: nowrap; transition: opacity .25s; text-shadow: 0 0 6px #000; }
.ctag b { font-size: 9px; letter-spacing: .12em; color: var(--w); }
.fl { position: absolute; transform: translate(-50%, -100%); font-size: 10px; letter-spacing: .26em; text-transform: uppercase; white-space: nowrap; animation: rise 1.1s cubic-bezier(.2, .7, .2, 1) forwards; text-shadow: 0 1px 0 #000, 0 0 8px #000; }
@keyframes rise { 0% { opacity: 0; margin-top: 6px; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; margin-top: -22px; } }

/* ---------- title ---------- */
#title { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0, 0, 0, .86), rgba(0, 0, 0, .62) 100%); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); transition: opacity .9s ease; z-index: 5; }
body.playing #title { opacity: 0; pointer-events: none; }
.tin { text-align: center; width: min(720px, 92vw); }
.logo { width: min(380px, 62vw); height: auto; display: block; margin: 0 auto; image-rendering: pixelated; }
.lead { font-size: 13px; letter-spacing: .26em; text-transform: uppercase; margin: 34px 0 0; white-space: nowrap; }
.body { font-size: 14px; line-height: 1.75; color: var(--dim); margin: 22px auto 0; max-width: 470px; }
#start { margin-top: 40px; padding: 15px 34px 15px 40px; border: 1px solid rgba(243, 243, 243, .5); color: var(--w); transition: background .25s, color .25s; }
#start:hover { background: var(--w); color: #000; }
.ctl { margin-top: 26px; letter-spacing: .26em; }
.ret { margin-top: 8px; min-height: 16px; }

/* ---------- modals ---------- */
#modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .72); z-index: 8; animation: fin .3s ease; }
@keyframes fin { from { opacity: 0; } }
#modal[hidden], .panel[hidden] { display: none; }
.panel { background: #000; border: 1px solid var(--line); padding: 34px 36px 30px; width: min(620px, 92vw); max-height: 90vh; overflow: auto; }
.panel.wide { width: min(880px, 94vw); }
.ph { display: flex; justify-content: space-between; align-items: center; }
.h { text-transform: uppercase; letter-spacing: .42em; font-size: 16px; }
.h.big { font-size: 30px; letter-spacing: .38em; }
.sub { color: var(--dim); font-size: 13px; line-height: 1.65; margin: 14px 0 24px; }
.sub.mono { font-size: 11px; }
.x { padding-right: 0; }

.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.skin { background: #000; padding: 18px 16px 14px; text-align: center; position: relative; }
.skin canvas { width: 84px; height: 112px; image-rendering: pixelated; display: block; margin: 0 auto 12px; }
.skin .n { text-transform: uppercase; letter-spacing: .34em; font-size: 11px; }
.skin .r { font-size: 11px; color: var(--dim); margin-top: 6px; font-variant-numeric: tabular-nums; }
.skin .pr { height: 1px; background: var(--line); margin: 10px 8px 0; position: relative; }
.skin .pr i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--w); }
.skin.lock canvas { filter: grayscale(1) brightness(.32); }
.skin.lock .n { color: var(--dim); }
.skin.on { outline: 1px solid var(--w); outline-offset: -1px; }
.skin button { padding: 8px 0 0; }
.skin:not(.lock) { cursor: pointer; }

.ks { display: grid; grid-template-columns: auto 1fr; gap: 34px; }
#heat { width: 352px; height: 352px; image-rendering: pixelated; display: block; border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; width: 352px; letter-spacing: .2em; }
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); }
.legend i { width: 7px; height: 7px; display: inline-block; }
.lh { display: grid; grid-template-columns: 78px 1fr 74px; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
#pages > div { display: grid; grid-template-columns: 78px 1fr 74px; gap: 12px; padding: 5px 0; border-bottom: 1px solid rgba(243, 243, 243, .06); color: var(--dim); }
#pages > div .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pages > div .s { text-align: right; }
#pages > div.cur { color: var(--w); }
#pages > div.next { color: rgba(243, 243, 243, .28); }

.pay > div { display: grid; grid-template-columns: 1fr 100px 70px 96px; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(243, 243, 243, .08); font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.pay > div:first-child { border-bottom-color: var(--line); }
.pay > div > :not(:first-child) { text-align: right; }
.pay > div.me { color: var(--w); }
.pay > div.win span:first-child::after { content: "  key"; font-size: 9px; letter-spacing: .3em; text-transform: uppercase; color: #ffd25a; }
.seal { margin: 22px 0 0; letter-spacing: .22em; }
.pf { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }
#payGo { border: 1px solid rgba(243, 243, 243, .5); color: var(--w); padding: 11px 22px 11px 26px; }
#payGo:hover { background: var(--w); color: #000; }

.tgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 18px; }
.tgrid > div { background: #000; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.tgrid .num { font-size: 20px; }
.trow { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid rgba(243, 243, 243, .08); letter-spacing: .2em; }
.trow .mono { letter-spacing: .02em; text-transform: none; }
.lh2 { margin: 22px 0 8px; }
#ledger > div { display: grid; grid-template-columns: 90px 1fr 110px; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(243, 243, 243, .06); color: var(--dim); }
#ledger > div > :last-child { text-align: right; color: var(--w); }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 4; }
#fade.on { opacity: 1; }

/* touch controls */
#touch { position: fixed; left: 0; right: 0; bottom: 18px; display: none; justify-content: space-between; padding: 0 18px; z-index: 3; pointer-events: none; }
#touch .pad { display: flex; gap: 10px; pointer-events: auto; }
#touch button { width: 62px; height: 62px; border: 1px solid rgba(243, 243, 243, .35); background: rgba(0, 0, 0, .35); display: grid; place-items: center; touch-action: none; }
#touch button.on { background: rgba(243, 243, 243, .9); }
#touch button.on .ar { border-color: #000; }
.ar { width: 12px; height: 12px; border-left: 1.5px solid var(--w); border-bottom: 1.5px solid var(--w); display: block; }
.ar.l { transform: translateX(3px) rotate(45deg); }
.ar.r { transform: translateX(-3px) rotate(-135deg); }
.ar.d { transform: translateY(-3px) rotate(-45deg); }
.ar.u { transform: translateY(3px) rotate(135deg); }

@media (max-height: 620px), (max-width: 1100px) { .crew { display: none; } .feed { width: min(460px, 50vw); } }
@media (pointer: coarse), (max-width: 760px) {
  :root { --pad: 16px; }
  body.playing #touch { display: flex; }
  .crew, .feed { display: none; }
  .stats { bottom: 100px; }
  .num.xl { font-size: 30px; }
  .kv { display: none; }
  .tc { top: 56px; width: calc(100vw - 32px); }
  .btns { bottom: 100px; }
  .ks { grid-template-columns: 1fr; }
  #heat, .legend { width: 100%; height: auto; }
  .skins { grid-template-columns: repeat(2, 1fr); }
  .pay > div { grid-template-columns: 1fr 70px 56px 76px; font-size: 12px; }
}
