/* MEGACADE — one stylesheet for landing + play. Bright-chunky, rounded,
   sunny. NOT dark-neon-crypto. */
:root {
  --ink: #2b2440;
  --paper: #ffffff;
  --sky: #7ec8ff;
  --accent: #ff5d73;
  --accent2: #3db8ff;
  --gold: #ffc94a;
  --green: #39d98a;
  --shadow: 0 6px 0 rgba(43, 36, 64, .18);
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #7ec8ff 0%, #eaf7ff 78%);
  overflow-x: hidden;
}
body.play { overflow: hidden; position: fixed; inset: 0; width: 100%; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------------------------------------------------------------- loader -- */
#loader {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #7ec8ff, #eaf7ff);
  transition: opacity .4s;
}
#loader.hide { opacity: 0; pointer-events: none; }
.loaderLogo {
  font-weight: 700; font-size: 42px; letter-spacing: 2px; color: #fff;
  -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 rgba(43,36,64,.25);
  margin-bottom: 18px; text-align: center;
}
.loaderTrack { width: 240px; height: 16px; background: rgba(255,255,255,.5); border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; }
#loadbar { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }

/* ------------------------------------------------------------------- HUD -- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hudLogo {
  font-weight: 700; font-size: 20px; color: #fff; text-decoration: none;
  -webkit-text-stroke: 1.5px var(--ink); text-shadow: 0 3px 0 rgba(43,36,64,.25);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px;
  padding: 4px 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  white-space: nowrap;
}
.vaultChip { background: #fff6dd; }
.hudRight { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.btn {
  font-family: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 14px; padding: 10px 18px;
  box-shadow: var(--shadow); transition: transform .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(43,36,64,.18); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.small { font-size: 14px; padding: 7px 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.x { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink); }
.hide { display: none !important; }

/* ---------------------------------------------------------------- sheets -- */
.sheet, .panel {
  position: fixed; z-index: 40; background: var(--paper);
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sheet { right: 12px; top: 64px; width: 270px; max-height: 70vh; overflow: auto; }
.sheetHead { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 2px dashed #e3ddcf; }
.sheetHead b { font-size: 17px; }
.sheetHead .x { margin-left: auto; }
.lvl { font-size: 13px; background: var(--gold); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px; }

.buildList { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.buildItem {
  font-family: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  background: #fdf9ee; border: 2.5px solid var(--ink); border-radius: 12px; padding: 9px 12px;
}
.buildItem b { font-size: 15px; }
.buildItem span { font-weight: 700; color: var(--accent); }
.buildItem i { grid-column: 1 / -1; font-style: normal; font-size: 12px; opacity: .7; }
.buildItem:hover { background: #fff3d6; }

.panel { left: 50%; transform: translateX(-50%); bottom: 18px; width: min(340px, 92vw); }
.panelBtns { display: flex; gap: 10px; padding: 14px; }
.panelBtns .btn { flex: 1; }

.placingBar, .visitBar {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 35;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px;
  padding: 8px 16px; font-size: 15px; box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: center; white-space: nowrap;
}
.visitBar a { color: var(--accent); font-weight: 700; }

/* ------------------------------------------------------------- game layer -- */
.gameLayer { position: fixed; inset: 0; z-index: 45; background: #0b0d18; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gameTop {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  color: #fff; font-weight: 700; letter-spacing: 1px; pointer-events: none;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.gameTop .btn { pointer-events: auto; }

.endCard {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 22px;
  box-shadow: 0 10px 0 rgba(0,0,0,.35); padding: 26px 34px; text-align: center; min-width: 280px;
}
.endCard h2 { font-size: 18px; letter-spacing: 2px; margin-bottom: 8px; }
.endScore { font-size: 44px; font-weight: 700; color: var(--accent); }
.endTickets { font-size: 17px; font-weight: 700; color: var(--green); margin: 6px 0; }
.endBest { font-size: 13px; opacity: .7; margin-bottom: 12px; }

/* ------------------------------------------------------------------ toast -- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  z-index: 55; background: var(--ink); color: #fff; font-weight: 600;
  border-radius: 999px; padding: 10px 20px; opacity: 0; transition: all .25s;
  pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================================================================== */
/* Landing                                                              */
/* ==================================================================== */
.landing main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.landing section { margin: 64px 0; }

.hero { position: relative; min-height: 78vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 90px 20px 40px; }
#heroScene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero > * { position: relative; z-index: 1; }
.heroTitle {
  font-size: clamp(44px, 9vw, 92px); font-weight: 700; color: #fff; letter-spacing: 3px;
  -webkit-text-stroke: 3px var(--ink); text-shadow: 0 6px 0 rgba(43,36,64,.25);
}
.heroTag { font-size: clamp(17px, 2.6vw, 24px); font-weight: 600; margin: 10px 0 22px; text-shadow: 0 1px 0 #fff; }
.heroBtns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.btn.big { font-size: 20px; padding: 14px 30px; border-radius: 18px; }
.caChip {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px;
  padding: 8px 16px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer;
  max-width: 92vw; overflow: hidden;
}
.caChip code { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
}
.topnav .hudLogo { font-size: 24px; }
.topnav .spacer { flex: 1; }
.topnav a.btn { text-decoration: none; }

.h2 {
  font-size: clamp(26px, 4.4vw, 40px); font-weight: 700; text-align: center; margin-bottom: 26px;
  color: #fff; -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 rgba(43,36,64,.2);
}
.card {
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.step .num {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 20px;
  border: 3px solid var(--ink); border-radius: 50%; margin-bottom: 12px;
}
.step h3 { margin-bottom: 6px; }
.step p { font-size: 15px; line-height: 1.5; }

.lbTable { width: 100%; border-collapse: collapse; }
.lbTable th, .lbTable td { padding: 9px 12px; text-align: left; font-size: 15px; }
.lbTable th { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; }
.lbTable tr + tr td { border-top: 2px dashed #efe8d8; }
.lbTable .rank { font-weight: 700; color: var(--accent); width: 40px; }
.lbTable .val { font-weight: 700; }
.lbTable .demoTag { font-size: 11px; background: #eee; border-radius: 999px; padding: 2px 8px; margin-left: 6px; }
.lbTable a { color: var(--accent2); font-weight: 600; text-decoration: none; }
.vaultBig { text-align: center; font-size: clamp(34px, 6vw, 56px); font-weight: 700; color: var(--gold); -webkit-text-stroke: 2px var(--ink); }

.tokRow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.tok h3 { color: var(--accent); margin-bottom: 6px; }
.tok p { font-size: 15px; line-height: 1.5; }

footer { text-align: center; padding: 40px 16px 60px; font-size: 14px; }
footer a { color: var(--ink); font-weight: 700; }

/* ---------------------------------------------------- landing: artsy bits -- */
.ticker {
  overflow: hidden; white-space: nowrap;
  background: var(--ink); color: var(--gold);
  border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: rotate(-1.2deg) scale(1.02); margin: -8px 0 8px;
}
.tickerTrack { display: inline-block; animation: tickerMove 26s linear infinite; }
.tickerTrack span {
  display: inline-block; padding: 9px 0;
  font-family: 'Press Start 2P', monospace; font-size: 11px; letter-spacing: 2px;
}
@keyframes tickerMove { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.gamesSec { position: relative; }
.gameCards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 26px; }
.gameCard {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 4px solid var(--ink); border-radius: 20px;
  box-shadow: 0 10px 0 rgba(43,36,64,.2); overflow: hidden;
  transition: transform .15s;
}
.gameCard img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; border-bottom: 3px solid var(--ink); }
.gameCardLabel { padding: 12px 14px; }
.gameCardLabel b { display: block; font-size: 17px; letter-spacing: 1px; }
.gameCardLabel span { font-size: 13px; opacity: .75; }
.tiltL { transform: rotate(-2.4deg); }
.tiltR { transform: rotate(2.2deg); }
.gameCard:hover { transform: rotate(0) translateY(-6px) scale(1.02); }
.secNote { text-align: center; margin-top: 22px; font-size: 16px; }

/* ticket-stub steps: dashed perforation + punched notches */
.ticket {
  position: relative;
  background: var(--paper); border: 3px dashed var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.ticket::before, .ticket::after {
  content: ''; position: absolute; top: 50%; width: 22px; height: 22px;
  background: var(--sky); border: 3px solid var(--ink); border-radius: 50%;
  transform: translateY(-50%);
}
.ticket::before { left: -14px; }
.ticket::after { right: -14px; }

.showcase { position: relative; margin: 72px 0; border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); overflow: hidden; }
.showcaseBg { width: 100%; display: block; min-height: 300px; object-fit: cover; }
.showcaseInner {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(180deg, rgba(43,36,64,.1), rgba(43,36,64,.45));
}
.showcaseInner .h2 { margin-bottom: 0; }

.vaultCard { background: #fff6dd; border-width: 4px; }
.footHandles a { font-size: 16px; }

@media (max-width: 640px) {
  .chips .chip { font-size: 12px; padding: 3px 9px; }
  .sheet { left: 12px; width: auto; }
  .hudLogo { font-size: 17px; }
  .hudRight .btn.small { font-size: 12px; padding: 6px 10px; }
  .tiltL, .tiltR { transform: none; }
  .ticket::before, .ticket::after { display: none; }
  .panel { bottom: 10px; }
  .showcaseBg { min-height: 240px; }
}
