* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #10141c; color: #e8ecf4; font-size: 15px;
}
@font-face {
  font-family: 'PS2P';
  src: url('/vendor/pressstart2p.ttf') format('truetype');
  font-display: swap;
}
.px { image-rendering: pixelated; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

/* ===== auth ===== */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1d2b45, #10141c 70%);
  z-index: 50; overflow-y: auto; padding: 20px;
}
.auth-box { width: 380px; max-width: 94vw; }
.logo { font-family: 'PS2P', monospace; font-size: 30px; text-align: center; letter-spacing: 2px; }
.logo span { color: #ffcc33; }
.tagline { text-align: center; color: #94a0b8; margin: 10px 0 24px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 8px; background: #1a2130; color: #94a0b8;
  border: 1px solid #2a3450; border-radius: 8px 8px 0 0;
}
.tab.active { background: #24304a; color: #fff; border-bottom-color: transparent; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: #94a0b8; margin-bottom: 4px; }
.field input {
  width: 100%; padding: 10px 12px; background: #1a2130; color: #fff;
  border: 1px solid #2a3450; border-radius: 8px; outline: none;
}
.field input:focus { border-color: #ffcc33; }
.error { color: #ff7b7b; min-height: 20px; font-size: 13px; margin-bottom: 8px; }
.btn {
  background: #24304a; color: #e8ecf4; border: 1px solid #3a4a70;
  border-radius: 8px; padding: 9px 16px;
}
.btn:hover { background: #2c3a5a; }
.btn.primary { background: #ffcc33; border-color: #ffcc33; color: #1a1a10; font-weight: 700; width: 100%; padding: 12px; }
.btn.primary:hover { background: #ffd75e; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.dev { border-color: #4d9fff; color: #8fc4ff; }
.btn.danger { border-color: #a05050; color: #ff9c9c; }
.btn:disabled { opacity: .45; cursor: default; }
.disclaimer { font-size: 10.5px; color: #5d6880; margin-top: 26px; line-height: 1.5; }

/* ===== game chrome ===== */
#c3d { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud {
  position: fixed; top: 12px; left: 12px; z-index: 10;
  background: rgba(13, 17, 26, .82); border: 1px solid #2a3450; border-radius: 12px;
  padding: 10px 14px; min-width: 210px;
}
#hud-id { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
#hud-name { font-weight: 700; }
#hud-name.dev { color: #4d9fff; }
#hud-money { color: #ffcc33; font-weight: 600; }
#hud-badges { display: flex; gap: 5px; margin: 7px 0; }
.badge-pip {
  width: 14px; height: 14px; border-radius: 4px; background: #232c40;
  border: 1px solid #3a4a70;
}
.badge-pip.owned.verdant { background: #58c470; border-color: #58c470; }
.badge-pip.owned.ember { background: #ff7043; border-color: #ff7043; }
.badge-pip.owned.azure { background: #42a5f5; border-color: #42a5f5; }
.badge-pip.owned.volt { background: #ffd740; border-color: #ffd740; }
#hud-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

#prompt {
  position: fixed; bottom: 120px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: rgba(13, 17, 26, .88); border: 1px solid #ffcc33; color: #ffe9a8;
  padding: 8px 18px; border-radius: 999px; font-size: 14px; display: none;
}
#area-label {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 9;
  font-family: 'PS2P', monospace; font-size: 13px; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.8); opacity: 0; transition: opacity .6s;
}
#toast-wrap { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: rgba(13, 17, 26, .92); border: 1px solid #3a4a70; border-radius: 10px;
  padding: 9px 18px; animation: toastin .25s ease-out;
}
.toast.gold { border-color: #ffcc33; color: #ffe9a8; }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1 } }

/* ===== chat ===== */
#chat { position: fixed; left: 12px; bottom: 12px; width: 360px; max-width: 60vw; z-index: 10; }
#chat-log {
  max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px;
  padding: 8px; background: rgba(13, 17, 26, .62); border-radius: 10px 10px 0 0;
  font-size: 13.5px; scrollbar-width: thin;
}
#chat-log .from { font-weight: 700; color: #fff; }
#chat-log .from.dev { color: #4d9fff; }
#chat-log .sys { color: #7d8aa5; font-style: italic; }
#chat-input {
  width: 100%; padding: 8px 12px; background: rgba(13, 17, 26, .85); color: #fff;
  border: 1px solid #2a3450; border-radius: 0 0 10px 10px; outline: none;
}
#chat-input:focus { border-color: #ffcc33; }

/* ===== modal panels ===== */
#modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 8, 14, .6); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.panel {
  background: #141a28; border: 1px solid #2a3450; border-radius: 14px;
  padding: 20px; max-width: 720px; width: 100%; max-height: 86vh; overflow-y: auto;
  scrollbar-width: thin;
}
.panel h2 { font-family: 'PS2P', monospace; font-size: 15px; margin-bottom: 14px; color: #ffcc33; }
.panel h3 { margin: 12px 0 8px; font-size: 15px; }
.panel .close-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }

/* starter cards */
.starter-row { display: flex; gap: 12px; justify-content: center; }
.starter-card {
  flex: 1; max-width: 170px; text-align: center; padding: 14px; background: #1a2130;
  border: 2px solid #2a3450; border-radius: 12px; cursor: pointer; transition: border-color .15s;
}
.starter-card:hover { border-color: #ffcc33; }
.starter-card img { width: 96px; height: 96px; }
.starter-card .nm { font-weight: 700; margin-top: 4px; }
.type-chip {
  display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px;
  color: #fff; text-transform: capitalize; margin: 2px;
}

/* party */
.party-row {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px;
  background: #1a2130; margin-bottom: 6px;
}
.party-row img { width: 48px; height: 48px; }
.party-row .grow { flex: 1; }
.party-row .hpbar { margin-top: 4px; }
.hpbar { height: 8px; background: #232c40; border-radius: 999px; overflow: hidden; width: 100%; }
.hpbar .hp { height: 100%; background: #58c470; border-radius: 999px; transition: width .35s; }
.hpbar .hp.mid { background: #ffcc33; }
.hpbar .hp.low { background: #ff5a5a; }
.mini { font-size: 12px; color: #94a0b8; }

/* pokedex */
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.dex-cell {
  background: #1a2130; border-radius: 8px; text-align: center; padding: 4px 2px;
  cursor: pointer; border: 1px solid transparent;
}
.dex-cell:hover { border-color: #3a4a70; }
.dex-cell img { width: 40px; height: 40px; }
.dex-cell.unseen img { filter: brightness(0) opacity(.55); }
.dex-cell .no { font-size: 10px; color: #7d8aa5; display: block; }
.dex-cell.caught { border-color: #58c47055; }
.dex-detail { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.dex-detail img { width: 144px; height: 144px; background: #1a2130; border-radius: 12px; }
.statbar { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
.statbar .lbl { width: 42px; color: #94a0b8; }
.statbar .bar { flex: 1; height: 7px; background: #232c40; border-radius: 99px; overflow: hidden; }
.statbar .bar div { height: 100%; background: #4d9fff; border-radius: 99px; }

/* shop/market/bag tables */
.item-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: #1a2130; border-radius: 10px; margin-bottom: 6px;
}
.item-row .grow { flex: 1; }
.item-row .price { color: #ffcc33; font-weight: 600; white-space: nowrap; }
.qty-input { width: 64px; padding: 6px 8px; background: #10141c; color: #fff; border: 1px solid #2a3450; border-radius: 8px; }
.mtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.seller { color: #94a0b8; font-size: 12.5px; }
.seller.dev { color: #4d9fff; }

/* ===== battle ===== */
#battle { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; }
#battle-stage {
  flex: 1; position: relative;
  background: linear-gradient(#87c8f0 0%, #a8dcf8 45%, #7ec87e 46%, #5aae5a 100%);
}
#enemy-sprite {
  position: absolute; right: 12%; top: 16%; width: 260px; height: 260px;
  filter: drop-shadow(0 14px 10px rgba(0,0,0,.25));
}
#my-sprite {
  position: absolute; left: 10%; bottom: 4%; width: 300px; height: 300px;
  filter: drop-shadow(0 14px 10px rgba(0,0,0,.25));
}
.mon-box {
  position: absolute; background: rgba(16, 20, 28, .88); border: 1px solid #3a4a70;
  border-radius: 12px; padding: 10px 14px; min-width: 230px;
}
#enemy-box { left: 8%; top: 10%; }
#my-box { right: 8%; bottom: 12%; }
.mon-box .mon-name { font-weight: 700; margin-right: 8px; }
.mon-box .mon-lv { color: #94a0b8; }
.mon-box .hpbar { margin-top: 7px; }
.mon-box .hptext { font-size: 12px; color: #94a0b8; margin-top: 3px; text-align: right; }
.expbar { height: 4px; background: #232c40; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.expbar .exp { height: 100%; background: #4d9fff; }
@keyframes hitshake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-10px) } 75% { transform: translateX(10px) } }
.hit { animation: hitshake .3s; }
@keyframes faintdrop { to { transform: translateY(60px); opacity: 0 } }
.faint { animation: faintdrop .5s forwards; }

#battle-bottom {
  display: flex; gap: 12px; padding: 14px; background: #10141c; border-top: 2px solid #2a3450;
  min-height: 150px;
}
#battle-log {
  flex: 1.2; background: #1a2130; border-radius: 10px; padding: 10px 14px;
  font-size: 14.5px; overflow-y: auto; max-height: 150px; scrollbar-width: thin;
}
#battle-log div { margin-bottom: 3px; }
#battle-actions { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.move-btn { padding: 10px 8px; border-radius: 10px; border: 1px solid #3a4a70; background: #24304a; color: #fff; text-align: left; }
.move-btn:hover { border-color: #ffcc33; }
.move-btn .sub { display: block; font-size: 11px; color: #94a0b8; text-transform: capitalize; }

/* type colors */
.t-normal { background: #9199a1 } .t-fire { background: #e2543c } .t-water { background: #4a90dd }
.t-electric { background: #e3b31c } .t-grass { background: #56ab48 } .t-ice { background: #58c8be }
.t-fighting { background: #b54f43 } .t-poison { background: #9c59c8 } .t-ground { background: #ce9a52 }
.t-flying { background: #8ea4de } .t-psychic { background: #e26a88 } .t-bug { background: #92ac28 }
.t-rock { background: #b0a166 } .t-ghost { background: #6a5a92 } .t-dragon { background: #6b4fd8 }
.t-dark { background: #5a4f48 } .t-steel { background: #8a99a8 } .t-fairy { background: #dd8fdd }
