:root {
  --bg: #15102a;
  --panel: rgba(38, 26, 56, 0.92);
  --panel-solid: #241a3d;
  --edge: #5a3f86;
  --text: #fff3da;
  --muted: #cdb9ee;
  --gold: #ffc94a;
  --mint: #4ee487;
  --red: #ff5c5c;

  --ink: #4a2c18;
  --ink-soft: #7c4d37;
  --wood: #8a5230;
  --wood-dark: #5b3320;
  --wood-light: #d99a5e;
  --parchment: #ffe9c7;
  --parchment-deep: #f7d9ac;
  --parchment-deeper: #f0c794;

  --accent-orange: #ff8a3d;
  --accent-red: #ff5c5c;
  --accent-green: #4ee487;
  --accent-blue: #4fc3f7;
  --accent-purple: #c87bf0;
  --accent-gold: #ffc94a;

  --font-pixel: "Press Start 2P", ui-monospace, "Segoe UI", monospace;
  --font-body: "VT323", ui-monospace, "Segoe UI", monospace;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% -6%, rgba(255, 201, 74, 0.35), transparent 40%),
    radial-gradient(circle at 86% 4%, rgba(255, 92, 92, 0.22), transparent 38%),
    linear-gradient(165deg, #2c1a52 0%, #441a4c 38%, #1c1438 72%, #120c24 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 19px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button {
  font: inherit;
  /* Kill the 300ms tap delay and double-tap zoom on touch devices. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.view {
  width: min(100%, 1320px);
}

.hidden {
  display: none !important;
}

h1,
h2,
.eyebrow,
.mode-button strong,
.info-grid strong,
.mint-card > strong,
.mint-price,
.next-map-box strong,
.detail-head strong,
.row-info strong,
.mint-hatched b,
.stat strong {
  font-family: var(--font-pixel);
}

.landing-view,
.menu-view,
.dinos-view,
.withdraw-view {
  min-height: min(760px, calc(100vh - 36px));
}

.landing-view {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  align-items: center;
  gap: 28px;
}

.landing-copy {
  position: relative;
  display: grid;
  gap: 18px;
  max-width: 780px;
  border: 4px solid var(--wood-dark);
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(255, 201, 74, 0.16), rgba(78, 228, 135, 0.08)),
    var(--panel-solid);
  padding: 30px 34px;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.08),
    0 10px 0 rgba(0, 0, 0, 0.4),
    0 20px 48px rgba(0, 0, 0, 0.5);
}

.landing-sprite {
  position: absolute;
  bottom: -8px;
  width: 96px;
  height: 96px;
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-position: 0 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.5));
  animation: dino-bob 1.6s ease-in-out infinite;
  pointer-events: none;
}

.landing-sprite-left {
  left: -28px;
  background-image: url("../dinoaaa/male/olaf/base/idle.png");
}

.landing-sprite-right {
  right: -28px;
  transform: scaleX(-1);
  animation-delay: 0.4s;
  background-image: url("../dinoaaa/female/vita/base/idle.png");
}

@keyframes dino-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.landing-sprite-right {
  animation-name: dino-bob-r;
}

@keyframes dino-bob-r {
  0%, 100% { transform: scaleX(-1) translateY(0); }
  50% { transform: scaleX(-1) translateY(-8px); }
}

.eyebrow {
  color: var(--accent-gold);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

h1 {
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.25;
  color: var(--accent-gold);
  text-shadow:
    3px 0 0 var(--accent-orange),
    0 3px 0 var(--accent-orange),
    3px 3px 0 var(--accent-orange),
    5px 5px 0 rgba(0, 0, 0, 0.55);
}

.lead {
  max-width: 680px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(20px, 2.2vw, 27px);
  line-height: 1.3;
  font-weight: 400;
}

.landing-actions,
.header-actions,
.wallet-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.landing-actions span,
.wallet-pill {
  color: var(--mint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 3px solid #bf6a14;
  border-radius: 8px;
  background: linear-gradient(#ffd166, #ff8a1f);
  color: #4a2c18;
  padding: 7px 12px;
  font-family: var(--font-pixel);
  font-size: 12px;
  box-shadow: inset 0 2px 0 rgba(255, 241, 168, 0.6), 0 3px 0 #8b4b16;
}

.farm-note {
  margin: 0 0 10px;
  color: var(--mint);
  font-weight: 800;
  font-size: 14px;
  min-height: 18px;
}

.info-grid {
  display: grid;
  gap: 12px;
}

.info-grid article {
  --glow: var(--accent-gold);
  min-height: 124px;
  border: 3px solid var(--wood-dark);
  border-radius: 10px;
  background: var(--panel);
  padding: 16px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    0 0 0 1px color-mix(in srgb, var(--glow) 35%, transparent),
    0 6px 0 rgba(0, 0, 0, 0.35);
}

.info-grid article.info-fire { --glow: var(--accent-orange); }
.info-grid article.info-green { --glow: var(--accent-green); }
.info-grid article.info-blue { --glow: var(--accent-blue); }

.info-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--glow, var(--accent-gold));
  font-size: 14px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.info-grid p,
.mode-button span {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.3;
}

.screen-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

/* Hints sit on dark backgrounds (dinos header, deposit card), so they use the
   light palette — the brown ink colors are for parchment cards only. */
.screen-hint {
  margin: 6px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.screen-hint b {
  color: var(--accent-gold);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-button {
  --accent: var(--accent-gold);
  position: relative;
  min-height: 180px;
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 8px;
  border: 4px solid var(--wood-dark);
  border-radius: 12px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--panel-solid);
  color: var(--text);
  padding: 18px;
  cursor: pointer;
  text-align: left;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.07),
    0 8px 0 rgba(0, 0, 0, 0.4),
    0 14px 26px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.mode-icon {
  font-size: 30px;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.4));
}

.mode-button strong {
  color: var(--accent);
  font-size: clamp(16px, 2vw, 22px);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

#treasure-btn { --accent: var(--accent-orange); }
#market-btn { --accent: var(--accent-blue); }
#mint-btn { --accent: var(--accent-green); }
#dinos-btn { --accent: var(--accent-purple); }

.primary-mode {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%),
    var(--panel-solid);
}

.mode-button:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.1),
    0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent),
    0 11px 0 rgba(0, 0, 0, 0.4),
    0 18px 30px rgba(0, 0, 0, 0.45);
}

.mode-button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.07),
    0 3px 0 rgba(0, 0, 0, 0.4);
}

.menu-status {
  min-height: 24px;
  margin-top: 12px;
  color: var(--accent-gold);
  font-size: 14px;
  font-weight: 800;
}

.mint-view {
  min-height: min(760px, calc(100vh - 36px));
}

.withdraw-board {
  display: grid;
  grid-template-columns: minmax(300px, 460px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  background: linear-gradient(160deg, #f6c98a, var(--parchment-deep));
  padding: 20px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 238, 207, 0.55),
    0 10px 0 rgba(0, 0, 0, 0.32),
    0 22px 50px rgba(0, 0, 0, 0.5);
}

.withdraw-card {
  display: grid;
  gap: 12px;
  background: var(--panel-solid);
  border: 3px solid var(--wood-dark);
  border-radius: 10px;
  padding: 18px;
}

.withdraw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.withdraw-row strong { color: var(--accent-gold); font-size: 16px; }
.withdraw-row.receive strong { color: var(--accent-green); font-size: 20px; }

.withdraw-input-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.withdraw-input {
  display: flex;
  gap: 8px;
}

.withdraw-input input {
  flex: 1 1 auto;
  min-width: 0;
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  background: #14102a;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
}

.withdraw-input button {
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  background: linear-gradient(#3a2654, #271a3d);
  color: var(--accent-gold);
  padding: 0 14px;
  font-family: var(--font-pixel);
  font-size: 11px;
  cursor: pointer;
}

.withdraw-card .primary-btn {
  border: 3px solid #bf6a14;
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-pixel);
  font-size: 13px;
  cursor: pointer;
}

.withdraw-history {
  display: grid;
  align-content: start;
  gap: 8px;
  background: var(--panel-solid);
  border: 3px solid var(--wood-dark);
  border-radius: 10px;
  padding: 16px;
  max-height: 460px;
  overflow-y: auto;
}

.withdraw-history > strong { color: var(--accent-gold); font-size: 14px; text-transform: uppercase; }

.withdraw-history-list { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }

.wd-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--edge);
  border-left: 4px solid var(--accent-gold);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  font-weight: 800;
}

.wd-history-row em { font-style: normal; text-transform: uppercase; font-size: 11px; }
.wd-history-row.wd-pending { border-left-color: var(--accent-gold); }
.wd-history-row.wd-completed { border-left-color: var(--accent-green); }
.wd-history-row.wd-rejected { border-left-color: var(--accent-red); }

@media (max-width: 760px) {
  .withdraw-board { grid-template-columns: 1fr; }
}

.mint-board {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 18px;
  height: clamp(560px, calc(100vh - 142px), 760px);
  min-height: 0;
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  background: linear-gradient(160deg, #f6c98a, var(--parchment-deep));
  padding: 20px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 238, 207, 0.55),
    0 10px 0 rgba(0, 0, 0, 0.32),
    0 22px 50px rgba(0, 0, 0, 0.5);
}

.mint-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  min-height: 0;
  border: 4px solid var(--wood-dark);
  border-radius: 8px;
  background: linear-gradient(160deg, #e08a55, #c0673c);
  padding: 28px 20px 22px;
  color: #fff8e8;
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 224, 0.4);
}

.mint-card > strong {
  font-size: 18px;
  color: var(--accent-gold);
  text-shadow: 0 2px 0 rgba(64, 47, 38, 0.85);
}

.mint-capsule {
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  border: 5px solid var(--wood-dark);
  border-radius: 50px 50px 20px 20px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(78, 228, 135, 0.35), rgba(22, 92, 68, 0.22)),
    #2d6750;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.2),
    inset 0 -14px 0 rgba(26, 34, 33, 0.4),
    0 0 30px rgba(255, 201, 74, 0.25);
}

.mint-egg {
  width: 24px;
  height: 24px;
  display: block;
  background: url("../dinoaaa/male/cole/egg/move.png") left center / auto 24px no-repeat;
  image-rendering: pixelated;
  transform: scale(6);
  transform-origin: center;
}

.mint-egg.hatching {
  transform: scale(6.2);
}

.mint-egg.hatched {
  transform: scale(5.6);
}

.mint-price {
  color: var(--accent-gold);
  font-size: 18px;
  text-shadow: 0 2px 0 rgba(64, 47, 38, 0.7);
}

.mint-actions {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 12px;
  width: min(100%, 250px);
}

.mint-actions button {
  min-height: 52px;
  border: 3px solid #bf6a14;
  border-radius: 6px;
  background: linear-gradient(#ffd166, #ff8a1f);
  color: #fff8e8;
  font-family: var(--font-pixel);
  font-size: 13px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(89, 55, 35, 0.7);
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 241, 168, 0.6),
    0 4px 0 #8b4b16;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.1s ease;
}

.mint-actions button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.mint-actions button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 0 rgba(255, 241, 168, 0.6),
    0 1px 0 #8b4b16;
}

.mint-actions button:disabled {
  filter: grayscale(0.45);
  box-shadow: none;
  transform: none;
}

.mint-free-btn {
  width: min(100%, 250px);
  min-height: 44px;
  margin-top: 10px;
  border: 3px solid #6f6b70;
  border-radius: 6px;
  /* Grey by default; turns orange (.active) once an admin gifts a free mint. */
  background: linear-gradient(#9a949c, #7d7780);
  color: #fff8e8;
  font-family: var(--font-pixel);
  font-size: 12px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(60, 45, 35, 0.6);
  cursor: not-allowed;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.1s ease;
}

.mint-free-btn.active {
  border-color: #bf6a14;
  background: linear-gradient(#ffd166, #ff8a1f);
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 241, 168, 0.6),
    0 4px 0 #8b4b16;
  animation: freeMintPulse 1.4s ease-in-out infinite;
}

.mint-free-btn.active:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

@keyframes freeMintPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.14); }
}

#mint-menu-btn {
  border: 2px solid var(--wood-dark);
  border-radius: 7px;
  background: linear-gradient(#3a2654, #271a3d);
  color: var(--accent-gold);
  padding: 9px 12px;
  font-weight: 900;
  cursor: pointer;
}

.mint-result {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  border: 4px solid var(--wood-dark);
  border-radius: 8px;
  background: var(--parchment-deep);
  padding: 14px;
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 2px rgba(255, 248, 224, 0.55);
}

.mint-result > strong {
  color: var(--ink);
  font-size: 16px;
}

.mint-result-list::-webkit-scrollbar,
.mint-result-detail::-webkit-scrollbar {
  width: 10px;
}

.mint-result-list::-webkit-scrollbar-track,
.mint-result-detail::-webkit-scrollbar-track {
  background: var(--parchment-deeper);
  border-left: 2px solid rgba(155, 103, 73, 0.45);
}

.mint-result-list::-webkit-scrollbar-thumb,
.mint-result-detail::-webkit-scrollbar-thumb {
  border: 2px solid var(--parchment-deeper);
  border-radius: 8px;
  background: var(--wood);
}

.mint-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: visible;
}

.mint-result-list > span:not(.mint-hatched) {
  color: var(--ink-soft);
  font-weight: 900;
}

.mint-hatched {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 70px;
  border: 3px solid var(--rarity-color);
  border-radius: 6px;
  background: #f3d0b2;
  padding: 8px;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.mint-hatched:hover,
.mint-hatched:focus-visible,
.mint-hatched.active {
  outline: none;
  background: #f9e3c6;
  box-shadow:
    inset 0 0 0 2px rgba(255, 248, 224, 0.68),
    0 0 0 2px color-mix(in srgb, var(--rarity-color) 55%, transparent),
    0 0 14px color-mix(in srgb, var(--rarity-color) 45%, transparent);
}

.mint-hatched b {
  color: var(--ink);
  font-size: 13px;
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mint-hatched-preview {
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: center;
  width: 50px;
  height: 50px;
}

.mint-hatched em {
  color: var(--rarity-color);
  font-style: normal;
  font-size: 12px;
  font-weight: 950;
}

.mint-result-detail {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 3px solid var(--wood);
  border-radius: 6px;
  background: #f3d0b2;
  padding: 12px;
  max-height: 100%;
}

.mint-result-detail > span {
  color: var(--ink-soft);
  font-weight: 950;
}

.mint-detail-head {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 3px solid var(--wood);
  border-radius: 5px;
  background: #f9e3c6;
  padding: 8px;
}

.mint-detail-head div {
  display: grid;
  gap: 2px;
}

.mint-detail-head strong {
  color: var(--ink);
  font-size: 14px;
  text-transform: capitalize;
}

.mint-status {
  min-height: 28px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 950;
  border-top: 2px solid rgba(155, 103, 73, 0.3);
  padding-top: 6px;
}

.rarity-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.rarity-filter-btn {
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  background: linear-gradient(#3a2654, #271a3d);
  color: var(--accent-gold);
  padding: 7px 12px;
  font-family: var(--font-pixel);
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.12s ease, color 0.12s ease;
}

.rarity-filter-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-1px);
}

.rarity-filter-btn.active {
  background: linear-gradient(#ffd166, #ff8a1f);
  color: #4a2c18;
  border-color: #bf6a14;
  box-shadow:
    inset 0 2px 0 rgba(255, 241, 168, 0.6),
    0 3px 0 #8b4b16;
}

.rarity-filter-btn[data-rarity="Common"].active { border-color: #7a5b45; }
.rarity-filter-btn[data-rarity="Uncommon"].active { border-color: #2f8a55; }
.rarity-filter-btn[data-rarity="Rare"].active { border-color: #3578a8; }
.rarity-filter-btn[data-rarity="Epic"].active { border-color: #9a4fb0; }
.rarity-filter-btn[data-rarity="Legendary"].active { border-color: #bf6a14; }

.dino-roster {
  display: grid;
  min-height: 560px;
}

.character-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  background: linear-gradient(160deg, #f6c98a, var(--parchment-deep));
  padding: 18px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 238, 207, 0.55),
    0 10px 0 rgba(0, 0, 0, 0.32),
    0 22px 50px rgba(0, 0, 0, 0.5);
}

.character-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.empty-roster {
  grid-template-columns: 1fr;
}

.empty-dinos {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 3px solid var(--wood);
  border-radius: 6px;
  background: #f3d0b2;
  color: var(--ink-soft);
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 224, 0.48);
}

.empty-dinos strong {
  font-size: 18px;
}

.empty-dinos span {
  color: #9a6a4e;
  font-weight: 900;
}

.character-row {
  --rarity-color: var(--gold);
  display: grid;
  grid-template-columns: 88px minmax(140px, 1fr) minmax(160px, 210px) auto;
  align-items: center;
  gap: 10px;
  min-height: 88px;
  border: 3px solid var(--wood);
  border-radius: 6px;
  background: #f3d0b2;
  padding: 8px 10px;
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 224, 0.48);
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}

.character-row:hover,
.character-row:focus-visible,
.character-row.active {
  border-color: var(--rarity-color);
  outline: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 248, 224, 0.68),
    0 0 0 2px color-mix(in srgb, var(--rarity-color) 50%, transparent),
    0 0 16px color-mix(in srgb, var(--rarity-color) 40%, transparent);
}

.character-row:not(.working) {
  filter: saturate(0.76);
}

.dino-portrait {
  display: block;
  overflow: hidden;
  flex: 0 0 auto;
  background-image: var(--sprite);
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 300% 100%;
  image-rendering: pixelated;
}

.row-preview {
  width: 78px;
  height: 78px;
}

.row-info,
.detail-head div {
  display: grid;
  gap: 2px;
}

.row-top {
  display: flex;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 950;
}

.row-top i {
  font-style: normal;
}

.row-info strong,
.detail-head strong {
  color: var(--ink);
  font-size: 14px;
  text-transform: capitalize;
}

.row-info small {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 950;
}

.rarity-pill {
  color: var(--rarity-color);
  font-size: 12px;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(255, 248, 224, 0.55);
}

.row-state {
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.character-row.working {
  box-shadow: inset 0 0 0 2px var(--accent-green);
}

.character-row.working .row-state {
  color: var(--accent-green);
}

.row-stamina {
  display: grid;
  gap: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}

.row-stamina i {
  display: block;
  width: 100%;
  height: 12px;
  border: 2px solid var(--wood);
  background: #f8e4c7;
  box-shadow: inset 0 0 0 1px rgba(93, 61, 42, 0.2);
}

.row-stamina b {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), #bfe56a);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  min-width: 54px;
  border: 2px solid #a66321;
  border-radius: 4px;
  background: linear-gradient(#ffaa44, #f29322);
  color: #fff8e8;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(89, 55, 35, 0.7);
  cursor: pointer;
}

.row-actions .rest-btn {
  background: linear-gradient(#dc9650, #c9802f);
}

.row-actions button:disabled {
  border-color: #6f6b70;
  background: #837d86;
  cursor: default;
  opacity: 0.78;
}

.character-detail {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 3px solid var(--wood);
  border-radius: 6px;
  background: var(--parchment-deep);
  padding: 12px;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 224, 0.55);
}

.detail-head {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 3px solid var(--wood);
  border-radius: 5px;
  background: #f3d0b2;
  padding: 8px;
}

.detail-preview {
  width: 104px;
  height: 104px;
}

.mint-detail-head .detail-preview {
  width: 90px;
  height: 90px;
  align-self: center;
  justify-self: center;
}

.dino-id,
.detail-level {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 950;
}

.detail-level {
  align-self: start;
}

.detail-stats {
  display: grid;
  gap: 10px;
  border: 3px solid #c28c65;
  border-radius: 6px;
  background: #f9e3c6;
  padding: 14px;
}

.detail-stats span {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 950;
}

.detail-stats em {
  color: #8a5b40;
  font-style: normal;
  text-align: right;
}

.stat-icon {
  position: relative;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(91, 61, 42, 0.42);
  border-radius: 4px;
  background: #f3d0b2;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.22),
    0 1px 0 rgba(92, 55, 34, 0.35);
}

.stat-icon::before,
.stat-icon::after {
  content: "";
  position: absolute;
}

.stat-icon.power {
  background: #5e2430;
}

.stat-icon.power::before {
  left: 6px;
  top: 3px;
  width: 11px;
  height: 16px;
  border-radius: 9px 9px 9px 2px;
  background: linear-gradient(#ffe06b 0 24%, #f28b25 48%, #d8432f 100%);
  transform: rotate(24deg);
}

.stat-icon.power::after {
  left: 9px;
  top: 9px;
  width: 6px;
  height: 8px;
  border-radius: 8px 8px 8px 2px;
  background: #fff0a0;
  transform: rotate(18deg);
}

.stat-icon.speed {
  background: #22447f;
}

.stat-icon.speed::before {
  left: 5px;
  top: 5px;
  width: 15px;
  height: 13px;
  background: linear-gradient(135deg, #8ee9ff, #3d74db 68%, #18316f);
  clip-path: polygon(0 52%, 42% 0, 100% 0, 72% 48%, 100% 48%, 38% 100%, 0 100%, 26% 52%);
}

.stat-icon.speed::after {
  left: 2px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-top: 2px solid #dff8ff;
  border-bottom: 2px solid #dff8ff;
}

.stat-icon.stamina {
  background: #315f39;
}

.stat-icon.stamina::before {
  left: 7px;
  top: 2px;
  width: 11px;
  height: 19px;
  background: linear-gradient(#fff06d, #73d65d 58%, #23a84b);
  clip-path: polygon(43% 0, 100% 0, 68% 42%, 100% 42%, 32% 100%, 48% 57%, 8% 57%);
}

.stat-icon.stamina::after {
  left: 4px;
  top: 17px;
  width: 7px;
  height: 3px;
  background: #c4f27a;
}

.stat-icon.bombs {
  background: #f3d0b2 url("../assets/stats/bomb.svg") center / 24px 24px no-repeat;
}

.stat-icon.range {
  background: #f3d0b2 url("../assets/stats/bow-range.svg") center / 24px 24px no-repeat;
}

.stat-icon.bombs::before,
.stat-icon.bombs::after,
.stat-icon.range::before,
.stat-icon.range::after {
  display: none;
}

.detail-perks {
  display: grid;
  gap: 8px;
}

.detail-perk {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 3px solid var(--wood);
  border-radius: 6px;
  background: linear-gradient(160deg, #e08a55, #c0673c);
  padding: 8px;
}

.detail-perk img {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
}

.detail-perk b {
  color: #fff8e8;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.2;
  text-shadow: 0 2px 0 rgba(64, 47, 38, 0.85);
}

#topbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 12px;
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(255, 201, 74, 0.16), rgba(78, 228, 135, 0.08)),
    var(--panel-solid);
  padding: 14px 18px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.07),
    0 8px 0 rgba(0, 0, 0, 0.4),
    0 14px 26px rgba(0, 0, 0, 0.4);
}

h2,
p {
  margin: 0;
}

#topbar p {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 18px;
  margin-top: 4px;
}

#wallet {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#wallet-address {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--mint);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

#connect-btn,
#disconnect-btn,
#withdraw-menu-btn,
#deposit-menu-btn,
#connect-play-btn,
#back-menu-btn,
#game-menu-btn {
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  background: linear-gradient(#3a2654, #271a3d);
  color: var(--accent-gold);
  padding: 10px 14px;
  font-family: var(--font-pixel);
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.12s ease, color 0.12s ease;
}

.primary-btn {
  background: linear-gradient(#ffd166, #ff8a1f);
  color: #4a2c18;
  border-color: #bf6a14;
  box-shadow:
    inset 0 2px 0 rgba(255, 241, 168, 0.6),
    0 4px 0 #8b4b16;
}

#connect-btn:hover,
#disconnect-btn:hover,
#withdraw-menu-btn:hover,
#deposit-menu-btn:hover,
#connect-play-btn:hover,
#back-menu-btn:hover,
#game-menu-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-1px);
}

.primary-btn:hover {
  color: #4a2c18;
  filter: brightness(1.08);
}

#connect-btn:active,
#disconnect-btn:active,
#withdraw-menu-btn:active,
#deposit-menu-btn:active,
#connect-play-btn:active,
#back-menu-btn:active,
#game-menu-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.game-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 36px);
}

#game-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    linear-gradient(160deg, rgba(255, 201, 74, 0.14), rgba(78, 228, 135, 0.07)),
    var(--panel-solid);
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  padding: 14px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.06),
    0 18px 50px rgba(0, 0, 0, 0.45);
}

.stat {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stat span,
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  font-size: 19px;
  color: var(--accent-gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.active-dino-list {
  display: grid;
  align-content: start;
  gap: 9px;
  margin-top: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.active-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.active-dino {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--rarity-color) 55%, var(--edge));
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rarity-color) 18%, transparent);
}

.active-dino-sprite {
  flex: 0 0 auto;
}

.active-dino-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.active-dino-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.active-dino-head strong {
  min-width: 0;
  color: #fff8e8;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-rest-btn {
  border: 1px solid #b66b22;
  border-radius: 5px;
  background: linear-gradient(#dc9650, #cf7d22);
  color: #fff8e8;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(64, 47, 38, 0.75);
  cursor: pointer;
}

.active-rest-btn:hover {
  border-color: var(--accent-gold);
  color: #fff;
}

.active-energy {
  display: grid;
  gap: 4px;
}

.active-energy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.active-energy i {
  display: block;
  height: 8px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: #14102a;
  overflow: hidden;
}

.active-energy b {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-gold));
  transition: width 0.2s;
}

.progress {
  margin: 14px 0;
  color: var(--muted);
  font-weight: 800;
}

.progress div {
  height: 12px;
  margin-top: 7px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  background: #14102a;
  overflow: hidden;
}

.progress i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--gold));
  transition: width 0.2s;
}

#server-msg {
  min-height: 34px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

#canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  overflow: hidden;
  background: #0c1110;
  min-height: 0;
  box-shadow:
    inset 0 0 0 3px rgba(255, 201, 74, 0.12),
    0 22px 70px rgba(0, 0, 0, 0.6);
}

canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  image-rendering: pixelated;
}

#prompt {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  padding: 7px 12px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 201, 74, 0.4);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

.next-map-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 11, 0.68);
  z-index: 4;
}

.next-map-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: min(320px, calc(100% - 36px));
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  background: linear-gradient(160deg, #f6c98a, var(--parchment-deep));
  color: var(--ink);
  padding: 22px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 248, 224, 0.55),
    0 22px 60px rgba(0, 0, 0, 0.5);
}

.next-map-box strong {
  font-size: 20px;
  color: var(--accent-orange);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.next-map-box span {
  font-size: 18px;
  font-weight: 950;
  font-family: var(--font-body);
}

.next-map-box button {
  min-width: 120px;
  min-height: 44px;
  border: 3px solid #bf6a14;
  border-radius: 6px;
  background: linear-gradient(#ffd166, #ff8a1f);
  color: #fff8e8;
  font-family: var(--font-pixel);
  font-size: 13px;
  text-shadow: 0 2px 0 rgba(89, 55, 35, 0.7);
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 241, 168, 0.6),
    0 4px 0 #8b4b16;
}

.next-map-box button:hover {
  filter: brightness(1.08);
}

.next-map-box button:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(255, 241, 168, 0.6), 0 1px 0 #8b4b16;
}

@media (max-width: 980px) {
  .landing-view {
    grid-template-columns: 1fr;
  }

  .landing-sprite {
    display: none;
  }

  .menu-grid {
    grid-template-columns: 1fr;
  }

  .mint-board {
    grid-template-columns: 1fr;
  }

  .game-view {
    height: auto;
  }

  #game-shell {
    grid-template-columns: 1fr;
  }

  /* Put the map first on narrow screens; stats + crew sit below it. */
  #canvas-wrap {
    order: -1;
    min-height: 46vh;
  }

  .panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    align-content: start;
  }

  .panel .active-dino-list {
    grid-column: 1 / -1;
    max-height: 34vh;
    margin-top: 6px;
  }

  .character-board {
    grid-template-columns: 1fr;
  }

  .character-detail {
    order: -1;
  }
}

@media (max-width: 580px) {
  #app {
    padding: 8px;
  }

  #topbar {
    align-items: start;
    flex-direction: column;
  }

  .screen-header {
    align-items: start;
    flex-direction: column;
  }

  .panel {
    grid-template-columns: 1fr;
  }

  .character-board {
    padding: 10px;
  }

  .character-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .row-preview {
    width: 64px;
    height: 64px;
  }

  .row-stamina,
  .row-actions {
    grid-column: 1 / -1;
  }

  .row-actions button {
    flex: 1;
  }

  #prompt {
    font-size: 11px;
    white-space: normal;
    text-align: center;
  }
}

/* ---- Phones: scale type down, keep tap targets big, avoid iOS focus zoom ---- */
@media (max-width: 640px) {
  html,
  body { font-size: 17px; }

  /* 16px+ inputs stop iOS Safari from auto-zooming when a field is focused. */
  input,
  select,
  textarea { font-size: 16px; }

  /* Comfortable touch targets (Apple/Google both recommend ~44px). */
  .mode-button,
  .primary-btn,
  .header-actions button,
  .wallet-pill button,
  #topbar button,
  .rarity-filter-btn,
  .withdraw-input button { min-height: 44px; }

  #canvas-wrap { min-height: 42vh; }

  .menu-grid { gap: 10px; }

  /* Let the wallet/header controls wrap instead of overflowing the screen. */
  .wallet-pill,
  .header-actions { flex-wrap: wrap; }
}

@media (max-width: 400px) {
  html,
  body { font-size: 15.5px; }

  #app { padding: 6px; }

  #canvas-wrap { min-height: 38vh; }
}

/* ---- Phone held sideways: there's width again, so restore the map + side panel
   and give the shell real height so the canvas isn't squashed. ---- */
@media (max-width: 980px) and (max-height: 560px) and (orientation: landscape) {
  .game-view { height: calc(100dvh - 36px); }

  #game-shell { grid-template-columns: minmax(0, 1fr) 190px; }

  #canvas-wrap {
    order: 0;
    min-height: 0;
  }

  .panel {
    grid-template-columns: 1fr;
  }

  .panel .active-dino-list {
    max-height: none;
  }
}
