/* $POKEMON — styles */
:root {
  --bg: #0b0b0d; --surface: #131316; --surface-2: #1a1a1f; --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f4f5; --muted: #8b8b95; --accent: #ffcb05; --accent-ink: #1a1400; --green: #34d399; --red: #f87171;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 12px; --r-lg: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1280px; }
#fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45em; padding: 0.7em 1.1em; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; font-size: 0.92rem; transition: background 120ms, border-color 120ms, transform 120ms; white-space: nowrap; }
.btn:hover { background: #222228; border-color: rgba(255,255,255,0.22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #ffd53a; border-color: #ffd53a; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 0.45em 0.8em; font-size: 0.82rem; border-radius: 8px; }
kbd { font-family: var(--mono); font-size: 0.72em; padding: 0.15em 0.45em; border-radius: 5px; background: rgba(255,255,255,0.08); border: 1px solid var(--line-2); color: var(--text); }
.link { color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.link:hover { color: var(--text); }

/* Music toggle + hidden YouTube player */
.music-btn { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.4em 0.75em; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.8rem; transition: color 120ms, border-color 120ms; }
.music-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.22); }
.music-btn.on { color: var(--text); border-color: rgba(255,203,5,0.5); }
.music-btn .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.music-btn .eq b { display: block; width: 3px; height: 4px; border-radius: 1px; background: currentColor; opacity: 0.6; }
.music-btn.on .eq b { background: var(--accent); opacity: 1; animation: eq 0.9s ease-in-out infinite; }
.music-btn.on .eq b:nth-child(2) { animation-delay: 0.15s; }
.music-btn.on .eq b:nth-child(3) { animation-delay: 0.3s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 12px; } }
.yt-hidden { position: fixed; right: 0; bottom: 0; width: 2px; height: 2px; opacity: 0.02; pointer-events: none; overflow: hidden; }
.yt-hidden iframe { width: 2px; height: 2px; border: 0; }
@media (max-width: 560px) { .music-btn span { display: none; } .music-btn { padding: 0.5em 0.6em; } }

/* Nav */
.nav { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 24px; background: rgba(11,11,13,0.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.nav-links { display: flex; gap: 1.4rem; font-weight: 500; color: var(--muted); font-size: 0.92rem; }
.nav-links a:hover { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 0.9rem; }
.online { display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.online i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }

/* Hero */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; padding-top: 6rem; padding-bottom: 4rem; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 1.2rem; }
h1 { font-size: clamp(2.4rem, 5.2vw, 4.2rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.035em; }
.sub { color: var(--muted); font-size: 1.08rem; margin: 1.4rem 0 1.6rem; max-width: 34rem; }
.ca { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.5rem 0.5rem 0.9rem; max-width: 36rem; margin-bottom: 1.1rem; }
.ca-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; }
.ca code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero > *, .arena > *, .arena-main > * { min-width: 0; }
.copy { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 0.35em 0.7em; font-size: 0.8rem; font-weight: 600; }
.copy:hover { background: #222228; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1.3rem 1rem; }
.stat-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }
.stat-head img { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.stat-name { font-weight: 700; }
.stat-sub { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 0.4em; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.live.off { background: var(--muted); }
.price-row { display: flex; align-items: baseline; gap: 0.7rem; }
.price { font-family: var(--mono); font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }
.chip { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; padding: 0.15em 0.5em; border-radius: 6px; background: rgba(255,255,255,0.06); }
.chip.up { color: var(--green); background: rgba(52,211,153,0.12); }
.chip.down { color: var(--red); background: rgba(248,113,113,0.12); }
#sparkline { width: 100%; height: 56px; margin: 0.6rem 0 0.8rem; display: block; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; margin: 0; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.stat-grid dt { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.stat-grid dd { margin: 0; font-family: var(--mono); font-weight: 600; font-size: 0.98rem; }

/* Sections */
.section { padding: 3.5rem 24px; }
.section-head { margin-bottom: 1.4rem; }
.section-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
h2 { font-size: 1.5rem; font-weight: 700; }
.lead { color: var(--muted); max-width: 44rem; margin-top: 0.4rem; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.tabs button { background: transparent; border: 0; padding: 0.35em 0.8em; border-radius: 7px; font-weight: 600; font-size: 0.82rem; color: var(--muted); }
.tabs button.on { background: var(--surface-2); color: var(--text); }

/* Chart */
.chart-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); height: 420px; overflow: hidden; }
#chart-canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.chart-tooltip { position: absolute; top: 12px; left: 12px; pointer-events: none; font-family: var(--mono); font-size: 0.75rem; background: rgba(11,11,13,0.9); border: 1px solid var(--line-2); border-radius: 8px; padding: 0.5rem 0.7rem; display: grid; gap: 2px; }
.chart-tooltip b { color: var(--muted); font-weight: 500; margin-right: 0.4em; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.9rem; pointer-events: none; }
.proof-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-top: 0.8rem; }
.proof { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem 1rem; display: flex; align-items: center; gap: 0.8rem; }
.proof i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-style: normal; font-weight: 800; background: rgba(52,211,153,0.15); color: var(--green); flex-shrink: 0; }
.proof.warn i { background: rgba(248,113,113,0.15); color: var(--red); }
.proof.info i { background: rgba(255,255,255,0.08); color: var(--muted); }
.proof b { display: block; font-size: 0.9rem; }
.proof span { display: block; font-size: 0.75rem; color: var(--muted); }

/* Lore */
.lore { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 2rem; align-items: start; }
.lore-figure { margin: 0; }
.lore-frame { display: block; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 0.6rem; box-shadow: 0 0 0 4px rgba(255,203,5,0.08), 0 30px 60px rgba(0,0,0,0.45); transition: transform 150ms, box-shadow 150ms; }
a.lore-frame[href]:hover { transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(255,203,5,0.18), 0 34px 64px rgba(0,0,0,0.5); }
.lore-frame img { width: 100%; height: auto; border-radius: 10px; display: block; }
.lore-figure figcaption { margin-top: 0.7rem; font-size: 0.8rem; color: var(--muted); font-weight: 500; text-align: center; }
.lore-chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.lore-chapters li { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1.3rem; }
.lore-chapters .num { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,203,5,0.12); color: var(--accent); font-family: var(--mono); font-weight: 600; font-size: 0.8rem; }
.lore-chapters h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.lore-chapters p { color: var(--muted); font-size: 0.95rem; }
.lore-chapters p b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.lore-right { display: grid; gap: 0.8rem; min-width: 0; }
.lore-video { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem 1.1rem; }
.lore-video-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.lore-video-head h3 { font-size: 0.95rem; }
.lore-video-head span { color: var(--muted); font-size: 0.85rem; }
.lore-video video { display: block; width: 100%; max-height: 420px; border-radius: 10px; background: #000; border: 1px solid var(--line-2); }

/* About */
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.cols > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.3rem; }
.cols h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.cols p { color: var(--muted); font-size: 0.93rem; }

/* Arena */
.controls { display: flex; gap: 0.9rem; color: var(--muted); font-size: 0.8rem; font-weight: 500; align-items: center; }
.arena { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.arena-main { min-width: 0; }
.arena-screen { position: relative; background: #000; border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 800 / 480; }
#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8,8,10,0.78); backdrop-filter: blur(4px); z-index: 5; padding: 1rem; overflow: auto; }
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 1.3rem; width: min(560px, 100%); }
.join-card h3 { font-size: 1.05rem; margin-bottom: 1rem; text-align: center; }
.starter-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
.starter { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 0.7rem 0.4rem 0.6rem; text-align: center; display: grid; justify-items: center; gap: 0.25rem; transition: border-color 120ms, transform 120ms; }
.starter:hover { transform: translateY(-2px); }
.starter.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,203,5,0.18); }
.starter img { width: 72px; height: 72px; image-rendering: auto; }
.starter b { font-size: 0.85rem; }
.type { display: inline-block; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.15em 0.5em; border-radius: 999px; background: var(--t, #666); color: #111; margin-right: 0.2em; }
.types { display: inline-flex; gap: 0.2em; }
.join-row { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; }
.join-row input:not([type=color]) { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 0.6rem 0.8rem; }
.join-row input:focus { outline: none; border-color: var(--accent); }
.join-row input[type=color] { width: 44px; height: 100%; min-height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); padding: 3px; }
.join-error { color: var(--red); font-size: 0.82rem; min-height: 1.3em; margin-top: 0.5rem; text-align: center; }

.enc-card { text-align: center; width: min(460px, 100%); }
.enc-stage { position: relative; height: 150px; display: grid; place-items: center; background: radial-gradient(circle at 50% 85%, rgba(52,211,153,0.25), transparent 60%); border-radius: var(--r); margin-bottom: 0.8rem; }
.enc-sprite img { height: 120px; width: auto; image-rendering: pixelated; animation: bob 1.4s ease-in-out infinite; }
.enc-sprite.shake img { animation: shake 0.4s ease-in-out 1; }
.enc-sprite.caught img { animation: shrink 0.5s forwards; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes shake { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes shrink { to { transform: scale(0.1); opacity: 0; } }
.enc-ball { position: absolute; left: 50%; bottom: 10px; width: 40px; height: 40px; transform: translateX(-50%); opacity: 0; }
.enc-ball canvas { image-rendering: pixelated; width: 40px; height: 40px; }
.enc-ball.throw { animation: throwball 0.55s cubic-bezier(.3,1.4,.6,1) forwards; }
.enc-ball.wobble { opacity: 1; animation: ballwobble 0.5s ease-in-out 3; }
@keyframes throwball { 0% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 1; transform: translate(-50%, -76px) scale(0.8) rotate(360deg); } }
@keyframes ballwobble { 0%, 100% { transform: translate(-50%, -76px) rotate(0); } 25% { transform: translate(-50%, -76px) rotate(-25deg); } 75% { transform: translate(-50%, -76px) rotate(25deg); } }
.enc-card h3 { font-size: 1rem; display: flex; justify-content: center; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.shiny-tag { color: var(--accent); font-size: 0.8rem; font-weight: 700; }
.enc-bar { position: relative; height: 18px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; margin: 0.9rem 0 0.5rem; }
.enc-bar .zone { position: absolute; top: 0; bottom: 0; left: 35%; width: 30%; background: rgba(52,211,153,0.35); }
.enc-bar .zone-perfect { position: absolute; top: 0; bottom: 0; left: 47%; width: 6%; background: var(--accent); }
.enc-bar .cursor { position: absolute; top: -2px; bottom: -2px; width: 4px; background: #fff; border-radius: 2px; box-shadow: 0 0 6px #fff; left: 0; }
.enc-msg { color: var(--muted); font-size: 0.88rem; min-height: 1.4em; }
.enc-actions { display: flex; gap: 0.5rem; justify-content: center; align-items: center; margin-top: 0.8rem; }
.enc-throws { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }

.evo { text-align: center; }
.evo-sprite img { height: 140px; width: auto; image-rendering: pixelated; animation: evoflash 0.5s ease-in-out infinite alternate; }
#evo-overlay.done .evo-sprite img { animation: evopop 0.5s ease-out 1; filter: none; }
@keyframes evoflash { from { filter: brightness(1); } to { filter: brightness(6) saturate(0); } }
@keyframes evopop { from { transform: scale(0.6); } to { transform: scale(1); } }
.evo-text { margin-top: 1rem; font-weight: 600; font-size: 1.05rem; }

.battle { width: min(820px, 100%); display: grid; gap: 0.7rem; }
.field { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; background: linear-gradient(180deg, #1f2937 0%, #27364a 45%, #3f6b3b 45%, #2f5a2c 100%); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 1rem; min-height: 230px; }
.side { display: flex; align-items: center; gap: 1rem; }
.side.foe { align-self: start; }
.side.me { justify-content: flex-end; align-self: end; }
.battle-sprite img { height: 128px; width: auto; image-rendering: pixelated; }
.battle-sprite.hit img { animation: hitflash 0.4s ease-in-out 2; }
.battle-sprite.faint img { animation: faint 0.8s forwards; }
@keyframes hitflash { 50% { opacity: 0.2; transform: translateX(6px); } }
@keyframes faint { to { transform: translateY(40px); opacity: 0; } }
.hp-box { background: rgba(11,11,13,0.85); border: 1px solid var(--line-2); border-radius: var(--r); padding: 0.55rem 0.8rem; min-width: 200px; }
.hp-name { display: flex; justify-content: space-between; gap: 0.6rem; font-weight: 700; font-size: 0.9rem; }
.hp-name small { color: var(--muted); font-weight: 500; }
.hp-name .lv { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.hp-box .types { margin: 0.2rem 0 0.35rem; }
.hp-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden; }
.hp-fill { height: 100%; width: 100%; background: var(--green); transition: width 500ms, background 300ms; }
.hp-text { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: right; margin-top: 0.25rem; }
.console { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 0.8rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.battle-log { background: var(--bg); border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.85rem; max-height: 130px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.2rem; }
.battle-log .ev { animation: fadein 250ms; }
.battle-log .super { color: var(--accent); }
.battle-log .weak { color: var(--muted); }
.battle-log .sys { color: #93c5fd; }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } }
.battle-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.move-btn { background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--t); border-radius: 10px; padding: 0.5rem 0.7rem; text-align: left; display: grid; gap: 0.15rem; transition: background 120ms; }
.move-btn:hover:not(:disabled) { background: #222228; }
.move-btn:disabled { opacity: 0.4; cursor: default; }
.mv-name { font-weight: 700; font-size: 0.9rem; }
.mv-meta { font-size: 0.72rem; color: var(--muted); display: flex; align-items: center; gap: 0.4em; }
.battle-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

.challenge { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; padding: 0.5rem 0.8rem; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.toasts { position: absolute; left: 12px; top: 12px; z-index: 4; display: flex; flex-direction: column; gap: 0.4rem; pointer-events: none; max-width: 70%; }
.toast { background: rgba(11,11,13,0.9); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: 9px; padding: 0.4rem 0.7rem; font-weight: 600; font-size: 0.8rem; animation: toastin 250ms ease-out; transition: opacity 400ms; }
.toast.out { opacity: 0; }
.toast.legendary { border-left-color: #c084fc; }
.toast.shiny { border-left-color: var(--accent); }
.toast.battle { border-left-color: var(--red); }
.toast.error { border-left-color: var(--red); }
.toast.info, .toast.catch, .toast.evolve { border-left-color: var(--green); }
@keyframes toastin { from { opacity: 0; transform: translateX(-10px); } }

/* On-screen controls under the arena (touch devices and phones) */
.gb-controls { display: none; grid-template-columns: auto 1fr auto; grid-template-areas: 'dpad ss ab'; align-items: center; gap: 1rem; padding: 0.9rem 0.9rem 0.7rem; background: #141417; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); position: relative; }
.touch .gb-controls { display: grid; }
.touch .arena-screen { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.dpad { grid-area: dpad; position: relative; display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); }
.dpad button, .dpad-center { background: #202026; border: 0; font-size: 0; box-shadow: inset 0 -3px 0 #0d0d10; touch-action: none; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.dpad button::after { font-size: 10px; color: #5c5c66; }
.dpad button[data-dir="up"] { grid-column: 2; grid-row: 1; border-radius: 8px 8px 0 0; }
.dpad button[data-dir="up"]::after { content: '▲'; }
.dpad button[data-dir="left"] { grid-column: 1; grid-row: 2; border-radius: 8px 0 0 8px; }
.dpad button[data-dir="left"]::after { content: '◀'; }
.dpad button[data-dir="right"] { grid-column: 3; grid-row: 2; border-radius: 0 8px 8px 0; }
.dpad button[data-dir="right"]::after { content: '▶'; }
.dpad button[data-dir="down"] { grid-column: 2; grid-row: 3; border-radius: 0 0 8px 8px; }
.dpad button[data-dir="down"]::after { content: '▼'; }
.dpad-center { grid-column: 2; grid-row: 2; box-shadow: none; }
.dpad button:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 #0d0d10; }
.ab { grid-area: ab; display: flex; gap: 1rem; align-items: flex-end; }
.gb-key { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.gb-key small { font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.gb-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 1rem; box-shadow: 0 4px 0 #8a6d00; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
#b-btn { background: #2a2a30; color: #fff; box-shadow: 0 4px 0 #101013; }
.gb-btn:active { transform: translateY(3px); box-shadow: none; }
.ss { grid-area: ss; display: flex; justify-content: center; gap: 1.4rem; }
.pill-btn { width: 46px; height: 14px; border-radius: 999px; border: 0; background: #3a3a42; box-shadow: 0 3px 0 #1a1a1e; transform: rotate(-22deg); -webkit-tap-highlight-color: transparent; }
.pill-btn:active { transform: rotate(-22deg) translateY(2px); box-shadow: none; }

.chat { margin-top: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0.6rem; }
.chat-log { height: 120px; overflow-y: auto; font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.15rem; padding: 0.2rem 0.4rem; }
.chat-log .msg b { font-weight: 700; margin-right: 0.3em; }
.chat-log .sys { color: var(--muted); font-size: 0.8rem; }
.chat-row { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.chat-row input { flex: 1; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 0.5rem 0.8rem; font-size: 0.88rem; }
.chat-row input:focus { outline: none; border-color: var(--accent); }

.arena-side { display: grid; gap: 0.8rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0.85rem 0.95rem; }
.panel h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.6rem; font-weight: 600; }
.panel h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.8; margin-left: 0.3em; }
img.mon { image-rendering: pixelated; display: inline-block; vertical-align: middle; flex-shrink: 0; }
i.shiny { color: var(--accent); font-style: normal; font-size: 0.75em; margin-left: 0.15em; }
.me-card { display: flex; align-items: center; gap: 0.7rem; font-size: 0.85rem; }
.me-name { font-weight: 700; }
.me-name .lv { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; font-weight: 500; margin-left: 0.3em; }
.me-stats { display: flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }
.party { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.party-mon { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.3rem; display: grid; place-items: center; width: 62px; position: relative; }
.party-mon small { font-size: 0.6rem; color: var(--muted); font-weight: 600; }
.party-mon.active { border-color: var(--accent); }
.party-mon.active::after { content: ''; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.party-mon i.shiny { position: absolute; top: 3px; left: 6px; }
.party-empty { display: grid; place-items: center; width: 62px; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 0.65rem; color: var(--muted); }
.nearby-list { display: grid; gap: 0.4rem; font-size: 0.85rem; }
.nearby { display: flex; align-items: center; gap: 0.5rem; }
.nearby .nm { flex: 1; font-weight: 600; }
.nearby small { color: var(--muted); font-family: var(--mono); font-weight: 500; }
.lb { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; font-size: 0.85rem; }
.lb li { display: flex; align-items: center; gap: 0.5rem; }
.lb .rank { width: 1.2em; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.lb .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pts { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.lb li.me .nm { color: var(--accent); }

/* Evolution roadmap */
.evo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
.evo-stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1rem 1rem; text-align: center; position: relative; }
.evo-stage img { width: 96px; height: 96px; margin: 0 auto 0.6rem; object-fit: contain; }
.evo-stage.locked img { filter: brightness(0) invert(0.25); }
.evo-stage.current { border-color: var(--accent); }
.evo-stage .tag { position: absolute; top: 10px; right: 10px; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.evo-stage.current .tag { color: var(--accent); }
.evo-stage.done .tag { color: var(--green); }
.evo-stage b { display: block; font-size: 0.95rem; }
.evo-stage .mcap { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin: 0.15rem 0 0.4rem; }
.evo-stage p { font-size: 0.8rem; color: var(--muted); }
.evo-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 999px; margin-top: 0.8rem; overflow: hidden; }
.evo-bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 1.2s cubic-bezier(.2,.8,.2,1); }

/* Community */
.social-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; }
.social { display: flex; align-items: center; gap: 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem; transition: border-color 120ms, transform 120ms; }
.social:hover { border-color: var(--line-2); transform: translateY(-2px); }
.social .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.1rem; }
.social b { display: block; font-size: 0.95rem; }
.social span { display: block; color: var(--muted); font-size: 0.8rem; }

.footer { padding: 3rem 24px 3.5rem; border-top: 1px solid var(--line); margin-top: 2rem; color: var(--muted); font-size: 0.8rem; display: grid; gap: 0.6rem; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 600ms ease, transform 600ms ease; }
.reveal.in { opacity: 1; transform: none; }

/* Responsive */
@media (max-width: 1000px) {
  .arena { grid-template-columns: 1fr; }
  .arena-side { grid-template-columns: 1fr 1fr; }
  .proof-grid { grid-template-columns: repeat(2, 1fr); }
  .evo-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 3.5rem; gap: 2rem; }
  .nav-links { display: none; }
  .cols { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); gap: 1rem 0; }
  .steps::before { display: none; }
  .console { grid-template-columns: 1fr; }
  .field { min-height: 190px; }
  .battle-sprite img { height: 96px; }
  .hp-box { min-width: 150px; }
  .starter-picker { grid-template-columns: repeat(2, 1fr); }
  .chart-wrap { height: 320px; }
  .controls { display: none; }
}
@media (max-width: 560px) {
  .section { padding: 2.5rem 20px; }
  .container { padding: 0 20px; }
  .arena-side { grid-template-columns: 1fr; }
  .proof-grid, .evo-row { grid-template-columns: 1fr; }
  .join-row { grid-template-columns: 1fr auto; }
  .join-row .btn { grid-column: 1 / -1; }
  .price { font-size: 1.6rem; }
  .online { display: none; }
}
/* ===================================================================== PHONES ===================================================================== */
@media (max-width: 820px) {
  .container { padding: 0 18px; }
  .section { padding: 2.4rem 18px; }
  .section-head { margin-bottom: 1rem; }
  .section-head.row { gap: 0.7rem 1rem; }
  .hero { padding-top: 2.6rem; padding-bottom: 1.6rem; gap: 1.6rem; }
  .eyebrow { margin-bottom: 0.9rem; }
  h1 { font-size: 2.25rem; }
  .sub { font-size: 1rem; margin: 1rem 0 1.2rem; }
  .ca { padding: 0.45rem 0.45rem 0.45rem 0.8rem; margin-bottom: 1rem; }
  .ca code { font-size: 0.78rem; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .actions .btn-primary { grid-column: 1 / -1; padding: 1em 1.2em; font-size: 1rem; }
  .actions .btn { padding: 0.9em 0.8em; font-size: 0.92rem; }
  .stat-card { padding: 1.1rem 1.1rem 0.9rem; }
  .price { font-size: 1.9rem; }
  .stat-grid { gap: 0.75rem 1rem; }
  .chart-wrap { height: 320px; }
  .proof-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .proof { padding: 0.85rem 0.9rem; gap: 0.6rem; align-items: flex-start; }
  .proof i { margin-top: 1px; }
  .proof b { font-size: 0.85rem; line-height: 1.3; }
  .proof span { font-size: 0.74rem; margin-top: 0.15rem; }
  .cols { gap: 0.7rem; }
  .cols > div { padding: 1.15rem 1.15rem; }
  .lore { grid-template-columns: 1fr; gap: 1.2rem; }
  .lore-chapters li { padding: 1rem 1.05rem; gap: 0.8rem; }
  .lore-frame { padding: 0.45rem; }
  .lore-video { padding: 0.85rem 0.9rem 0.9rem; }
  .lore-video video { max-height: 70vh; }
  .controls { display: none; }
  .arena { display: block; }

  /* arena on phones: same dark layout, touch controls under the screen */
  .arena-screen { aspect-ratio: 480 / 416; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .gb-controls { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'dpad ab' 'ss ss'; gap: 0.8rem 0.6rem; padding: 0.9rem 0.9rem 0.8rem; }
  .dpad { grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); }
  .ab { justify-self: end; gap: 1rem; align-items: flex-start; }
  .ab .gb-key:first-child { margin-top: 26px; }
  .gb-btn { width: 54px; height: 54px; }
  .ss { justify-content: center; gap: 1.6rem; }
  /* overlays on the small screen */
  .overlay { padding: 0.5rem; }
  .card { padding: 0.8rem; }
  .join-card { padding: 0.6rem; }
  .join-card h3 { font-size: 0.72rem; margin-bottom: 0.45rem; color: var(--muted); font-weight: 600; }
  .starter-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; margin-bottom: 0.5rem; }
  .starter { padding: 0.35rem 0.1rem 0.3rem; gap: 0.1rem; border-radius: 9px; min-width: 0; }
  .starter b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .starter img { width: 42px; height: 42px; }
  .starter b { font-size: 0.56rem; }
  .starter .types { display: none; }
  .join-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.35rem; }
  .join-row input:not([type=color]) { padding: 0.45rem 0.6rem; font-size: 0.9rem; min-width: 0; }
  .join-row input[type=color] { width: 38px; min-height: 36px; }
  .join-row .btn { padding: 0.5em 0.8em; font-size: 0.85rem; }
  .join-error { font-size: 0.74rem; margin-top: 0.3rem; min-height: 0; }
  .enc-card { width: 100%; }
  .enc-stage { height: 112px; margin-bottom: 0.5rem; }
  .enc-sprite img { height: 92px; }
  .enc-card h3 { font-size: 0.9rem; }
  .enc-actions .btn { padding: 0.65em 0.9em; }
  .battle { gap: 0.5rem; }
  .field { min-height: 0; padding: 0.6rem; gap: 0.4rem; }
  .side { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .side.me { flex-direction: column-reverse; align-items: flex-end; }
  .battle-sprite img { height: 76px; }
  .hp-box { min-width: 0; width: 100%; padding: 0.4rem 0.55rem; }
  .hp-name { font-size: 0.8rem; }
  .console { grid-template-columns: 1fr; padding: 0.6rem; gap: 0.5rem; }
  .battle-log { max-height: 84px; font-size: 0.8rem; }
  .move-btn { padding: 0.45rem 0.6rem; }
  .mv-name { font-size: 0.85rem; }
  .challenge { white-space: normal; flex-wrap: wrap; justify-content: center; max-width: 92%; font-size: 0.8rem; }

  /* chat + panels below the device */
  .chat { margin-top: 1rem; }
  .arena-side { display: grid; grid-template-columns: 1fr; gap: 0.7rem; margin-top: 0.8rem; }
  .evo-row { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .social-grid { grid-template-columns: 1fr; }
  .footer { padding: 2rem 18px 2.6rem; }
}

@media (prefers-reduced-motion: reduce) { .reveal { transition: none; opacity: 1; transform: none; } }
