/* MAMONO site. Warm cozy pixel RPG branding: coral sunset accents, cream
   parchment panels, red plaque headings, brown ink. Fixed top nav, the game
   fills the landing, shared components for dex/token/guide. Fully responsive. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f2e4c6;          /* parchment page */
  --bg2: #e0564c;         /* coral, for the play surround */
  --coral: #ec6a5e;
  --panel: #f7ebd2;       /* light cream card */
  --panel2: #eddcb2;      /* deeper cream */
  --line: #cd9a57;        /* tan border */
  --ink: #3a2418;         /* dark brown text */
  --dim: #8a6442;         /* muted brown */
  --gold: #d8472f;        /* primary accent = brand red (name kept for cascade) */
  --red: #d8472f;
  --green: #3f8a30;       /* forest green accent */
  --cream: #f7ebd2;
  --brown: #3a2418;
  --pink: #e87dae;
  --blue: #4f86c8;
  --nav-h: 58px;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --mono: "Courier New", ui-monospace, Menlo, Consolas, monospace;
}

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 720px at 50% -12%, #f7a892 0%, rgba(247,168,146,0) 56%),
    repeating-linear-gradient(0deg, rgba(58,36,24,0.025) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, rgba(58,36,24,0.025) 0 1px, transparent 1px 30px),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--mono);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--red); }

/* ---------- top nav (warm wooden bar) ---------- */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px;
  background: rgba(58, 36, 24, 0.97);
  border-bottom: 3px solid #2a1810;
  backdrop-filter: blur(8px);
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brandmark { display: none; }                 /* replaced by the plaque wordmark image */
.brandlogo { height: 38px; width: auto; display: block; image-rendering: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }
.brandtext { display: none; }
.navlinks { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.navlinks a {
  font-family: var(--pixel);
  font-size: 10px;
  color: #e9d4a6;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.5px;
  transition: color 0.15s, border-color 0.15s;
}
.navlinks a:hover { color: #fbf2da; border-bottom-color: var(--coral); }
.navlinks a.active {
  color: #fbf2da;
  border-bottom-color: var(--coral);
  text-shadow: 0 0 12px rgba(236,106,94,0.5);
}
.navca { font-size: 11px; color: #d9b98a; margin-left: 10px; }
.navca b { color: #f6d24a; font-weight: 700; }
.navtoggle { display: none; margin-left: auto; background: none; border: none; color: #fbf2da; font-size: 22px; cursor: pointer; }

/* ---------- play page: the game fills the whole landing ---------- */
.page-play { overflow: hidden; }
.stage {
  position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  background:
    radial-gradient(1000px 560px at 50% 0%, #f3897c 0%, rgba(243,137,124,0) 64%),
    var(--bg2);
}

.gameframe {
  position: relative;
  height: 100%; width: 100%;
  display: flex; align-items: center; justify-content: center;
}

/* .screen is the sized game box (JS sets its width/height); both canvases fill it,
   the 3D scene behind and the 2D HUD/UI canvas in front. Cozy cream + wood frame. */
.screen {
  position: relative;
  box-shadow: 0 0 0 4px #f7ebd2, 0 0 0 8px #3a2418, 0 18px 50px rgba(70,28,18,0.45);
  border-radius: 4px;
  overflow: hidden;
  background: #2a1810;
}
#game3d, #game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; outline: none;
}
#game3d { z-index: 1; }
#game {
  z-index: 2;
  background: transparent;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.startpanel, .keybar, .controls { z-index: 5; }

/* ---------- start overlay: brand lockup + entry card over the key art ---------- */
.startpanel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: clamp(14px, 3.5vh, 30px);
  padding: 18px;
  text-align: center;
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 42%, rgba(40,20,12,0.14) 0%, rgba(40,20,12,0.10) 45%, rgba(40,20,12,0.42) 100%);
}
.startpanel.hidden { display: none; }

.lockup { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: auto; }
.startcard { margin-bottom: auto; }
.lockup-logo {
  width: clamp(240px, 56vw, 520px); height: auto;
  filter: drop-shadow(0 8px 18px rgba(40,20,12,0.5));
  animation: bob 2.8s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.lockup-tag {
  font-family: var(--pixel);
  font-size: clamp(8px, 1.6vw, 12px);
  color: #fff2d6;
  text-shadow: 1px 0 0 #5a1d12, -1px 0 0 #5a1d12, 0 1px 0 #5a1d12, 0 -1px 0 #5a1d12,
    1px 1px 0 #5a1d12, -1px 1px 0 #5a1d12, 0 3px 0 rgba(40,16,10,0.6);
  letter-spacing: 0.5px;
  line-height: 1.8;
}

.startcard {
  display: flex; flex-direction: column; align-items: center; gap: 11px;
  width: min(420px, calc(100vw - 32px));
  padding: 20px 22px 16px;
  background: rgba(247, 235, 210, 0.97);
  border: 3px solid #3a2418;
  border-radius: 16px;
  box-shadow: 0 0 0 4px rgba(205,154,87,0.6), 0 22px 50px rgba(70,28,18,0.45);
  backdrop-filter: blur(4px);
}
.startcard input {
  width: 100%;
  background: #fffaf0; border: 2px solid var(--line); color: var(--ink);
  padding: 12px 14px; font-family: var(--mono); font-size: 15px; text-align: center; border-radius: 10px; outline: none;
  transition: border-color 0.15s;
}
.startcard input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(216,71,47,0.18); }

/* chunky game style buttons used across the whole site */
button {
  font-family: var(--mono); cursor: pointer;
  border: 2px solid var(--line); border-bottom-width: 5px;
  background: linear-gradient(180deg, #fbf2da, #ecd9ac);
  color: var(--ink); border-radius: 10px;
  padding: 11px 16px; font-size: 14px; font-weight: 700; letter-spacing: 0.04em;
  transition: border-color 0.15s, filter 0.15s;
}
button:hover { border-color: var(--red); filter: brightness(1.03); }
button:active { transform: translateY(2px); border-bottom-width: 3px; margin-bottom: 2px; }
button:disabled { opacity: 0.5; cursor: default; }
.pad:active, .ab-btn:active, .startbtn:active { transform: none; border-bottom-width: 2px; margin-bottom: 0; }
.big.gold {
  width: 100%;
  font-family: var(--pixel); font-size: 11px; line-height: 1.6; padding: 13px 12px;
  background: linear-gradient(180deg, #f3897c, var(--red) 55%, #b8351f);
  color: #fff2e4; border-color: #9a2d1a; border-bottom-color: #7a2012;
  text-shadow: 0 2px 0 rgba(90,20,12,0.5);
}
.big.gold:hover { filter: brightness(1.06); border-color: #c33d24; }
.entryrow { display: flex; gap: 10px; width: 100%; }
.entryrow button { flex: 1; font-size: 13px; }
.gate { color: #5c3d24; font-size: 12px; min-height: 16px; max-width: 360px; line-height: 1.5; }
.status { color: #b23420; font-size: 13px; min-height: 16px; font-weight: 700; }

@media (max-height: 560px) {
  .startpanel { gap: 8px; padding: 10px; }
  .lockup-tag { display: none; }
  .lockup-logo { width: clamp(200px, 42vw, 360px); }
  .startcard { padding: 12px 16px 10px; gap: 8px; }
  .startcard input, .big.gold { padding-top: 9px; padding-bottom: 9px; }
}

/* ---------- touch controls (handhelds): a strip below the game window ---------- */
.controls {
  display: none;
  justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 10px calc(16px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  background: linear-gradient(to bottom, transparent, rgba(58,36,24,0.9));
  flex: 0 0 auto;
}
@media (hover: none) and (pointer: coarse) {
  .stage { flex-direction: column; align-items: stretch; }
  .gameframe { flex: 1 1 auto; min-height: 0; }
  body.playing .controls { display: flex; }
  body.playing #chatbox {
    bottom: calc(176px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - var(--nav-h) - 188px - env(safe-area-inset-bottom));
  }
  body.playing #chatlog { min-height: 0; }
}
@media (hover: none) and (pointer: coarse) and (max-height: 560px) {
  .stage { flex-direction: row; }
  body.playing .controls {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    background: none; pointer-events: none; z-index: 20;
    align-items: flex-end;
  }
  .controls > * { pointer-events: auto; }
  .pad, .startbtn { background: rgba(58,36,24,0.6); }
  .ab-btn { background: rgba(200,72,52,0.7); }
}
.dpad {
  display: grid;
  grid-template-columns: 46px 46px 46px; grid-template-rows: 46px 46px 46px;
  grid-template-areas: ". up ." "left . right" ". down ."; gap: 2px;
}
.pad, .ab-btn, .startbtn { touch-action: none; }
.pad { background: rgba(58,36,24,0.9); border: 2px solid #6a4630; color: #e9d4a6; font-size: 16px; border-radius: 8px; }
.pad.active, .ab-btn.active, .startbtn.active { background: var(--coral); color: #3a2418; }
.pad.up { grid-area: up; } .pad.down { grid-area: down; }
.pad.left { grid-area: left; } .pad.right { grid-area: right; }
.abwrap { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.ab { display: flex; gap: 14px; transform: rotate(-12deg); }
.ab-btn { width: 56px; height: 56px; border-radius: 50%; background: rgba(216,71,47,0.92); border: 2px solid #f3897c; color: #fff2e4; font-size: 18px; font-weight: 900; }
.startbtn { background: rgba(58,36,24,0.9); border: 2px solid #6a4630; color: #e9d4a6; font-size: 10px; padding: 6px 16px; border-radius: 12px; }

/* ---------- desktop keyboard legend ---------- */
.keybar {
  display: none;
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  gap: 14px; align-items: center;
  padding: 6px 14px; border-radius: 10px;
  background: rgba(58, 36, 24, 0.92); border: 1px solid #6a4630;
  font-size: 11px; color: #f7ebd2; white-space: nowrap;
  pointer-events: none; backdrop-filter: blur(4px);
  transition: opacity 0.25s;
}
body.ui-open .keybar { opacity: 0; }
.keybar span { display: inline-flex; align-items: center; gap: 5px; }
.keybar b {
  display: inline-block; min-width: 16px; text-align: center;
  color: #3a2418; background: #f7ebd2; border: 1px solid #cd9a57;
  border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; font-weight: 700; font-size: 10px;
}
@media (pointer: fine) {
  body.playing .keybar { display: flex; }
}
@media (max-width: 760px) { .keybar .kb-chat { display: none; } }

/* ---------- chat ---------- */
#chatbox {
  display: none;
  position: fixed; right: 14px; bottom: 14px;
  width: 300px; max-width: calc(100vw - 28px); max-height: 56vh;
  flex-direction: column;
  background: rgba(247,235,210,0.97); border: 3px solid #3a2418; border-radius: 10px; overflow: hidden; z-index: 30;
  box-shadow: 0 0 0 3px rgba(205,154,87,0.55), 0 14px 30px rgba(70,28,18,0.4);
}
.chathead { font-family: var(--pixel); font-size: 8px; color: var(--red); padding: 8px 10px; border-bottom: 2px solid var(--line); letter-spacing: 1px; }
#chatlog { flex: 1; min-height: 120px; overflow-y: auto; padding: 8px 10px; font-size: 12px; color: var(--ink); }
.chatline { margin-bottom: 3px; word-break: break-word; }
.chatline b { color: var(--green); font-weight: 700; }
.chatline.sys, .chatline.sys b { color: var(--dim); }
#chatinput { border: none; border-top: 2px solid var(--line); background: #fffaf0; color: var(--ink); padding: 10px 12px; font-family: var(--mono); font-size: 13px; outline: none; }

/* ---------- content pages (dex / token / guide) ---------- */
.page-content { min-height: 100%; }
.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 32px) 20px 80px;
}
.page-head { text-align: center; margin-bottom: 14px; }
.page-head h1 {
  font-family: var(--pixel); font-size: clamp(20px, 4vw, 30px); color: var(--red);
  letter-spacing: 1px; text-shadow: 3px 3px 0 rgba(122,32,18,0.3); line-height: 1.5;
}
.page-head p { color: var(--dim); margin-top: 12px; max-width: 70ch; margin-left: auto; margin-right: auto; }

.content h2 {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--pixel); font-size: 14px; color: var(--green);
  margin: 44px 0 16px; letter-spacing: 0.5px; line-height: 1.6;
}
.content h2::before {
  content: ""; flex: 0 0 auto;
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(180deg, var(--red) 0 46%, #3a2418 46% 54%, #cd9a57 54%);
  border: 2px solid #3a2418;
}
.content h2::after {
  content: ""; flex: 1 1 auto; height: 2px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.content h3 { color: var(--red); font-size: 15px; margin-bottom: 8px; }
.content p { color: var(--ink); max-width: 75ch; margin-bottom: 12px; }
.content ul { color: var(--ink); margin: 0 0 12px 20px; }
.content li { margin-bottom: 6px; }
.content strong { color: var(--red); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 8px 0 16px; }
.card {
  background: linear-gradient(180deg, #fbf2da, #efe0bc);
  border: 2px solid var(--line); border-radius: 14px; padding: 18px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--red); transform: translateY(-3px); box-shadow: 0 10px 26px rgba(70,28,18,0.18); }
.card p { color: var(--dim); font-size: 13px; }

.tablewrap {
  overflow-x: auto; margin: 8px 0 18px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(236,106,94,0.10); }
th { color: var(--green); font-family: var(--pixel); font-size: 9px; letter-spacing: 0.5px; background: rgba(205,154,87,0.22); }
td:first-child { color: var(--red); }

/* dex grid */
.dexbar { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.dexbar input {
  background: #fffaf0; border: 2px solid var(--line); color: var(--ink);
  padding: 10px 14px; border-radius: 8px; font-family: var(--mono); font-size: 14px; outline: none;
  width: min(420px, calc(100vw - 40px));
}
.dexbar input:focus { border-color: var(--red); }
.dexcount { color: var(--dim); font-size: 13px; }

#dexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.dexcell {
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px;
  padding: 10px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: border-color 0.15s, transform 0.15s; cursor: default;
}
.dexcell:hover { border-color: var(--red); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(70,28,18,0.2); }
.dexcell canvas { width: 72px; height: 72px; image-rendering: pixelated; image-rendering: crisp-edges; }
.dexcell canvas.thumb3d { image-rendering: auto; width: 80px; height: 80px; }
.dexcell .num { font-size: 10px; color: var(--dim); }
.dexcell .nm { font-size: 12px; color: var(--ink); text-align: center; }
.dexcell .ty { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.chip { font-size: 9px; padding: 2px 6px; border-radius: 10px; color: #11131f; font-weight: 700; }

footer { margin-top: 56px; border-top: 2px solid var(--line); padding-top: 20px; color: var(--dim); font-size: 12px; text-align: center; }
footer .ca { color: var(--red); margin-bottom: 8px; word-break: break-all; }
.btnrow { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.btnrow a {
  font-family: var(--pixel); font-size: 10px; padding: 13px 20px;
  border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 10px;
  color: var(--ink); background: linear-gradient(180deg, #fbf2da, #ecd9ac);
  transition: border-color 0.15s, filter 0.15s;
}
.btnrow a.primary {
  background: linear-gradient(180deg, #f3897c, var(--red) 55%, #b8351f);
  color: #fff2e4; border-color: #9a2d1a; border-bottom-color: #7a2012;
  text-shadow: 0 2px 0 rgba(90,20,12,0.5);
}
.btnrow a:hover { border-color: var(--red); filter: brightness(1.04); }
.btnrow a.primary:hover { border-color: #c33d24; }
.btnrow a:active { transform: translateY(2px); border-bottom-width: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .navtoggle { display: block; }
  .navlinks {
    display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0; margin: 0;
    background: rgba(58,36,24,0.98); border-bottom: 3px solid #2a1810;
  }
  .navlinks.open { display: flex; }
  .navlinks a { padding: 14px 18px; border-bottom: 1px solid #6a4630; }
  .navlinks a.active { border-bottom-color: #6a4630; }
  .navca { padding: 12px 18px; margin: 0; }
  .stage { padding: 6px; }
}
@media (max-width: 480px) {
  .ab-btn { width: 50px; height: 50px; }
  .dpad { grid-template-columns: 42px 42px 42px; grid-template-rows: 42px 42px 42px; }
}

/* ---------- contract address callout ---------- */
.navca:hover { color: #fbf2da; }
.cabox {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: center;
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px;
  padding: 16px 18px; margin: 4px auto 10px; max-width: 780px;
}
.cabox .lab { font-family: var(--pixel); font-size: 9px; color: var(--green); letter-spacing: 1px; }
.cabox code { font-family: var(--mono); font-size: 14px; color: var(--ink); background: #fffaf0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; word-break: break-all; }
.cabox .acts { display: flex; gap: 8px; }
.cabox .copyca, .cabox .buyca {
  font-family: var(--pixel); font-size: 9px; padding: 11px 14px; border-radius: 8px;
  border: 2px solid var(--line); border-bottom-width: 4px; cursor: pointer; color: var(--ink);
  background: linear-gradient(180deg, #fbf2da, #ecd9ac); transition: filter 0.15s, border-color 0.15s;
}
.cabox .buyca { background: linear-gradient(180deg, #f3897c, var(--red) 55%, #b8351f); color: #fff2e4; border-color: #9a2d1a; border-bottom-color: #7a2012; }
.cabox .copyca:hover, .cabox .buyca:hover { filter: brightness(1.05); }
.cabox .copyca:active, .cabox .buyca:active { transform: translateY(2px); border-bottom-width: 2px; }

/* ---------- X (twitter) nav icon ---------- */
.navx { display: inline-flex; align-items: center; justify-content: center; color: #e9d4a6; padding: 6px; border-radius: 8px; transition: color 0.15s, background 0.15s; }
.navx:hover { color: #fbf2da; background: rgba(255,255,255,0.08); }
.navx svg { display: block; }
@media (max-width: 760px) { .navx { padding: 14px 18px; justify-content: flex-start; gap: 10px; } .navx::after { content: "Follow on X"; font-family: var(--pixel); font-size: 10px; } }
