/* ============================================
   PXMON - 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: 500px;
}

.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: 100%;
  height: 20px;
  background: #2b2b2b;
  border: 3px solid #f0e8d0;
  margin-bottom: 16px;
  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; }
}

/* ---- 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: #2b2b2b;
  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(200, 184, 136, 0.35);
  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: #fff !important;
  border-color: #802020 !important;
  text-align: center !important;
  box-shadow:
    inset 2px 2px 0 #d06060,
    inset -2px -2px 0 #802020 !important;
}

.deploy-btn:hover {
  background: #c04040 !important;
}

.deploy-btn.deployed {
  background: #508050 !important;
  border-color: #305030 !important;
  box-shadow:
    inset 2px 2px 0 #70a070,
    inset -2px -2px 0 #305030 !important;
}

/* ---- CENTER CONTENT ---- */
.content {
  flex: 1;
  background: rgba(240, 232, 208, 0.2);
  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(232, 224, 208, 0.15);
}

/* 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: #f8f0d8;
  border: 3px solid #2b2b2b;
  padding: 8px;
  height: 200px;
  overflow-y: auto;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #c8b888;
}

.log-line {
  font-size: 7px;
  color: #2b2b2b;
  line-height: 2;
  border-bottom: 1px solid #e8dcc0;
  padding: 2px 0;
}

/* ---- 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(240, 232, 208, 0.3);
  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 ---- */
.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; }

  /* Menu → bottom tab bar */
  .menu {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 56px;
    flex-direction: row;
    border-right: none;
    border-top: 3px solid #2b2b2b;
    z-index: 50;
    padding: 0 4px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .menu-logo { display: none; }

  .menu-btn {
    font-size: 0;
    padding: 8px 12px;
    flex: 1;
    text-align: center;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .menu-btn::first-letter { font-size: 10px; }

  .menu-btn.deploy-btn {
    flex: none;
    padding: 8px 16px;
    font-size: 8px !important;
  }

  .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;
  }

  /* Content → full width, scroll */
  .content {
    width: 100%;
    padding-bottom: 60px; /* space for bottom nav */
    background: rgba(240,232,208,0.2);
  }

  .content-bg {
    position: fixed;
  }

  /* Chat → hidden by default, toggled */
  .chat {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 56px);
    z-index: 40;
    border-left: none;
    background: rgba(240,232,208,0.95);
  }

  .chat.mobile-open {
    display: flex;
  }

  /* 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: 120px; }
  .town-card-body { padding: 10px; }
  .town-name { font-size: 11px; }

  /* Dex cards */
  .dex-card img { width: 80px; height: 80px; }
  .dex-card-name { font-size: 8px; }
  .dex-filter-btn { font-size: 7px; padding: 6px 8px; }

  /* Mon cards in MY INFO */
  .mon-card img { width: 72px; height: 72px; }
  .mon-card-empty { min-height: 160px; }

  /* Chat messages */
  .chat-avatar-box { width: 36px; height: 36px; }
  .chat-avatar-box canvas { width: 36px; height: 36px; }

  /* Loading screen */
  .loading-content { width: 90%; }
  .loading-logo { font-size: 32px; }
  .loading-subtitle { font-size: 9px; margin-bottom: 24px; }

  /* Panel padding */
  .panel { padding: 10px; }
  .panel-title { font-size: 10px; padding: 8px; }

  /* Modal */
  .modal-box { width: 95%; padding: 12px; }
  .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; }
}

/* ---- SMALL MOBILE (< 480px) ---- */
@media (max-width: 480px) {
  .town-grid { grid-template-columns: 1fr; }
  .dex-grid { grid-template-columns: repeat(2, 1fr); }
  .myinfo-party-grid { grid-template-columns: 1fr 1fr; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }

  .dex-filter-btn { font-size: 6px; padding: 5px 6px; }

  .loading-logo { font-size: 24px; }
  .loading-monster { width: 36px; height: 36px; }
}
