/* ============================================
   KODAMA - Pixel Pokemon RPG
   Game Boy / Retro Pixel Style
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ---- LOADING SCREEN ---- */
.loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  width: 700px;
  max-width: 90vw;
}

.loading-logo {
  font-family: 'Press Start 2P', monospace;
  font-size: 48px;
  color: #b03030;
  text-shadow: 4px 4px 0 #600000, -2px -2px 0 #ff6060;
  margin-bottom: 12px;
  animation: logo-pulse 1.5s steps(2) infinite;
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.loading-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #d4a017;
  letter-spacing: 4px;
  margin-bottom: 40px;
}

.loading-scene {
  position: relative;
  height: 0;
  margin-bottom: 0;
}

.loading-parade {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  margin-bottom: 8px;
}

.loading-parade-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    #406030 0px, #406030 8px,
    #305020 8px, #305020 16px
  );
  animation: ground-scroll 1.5s linear infinite;
}

.parade-mon {
  position: absolute;
  bottom: 10px;
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  filter: drop-shadow(0 2px 0 #1a1a1a);
}

.loading-bar-wrap {
  width: 400px;
  max-width: 80%;
  height: 16px;
  background: #2b2b2b;
  border: 3px solid #f0e8d0;
  margin: 0 auto 16px auto;
  position: relative;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: #b03030;
  transition: width 0.3s steps(10);
}


@keyframes shake-l {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-3px); }
}

@keyframes shake-r {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

@keyframes gym-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes parade-walk {
  0% { left: -80px; }
  100% { left: 1520px; }
}

@keyframes parade-hop {
  0%, 100% { margin-bottom: 0; }
  50% { margin-bottom: var(--bounce, -14px); }
}


.loading-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #a09070;
  animation: text-blink 1s steps(2) infinite;
}

@keyframes text-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.press-start-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: #f0e060;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 24px;
  animation: start-blink 1s steps(2) infinite;
  letter-spacing: 3px;
}

.press-start-btn:hover {
  color: #fff;
  text-shadow: 0 0 8px #f0e060;
}

@keyframes start-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- HUD BAR (Stardew Valley style) ---- */
.hud-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: rgba(20, 16, 12, 0.85);
  border-bottom: 3px solid #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 30;
  font-family: 'Press Start 2P', monospace;
}

.hud-left, .hud-center, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-season {
  font-size: 9px;
  padding: 2px 8px;
  border: 2px solid;
}

.hud-day {
  font-size: 9px;
  color: #f0e8d0;
}

.hud-weather {
  font-size: 9px;
  color: #a0c0d0;
}

.hud-time {
  font-size: 11px;
  color: #f0e060;
  letter-spacing: 1px;
}

.hud-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  border: 2px solid #2b2b2b;
  background: #f0e8d0;
  color: #2b2b2b;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 2px 2px 0 #2b2b2b;
  text-decoration: none;
  transition: none;
}
.hud-social:hover {
  background: #fff5d8;
  transform: translate(1px, 1px);
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 1px 1px 0 #2b2b2b;
}
.hud-social:active {
  transform: translate(2px, 2px);
  box-shadow: inset 1px 1px 0 #c8b888, inset -1px -1px 0 #fff;
}

.hud-ca {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 7px;
  margin-right: 8px;
  border: 2px solid #2b2b2b;
  background: #fff5d8;
  color: #2b2b2b;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 2px 2px 0 #2b2b2b;
  white-space: nowrap;
  transition: none;
}
.hud-ca-label {
  background: #2b2b2b;
  color: #fff5d8;
  padding: 2px 4px;
  font-size: 7px;
  letter-spacing: 0.5px;
}
.hud-ca-addr { letter-spacing: 0.5px; }
.hud-ca:hover {
  background: #fff;
  transform: translate(1px, 1px);
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 1px 1px 0 #2b2b2b;
}
.hud-ca:active {
  transform: translate(2px, 2px);
  box-shadow: inset 1px 1px 0 #c8b888, inset -1px -1px 0 #fff;
}
.hud-ca.copied {
  background: #b8e0a0;
}
.hud-ca.copied .hud-ca-label {
  background: #2a5a1a;
}

.docs-ca {
  margin-top: 16px;
  padding: 12px 14px;
  border: 2px solid #2b2b2b;
  background: #fff5d8;
  cursor: pointer;
  text-align: center;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 3px 3px 0 #2b2b2b;
  transition: none;
}
.docs-ca:hover { background: #fffbe8; }
.docs-ca:active {
  transform: translate(2px, 2px);
  box-shadow: inset 1px 1px 0 #c8b888, inset -1px -1px 0 #fff;
}
.docs-ca-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #b03030;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.docs-ca-addr {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #2b2b2b;
  word-break: break-all;
  line-height: 1.6;
  letter-spacing: 0.5px;
}
.docs-ca-hint {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: #706050;
  margin-top: 6px;
  letter-spacing: 1px;
}
.docs-ca.flash {
  background: #b8e0a0;
}
.docs-ca.flash .docs-ca-label { color: #2a5a1a; }
.docs-ca.flash .docs-ca-hint::after { content: ' ✓ COPIED'; color: #2a5a1a; }

/* ── HOLDER BADGE (HUD) ─────────────────────────────────── */
.hud-holder {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 7px;
  margin-right: 8px;
  border: 2px solid #2b2b2b;
  background: #fff5d8;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 2px 2px 0 #2b2b2b;
  white-space: nowrap;
}
.hud-holder .hud-holder-tier {
  padding: 2px 4px;
  font-size: 7px;
  letter-spacing: 0.5px;
  color: #fff5d8;
  background: #2b2b2b;
}
.hud-holder .hud-holder-bal {
  letter-spacing: 0.5px;
  color: #2b2b2b;
}
.hud-holder.tier-bronze .hud-holder-tier { background: #a05a30; }
.hud-holder.tier-silver { background: #e0e0e8; }
.hud-holder.tier-silver .hud-holder-tier { background: #707080; }
.hud-holder.tier-gold {
  background: #ffe88a;
  border-color: #806010;
  box-shadow: inset 1px 1px 0 #fff8d0, inset -1px -1px 0 #c89818, 2px 2px 0 #806010;
}
.hud-holder.tier-gold .hud-holder-tier { background: #806010; color: #fff8d0; }
.hud-holder.tier-whale {
  background: linear-gradient(90deg, #ffd0e8, #d0e8ff, #e8ffd0, #ffe8d0);
  background-size: 300% 100%;
  animation: whale-shimmer 4s steps(8) infinite;
  border-color: #2030a0;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #6080c0, 2px 2px 0 #2030a0;
}
.hud-holder.tier-whale .hud-holder-tier { background: #2030a0; color: #fff; }
@keyframes whale-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* HOLDER body class effects */
body.holder-bronze .agent-card,
body.holder-silver .agent-card,
body.holder-gold .agent-card,
body.holder-whale .agent-card {
  position: relative;
}
body.holder-bronze .agent-card { border-color: #a05a30 !important; box-shadow: 0 0 0 2px #a05a30 inset, 3px 3px 0 #2b2b2b !important; }
body.holder-silver .agent-card { border-color: #707080 !important; box-shadow: 0 0 0 2px #c0c0d0 inset, 3px 3px 0 #2b2b2b !important; }
body.holder-gold .agent-card { border-color: #806010 !important; box-shadow: 0 0 0 2px #d4a017 inset, 3px 3px 0 #2b2b2b !important; }
body.holder-whale .agent-card { border-color: #2030a0 !important; box-shadow: 0 0 0 2px #4060c0 inset, 3px 3px 0 #2b2b2b !important; }

/* World chat gold tint for holders */
body.holder-gold .chat-line.you,
body.holder-whale .chat-line.you {
  color: #806010 !important;
  text-shadow: 1px 1px 0 #fff8d0;
}
body.holder-whale .chat-line.you {
  color: #2030a0 !important;
}

/* Offset everything below the HUD */
.app {
  padding-top: 35px;
}

/* ---- RESET ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0 !important;
}

/* ---- BASE ---- */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a1a;
  color: #2b2b2b;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  line-height: 1.6;
  image-rendering: pixelated;
}

/* ---- PIXEL WINDOW BORDER ---- */
.pixel-border {
  border: 3px solid #2b2b2b;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #a0a0a0;
}

/* ---- APP LAYOUT ---- */
.app {
  display: flex;
  width: 100%;
  height: 100%;
}

/* ---- LEFT MENU ---- */
.menu {
  width: 180px;
  background: rgba(0, 0, 0, 0.7);
  border-right: 3px solid #2b2b2b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 8px;
  gap: 4px;
}

.menu-logo {
  font-size: 20px;
  color: #b03030;
  text-align: center;
  padding: 12px 0;
  border-bottom: 3px solid #2b2b2b;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 #d8a0a0;
}

.menu-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background: #e8dcc0;
  color: #2b2b2b;
  border: 2px solid #2b2b2b;
  padding: 8px 6px;
  cursor: pointer;
  text-align: left;
  transition: none;
}

.menu-btn:hover {
  background: #f0e8d0;
}

.menu-btn.active {
  background: #f8f0d8;
  border-color: #b03030;
  color: #b03030;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.deploy-btn {
  background: #b03030 !important;
  color: #f0e8d0 !important;
  border: 3px solid #2b2b2b !important;
  text-align: center !important;
  font-size: 11px !important;
  padding: 14px 10px !important;
  letter-spacing: 1px;
  margin-top: auto;
  position: relative;
  box-shadow:
    inset 2px 2px 0 #d06060,
    inset -2px -2px 0 #802020 !important;
  animation: none;
  line-height: 1.4;
}

.deploy-btn:hover {
  background: #c04040 !important;
  box-shadow:
    inset 2px 2px 0 #e07070,
    inset -2px -2px 0 #902020 !important;
}

.deploy-btn:active {
  box-shadow:
    inset 2px 2px 0 #802020,
    inset -2px -2px 0 #d06060 !important;
}

.deploy-btn.deployed {
  background: #406040 !important;
  color: #c0d8b0 !important;
  border-color: #2b2b2b !important;
  box-shadow:
    inset 2px 2px 0 #608060,
    inset -2px -2px 0 #2a3a2a !important;
  animation: none;
  font-size: 10px !important;
  cursor: default !important;
  pointer-events: none;
}

/* ---- CENTER CONTENT ---- */
.content {
  flex: 1;
  background: rgba(0, 0, 0, 0.55);
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  position: relative;
}

.content-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 0;
}

.content-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
}

/* All main sections above background */
.menu, .content, .chat {
  position: relative;
  z-index: 1;
}

/* ---- SCROLLBAR ---- */
.content::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.activity-log::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.activity-log::-webkit-scrollbar-track {
  background: #d8d0b8;
}

.content::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.activity-log::-webkit-scrollbar-thumb {
  background: #a09070;
  border: 1px solid #2b2b2b;
}

/* ---- PANELS ---- */
.panel {
  display: none;
  padding: 12px;
}

.panel.active {
  display: block;
}

.panel-title {
  font-size: 11px;
  color: #2b2b2b;
  padding: 8px 10px;
  background: #d8c898;
  border: 2px solid #2b2b2b;
  margin-bottom: 10px;
  box-shadow:
    inset 2px 2px 0 #f0e8d0,
    inset -2px -2px 0 #b0a070;
}

.pixel-icon {
  color: #b03030;
}

/* ---- TOWN GRID ---- */
.town-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  align-content: start;
}

.town-card {
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
  transition: none;
  overflow: hidden;
}

.town-card-bg {
  width: 100%;
  height: 140px;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  border-bottom: 2px solid #2b2b2b;
  position: relative;
}

.town-card-bg::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(transparent, rgba(43,43,43,0.3));
}

.town-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.town-card:hover {
  border-color: #b03030;
}

.town-card.current {
  border-color: #b03030;
  background: #f8e8d0;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #d0a060,
    0 0 0 2px #b03030;
}

.town-card.cleared {
  position: relative;
}

.town-card.cleared::after {
  content: '★';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 12px;
  color: #d4a017;
}

.town-name {
  font-size: 12px;
  color: #2b2b2b;
}

.town-info {
  font-size: 8px;
  color: #2b2b2b;
  line-height: 1.8;
}

.town-gym {
  font-size: 7px;
  padding: 4px 6px;
  background: #e8d8b8;
  border: 1px solid #a09070;
}

.town-gym-type {
  color: #b03030;
}

.town-badge {
  font-size: 7px;
  color: #d4a017;
}

.town-route {
  font-size: 7px;
  color: #508050;
}

/* ---- TRAINER CARD ---- */
.trainer-card {
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 12px;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.trainer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #c8b888;
}

.trainer-card-name {
  font-size: 11px;
  color: #b03030;
}

.trainer-card-location {
  font-size: 8px;
  color: #508050;
}

.trainer-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.trainer-stat {
  font-size: 7px;
  padding: 4px;
  background: #e8dcc0;
  border: 1px solid #c8b888;
}

.trainer-stat-label {
  color: #2b2b2b;
}

.trainer-stat-value {
  color: #2b2b2b;
  float: right;
}

.trainer-card-team {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.trainer-mon-mini {
  width: 52px;
  height: 52px;
  background: #e8dcc0;
  border: 2px solid #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.trainer-mon-mini img {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
}

.trainer-mon-lv {
  position: absolute;
  bottom: -1px;
  right: -1px;
  font-size: 5px;
  background: #2b2b2b;
  color: #f8f0d8;
  padding: 0 2px;
}

/* ---- ACTIVITY LOG ---- */
.activity-log {
  background: rgba(248,240,216,0.95);
  border: 3px solid #2b2b2b;
  padding: 10px;
  height: 180px;
  overflow-y: auto;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
  position: relative;
  z-index: 1;
}

.log-line {
  font-size: 8px;
  color: #2b2b2b;
  line-height: 1.8;
  border-bottom: 1px solid #d8d0b8;
  padding: 4px 6px;
  background: rgba(248,240,216,0.4);
}

/* ---- POKEDEX GRID ---- */
.dex-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.dex-filter-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 8px 12px;
  border: 3px solid #2b2b2b;
  background: #e8dcc0;
  cursor: pointer;
  color: #2b2b2b;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888;
}

.dex-filter-btn:hover {
  border-color: #b03030;
}

.dex-filter-btn.active {
  background: #b03030;
  color: #fff;
  box-shadow: inset 2px 2px 0 #d06060, inset -2px -2px 0 #802020;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.dex-card {
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888;
}

.dex-card:hover {
  border-color: #b03030;
}

.dex-card.dex-locked {
  cursor: default;
  opacity: 0.7;
}

.dex-card.dex-locked:hover {
  border-color: #2b2b2b;
}

.dex-silhouette {
  filter: brightness(0);
  opacity: 0.5;
}

.dex-card img {
  width: 112px;
  height: 112px;
  image-rendering: pixelated;
}

.dex-card-name {
  font-size: 10px;
  color: #2b2b2b;
  text-align: center;
}

.dex-card-type {
  font-size: 9px;
  padding: 3px 8px;
  border: 2px solid;
}

.dex-card-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border: 2px solid #2b2b2b;
  background: #f8f0d8;
  cursor: pointer;
}

.dex-card-check.checked {
  background: #b03030;
}

.dex-card-check.checked::after {
  content: '✓';
  color: #fff;
  font-size: 10px;
  position: absolute;
  top: -1px;
  left: 2px;
}

/* ---- TEAM PANEL ---- */
.party-title {
  font-size: 8px;
  color: #2b2b2b;
  margin-bottom: 6px;
}

.party-slots, .storage-slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.party-slot {
  width: 80px;
  background: #f8f0d8;
  border: 2px solid #2b2b2b;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.party-slot.empty {
  border-style: dashed;
  border-color: #a09070;
  box-shadow: none;
}

.party-slot img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.party-slot-name {
  font-size: 6px;
  color: #2b2b2b;
}

.party-slot-lv {
  font-size: 6px;
  color: #2b2b2b;
}

.party-slot-hp {
  width: 100%;
  height: 6px;
  background: #c8b888;
  border: 1px solid #2b2b2b;
}

.party-slot-hp-fill {
  height: 100%;
  background: #50a050;
}

/* ---- BADGE GRID ---- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.badge-card {
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.badge-card.locked {
  opacity: 0.35;
}

.badge-card.locked .trophy-icon {
  filter: grayscale(1) brightness(0.6);
}

.trophy-icon {
  width: 64px;
  height: 72px;
  image-rendering: pixelated;
}

.badge-name {
  font-size: 9px;
  color: #2b2b2b;
  text-align: center;
}

.badge-leader {
  font-size: 6px;
  color: #2b2b2b;
}

/* ---- MY INFO PANELS ---- */
.myinfo-party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.mon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 3px solid #2b2b2b;
  padding: 14px;
  background: rgba(248,240,216,0.7);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888;
  position: relative;
}

.mon-card.rare { border-color: #d4a017; }
.mon-card.legend { border-color: #b03030; }

.mon-card img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.mon-card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed #a09070;
  min-height: 220px;
  font-size: 9px;
  color: #a09070;
}

.strategy-box {
  background: rgba(248,240,216,0.7);
  border: 3px solid #2b2b2b;
  padding: 16px;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888;
}

/* ---- SETTINGS ---- */
.settings-box {
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 12px;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e8dcc0;
  font-size: 8px;
  cursor: pointer;
}

.setting-row select {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  background: #e8dcc0;
  border: 2px solid #2b2b2b;
  padding: 3px;
  color: #2b2b2b;
}

/* ---- RIGHT CHAT ---- */
.chat {
  width: 380px;
  background: rgba(0, 0, 0, 0.65);
  border-left: 3px solid #2b2b2b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-header {
  font-size: 9px;
  padding: 8px 10px;
  background: #c8b888;
  border-bottom: 3px solid #2b2b2b;
  color: #2b2b2b;
  text-align: center;
  box-shadow:
    inset 2px 2px 0 #e8dcc0,
    inset -2px -2px 0 #a09070;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-msg {
  padding: 6px;
  background: #f8f0d8;
  border: 2px solid #d8d0b8;
  cursor: pointer;
}

.chat-msg:hover {
  border-color: #b03030;
}

.chat-msg-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.chat-avatar-box {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 2px solid #2b2b2b;
  background: #e8dcc0;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888;
}

.chat-avatar-box canvas {
  display: block;
}

.chat-avatar-system {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 2px solid #b03030;
  background: #f0d0d0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #b03030;
}

.chat-msg-body {
  flex: 1;
  min-width: 0;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.chat-trainer-name {
  font-size: 9px;
  font-weight: bold;
  color: #2b2b2b;
}

.chat-badge-count {
  font-size: 7px;
  color: #d4a017;
}

.chat-text {
  font-size: 8px;
  color: #2b2b2b;
  line-height: 1.6;
  word-break: break-word;
}

.chat-system {
  color: #b03030;
}

/* Chat message type colors */
.chat-msg.type-catch .chat-trainer-name { color: #508050; }
.chat-msg.type-gym .chat-trainer-name { color: #b03030; }
.chat-msg.type-level .chat-trainer-name { color: #5060a0; }
.chat-msg.type-move .chat-trainer-name { color: #2b2b2b; }
.chat-msg.type-evolve .chat-trainer-name { color: #a05090; }

/* ---- MODALS ---- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(43, 43, 43, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: #f0e8d0;
  border: 4px solid #2b2b2b;
  padding: 16px;
  max-width: 500px;
  width: 90%;
  box-shadow:
    inset 3px 3px 0 #fff,
    inset -3px -3px 0 #c8b888,
    6px 6px 0 rgba(0,0,0,0.3);
}

.modal-title {
  font-size: 12px;
  color: #b03030;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 3px solid #c8b888;
  margin-bottom: 12px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- STARTER SELECTION ---- */
.starter-name-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.starter-name-row label {
  font-size: 8px;
  color: #2b2b2b;
}

.pixel-input {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 8px;
  color: #2b2b2b;
  outline: none;
  box-shadow:
    inset 2px 2px 0 #c8b888;
}

.pixel-input:focus {
  border-color: #b03030;
}

/* ---- AVATAR GRID ---- */
.avatar-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.avatar-card {
  width: 56px;
  height: 56px;
  border: 2px solid #2b2b2b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f0d8;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888;
}

.avatar-card:hover {
  border-color: #b03030;
}

.avatar-card.selected {
  border-color: #b03030;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #d0a060, 0 0 0 2px #b03030;
}

.pixel-avatar {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  position: relative;
}

/* Pixel avatar built with box-shadow pixel art */
.pixel-avatar-render {
  width: 2px;
  height: 2px;
  position: relative;
  margin: 4px auto;
}

.starter-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.starter-card {
  width: 120px;
  background: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.starter-card:hover {
  border-color: #b03030;
}

.starter-card.selected {
  border-color: #b03030;
  background: #f8e8d0;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #d0a060,
    0 0 0 2px #b03030;
}

.starter-card img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.starter-card-name {
  font-size: 8px;
  color: #2b2b2b;
}

.starter-card-type {
  font-size: 6px;
  padding: 2px 6px;
  border: 1px solid;
}

/* ---- PIXEL BUTTONS ---- */
/* ── DOCS PANEL ───────────────────────────────────────── */
.docs-card {
  background: rgba(248, 240, 216, 0.7);
  border: 3px solid #2b2b2b;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888;
}
.docs-h {
  font-size: 12px;
  color: #b03030;
  margin-bottom: 14px;
  letter-spacing: 1px;
  border-bottom: 2px solid #c8b888;
  padding-bottom: 8px;
}
.docs-pill {
  display: inline-block;
  font-size: 7px;
  color: #2b2b2b;
  background: #f8f0d8;
  border: 2px solid #2b2b2b;
  padding: 4px 8px;
  letter-spacing: 1px;
}
.docs-steps { display: flex; flex-direction: column; gap: 14px; }
.docs-step { display: flex; gap: 14px; align-items: flex-start; }
.docs-step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: #b03030;
  color: #f8f0d8;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #2b2b2b;
  box-shadow: 2px 2px 0 #2b2b2b;
}
.docs-step-title {
  font-size: 10px;
  color: #b03030;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.docs-step-body {
  font-size: 8px;
  color: #2b2b2b;
  line-height: 1.9;
}
.docs-table { display: flex; flex-direction: column; }
.docs-row {
  display: flex;
  padding: 8px 10px;
  font-size: 8px;
  border-bottom: 1px solid #c8b888;
  align-items: center;
}
.docs-row.alt { background: rgba(232, 220, 192, 0.4); }
.docs-row:last-child { border-bottom: none; }
.docs-key {
  flex-shrink: 0;
  width: 130px;
  color: #b03030;
  letter-spacing: 1px;
}
.docs-val { color: #2b2b2b; line-height: 1.7; }
.docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.docs-cell {
  background: #f8f0d8;
  border: 2px solid #2b2b2b;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 2px 2px 0 #c8b888;
}
.docs-cell-n {
  font-size: 18px;
  color: #b03030;
  margin-bottom: 4px;
}
.docs-cell-l {
  font-size: 8px;
  color: #2b2b2b;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.docs-cell-d {
  font-size: 6px;
  color: #706050;
  line-height: 1.6;
}
.docs-faq .docs-q {
  font-size: 9px;
  color: #b03030;
  margin-top: 12px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.docs-faq .docs-q:first-child { margin-top: 0; }
.docs-faq .docs-a {
  font-size: 8px;
  color: #2b2b2b;
  line-height: 1.9;
  padding-left: 14px;
  border-left: 2px solid #c8b888;
}
@media (max-width: 768px) {
  .docs-grid { grid-template-columns: repeat(2, 1fr); }
  .docs-key { width: 90px; }
}

/* ── RANK / PODIUM PAGE ───────────────────────────────────── */
.rank-hero {
  position: relative;
  padding: 28px 18px 32px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(212,160,23,0.25) 0%, transparent 55%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0px, rgba(0,0,0,0.05) 1px, transparent 1px, transparent 3px),
    linear-gradient(180deg, #1a1410 0%, #2b1f12 70%, #3a2a18 100%);
  border: 3px solid #2b2b2b;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: inset 2px 2px 0 #4a3a28, inset -2px -2px 0 #0a0805;
}

/* Stadium-light beams from the top */
.rank-hero::before {
  content: '';
  position: absolute;
  top: -20%; left: 8%;
  width: 28%; height: 140%;
  background: linear-gradient(180deg, rgba(255,240,180,0.10), transparent 70%);
  transform: skewX(8deg);
  pointer-events: none;
}
.rank-hero::after {
  content: '';
  position: absolute;
  top: -20%; right: 8%;
  width: 28%; height: 140%;
  background: linear-gradient(180deg, rgba(255,240,180,0.10), transparent 70%);
  transform: skewX(-8deg);
  pointer-events: none;
}

.rank-hero-title {
  position: relative;
  text-align: center;
  font-size: 16px;
  color: #f0c540;
  letter-spacing: 4px;
  margin-bottom: 6px;
  text-shadow: 0 0 12px rgba(240,197,64,0.7), 0 0 4px rgba(240,197,64,0.9), 2px 2px 0 #000;
}
.rank-hero-sub {
  position: relative;
  text-align: center;
  font-size: 7px;
  color: #d8c898;
  letter-spacing: 2px;
  margin-bottom: 32px;
}

.podium-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 22px;
  position: relative;
  z-index: 1;
  min-height: 340px;
  padding: 0 12px;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  width: 160px;
  position: relative;
}

/* Pokemon sprite zone -- floats ABOVE the banner */
.podium-spotlight {
  position: relative;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.podium-spotlight::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--halo, rgba(240,197,64,0.55)) 0%, transparent 65%);
  filter: blur(3px);
  z-index: 0;
  animation: podium-pulse 2.4s steps(8) infinite;
}
.podium-spotlight::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 10px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.55) 0%, transparent 70%);
  z-index: 1;
}
.podium-mon {
  position: relative;
  width: 110px;
  height: 110px;
  image-rendering: pixelated;
  z-index: 2;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.55));
  animation: podium-bob 2s steps(6) infinite;
}

/* Tier-specific bobbing offsets so they don't sync */
.podium-slot.silver .podium-mon { animation-delay: 0.4s; }
.podium-slot.bronze .podium-mon { animation-delay: 0.8s; }

@keyframes podium-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Trainer banner: pinned to TOP edge of the pillar */
.podium-banner {
  position: relative;
  width: 150px;
  background: var(--banner-bg, #fff5d8);
  border: 3px solid #2b2b2b;
  border-bottom-width: 0;
  padding: 8px 10px 10px;
  text-align: center;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 var(--banner-shadow, #c8b888), 0 0 0 2px var(--medal-color, #d4a017);
  z-index: 2;
}
.podium-banner .pn {
  font-size: 10px;
  color: #2b2b2b;
  letter-spacing: 1px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 #fff;
}
.podium-banner .pcp {
  font-size: 18px;
  color: var(--medal-color, #d4a017);
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #2b2b2b;
}
.podium-banner .pcp small {
  font-size: 6px;
  color: #706050;
  letter-spacing: 2px;
  display: block;
  margin-top: 4px;
  text-shadow: none;
}
.podium-banner .pmeta {
  font-size: 6px;
  color: #706050;
  margin-top: 6px;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Podium pillar -- 3D block w/ rank number */
.podium-pillar {
  width: 150px;
  background:
    linear-gradient(180deg, var(--pillar-light, #f0c540) 0%, var(--pillar-mid, #d4a017) 35%, var(--pillar-dark, #8a6010) 100%);
  border: 3px solid #2b2b2b;
  border-top-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 3px 0 0 rgba(255,255,255,0.35),
    inset -3px 0 0 rgba(0,0,0,0.45),
    inset 0 -4px 0 rgba(0,0,0,0.35),
    6px 6px 0 rgba(0,0,0,0.5);
  font-family: 'Press Start 2P', monospace;
  font-size: 38px;
  color: #fff;
  text-shadow: 3px 3px 0 #000, 0 0 12px var(--pillar-mid, #d4a017);
  letter-spacing: 2px;
}
.podium-pillar::after {
  /* subtle grout pattern */
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(0,0,0,0.12) 24px 25px),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(0,0,0,0.10) 24px 25px);
  pointer-events: none;
}

/* Slot tints + heights */
.podium-slot.gold {
  --halo: rgba(240,197,64,0.65);
  --pillar-light: #ffd75a;
  --pillar-mid: #d4a017;
  --pillar-dark: #6f4a08;
  --medal-color: #d4a017;
  --banner-bg: #fff5d8;
  --banner-shadow: #c8b070;
}
.podium-slot.silver {
  --halo: rgba(220,220,220,0.6);
  --pillar-light: #f0f0f0;
  --pillar-mid: #b8b8b8;
  --pillar-dark: #4a4a4a;
  --medal-color: #909090;
  --banner-bg: #f5f5f5;
  --banner-shadow: #b0b0b0;
}
.podium-slot.bronze {
  --halo: rgba(200,120,60,0.55);
  --pillar-light: #e89060;
  --pillar-mid: #a06030;
  --pillar-dark: #5a2810;
  --medal-color: #a06030;
  --banner-bg: #f5d8b8;
  --banner-shadow: #b08858;
}
.podium-slot.gold   .podium-pillar { height: 150px; }
.podium-slot.silver .podium-pillar { height: 105px; }
.podium-slot.bronze .podium-pillar { height: 70px; }

/* Medal floating on the upper-right of the sprite zone — uses twemoji 🥇🥈🥉 */
.podium-medal {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 40px;
  height: 40px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: medal-bob 2.8s steps(8) infinite;
}
.podium-medal-img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.5)) drop-shadow(0 0 6px var(--halo, rgba(212,160,23,0.6)));
}
@keyframes medal-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-2px) rotate(3deg); }
}

/* Champion crown -- twemoji 👑 on rank 1 */
.podium-slot.gold .podium-spotlight {
  margin-top: 30px;
}
.podium-slot.gold .podium-crown {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  width: 56px;
  height: 56px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(240,197,64,0.85)) drop-shadow(2px 4px 0 rgba(0,0,0,0.4));
  animation: crown-tilt 3.6s steps(8) infinite alternate;
}
@keyframes crown-tilt {
  from { transform: translateX(-50%) rotate(-6deg); }
  to   { transform: translateX(-50%) rotate(6deg); }
}

/* Sparkles around #1 */
.podium-slot.gold .podium-spotlight .sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #fff5a0;
  box-shadow: 0 0 6px #fff5a0;
  z-index: 4;
  animation: sparkle-twinkle 1.6s steps(4) infinite;
}
.podium-slot.gold .podium-spotlight .sparkle:nth-child(1) { top: 12%; left: 10%; animation-delay: 0s; }
.podium-slot.gold .podium-spotlight .sparkle:nth-child(2) { top: 22%; right: 6%; animation-delay: 0.4s; }
.podium-slot.gold .podium-spotlight .sparkle:nth-child(3) { bottom: 30%; left: 4%; animation-delay: 0.8s; }
.podium-slot.gold .podium-spotlight .sparkle:nth-child(4) { bottom: 18%; right: 10%; animation-delay: 1.2s; }

@keyframes sparkle-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50%      { opacity: 1; transform: scale(1.2); }
}

@keyframes podium-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.95; transform: scale(1.10); }
}

/* Rank list (4-20) */
.rank-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
}
.rank-row {
  display: grid;
  grid-template-columns: 50px 56px 1fr 80px 60px 60px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(248,240,216,0.7);
  border: 2px solid #c8b888;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
  transition: none;
}
.rank-row:hover { background: #fff8e0; transform: translate(1px, 1px); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #c8b888, 2px 2px 0 #c8b888; }
.rank-row.you { background: rgba(176,48,48,0.12); border-color: #b03030; }
.rank-row .rk { font-size: 12px; color: #2b2b2b; text-align: center; }
.rank-row .rmon { width: 48px; height: 48px; image-rendering: pixelated; }
.rank-row .rname { font-size: 9px; color: #2b2b2b; letter-spacing: 1px; }
.rank-row .rname small { font-size: 6px; color: #a09070; display: block; margin-top: 4px; letter-spacing: 1px; }
.rank-row .rcp { font-size: 11px; color: #b03030; text-align: right; font-weight: bold; }
.rank-row .rcp small { font-size: 5px; color: #706050; display: block; margin-top: 2px; letter-spacing: 1px; }
.rank-row .rbadge { font-size: 9px; color: #d4a017; text-align: right; }
.rank-row .rlv { font-size: 8px; color: #5060a0; text-align: right; }

.rank-empty {
  text-align: center;
  padding: 40px 20px;
  font-size: 9px;
  color: #a09070;
  border: 3px dashed #c8b888;
  background: rgba(248,240,216,0.4);
  letter-spacing: 1px;
}

@media (max-width: 768px) {
  .podium-slot { width: 110px; }
  .podium-trainer { width: 100px; }
  .podium-pillar { width: 100px; font-size: 22px; }
  .rank-row { grid-template-columns: 36px 40px 1fr 60px; }
  .rank-row .rbadge, .rank-row .rlv { display: none; }
}

.wallet-card {
  cursor: pointer;
  padding: 14px 6px 10px;
  border: 3px solid #2b2b2b;
  background: #f8f0d8;
  text-align: center;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888, 3px 3px 0 #2b2b2b;
  font-family: 'Press Start 2P', monospace;
  transition: none;
}
.wallet-card:hover {
  background: #fff8e0;
  transform: translate(1px, 1px);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c8b888, 2px 2px 0 #2b2b2b;
}
.wallet-card:active {
  transform: translate(3px, 3px);
  box-shadow: inset 2px 2px 0 #c8b888, inset -2px -2px 0 #fff;
}
.wallet-card svg {
  display: block;
  margin: 0 auto 8px;
  image-rendering: pixelated;
}
.wallet-card .wallet-name {
  font-size: 8px;
  color: #2b2b2b;
  letter-spacing: 1px;
}
.wallet-card.selected {
  background: #b03030;
  border-color: #2b2b2b;
}
.wallet-card.selected .wallet-name { color: #f8f0d8; }

.pixel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: #e8dcc0;
  color: #2b2b2b;
  border: 3px solid #2b2b2b;
  padding: 10px 16px;
  cursor: pointer;
  text-align: center;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.pixel-btn:hover {
  background: #f0e8d0;
}

.pixel-btn:active {
  box-shadow:
    inset 2px 2px 0 #c8b888,
    inset -2px -2px 0 #fff;
}

.pixel-btn.primary {
  background: #b03030;
  color: #fff;
  box-shadow:
    inset 2px 2px 0 #d06060,
    inset -2px -2px 0 #802020;
}

.pixel-btn.primary:hover {
  background: #c04040;
}

.pixel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- TYPE COLORS ---- */
.type-fire { color: #c03028; border-color: #c03028; }
.type-water { color: #5080b0; border-color: #5080b0; }
.type-grass { color: #508050; border-color: #508050; }
.type-electric { color: #b8a020; border-color: #b8a020; }
.type-ice { color: #70a0b0; border-color: #70a0b0; }
.type-dragon { color: #6038a0; border-color: #6038a0; }
.type-fighting { color: #903028; border-color: #903028; }
.type-poison { color: #804080; border-color: #804080; }
.type-ground { color: #a08840; border-color: #a08840; }
.type-flying { color: #7070c0; border-color: #7070c0; }
.type-psychic { color: #d05080; border-color: #d05080; }
.type-bug { color: #889810; border-color: #889810; }
.type-rock { color: #a08860; border-color: #a08860; }
.type-ghost { color: #605088; border-color: #605088; }
.type-dark { color: #504038; border-color: #504038; }
.type-steel { color: #9898a0; border-color: #9898a0; }

/* Gym battle animations */
@keyframes blink {
  50% { opacity: 0; }
}
@keyframes pulse-border {
  0%, 100% { border-color: #f0e060; }
  50% { border-color: #b03030; }
}
.type-normal { color: #908870; border-color: #908870; }

/* ---- TYPE BG COLORS (for badges, etc) ---- */
.type-bg-fire { background: #f0c0b0; }
.type-bg-water { background: #c0d8f0; }
.type-bg-grass { background: #c0e0c0; }
.type-bg-electric { background: #f0e8a0; }
.type-bg-rock { background: #e0d0b0; }
.type-bg-poison { background: #e0c0e0; }
.type-bg-psychic { background: #f0c0d0; }
.type-bg-ground { background: #e8d8a8; }

/* ---- RESPONSIVE ---- */
/* ---- DEPLOY STEPS ---- */
.deploy-step {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 12px;
  color: #a09070;
  border-bottom: 3px solid transparent;
}

.deploy-step.active {
  color: #b03030;
  border-bottom-color: #b03030;
}

.deploy-step.done {
  color: #508050;
  border-bottom-color: #508050;
}

.deploy-panel {
  animation: panel-fade 0.2s;
}

@keyframes panel-fade {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* CHAT button hidden on desktop */
.mobile-chat-btn {
  display: none !important;
}

/* ---- TABLET (< 1024px) ---- */
@media (max-width: 1024px) {
  .menu { width: 56px; padding: 4px; }
  .menu-logo { font-size: 12px; padding: 8px 0; }
  .menu-btn { font-size: 0; padding: 10px 4px; }
  .menu-btn::first-letter { font-size: 9px; }
  .chat { width: 260px; }
  .town-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---- MOBILE (< 768px) ---- */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  html, body { overflow: auto; }

  /* HIDE deploy button on mobile */
  .menu-btn.deploy-btn {
    display: none !important;
  }

  /* Menu → bottom tab bar */
  .menu {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 52px;
    flex-direction: row;
    border-right: none;
    border-top: 3px solid #2b2b2b;
    z-index: 50;
    padding: 0;
    gap: 0;
    overflow: hidden;
    background: rgba(200, 184, 136, 0.95);
  }

  .menu-logo { display: none; }

  .menu-btn {
    font-size: 0;
    padding: 6px 0;
    flex: 1;
    text-align: center;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-right: 1px solid #c8b888;
    background: transparent;
  }

  .menu-btn:last-child { border-right: none; }

  .menu-btn::first-letter { font-size: 11px; }

  .menu-btn.active {
    background: #f8f0d8;
    border-color: #c8b888;
    box-shadow: none;
  }

  .mobile-chat-btn {
    display: flex !important;
    background: #5060a0 !important;
    color: #fff !important;
    border-color: #304080 !important;
  }

  .mobile-chat-btn.active {
    background: #b03030 !important;
    border-color: #802020 !important;
  }

  /* HUD bar mobile */
  .hud-bar {
    height: 28px;
    padding: 0 8px;
  }

  .hud-left, .hud-center, .hud-right {
    gap: 6px;
  }

  .hud-season { font-size: 7px; padding: 1px 5px; }
  .hud-day { font-size: 7px; }
  .hud-weather { font-size: 7px; }
  .hud-time { font-size: 8px; }

  .app { padding-top: 31px; }

  /* Content → full width, scroll */
  .content {
    width: 100%;
    padding-bottom: 56px;
    background: rgba(240,232,208,0.2);
  }

  .content-bg {
    position: fixed;
  }

  /* Chat → fullscreen overlay */
  .chat {
    display: none;
    position: fixed;
    top: 28px;
    left: 0;
    width: 100%;
    height: calc(100% - 80px);
    z-index: 40;
    border-left: none;
    background: rgba(240,232,208,0.97);
  }

  .chat.mobile-open {
    display: flex;
  }

  .chat-header {
    font-size: 8px;
    padding: 6px 8px;
  }

  .chat-msg {
    padding: 5px;
  }

  .chat-msg-inner {
    gap: 6px;
  }

  /* Chat messages */
  .chat-avatar-box { width: 36px; height: 36px; }
  .chat-avatar-box canvas { width: 36px; height: 36px; }
  .chat-trainer-name { font-size: 8px; }
  .chat-text { font-size: 7px; }
  .chat-badge-count { font-size: 6px; }

  /* Grids */
  .town-grid { grid-template-columns: 1fr; gap: 10px; }
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .badge-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .myinfo-party-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

  /* Town card */
  .town-card-bg { height: 140px; }
  .town-card-body { padding: 10px; }
  .town-name { font-size: 11px; }
  .town-info { font-size: 7px; }

  /* Dex cards */
  .dex-card { padding: 8px; }
  .dex-card img { width: 80px; height: 80px; }
  .dex-card-name { font-size: 8px; }
  .dex-card-type { font-size: 7px; }
  .dex-filter-btn { font-size: 7px; padding: 6px 8px; }
  .dex-filters { gap: 4px; margin-bottom: 10px; }

  /* Badge cards */
  .badge-card { padding: 10px 6px; gap: 6px; }
  .trophy-icon { width: 48px; height: 56px; }
  .badge-name { font-size: 7px; }
  .badge-leader { font-size: 5px; }

  /* Mon cards in MY INFO */
  .mon-card { padding: 10px; }
  .mon-card img { width: 72px; height: 72px; }
  .mon-card-empty { min-height: 140px; font-size: 8px; }

  /* Trainer card */
  .trainer-card { padding: 10px; }
  .trainer-card-name { font-size: 10px; }
  .trainer-card-location { font-size: 7px; }
  .trainer-mon-mini { width: 44px; height: 44px; }
  .trainer-mon-mini img { width: 36px; height: 36px; }
  .trainer-mon-lv { font-size: 4px; }

  /* Strategy box */
  .strategy-box { padding: 12px; }

  /* Loading screen */
  .loading-content { width: 90%; }
  .loading-logo { font-size: 28px; }
  .loading-subtitle { font-size: 8px; margin-bottom: 20px; letter-spacing: 2px; }
  .loading-parade { height: 80px; }
  .parade-mon { width: 56px; height: 56px; }

  /* Panel padding */
  .panel { padding: 10px; overflow-x: hidden; }
  .panel-title { font-size: 9px; padding: 7px 8px; }

  /* Docs code blocks on mobile */
  .panel pre { font-size: 6px !important; line-height: 2 !important; word-break: break-all; }
  .panel div[style*="font-size:14px"] { font-size: 11px !important; }

  /* Modal - still show on mobile for trainer profile popup etc */
  .modal-box { width: 95%; padding: 12px; max-height: 85vh; overflow-y: auto; }
  .modal-title { font-size: 10px; }
  .starter-grid { flex-direction: column; align-items: center; }
  .starter-card { width: 100%; max-width: 200px; }
  .starter-card img { width: 72px; height: 72px; }
  .avatar-grid { gap: 6px; }
  .avatar-card { width: 44px; height: 44px; }

  /* Party slots */
  .party-slot { width: 64px; padding: 4px; }
  .party-slot img { width: 48px; height: 48px; }
  .party-slot-name { font-size: 5px; }
  .party-slot-lv { font-size: 5px; }

  /* Activity log */
  .activity-log { height: 150px; }
  .log-line { font-size: 6px; }

  /* Settings */
  .setting-row { font-size: 7px; }
  .setting-row select { font-size: 6px; }

  /* Scrollbar thinner on mobile */
  .content::-webkit-scrollbar,
  .chat-messages::-webkit-scrollbar { width: 4px; }
}

/* ---- SMALL MOBILE (< 480px) ---- */
@media (max-width: 480px) {
  .town-grid { grid-template-columns: 1fr; }
  .dex-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .myinfo-party-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }

  .dex-filter-btn { font-size: 6px; padding: 5px 6px; }
  .dex-card img { width: 64px; height: 64px; }
  .dex-card { padding: 6px; }

  .loading-logo { font-size: 22px; }
  .loading-parade { height: 60px; }
  .parade-mon { width: 40px; height: 40px; }

  .hud-season { font-size: 6px; }
  .hud-day { font-size: 6px; }
  .hud-weather { display: none; }
  .hud-time { font-size: 7px; }

  .panel { padding: 8px; }
  .panel-title { font-size: 8px; padding: 6px; }

  .town-card-bg { height: 120px; }
  .town-name { font-size: 10px; }

  .badge-card { padding: 8px 4px; }
  .trophy-icon { width: 40px; height: 48px; }
  .badge-name { font-size: 6px; }

  .mon-card img { width: 56px; height: 56px; }

  .chat-avatar-box { width: 32px; height: 32px; }
  .chat-avatar-box canvas { width: 32px; height: 32px; }
  .chat-text { font-size: 6px; }
  .chat-trainer-name { font-size: 7px; }

  .trainer-card-stats { grid-template-columns: 1fr; }
}
