:root {
  /* retro CRT palette — deep purple night with hot neon accents */
  --crt-bg: #0b021a;
  --crt-panel: #150631;
  --neon-pink: #ff5ad9;
  --neon-cyan: #33c9ff;
  --neon-green: #5be5b0;
  --neon-amber: #ffcf33;
  --neon-purple: #a855f7;
  --scanline: rgba(0,0,0,.25);
}
* { box-sizing: border-box; }

@keyframes flicker {
  0%,19%,21%,23%,80%,100% { opacity: 1; }
  20%,22% { opacity: .82; }
}
@keyframes hue-shift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
@keyframes crt-jit { 0%,100%{ transform:translate(0,0);} 25%{transform:translate(-1px,1px);} 50%{transform:translate(1px,-1px);} 75%{transform:translate(-1px,0);} }
@keyframes glitch-anim {
  0%   { clip-path: inset(0 0 85% 0); transform: translate(-2px,0); }
  20%  { clip-path: inset(50% 0 30% 0); transform: translate(2px,0); }
  40%  { clip-path: inset(20% 0 60% 0); transform: translate(-1px,0); }
  60%  { clip-path: inset(70% 0 5% 0); transform: translate(1px,0); }
  80%  { clip-path: inset(10% 0 75% 0); transform: translate(-2px,0); }
  100% { clip-path: inset(40% 0 40% 0); transform: translate(2px,0); }
}

body {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  background:
    radial-gradient(circle at 15% 0%, rgba(255,90,217,.18), transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(51,201,255,.15), transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,.12) 2px 4px),
    var(--crt-bg);
  color: #f0e9ff;
  -webkit-tap-highlight-color: transparent;
  image-rendering: pixelated;
}

/* Full-screen CRT scanline + vignette overlay */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
  mix-blend-mode: multiply;
  animation: flicker 6s infinite;
}
/* subtle rolling chromatic glow bar */
body::after {
  content:''; position: fixed; left:0; right:0; height: 120px; pointer-events:none; z-index:998;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.03), transparent);
  animation: roll 8s linear infinite;
}
@keyframes roll { 0%{ top:-120px;} 100%{ top:100%;} }

.title-font { font-family: 'Silkscreen', monospace; font-weight: 700; letter-spacing: 0; }
.pixel-font { font-family: 'Silkscreen', monospace; letter-spacing: .04em; }

/* body text can use the grotesque for readability but tinted */
p, .flavor, .era-tag, select, input, textarea { font-family: 'Bricolage Grotesque', sans-serif; }

/* ---- Chromatic aberration glitch title ---- */
.glitch { position: relative; text-shadow: 2px 0 var(--neon-pink), -2px 0 var(--neon-cyan); }
.glitch::before, .glitch::after {
  content: attr(data-txt);
  position: absolute; left: 0; top: 0; width: 100%; overflow: hidden;
}
.glitch::before { color: var(--neon-cyan); animation: glitch-anim 2.6s infinite linear alternate; left: 2px; }
.glitch::after  { color: var(--neon-pink); animation: glitch-anim 3.1s infinite linear alternate; left: -2px; }
.glitch-txt { text-shadow: 1px 0 var(--neon-pink), -1px 0 var(--neon-cyan); }

/* pixel sprites: crisp mc_item icons, square, with chromatic drop shadow */
.pixel-sprite { image-rendering: pixelated; display: block; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(1px 0 rgba(255,90,217,.6)) drop-shadow(-1px 0 rgba(51,201,255,.6)); }
.crt-jitter { animation: crt-jit .5s steps(2) infinite; }
.badge-live { animation: bob 2s ease-in-out infinite; }

/* ---- Header (CRT console bar) ---- */
.pkdx-header {
  background: linear-gradient(180deg, #2a0a55 0%, #1a0538 100%);
  border-bottom: 3px solid var(--neon-pink);
  box-shadow: 0 3px 0 #0a0220, 0 4px 20px rgba(255,90,217,.35);
}
.lens {
  width: 46px; height: 46px; border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.3) 0 2px, transparent 2px 4px),
    radial-gradient(circle at 35% 30%, #7ff0ff, #33c9ff 55%, #0a4a7a);
  border: 3px solid var(--neon-cyan); position: relative; flex-shrink: 0;
  box-shadow: 0 0 14px var(--neon-cyan);
  image-rendering: pixelated;
}
.lens-shine { position:absolute; top:5px; left:7px; width:10px; height:6px; background:rgba(255,255,255,.9); }
.dot { width:9px; height:9px; display:inline-block; box-shadow:0 0 8px currentColor; animation: flicker 3s infinite; }
.dot:nth-child(2){ animation-delay:.6s; } .dot:nth-child(3){ animation-delay:1.2s; }

/* ---- Buttons ---- */
.btn-pk {
  background: linear-gradient(180deg, var(--neon-pink), #c22aa0);
  color:#fff; font-weight:700; border:2px solid #fff; border-radius:0;
  padding:12px 16px; cursor:pointer; box-shadow:4px 4px 0 #0a0220, 0 0 12px rgba(255,90,217,.5);
  font-family:'Silkscreen',monospace; letter-spacing:.04em; text-transform:uppercase; font-size:12px;
  transition:transform .06s, box-shadow .06s;
}
.btn-pk:active { transform:translate(3px,3px); box-shadow:1px 1px 0 #0a0220; }
.btn-pk:disabled { opacity:.45; }
.btn-ghost {
  background:rgba(51,201,255,.08); color:var(--neon-cyan); border:2px solid var(--neon-cyan);
  border-radius:0; padding:12px 16px; cursor:pointer; font-weight:700; font-family:'Silkscreen',monospace;
  font-size:11px; text-transform:uppercase; box-shadow:3px 3px 0 #0a0220;
}
.btn-ghost:active { transform:translate(2px,2px); box-shadow:1px 1px 0 #0a0220; }

.card-soft { background:var(--crt-panel); border:2px solid rgba(51,201,255,.35); border-radius:0;
  box-shadow: inset 0 0 24px rgba(51,201,255,.06), 3px 3px 0 rgba(0,0,0,.5); }

/* ---- Viewfinder ---- */
.viewfinder {
  position:relative; height:340px; border-radius:0; cursor:pointer;
  background:
    repeating-linear-gradient(0deg, rgba(51,201,255,.05) 0 3px, transparent 3px 6px),
    radial-gradient(circle at 50% 45%, #12184a, #05010f);
  border:2px solid var(--neon-cyan);
  display:flex; align-items:center; justify-content:center; overflow:hidden;
  box-shadow: inset 0 0 40px rgba(51,201,255,.15), 0 0 18px rgba(51,201,255,.3);
}
.viewfinder:active { transform:scale(.99); }
.corner { position:absolute; width:32px; height:32px; border:3px solid var(--neon-amber); }
.corner.tl{ top:14px; left:14px; border-right:none; border-bottom:none;}
.corner.tr{ top:14px; right:14px; border-left:none; border-bottom:none;}
.corner.bl{ bottom:14px; left:14px; border-right:none; border-top:none;}
.corner.br{ bottom:14px; right:14px; border-left:none; border-top:none;}
.scanline { position:absolute; left:0; right:0; height:3px;
  background:linear-gradient(90deg,transparent,var(--neon-green),transparent);
  animation:scan 2.4s linear infinite; box-shadow:0 0 14px var(--neon-green); }
@keyframes scan { 0%{top:6%} 50%{top:92%} 100%{top:6%} }

/* ---- CRT loader (was pokeball) ---- */
.pokeball-spin {
  width:60px; height:60px; border-radius:0;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.35) 3px 6px),
    conic-gradient(var(--neon-pink), var(--neon-cyan), var(--neon-green), var(--neon-amber), var(--neon-pink));
  border:3px solid #fff; position:relative; animation:spin .9s steps(8) infinite;
  box-shadow:0 0 18px var(--neon-pink);
}
.pokeball-spin::after { content:''; position:absolute; top:50%; left:50%; width:16px; height:16px; margin:-8px; background:#0b021a; border:3px solid #fff; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ---- Cards ---- */
.trade-card, .modal-card { background:var(--crt-panel); border:3px solid #555; border-radius:0; padding:14px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.4); }
.dex-card { background:var(--crt-panel); border:2px solid #444; border-radius:0; overflow:hidden; transition:transform .1s;
  box-shadow:2px 2px 0 rgba(0,0,0,.6); }
.dex-card:active { transform:translate(2px,2px); }
.dex-card.locked { border-style:dashed; opacity:.55; }
.dex-card img { image-rendering:auto; }
.rarity-badge { color:#0b021a; font-weight:700; font-size:10px; padding:2px 8px; border-radius:0;
  font-family:'Silkscreen',monospace; text-transform:uppercase; }
.era-tag { background:rgba(255,90,217,.12); border:1px solid var(--neon-pink); border-radius:0; padding:2px 8px; font-size:11px; color:#ffc9f2; }
.flavor { border-left:3px solid var(--neon-amber); padding-left:8px; }

/* ---- Modal ---- */
.modal-backdrop { position:fixed; inset:0; background:rgba(5,1,15,.8); backdrop-filter:blur(2px); z-index:50; display:flex; align-items:center; justify-content:center; padding:16px; }
.modal-card { position:relative; max-width:440px; width:100%; max-height:88vh; overflow:auto;
  box-shadow: 6px 6px 0 rgba(0,0,0,.6), 0 0 30px rgba(255,90,217,.4); }

/* ---- XP / badges ---- */
.xp-bar { height:12px; background:rgba(255,255,255,.08); border:1px solid rgba(51,201,255,.3); border-radius:0; overflow:hidden;
  background-image: repeating-linear-gradient(90deg, transparent 0 3px, rgba(0,0,0,.2) 3px 4px); }
.xp-bar.mini { height:7px; }
.xp-fill { height:100%; background:repeating-linear-gradient(90deg, var(--neon-amber) 0 4px, #ff9d2e 4px 6px); border-radius:0; transition:width .5s steps(10); box-shadow:0 0 8px var(--neon-amber); }
.badge { background:var(--crt-panel); border:2px solid rgba(51,201,255,.25); border-radius:0; padding:12px; text-align:center; box-shadow:2px 2px 0 rgba(0,0,0,.5); }
.badge.earned { border-color:var(--neon-amber); box-shadow:2px 2px 0 rgba(0,0,0,.5), 0 0 16px rgba(255,207,51,.4); }
.badge.locked .pixel-sprite { filter: grayscale(1) brightness(.5); }
@keyframes bob { 50%{ transform:translateY(-4px); } }
.avatar-px { border:3px solid var(--neon-pink); box-shadow:0 0 12px var(--neon-pink); image-rendering:pixelated; }

/* ---- Tabbar ---- */
.tabbar { position:fixed; bottom:0; left:0; right:0; z-index:40; display:flex; justify-content:space-around;
  background:#100428; border-top:3px solid var(--neon-pink); padding:6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow:0 -3px 0 #0a0220; }
.tab { display:flex; flex-direction:column; align-items:center; gap:2px; background:none; border:none; color:#7a6b9e; cursor:pointer; padding:6px 8px; border-radius:0; font-family:'Silkscreen',monospace; }
.tab .tab-icon { filter: grayscale(.6) brightness(.7); }
.tab.active { color:#fff; background:rgba(255,90,217,.2); box-shadow: inset 0 0 12px rgba(255,90,217,.3); }
.tab.active .tab-icon { filter:none; transform:scale(1.1); }

/* ---- Toast ---- */
.toast { position:fixed; top:80px; left:50%; transform:translateX(-50%); z-index:60;
  background:var(--neon-amber); color:#0b021a; padding:10px 18px; border:2px solid #fff; border-radius:0; font-weight:700;
  box-shadow:4px 4px 0 rgba(0,0,0,.6), 0 0 20px rgba(255,207,51,.6); animation:toastin .25s steps(3); text-align:center; max-width:90%;
  text-transform:uppercase; letter-spacing:.04em; text-shadow: 1px 0 rgba(255,90,217,.4), -1px 0 rgba(51,201,255,.4); }
@keyframes toastin { from{ opacity:0; transform:translate(-50%,-10px);} to{ opacity:1; transform:translate(-50%,0);} }

/* ---- Confetti (pixel blocks) ---- */
.confetti-layer { position:fixed; inset:0; pointer-events:none; z-index:70; overflow:hidden; }
.confetti { position:absolute; top:-10px; width:8px; height:8px; border-radius:0; image-rendering:pixelated; animation:fall 1.8s steps(12) forwards; box-shadow:0 0 6px currentColor; }
@keyframes fall { to { top:110%; transform:rotate(720deg); } }

.fade-in { animation:fadein .3s steps(4); }
@keyframes fadein { from{ opacity:0; transform:translateY(8px);} to{ opacity:1; transform:none;} }

.line-clamp-4 { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }

/* inputs / selects retro */
input, select, textarea {
  background:#0d0320 !important; border:2px solid rgba(51,201,255,.4) !important; color:#f0e9ff !important;
  border-radius:0 !important;
}
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--neon-pink) !important; box-shadow:0 0 10px rgba(255,90,217,.4); }

/* leaflet popup retro tweak */
.leaflet-popup-content-wrapper { border-radius:0; background:#150631; color:#f0e9ff; border:2px solid var(--neon-cyan); font-family:'Silkscreen',monospace; font-size:11px; }
.leaflet-popup-tip { background:#150631; }
.leaflet-container { background:#05010f; }
.pokestop { width:20px; height:20px; background:var(--neon-green); border:2px solid #fff; box-shadow:0 0 10px var(--neon-green); image-rendering:pixelated; }
</parameter>