/* ═══════════════════════════════════════════════
   PokéCozy — style.css
   Cozy Retro-Modern Theme
   ═══════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Core palette */
  --color-bg:           #1F232B;
  --color-bg-deep:      #181C23;
  --color-surface:      #F4F1EA;
  --color-surface-warm: #EDE8DF;
  --color-surface-dim:  #E2DDD4;

  /* Accent palette */
  --color-accent:       #E8A838;   /* warm amber */
  --color-accent-soft:  #F0C070;
  --color-accent-glow:  rgba(232, 168, 56, 0.18);
  --color-red:          #C44B3A;
  --color-red-soft:     rgba(196, 75, 58, 0.12);
  --color-green:        #5A8A5E;
  --color-muted:        #7A8394;
  --color-border:       rgba(244, 241, 234, 0.1);

  /* Typography */
  --font-display:  'Cinzel', serif;
  --font-body:     'Lora', serif;
  --font-mono:     'JetBrains Mono', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Radii */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --radius-xl:  32px;

  /* Shadows */
  --shadow-card:  0 4px 32px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.2);
  --shadow-lift:  0 12px 48px rgba(0,0,0,0.36), 0 2px 8px rgba(0,0,0,0.24);
  --shadow-glow:  0 0 32px var(--color-accent-glow), 0 4px 32px rgba(0,0,0,0.28);

  /* Transitions */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-surface);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── GRAIN TEXTURE OVERLAY ── */
.grain-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── AMBIENT ORBS ── */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 20s ease-in-out infinite alternate;
}
.orb--1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(232, 168, 56, 0.07) 0%, transparent 70%);
  top: -180px; left: -120px;
  animation-duration: 24s;
}
.orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(90, 138, 94, 0.06) 0%, transparent 70%);
  bottom: -100px; right: -80px;
  animation-duration: 18s;
  animation-direction: alternate-reverse;
}
.orb--3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(196, 75, 58, 0.05) 0%, transparent 70%);
  top: 50%; left: 60%;
  animation-duration: 30s;
}
@keyframes orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -40px) scale(1.06); }
}

/* ── APP SHELL ── */
.app-shell {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  animation: shell-reveal 0.8s var(--ease-out) both;
}
@keyframes shell-reveal {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── HEADER ── */
.site-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(232, 168, 56, 0.12);
  border: 1px solid rgba(232, 168, 56, 0.3);
  border-radius: 100px;
  padding: 5px 18px;
  animation: shell-reveal 0.6s var(--ease-out) 0.1s both;
}
.badge-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--color-accent-soft);
}
.badge-icon {
  font-size: 0.6rem;
  color: var(--color-accent);
}

.site-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: 0.04em;
  color: var(--color-surface);
  text-shadow: 0 2px 24px rgba(232, 168, 56, 0.3);
  animation: shell-reveal 0.7s var(--ease-out) 0.15s both;
}

.site-tagline {
  font-style: italic;
  color: var(--color-muted);
  font-size: 0.95rem;
  animation: shell-reveal 0.7s var(--ease-out) 0.2s both;
}

/* ── CARD GRID ── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-lg);
}
.card--profile  { grid-column: 1; grid-row: 1; }
.card--pokedex  { grid-column: 2; grid-row: 1; }
.card--actions  { grid-column: 1; grid-row: 2; }
.card--console  { grid-column: 2; grid-row: 2; }

@media (max-width: 700px) {
  .main-grid { grid-template-columns: 1fr; }
  .card--profile, .card--pokedex,
  .card--actions, .card--console { grid-column: 1; grid-row: auto; }
}

/* ── CARD ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  color: #2C2420;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  animation: card-in 0.6s var(--ease-out) both;
}
.card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

/* Staggered card entrance */
.card--profile  { animation-delay: 0.25s; }
.card--pokedex  { animation-delay: 0.32s; }
.card--actions  { animation-delay: 0.39s; }
.card--console  { animation-delay: 0.46s; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Warm top-edge accent line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: var(--space-lg); right: var(--space-lg);
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(232, 168, 56, 0.5), transparent);
  border-radius: 0 0 2px 2px;
}

/* Subtle corner texture dots */
.card::after {
  content: '· · ·';
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-md);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: rgba(44, 36, 32, 0.2);
  pointer-events: none;
}

/* ── CARD EYEBROW ── */
.card__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7A6A62;
}
.eyebrow-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}
.eyebrow-dot--live {
  background: var(--color-green);
  box-shadow: 0 0 0 0 rgba(90, 138, 94, 0.6);
  animation: pulse-live 2s ease-out infinite;
}
@keyframes pulse-live {
  0%   { box-shadow: 0 0 0 0 rgba(90, 138, 94, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(90, 138, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(90, 138, 94, 0); }
}

/* ── PROFILE CARD ── */
.profile-avatar {
  font-size: 3.2rem;
  text-align: center;
  filter: drop-shadow(0 4px 12px rgba(232, 168, 56, 0.25));
  animation: float 5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.profile-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  text-align: center;
  color: #2C2420;
  letter-spacing: 0.03em;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}
.stat {
  background: var(--color-surface-warm);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--color-surface-dim);
  transition: background 0.2s;
}
.stat:hover { background: var(--color-surface-dim); }
.stat__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9A8880;
  font-family: var(--font-mono);
}
.stat__value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2C2420;
}

/* ── POKÉDEX CARD ── */
.pokedex-count {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-md) 0 var(--space-xs);
}
.pokedex-count__number {
  font-size: 3.5rem;
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1;
}
.pokedex-count__label {
  font-size: 0.85rem;
  color: #7A6A62;
  line-height: 1.3;
}
.pokemon-list {
  flex: 1;
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-content: flex-start;
}
.empty-state {
  width: 100%;
  text-align: center;
  font-style: italic;
  font-size: 0.85rem;
  color: #9A8880;
  padding: var(--space-md) 0;
  line-height: 1.7;
}
.pokemon-tag {
  background: var(--color-surface-warm);
  border: 1px solid var(--color-surface-dim);
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: #4A3C38;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s var(--ease-snap), background 0.2s;
}
.pokemon-tag:hover { transform: scale(1.05); background: var(--color-surface-dim); }

/* ── ACTIONS CARD ── */
.action-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.action-group__title {
  font-size: 1rem;
  font-weight: 600;
  color: #2C2420;
}
.action-group__desc {
  font-size: 0.83rem;
  color: #7A6A62;
  font-style: italic;
  line-height: 1.5;
}

.divider {
  height: 1px;
  background: var(--color-surface-dim);
  border-radius: 1px;
  margin: var(--space-xs) 0;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-snap),
    box-shadow 0.2s var(--ease-out),
    background 0.2s;
  align-self: flex-start;
  letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.96) !important; }

.btn--primary {
  background: #2C2420;
  color: var(--color-accent-soft);
  box-shadow: 0 2px 12px rgba(44, 36, 32, 0.18);
}
.btn--primary:hover {
  background: #1F1A17;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(44, 36, 32, 0.25), 0 0 0 2px var(--color-accent);
}

.btn--danger {
  background: var(--color-surface-warm);
  color: var(--color-red);
  border: 1.5px solid rgba(196, 75, 58, 0.3);
  box-shadow: 0 2px 8px rgba(196, 75, 58, 0.08);
}
.btn--danger:hover {
  background: var(--color-red-soft);
  transform: translateY(-2px);
  border-color: var(--color-red);
  box-shadow: 0 6px 20px rgba(196, 75, 58, 0.18);
}

.btn__icon { font-size: 1rem; }

/* ── CONSOLE / LOG ── */
.console-output {
  flex: 1;
  min-height: 140px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-sm) 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(44, 36, 32, 0.2) transparent;
}
.console-output::-webkit-scrollbar { width: 4px; }
.console-output::-webkit-scrollbar-track { background: transparent; }
.console-output::-webkit-scrollbar-thumb { background: rgba(44, 36, 32, 0.2); border-radius: 4px; }

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  animation: log-slide 0.3s var(--ease-out) both;
}
@keyframes log-slide {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.log-entry--info    { color: #4A3C38; }
.log-entry--success { color: var(--color-green); background: rgba(90, 138, 94, 0.08); }
.log-entry--warn    { color: #C47A2A; background: rgba(232, 168, 56, 0.1); }
.log-entry--error   { color: var(--color-red); background: var(--color-red-soft); }

.log-entry__time {
  color: #9A8880;
  flex-shrink: 0;
  user-select: none;
}
.log-entry__msg { flex: 1; }

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
  padding-top: var(--space-sm);
  opacity: 0.6;
}

/* ── MONO UTILITY ── */
.mono { font-family: var(--font-mono); }

/* ── TOAST NOTIFICATION ── */
.toast {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #2C2420;
  color: var(--color-surface);
  padding: 12px 28px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  box-shadow: var(--shadow-lift);
  z-index: 100;
  opacity: 0;
  transition: transform 0.4s var(--ease-snap), opacity 0.4s var(--ease-out);
  pointer-events: none;
  border: 1px solid rgba(244, 241, 234, 0.15);
  white-space: nowrap;
}
.toast.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--success { border-color: rgba(90, 138, 94, 0.5); }
.toast--error   { border-color: rgba(196, 75, 58, 0.5); }

/* ══════════════════════════════════════════════
   MAP SECTION
══════════════════════════════════════════════ */

.map-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: card-in 0.6s var(--ease-out) 0.2s both;
}

.map-eyebrow {
  /* Reuse card eyebrow styles in a standalone context */
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.map-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-accent-soft);
  letter-spacing: 0.08em;
  opacity: 0.8;
  transition: opacity 0.4s;
}
.map-status.is-locked {
  color: var(--color-green);
  opacity: 1;
}

/* ── MAP WRAP (relative container for overlays) ── */
.map-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  border: 1px solid var(--color-border);
}

/* ── LEAFLET MAP CANVAS ── */
#map {
  width: 100%;
  height: 420px;
  background: #181C23;           /* matches bg while tiles load */
  z-index: 0;
}

/* Suppress Leaflet's default attribution styling conflict */
.leaflet-container {
  font-family: var(--font-mono) !important;
  font-size: 0.68rem !important;
}
.leaflet-control-attribution {
  background: rgba(31, 35, 43, 0.75) !important;
  color: rgba(244, 241, 234, 0.45) !important;
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm) 0 0 0 !important;
}
.leaflet-control-attribution a { color: rgba(240, 192, 112, 0.7) !important; }

/* Leaflet zoom controls — restyle to match our theme */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: none !important;
}
.leaflet-control-zoom a {
  background: rgba(31, 35, 43, 0.88) !important;
  color: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  font-size: 1.1rem !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
  backdrop-filter: blur(6px);
  transition: background 0.2s !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(232, 168, 56, 0.18) !important;
  color: var(--color-accent-soft) !important;
}

/* ── CUSTOM PLAYER MARKER ── */
/* The outer wrapper sits at the marker's lat/lng centre */
.player-marker-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Leaflet offsets via iconAnchor, so no extra transform needed */
}

/* Pulsing 30-metre radius ring */
.player-radius-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  /* Actual pixel size is set dynamically in JS based on zoom/lat */
  width:  var(--ring-px, 60px);
  height: var(--ring-px, 60px);
  border-radius: 50%;
  border: 2px solid rgba(232, 168, 56, 0.55);
  background: rgba(232, 168, 56, 0.07);
  animation: ring-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes ring-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(232, 168, 56, 0.35); opacity: 1; }
  60%  { box-shadow: 0 0 0 12px rgba(232, 168, 56, 0);   opacity: 0.7; }
  100% { box-shadow: 0 0 0 0   rgba(232, 168, 56, 0);   opacity: 1; }
}

/* Pixel-art style avatar circle */
.player-dot {
  position: relative;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F0C070, #E8A838 60%, #B87820);
  border: 2.5px solid #1F232B;
  box-shadow:
    0 0 0 2px rgba(232, 168, 56, 0.6),
    0 0 12px rgba(232, 168, 56, 0.5),
    inset 0 1px 2px rgba(255,255,255,0.3);
  /* Pixel-art feel: crisp inner highlight */
  image-rendering: pixelated;
}

/* Small directional pip (top of dot) */
.player-dot::before {
  content: '';
  position: absolute;
  top: 2px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
}

/* ── MAP HUD (Moved completely under the map) ── */
.map-hud {
  /* 1. Reset absolute positioning entirely */
  position: relative !important; 
  top: auto !important;
  left: auto !important;
  transform: none !important;
  z-index: 10;
  
  /* 2. Visual layout rules */
  background: var(--color-surface);
  border-radius: var(--radius-lg); 
  padding: var(--space-md) var(--space-lg);
  width: 100%;                 
  box-shadow: var(--shadow-card);
  
  /* 3. Horizontal flex setup */
  display: flex !important;
  flex-direction: row;         
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-top: var(--space-md); /* Creates a cozy separation gap below the map */
  
  border-top: none;
  border-left: 3px solid var(--color-accent); 
  animation: card-in 0.5s var(--ease-out) both;
  
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 23px,
    rgba(44, 36, 32, 0.035) 23px,
    rgba(44, 36, 32, 0.035) 24px
  );
}

/* Container to lay out stats horizontally */
.hud-row-container {
  display: flex;
  flex: 1;
  justify-content: space-around;
  gap: var(--space-md);
}

.hud-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Turn vertical dividers into subtle vertical layout columns instead */
.map-hud .hud-divider {
  width: 1px;
  height: 32px;
  background: var(--color-surface-dim);
  margin: 0;
  display: block;
}

.hud-row {
  display: flex;
  flex-direction: column;    
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.68rem;
  color: #7A6A62;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud-value {
  font-size: 1rem;
  font-weight: 600;
  color: #2C2420;
  text-align: center;
}

/* Constrain the PC box launcher button size inside the row */
.hud-pc-btn {
  width: auto;
  padding: 8px 16px;
  flex-shrink: 0;
}

/* Mobile responsive handling for the new display */
@media (max-width: 650px) {
  .map-hud {
    flex-direction: column !important;   
    align-items: stretch;
    gap: var(--space-sm);
  }
  .hud-row-container {
    flex-direction: row;
    justify-content: space-between;
  }
  .map-hud .hud-divider {
    display: none;            
  }
}
@keyframes hud-slide {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.hud-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: 2px;
}
.hud-badge__icon { font-size: 1rem; }
.hud-badge__name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: #2C2420;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.hud-divider {
  height: 1px;
  background: var(--color-surface-dim);
  margin: 4px 0;
}

.hud-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}
.hud-label {
  font-size: 0.72rem;
  color: #7A6A62;
  white-space: nowrap;
}
.hud-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: #2C2420;
  text-align: right;
}
.hud-value.updated {
  color: var(--color-green);
  transition: color 0.8s;
}

/* ── RE-CENTER BUTTON ── */
.map-recenter {
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  z-index: 400;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: rgba(31, 35, 43, 0.88);
  color: var(--color-accent-soft);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: transform 0.2s var(--ease-snap), background 0.2s, box-shadow 0.2s;
}
.map-recenter:hover {
  background: rgba(232, 168, 56, 0.2);
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--shadow-glow);
}
.map-recenter:active {
  transform: scale(0.94) rotate(0deg);
}

/* ── GEO ERROR BANNER ── */
.geo-error-banner {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  background: rgba(196, 75, 58, 0.88);
  color: var(--color-surface);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 8px 18px;
  border-radius: 100px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-card);
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   POKÉMON SPAWN MARKERS
══════════════════════════════════════════════ */

.poke-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  transition: transform 0.2s var(--ease-snap);
}
.poke-marker:hover { transform: scale(1.12) translateY(-3px); }

/* Sprite image — floats and bobs */
.poke-marker__sprite {
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  animation: poke-bob 2.2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
@keyframes poke-bob {
  0%, 100% { transform: translateY(0);    }
  45%       { transform: translateY(-6px); }
}

/* Elliptical ground shadow */
.poke-marker__shadow {
  position: absolute;
  bottom: 2px;
  width: 32px; height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  filter: blur(3px);
  animation: poke-shadow 2.2s ease-in-out infinite;
  z-index: 1;
}
@keyframes poke-shadow {
  0%, 100% { transform: scaleX(1);    opacity: 0.4; }
  45%       { transform: scaleX(0.7); opacity: 0.2; }
}

/* Pulsing encounter ring beneath sprite */
.poke-marker__wobble-ring {
  position: absolute;
  bottom: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  animation: wobble-ring 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes wobble-ring {
  0%   { transform: scale(0.6); opacity: 0.8; }
  70%  { transform: scale(1.5); opacity: 0;   }
  100% { transform: scale(0.6); opacity: 0;   }
}

/* Night-mode marker tint */
.poke-marker[data-night="true"] .poke-marker__sprite {
  filter: hue-rotate(200deg) saturate(0.8) brightness(0.85);
}
.poke-marker[data-night="true"] .poke-marker__wobble-ring {
  border-color: rgba(160, 120, 240, 0.4);
}


/* ══════════════════════════════════════════════
   ENCOUNTER MODAL
══════════════════════════════════════════════ */

.encounter-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;       /* sheet slides up from bottom */
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}
.encounter-modal.is-open {
  pointer-events: all;
  opacity: 1;
}

/* Dim backdrop */
.encounter-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 24, 0.72);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

/* Card sheet */
.encounter-modal__card {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg) var(--space-lg) calc(var(--space-lg) + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.4);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-snap);
  color: #2C2420;

  /* Parchment ruled-line texture */
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 27px,
    rgba(44,36,32,0.04) 27px, rgba(44,36,32,0.04) 28px
  );
}
.encounter-modal.is-open .encounter-modal__card {
  transform: translateY(0);
}

/* Drag handle hint */
.encounter-modal__card::before {
  content: '';
  display: block;
  width: 40px; height: 4px;
  border-radius: 2px;
  background: rgba(44,36,32,0.18);
  margin: 0 auto var(--space-md);
}

/* ── Modal Header ── */
.encounter-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.encounter-tod {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #9A8880;
  text-transform: uppercase;
}
.encounter-close {
  background: var(--color-surface-dim);
  border: none;
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 0.75rem;
  color: #7A6A62;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.encounter-close:hover { background: var(--color-surface-warm); transform: scale(1.1); }

/* ── Sprites ── */
.encounter-modal__sprites {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-sm) 0;
}
.encounter-sprite {
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
.encounter-sprite--front {
  width: 128px; height: 128px;
  animation: poke-bob 2.2s ease-in-out infinite;
}
.encounter-sprite--back {
  width: 80px; height: 80px;
  opacity: 0.55;
  align-self: flex-end;
  animation: poke-bob 2.2s ease-in-out infinite 0.4s;
}

/* ── Info block ── */
.encounter-modal__info {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}
.encounter-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  color: #2C2420;
}
.encounter-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #9A8880;
  font-weight: 400;
  margin-left: 4px;
}
.encounter-types {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 2px;
}

/* ── Type badges ── */
.type-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
  color: #fff;
  background: #888;
}
/* Type colours — a selection of the most common Gen 1 types */
.type-badge--grass     { background: #5A9E4E; }
.type-badge--normal    { background: #A8A878; color: #fff; }
.type-badge--ghost     { background: #5C4E7A; }
.type-badge--psychic   { background: #C8437A; }
.type-badge--dark      { background: #3D3228; }
.type-badge--poison    { background: #9A4FA0; }
.type-badge--fire      { background: #D05030; }
.type-badge--water     { background: #3A7CC8; }
.type-badge--electric  { background: #C8A830; color: #333; }
.type-badge--rock      { background: #8C7040; }
.type-badge--ground    { background: #C09050; }
.type-badge--flying    { background: #7090D0; }
.type-badge--ice       { background: #5AAFC8; }
.type-badge--dragon    { background: #4858C8; }
.type-badge--fighting  { background: #A03828; }
.type-badge--bug       { background: #6E8A18; }

/* ── Stat bars ── */
.encounter-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: var(--space-md) 0;
}
.encounter-stat {
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  align-items: center;
  gap: var(--space-sm);
}
.encounter-stat__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: #9A8880;
  text-transform: uppercase;
}
.encounter-stat__bar-wrap {
  height: 7px;
  background: var(--color-surface-dim);
  border-radius: 4px;
  overflow: hidden;
}
.encounter-stat__bar {
  height: 100%;
  width: var(--bar-w, 50%);
  border-radius: 4px;
  background: var(--color-green);
  transition: width 0.8s var(--ease-out);
}
.encounter-stat__bar--atk { background: var(--color-red);    }
.encounter-stat__bar--def { background: #5A82C8; }

.encounter-stat__val {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4A3C38;
  text-align: right;
}

/* ── Modal action buttons ── */
.encounter-modal__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.encounter-btn { flex: 1; justify-content: center; }
.encounter-btn--run {
  background: var(--color-surface-warm);
  color: #7A6A62;
  border: 1.5px solid var(--color-surface-dim);
}
.encounter-btn--run:hover {
  background: var(--color-surface-dim);
  transform: translateY(-1px);
}

/* Shake animation for failed catch */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px);  }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px);  }
}
.shake { animation: shake 0.45s var(--ease-out); }


/* ══════════════════════════════════════════════
   BATTLE SCREEN OVERLAY
   Full-screen, high z-index, hidden by default.
══════════════════════════════════════════════ */

/* ── Visibility states ── */
.battle-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;           /* above everything including Leaflet (z 400) */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Entrance / exit */
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity    0.35s var(--ease-out),
    transform  0.35s var(--ease-out),
    visibility 0s    0s;
  visibility: visible;
}
.battle-screen.is-hidden {
  opacity: 0;
  transform: translateY(30px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity    0.3s  var(--ease-out),
    transform  0.3s  var(--ease-out),
    visibility 0s    0.3s;
}

/* ── Retro scanline effect ── */
.battle-scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
  );
}

/* ══════════════════════════════════════════════
   ARENA (top half)
══════════════════════════════════════════════ */
.battle-arena {
  flex: 1 1 55%;
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;

  /* Two-tone sky-to-ground gradient */
  background: linear-gradient(
    180deg,
    #2A3550 0%,         /* deep night-sky blue */
    #3D4F6E 45%,        /* horizon mist */
    #5E6B44 45%,        /* grass line */
    #4A5538 100%        /* dark turf */
  );
}

/* Subtle ground stripe decoration */
.arena-ground {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 45%;
  pointer-events: none;
}
.arena-ground__stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 24px,
    transparent 24px, transparent 48px
  );
}

/* ── Combatant wrapper ── */
.combatant {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

/* Enemy: upper-right quadrant */
.combatant--enemy {
  top: 12%;
  right: 4%;
  align-items: flex-end;
}

/* Player: lower-left quadrant */
.combatant--player {
  bottom: 6%;
  left: 4%;
  align-items: flex-start;
  flex-direction: column-reverse; /* sprite above panel when stacked */
}

/* ── Sprite stage ── */
.sprite-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sprite-stage--enemy  { width: 140px; height: 140px; }
.sprite-stage--player { width: 120px; height: 120px; }

/* Elliptical drop shadow on ground */
.sprite-shadow {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.28);
  filter: blur(5px);
}
.sprite-shadow--enemy  { width: 80px;  height: 14px; }
.sprite-shadow--player { width: 70px;  height: 12px; }

/* Battle sprites */
.battle-sprite {
  position: absolute;
  bottom: 6px;
  image-rendering: pixelated;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
}
.battle-sprite--enemy {
  width: 140px; height: 140px;
  animation: enemy-idle 3s ease-in-out infinite;
}
.battle-sprite--player {
  width: 120px; height: 120px;
  animation: player-idle 2.6s ease-in-out infinite 0.4s;
}

@keyframes enemy-idle {
  0%,100% { transform: translateY(0);    }
  50%      { transform: translateY(-7px);}
}
@keyframes player-idle {
  0%,100% { transform: translateY(0);    }
  50%      { transform: translateY(-5px);}
}

/* Hit flash for sprites */
.battle-sprite.hit-flash {
  animation: hit-flash 0.4s steps(1) !important;
}
@keyframes hit-flash {
  0%,100% { filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5)); opacity: 1;   }
  25%      { filter: brightness(10) invert(1);                opacity: 0.5; }
  50%      { filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5)); opacity: 1;   }
  75%      { filter: brightness(10) invert(1);                opacity: 0.5; }
}

/* Faint sprite on defeat */
.battle-sprite.fainted {
  filter: grayscale(1) opacity(0.3) !important;
  transform: translateY(20px) !important;
  transition: transform 0.5s var(--ease-out), filter 0.5s;
  animation: none !important;
}

/* ── Status panels ── */
.status-panel {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 180px;
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--color-accent);
  display: flex;
  flex-direction: column;
  gap: 6px;

  /* Subtle parchment ruled lines */
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 19px,
    rgba(44,36,32,0.05) 19px, rgba(44,36,32,0.05) 20px
  );
}
.status-panel--enemy { border-top-color: var(--color-red); }

/* Type badges row inside status panel */
.status-panel__type-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

/* Arena platform ellipses */
.arena-ground__enemy-platform {
  position: absolute;
  top: 18%; right: 12%;
  width: 130px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.22);
  filter: blur(4px);
}
.arena-ground__player-platform {
  position: absolute;
  bottom: 18%; left: 8%;
  width: 110px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
  filter: blur(4px);
}

.status-panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.status-panel__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: #2C2420;
  white-space: nowrap;
}
.status-panel__level {
  font-size: 0.7rem;
  color: #9A8880;
}

.status-panel__hp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-panel__hp-label {
  font-size: 0.65rem;
  color: #9A8880;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

/* HP bar track */
.hp-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--color-surface-dim);
  border-radius: 4px;
  overflow: hidden;
}

/* HP bar fill — colour shifts green → yellow → red */
.hp-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s var(--ease-out), background-color 0.5s;
  width: 100%;
  background: #5A8A5E;  /* healthy green */
}
.hp-bar.hp-bar--yellow { background: #C8A830; }
.hp-bar.hp-bar--red    { background: #C44B3A; }
.hp-bar.hp-bar--critical { background: #C44B3A; animation: hp-pulse 0.8s ease-in-out infinite; }

@keyframes hp-pulse {
  0%,100% { opacity: 1;   }
  50%      { opacity: 0.5; }
}

.status-panel__hp-numbers {
  font-size: 0.72rem;
  color: #4A3C38;
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: flex-end;
}
.status-panel__hp-sep { color: #9A8880; }


/* ══════════════════════════════════════════════
   CONTROL PAD (bottom half)
══════════════════════════════════════════════ */
.battle-controls {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-deep);
  border-top: 2px solid rgba(244,241,234,0.08);
  position: relative;
  z-index: 2;
}

/* ── Dialogue box ── */
.battle-dialogue {
  flex: 0 0 auto;
  padding: 14px var(--space-lg) 10px;
  min-height: 64px;
  border-bottom: 1px solid rgba(244,241,234,0.06);
  position: relative;
  display: flex;
  align-items: center;
}
#battle-dialogue-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-surface);
  line-height: 1.5;
  flex: 1;
  animation: dialogue-fade 0.3s var(--ease-out);
}
@keyframes dialogue-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Blinking advance cursor */
.dialogue-cursor {
  font-size: 0.65rem;
  color: var(--color-accent);
  animation: cursor-blink 1s step-end infinite;
  align-self: flex-end;
  margin-left: 6px;
  margin-bottom: 2px;
}
@keyframes cursor-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}
.dialogue-cursor.is-hidden { display: none; }

/* ── 2×2 button grid ── */
.battle-button-grid,
.battle-btn-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  padding: var(--space-sm);
  gap: var(--space-sm);
}

/* ── Chunky battle button base ── */
.battle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    transform   0.15s var(--ease-snap),
    box-shadow  0.15s var(--ease-out),
    filter      0.15s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;

  /* Tactile bottom-edge bevel */
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25);
}

/* Press effect */
.battle-btn:active:not(:disabled) {
  transform: translateY(3px) scale(0.97);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2);
}

/* Hover shimmer */
.battle-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* Disabled state */
.battle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.battle-btn__icon  { font-size: 1.5rem; line-height: 1; }
.battle-btn__label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: #fff;
}
.battle-btn__sub {
  font-size: 0.62rem;
  opacity: 0.75;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.8);
}

/* ── ATTACK — warm autumn red ── */
.battle-btn--attack {
  background: linear-gradient(160deg, #C8503A 0%, #A03828 100%);
  border: 1px solid rgba(200,80,58,0.6);
}
.battle-btn--attack:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 6px 20px rgba(200,80,58,0.4);
}

/* ── CATCH — amber/poké-ball red, hidden until HP < 50% ── */
.battle-btn--catch {
  background: linear-gradient(160deg, #D4403A 0%, #AA2020 100%);
  border: 1px solid rgba(212,64,58,0.5);
  grid-column: 2;
  grid-row: 1;
}
.battle-btn--catch:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 6px 20px rgba(212,64,58,0.5);
}

/* Hidden state — zero size so grid flows correctly */
.battle-btn--catch-hidden,
.battle-btn--locked {
  opacity: 0;
  transform: scale(0.7) translateY(10px);
  pointer-events: none;
  transition:
    opacity   0.4s var(--ease-snap),
    transform 0.4s var(--ease-snap);
  /* Keep grid slot but don't show */
  visibility: hidden;
}

/* Bounce-in when HP drops below 50% */
.battle-btn--catch-revealed {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
  visibility: visible;
  animation: catch-bounce-in 0.55s var(--ease-snap) both;
}
@keyframes catch-bounce-in {
  0%   { opacity: 0; transform: scale(0.5) translateY(16px); }
  60%  { transform: scale(1.08) translateY(-4px);             }
  80%  { transform: scale(0.97) translateY(2px);              }
  100% { opacity: 1; transform: scale(1) translateY(0);       }
}

/* ── INFO — muted slate ── */
.battle-btn--info {
  background: linear-gradient(160deg, #4A5568 0%, #374151 100%);
  border: 1px solid rgba(74,85,104,0.5);
}
.battle-btn--info:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

/* ── FLEE — slate grey ── */
.battle-btn--flee {
  background: linear-gradient(160deg, #64748B 0%, #475569 100%);
  border: 1px solid rgba(100,116,139,0.5);
}
.battle-btn--flee:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 6px 16px rgba(100,116,139,0.35);
}

/* ── XP gain flash strip ── */
.xp-flash {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-green));
  border-radius: 2px;
  animation: xp-flash-anim 1.2s var(--ease-out) forwards;
  pointer-events: none;
}
@keyframes xp-flash-anim {
  0%   { transform: scaleX(0); transform-origin: left; opacity: 1; }
  70%  { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ══════════════════════════════════════════════
   CATCH NOTIFICATION BANNER
   Parchment card that slides up inside the
   control pad area when a Pokémon is caught.
══════════════════════════════════════════════ */
.catch-notification {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg);

  /* Parchment surface */
  background: var(--color-surface);
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 23px,
    rgba(44,36,32,0.04) 23px, rgba(44,36,32,0.04) 24px
  );

  /* Entrance: starts translated down and invisible */
  opacity: 0;
  transform: translateY(100%);
  transition:
    opacity   0.4s var(--ease-out),
    transform 0.4s var(--ease-snap);
  pointer-events: none;

  /* Warm top border */
  border-top: 3px solid var(--color-accent);
}

.catch-notification--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Poké Ball icon — spins in */
.catch-notif__pokeball {
  font-size: 2.8rem;
  animation: ball-spin 0.6s var(--ease-snap) 0.1s both;
  flex-shrink: 0;
}
@keyframes ball-spin {
  from { transform: rotate(-180deg) scale(0.4); opacity: 0; }
  to   { transform: rotate(0deg)    scale(1);   opacity: 1; }
}

/* Text body */
.catch-notif__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.catch-notif__headline {
  font-family: var(--font-display);
  font-size: clamp(1rem, 4vw, 1.35rem);
  letter-spacing: 0.04em;
  color: #2C2420;
  animation: notif-slide 0.45s var(--ease-out) 0.15s both;
}

.catch-notif__rewards {
  display: flex;
  gap: var(--space-sm);
  animation: notif-slide 0.45s var(--ease-out) 0.25s both;
}

@keyframes notif-slide {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Reward pills */
.catch-notif__pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 100px;
  letter-spacing: 0.06em;
}
.catch-notif__pill--xp {
  background: rgba(90, 138, 94, 0.15);
  color: var(--color-green);
  border: 1px solid rgba(90, 138, 94, 0.35);
}
.catch-notif__pill--money {
  background: rgba(232, 168, 56, 0.15);
  color: #B87820;
  border: 1px solid rgba(232, 168, 56, 0.35);
}

/* Sparkle decoration */
.catch-notif__sparkles {
  font-size: 1.4rem;
  color: var(--color-accent);
  animation: sparkle-pulse 1s ease-in-out 0.3s infinite alternate;
  flex-shrink: 0;
}
@keyframes sparkle-pulse {
  from { transform: scale(0.9); opacity: 0.6; }
  to   { transform: scale(1.2); opacity: 1;   }
}

/* ── Damage number flyout ── */
.dmg-number {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.2rem;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  animation: dmg-float 1.1s var(--ease-out) forwards;
}
.dmg-number--enemy  { color: #FF6B6B; right: 20%; top: 30%; }
.dmg-number--player { color: #F0C070; left: 20%;  bottom: 45%; }
@keyframes dmg-float {
  0%   { opacity: 1; transform: translateY(0) scale(1.2); }
  30%  { opacity: 1; transform: translateY(-18px) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.8); }
}

/* ── Victory / defeat overlay ── */
.battle-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,18,24,0.7);
  backdrop-filter: blur(4px);
  animation: result-fade 0.4s var(--ease-out) both;
}
@keyframes result-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.battle-result-text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.5rem);
  letter-spacing: 0.08em;
  text-align: center;
  line-height: 1.2;
  animation: result-pop 0.5s var(--ease-snap) 0.1s both;
}
.battle-result-text--victory { color: var(--color-accent-soft); }
.battle-result-text--defeat  { color: #FF8888; }


/* ══════════════════════════════════════════════
   HUD — PC BOX LAUNCHER BUTTON
══════════════════════════════════════════════ */
.hud-pc-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(232, 168, 56, 0.35);
  background: rgba(232, 168, 56, 0.08);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease-snap);
}
.hud-pc-btn:hover {
  background: rgba(232, 168, 56, 0.18);
  border-color: rgba(232, 168, 56, 0.6);
  transform: translateY(-1px);
}
.hud-pc-btn:active { transform: scale(0.97); }
.hud-pc-btn__icon  { font-size: 0.95rem; }
.hud-pc-btn__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2C2420;
  font-weight: 600;
}


/* ══════════════════════════════════════════════
   PC BOX DRAWER
══════════════════════════════════════════════ */

/* Overlay shell */
.pc-drawer {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s var(--ease-out), visibility 0s 0s;
}
.pc-drawer.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), visibility 0s 0.3s;
}

/* Dimming backdrop */
.pc-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 24, 0.65);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

/* Sliding panel */
.pc-drawer__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100vw);
  height: 100%;
  background: #F9F6EE;   /* warm cream binder cover */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 48px rgba(0,0,0,0.35);
  transform: translateX(0);
  transition: transform 0.4s var(--ease-snap);

  /* Binder spine texture via repeating gradient */
  background-image:
    repeating-linear-gradient(
      0deg, transparent, transparent 29px,
      rgba(180, 160, 130, 0.12) 29px, rgba(180, 160, 130, 0.12) 30px
    );
}
.pc-drawer.is-hidden .pc-drawer__panel {
  transform: translateX(100%);
}

/* ── Drawer header ── */
.pc-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 2px solid rgba(180, 160, 130, 0.3);
  background: #F4F1EA;
  flex-shrink: 0;
}
.pc-drawer__title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.pc-drawer__icon { font-size: 1.4rem; }
.pc-drawer__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  color: #2C2420;
}
.pc-drawer__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.pc-drawer__count {
  font-size: 0.72rem;
  color: #9A8880;
  letter-spacing: 0.06em;
}
.pc-drawer__close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(44,36,32,0.15);
  background: var(--color-surface-warm);
  color: #7A6A62;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.15s var(--ease-snap);
}
.pc-drawer__close:hover {
  background: var(--color-surface-dim);
  transform: scale(1.1) rotate(90deg);
}

/* ── Binder tab strip ── */
.pc-tabs {
  display: flex;
  gap: 2px;
  padding: var(--space-sm) var(--space-lg) 0;
  border-bottom: 2px solid rgba(180, 160, 130, 0.25);
  flex-shrink: 0;
  background: #F4F1EA;
}
.pc-tab {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  padding: 6px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: 1.5px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #9A8880;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.pc-tab--active,
.pc-tab:hover {
  background: #F9F6EE;
  color: #2C2420;
  border-color: rgba(180, 160, 130, 0.3);
}

/* ── Card grid ── */
.pc-grid {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-md);
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(44,36,32,0.15) transparent;
}
.pc-grid::-webkit-scrollbar { width: 4px; }
.pc-grid::-webkit-scrollbar-thumb { background: rgba(44,36,32,0.15); border-radius: 4px; }

/* ── Individual Pokémon card ── */
.pc-card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm) var(--space-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 12px rgba(44,36,32,0.1), 0 1px 3px rgba(44,36,32,0.08);
  border: 1.5px solid rgba(180,160,130,0.2);
  position: relative;
  transition: transform 0.2s var(--ease-snap), box-shadow 0.2s;
  animation: card-in 0.4s var(--ease-out) both;
  cursor: default;
}
.pc-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(44,36,32,0.15);
}

/* Sticker-style level badge */
.pc-card__level {
  position: absolute;
  top: 8px; right: 8px;
  background: #2C2420;
  color: var(--color-accent-soft);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 100px;
  letter-spacing: 0.08em;
}

/* Sprite */
.pc-card__sprite {
  width: 72px; height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.12));
  animation: poke-bob 3s ease-in-out infinite;
}
.pc-card__sprite.is-fainted {
  filter: grayscale(1) opacity(0.45);
  animation: none;
}

/* Name */
.pc-card__name {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #2C2420;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Type badge row */
.pc-card__types {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.pc-card__types .type-badge {
  font-size: 0.55rem;
  padding: 2px 7px;
}

/* HP status bar */
.pc-card__hp-wrap {
  width: 100%;
  height: 5px;
  background: rgba(44,36,32,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}
.pc-card__hp-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s var(--ease-out);
  background: var(--color-green);
}
.pc-card__hp-bar.is-yellow   { background: #C8A830; }
.pc-card__hp-bar.is-red      { background: var(--color-red); }

.pc-card__hp-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: #9A8880;
  align-self: flex-start;
  margin-top: -4px;
}

/* ── Empty state ── */
.pc-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  text-align: center;
}
.pc-empty__icon { font-size: 3rem; opacity: 0.4; }
.pc-empty__text {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #9A8880;
}
.pc-empty__sub {
  font-size: 0.82rem;
  color: #BEB0A8;
  font-style: italic;
}


/* ══════════════════════════════════════════════
   LANDMARK POPUPS  (Pokémon Center + PokéMart)
══════════════════════════════════════════════ */

.landmark-popup {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s var(--ease-out), visibility 0s 0s;
}
.landmark-popup.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), visibility 0s 0.3s;
}
.landmark-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 24, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Shared card */
.landmark-popup__card {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg) var(--space-lg) calc(var(--space-xl) + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-snap);

  /* Drag handle hint */
  &::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    border-radius: 2px;
    background: rgba(44,36,32,0.15);
    margin-bottom: calc(var(--space-sm) - var(--space-md));
    align-self: center;
  }
}
.landmark-popup:not(.is-hidden) .landmark-popup__card {
  transform: translateY(0);
}

/* Color accent on top border by type */
.landmark-popup__card--center { border-top: 3px solid #E8A0B0; } /* pastel pink */
.landmark-popup__card--mart   { border-top: 3px solid #8AAAD4; } /* soft blue   */

.landmark-popup__icon  { font-size: 2.5rem; }
.landmark-popup__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: #2C2420;
  text-align: center;
}
.landmark-popup__desc {
  font-size: 0.88rem;
  color: #7A6A62;
  text-align: center;
  line-height: 1.6;
  font-style: italic;
}
.landmark-popup__stats {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}
.landmark-popup__stat {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #7A6A62;
  background: var(--color-surface-warm);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--color-surface-dim);
}
.landmark-popup__stat--accent { color: var(--color-green); border-color: rgba(90,138,94,0.35); }

.landmark-popup__actions {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
}
.landmark-btn {
  flex: 1;
  justify-content: center;
}
.landmark-btn--cancel {
  background: var(--color-surface-warm);
  color: #7A6A62;
  border: 1.5px solid var(--color-surface-dim);
}
.landmark-btn--cancel:hover {
  background: var(--color-surface-dim);
  transform: translateY(-1px);
}


/* ── Pokémon Center — heal flash ── */
@keyframes heal-flash {
  0%,100% { background: var(--color-surface); }
  40%     { background: rgba(232, 160, 176, 0.25); }
}
.landmark-popup__card--center.healing {
  animation: heal-flash 0.8s var(--ease-out);
}


/* ── PokéMart — shop UI ── */
.mart-wallet {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  background: var(--color-surface-warm);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-surface-dim);
}
.mart-wallet__label {
  font-size: 0.72rem;
  color: #9A8880;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mart-wallet__amount {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2C2420;
}

.mart-shop-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.mart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface-warm);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-surface-dim);
  transition: border-color 0.2s;
}
.mart-item:hover { border-color: #8AAAD4; }
.mart-item__info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.mart-item__icon { font-size: 1.4rem; }
.mart-item__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mart-item__name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #2C2420;
}
.mart-item__desc {
  font-size: 0.68rem;
  color: #9A8880;
  letter-spacing: 0.05em;
}
.mart-item__buy {
  background: #8AAAD4;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18);
  transition: filter 0.15s, transform 0.15s var(--ease-snap);
}
.mart-item__buy:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.mart-item__buy:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15); }
.mart-item__buy:disabled { opacity: 0.4; cursor: not-allowed; }

.mart-inventory {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.78rem;
  color: #7A6A62;
  padding: 0 2px;
}
.mart-inventory__label { font-style: italic; }
.mart-inventory__val   { font-weight: 600; color: #2C2420; }


/* ══════════════════════════════════════════════
   LANDMARK MAP MARKERS
══════════════════════════════════════════════ */

.landmark-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-snap);
}
.landmark-marker:hover { transform: scale(1.12) translateY(-2px); }

/* Pin body */
.landmark-marker__pin {
  width: 38px; height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  border: 2.5px solid rgba(255,255,255,0.25);
}
.landmark-marker__pin--center { background: #E8A0B0; }  /* pastel pink */
.landmark-marker__pin--mart   { background: #8AAAD4; }  /* soft blue   */

/* Icon inside pin — counter-rotate so it stays upright */
.landmark-marker__emoji {
  transform: rotate(45deg);
  font-size: 1.1rem;
  line-height: 1;
}

/* Label below pin */
.landmark-marker__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #fff;
  background: rgba(31,35,43,0.75);
  padding: 2px 7px;
  border-radius: 100px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

/* Range circle (30 m interaction zone) */
.landmark-marker__range {
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,0.3);
  pointer-events: none;
  animation: range-pulse 3s ease-in-out infinite;
}
@keyframes range-pulse {
  0%,100% { opacity: 0.5; transform: scale(1);    }
  50%      { opacity: 0.2; transform: scale(1.08); }
}




