:root {
  color-scheme: dark;
  --green: #14f195;
  --cyan: #00d1ff;
  --purple: #9945ff;
  --bg: #07080d;
  --panel: #11141d;
  --line: #303647;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: #f4f7fb; background: radial-gradient(circle at 76% 0,rgba(153,69,255,.2),transparent 31rem), radial-gradient(circle at 8% 20%,rgba(20,241,149,.1),transparent 27rem), #07080d; font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
button { font: inherit; }
.hidden { display: none !important; }
.start-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 24px; background: linear-gradient(rgba(5,7,12,.75),rgba(5,7,12,.94)),url("../assets/pokesol-world-map.png") center/cover; backdrop-filter: blur(8px); opacity: 1; visibility: visible; transition: opacity .45s,visibility .45s; }
.start-screen::before { position: fixed; content: ""; inset: 0; pointer-events: none; opacity: .11; background: repeating-linear-gradient(0deg,#000 0,#000 1px,transparent 1px,transparent 4px); }
.start-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.start-card { position: relative; width: min(620px,100%); padding: 34px; overflow: hidden; border: 1px solid #424b60; border-radius: 20px; background: linear-gradient(145deg,rgba(26,30,43,.98),rgba(8,11,17,.99)); box-shadow: 0 36px 100px rgba(0,0,0,.72),0 0 80px rgba(153,69,255,.13); text-align: center; }
.start-card::before { position: absolute; content: ""; width: 270px; height: 270px; left: 50%; top: -165px; border-radius: 50%; background: linear-gradient(115deg,var(--green),var(--cyan),var(--purple)); filter: blur(65px); opacity: .19; transform: translateX(-50%); }
.start-eyebrow { position: relative; margin: 0 0 13px; color: var(--green); font-size: .68rem; font-weight: 900; letter-spacing: .18em; }
.start-title-lockup { position: relative; display: flex; flex-direction: column; width: fit-content; margin: 0 auto; }
.start-title-lockup h1 { margin: 0; color: transparent; background: linear-gradient(105deg,var(--green),var(--cyan) 48%,var(--purple)); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: clamp(3.4rem,10vw,5.5rem); line-height: .88; letter-spacing: -.08em; }
.start-title-lockup h1 span { display: flex; align-items: center; }
.start-title-lockup h1 img { width: .62em; height: .62em; margin-left: .08em; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 10px rgba(20,241,149,.25)); }
.start-title-lockup small { align-self: flex-end; margin: 7px 4px 0 0; color: #c7d0dc; font-size: .65rem; font-weight: 900; letter-spacing: .46em; }
.start-companion { width: 90px; height: 90px; margin: 10px auto 0; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(8px 10px 0 rgba(0,0,0,.25)); animation: start-float 1.2s steps(3) infinite; }
@keyframes start-float { 50% { transform: translateY(-5px); } }
.start-card h2 { margin: 2px 0 8px; font-size: 1.45rem; letter-spacing: -.035em; }
.start-copy { margin: 0 auto 20px; color: #8997aa; font-size: .9rem; line-height: 1.55; }
.save-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.save-option { min-height: 96px; padding: 12px; border: 1px solid #333b4e; border-radius: 10px; color: #d9e1eb; background: #151a24; text-align: left; cursor: pointer; transition: border-color .2s,background .2s,transform .2s; }
.save-option:hover, .save-option:focus-visible { border-color: #64728b; outline: none; transform: translateY(-2px); }
.save-option.is-active { border-color: var(--green); background: linear-gradient(145deg,rgba(20,241,149,.13),rgba(15,20,29,.96)); box-shadow: inset 0 0 0 1px rgba(20,241,149,.2); }
.save-option span, .save-option strong, .save-option small { display: block; }
.save-option span { margin-bottom: 10px; color: var(--green); font-size: .58rem; font-weight: 900; letter-spacing: .13em; }
.save-option strong { margin-bottom: 4px; font-size: .8rem; }
.save-option small { color: #718096; font-size: .66rem; line-height: 1.35; }
.start-status { min-height: 22px; margin: 15px 0 4px; color: #8492a6; font-size: .75rem; line-height: 1.45; }
.install-wallet { display: inline-block; margin: 3px 0 8px; color: var(--cyan); font-size: .75rem; font-weight: 800; text-underline-offset: 4px; }
.begin-game { display: flex; align-items: stretch; justify-content: center; width: min(310px,100%); min-height: 54px; margin: 15px auto 12px; overflow: hidden; border: 1px solid var(--green); border-radius: 8px; color: #07110c; background: var(--green); font-weight: 950; letter-spacing: .12em; cursor: pointer; box-shadow: 0 16px 38px rgba(20,241,149,.17); animation: begin-pulse 1.5s steps(2) infinite; }
.begin-game span { display: grid; place-items: center; flex: 1; }
.begin-game b { display: grid; place-items: center; width: 54px; border-left: 1px solid rgba(5,30,20,.22); }
.begin-game:hover, .begin-game:focus-visible { background: #57f6b7; outline: 3px solid #fff; outline-offset: 3px; }
@keyframes begin-pulse { 50% { box-shadow: 0 16px 48px rgba(20,241,149,.35); } }
.start-controls { color: #5f6e84; font-size: .58rem; font-weight: 850; letter-spacing: .13em; }
.world-shell { width: min(1240px,calc(100% - 32px)); margin: 0 auto; padding-bottom: 46px; }
.world-nav { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid rgba(108,123,150,.24); }
.world-brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; font-weight: 900; text-decoration: none; }
.world-brand > span:last-child { display: flex; flex-direction: column; font-size: 1rem; line-height: .82; letter-spacing: -.02em; }
.world-brand > span:last-child > span { display: flex; align-items: center; gap: 5px; }
.world-brand img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 6px rgba(20,241,149,.2)); }
.world-brand small { margin-top: 5px; color: #8290a5; font-size: .46rem; letter-spacing: .3em; }
.world-mark { position: relative; width: 31px; height: 25px; }
.world-mark i { position: absolute; display: block; width: 26px; height: 5px; left: 2px; border-radius: 2px; background: linear-gradient(115deg,var(--green),var(--cyan) 48%,var(--purple)); transform: skew(-26deg); }
.world-mark i:nth-child(1) { top: 1px; }
.world-mark i:nth-child(2) { top: 10px; transform: skew(26deg); }
.world-mark i:nth-child(3) { top: 19px; }
.world-nav nav { display: flex; gap: 24px; }
.world-nav nav button { padding: 0; border: 0; color: #718198; background: transparent; font-size: .73rem; font-weight: 750; cursor: pointer; }
.world-nav nav button strong { color: var(--green); }
.world-nav nav button:hover, .world-nav nav button:focus-visible { color: #fff; outline: none; }
.world-nav nav a { color: #9eacc0; font-size: .86rem; font-weight: 750; text-decoration: none; }
.world-nav nav a:hover, .world-nav nav a:focus-visible { color: #fff; outline: none; }

.world-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 36px 0 24px; }
.world-heading > div > p { margin: 0 0 7px; color: var(--green); font-size: .68rem; font-weight: 900; letter-spacing: .17em; }
.world-heading h1 { margin: 0; font-size: clamp(2rem,4vw,3.5rem); letter-spacing: -.055em; }
.world-heading > p { max-width: 500px; margin: 0; color: #8f9db2; font-size: .9rem; line-height: 1.55; text-align: right; }

.world-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 20px; align-items: start; }
.map-console { padding: 12px; overflow: hidden; border: 1px solid #373d50; border-radius: 20px; background: linear-gradient(145deg,#202431,#0d1018); box-shadow: 0 30px 80px rgba(0,0,0,.48), 16px -15px 70px rgba(153,69,255,.08), -15px 15px 70px rgba(20,241,149,.06); }
.map-hud { display: grid; grid-template-columns: 1fr 86px 116px 1fr; gap: 1px; overflow: hidden; border: 1px solid #2f3546; border-radius: 10px 10px 0 0; background: #090b11; }
.map-hud > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 13px; background: #121621; }
.map-hud span { color: #627188; font-size: .57rem; font-weight: 900; letter-spacing: .14em; }
.map-hud strong { overflow: hidden; color: #e4ebf4; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.map-hud b { font-weight: 850; }
.map-viewport { position: relative; overflow: hidden; aspect-ratio: 3 / 2; background-color: #283f36; background-image: url("../assets/pokesol-world-map.png"); background-position: center; background-size: cover; image-rendering: pixelated; outline: none; }
.map-viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--green); }
.map-scanlines { position: absolute; z-index: 6; inset: 0; pointer-events: none; opacity: .07; background: repeating-linear-gradient(0deg,#000 0,#000 1px,transparent 1px,transparent 4px); }
.world-player { position: absolute; z-index: 5; left: 50%; top: 58%; width: 54px; height: 54px; transform: translate(-50%,-64%); transition: left .09s linear, top .09s linear; }
.world-player span { position: absolute; left: 50%; bottom: 0; width: 31px; height: 11px; border-radius: 50%; background: rgba(9,11,17,.5); transform: translateX(-50%); filter: blur(1px); }
.world-player img { position: relative; width: 54px; height: 54px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 8px rgba(20,241,149,.36)); }
.world-player.step img { animation: player-step .16s steps(2); }
.world-player.attention img { animation: player-attention .32s steps(2) 7; }
.world-player.attention::before { position: absolute; z-index: 2; content: "▼"; left: 50%; top: -22px; color: #fff36b; font-size: 1rem; text-shadow: 0 0 12px #fff36b; transform: translateX(-50%); animation: marker-bounce .32s steps(2) 7; }
@keyframes player-step { 50% { transform: translateY(-4px); } }
@keyframes player-attention { 50% { opacity: .18; filter: drop-shadow(0 0 18px #fff36b) brightness(1.8); transform: translateY(-5px) scale(1.13); } }
@keyframes marker-bounce { 50% { opacity: .35; transform: translate(-50%,-5px); } }
.map-prompt { position: absolute; z-index: 7; left: 50%; bottom: 14px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 7px; color: #e7edf5; background: rgba(7,9,14,.78); font-size: .7rem; font-weight: 800; transform: translateX(-50%); transition: opacity .35s; white-space: nowrap; }
.map-prompt.fade { opacity: 0; }
.xp-track { height: 6px; overflow: hidden; border-radius: 0 0 9px 9px; background: #242a38; }
.xp-track i { display: block; width: 0%; height: 100%; background: linear-gradient(90deg,var(--green),var(--cyan),var(--purple)); transition: width .5s; }

.world-panel { display: grid; gap: 14px; }
.level-card, .zone-list, .dpad { border: 1px solid #2d3445; border-radius: 14px; background: rgba(17,20,29,.88); }
.level-card { padding: 18px; }
.level-card p { margin: 0 0 8px; color: var(--green); font-size: .6rem; font-weight: 900; letter-spacing: .15em; }
.level-card h2 { margin: 0 0 4px; font-size: 1.3rem; letter-spacing: -.03em; }
.level-card span { color: #8492a8; font-size: .77rem; }
.zone-list { padding: 8px 15px; }
.zone-list article { display: grid; grid-template-columns: 10px 1fr; align-items: center; gap: 10px; padding: 12px 0; }
.zone-list article + article { border-top: 1px solid #293041; }
.zone-list i { width: 7px; height: 7px; border-radius: 50%; }
.zone-dot.field { background: #58dc76; }
.zone-dot.forest { background: #168f5d; }
.zone-dot.coast { background: #3fc8ed; }
.zone-dot.ridge { background: #a965ff; }
.zone-list div { display: flex; flex-direction: column; gap: 2px; }
.zone-list strong { color: #d9e1ec; font-size: .75rem; }
.zone-list span { color: #6f7d92; font-size: .65rem; }
.dpad { display: grid; grid-template-columns: repeat(3,52px); grid-template-rows: repeat(2,45px); justify-content: center; gap: 6px; padding: 15px; }
.dpad button { border: 1px solid #3a4357; border-radius: 8px; color: #dce4ef; background: #1b202c; cursor: pointer; }
.dpad button:hover, .dpad button:focus-visible { border-color: var(--green); color: var(--green); outline: none; }
.dpad [data-direction="up"] { grid-column: 2; }
.dpad [data-direction="left"] { grid-column: 1; grid-row: 2; }
.dpad [data-direction="down"] { grid-column: 2; grid-row: 2; }
.dpad [data-direction="right"] { grid-column: 3; grid-row: 2; }
.prototype-note { margin: 0; color: #657389; font-size: .7rem; line-height: 1.5; }

.encounter-modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(4,6,10,.76); backdrop-filter: blur(6px); }
.encounter-modal.hidden, .battle-demo-link.hidden { display: none; }
.encounter-card { width: min(390px,100%); padding: 24px; border: 1px solid #3f465c; border-radius: 19px; background: linear-gradient(145deg,#1a1e2a,#0b0d14); box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 60px rgba(153,69,255,.11); text-align: center; }
.encounter-card > p:first-child { margin: 0 0 8px; color: var(--green); font-size: .63rem; font-weight: 900; letter-spacing: .17em; }
.encounter-card img { width: 112px; height: 112px; margin: 2px auto 8px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(7px 10px 0 rgba(0,0,0,.25)); }
.encounter-card h2 { margin: 0 0 14px; font-size: 1.35rem; }
.wild-meta { display: flex; justify-content: center; gap: 17px; color: #dfe6f0; font-size: .92rem; font-weight: 850; }
.wild-meta strong { color: var(--cyan); }
#battleResult { min-height: 42px; margin: 15px 0; color: #8795aa; font-size: .82rem; line-height: 1.55; }
.encounter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.encounter-actions button { min-height: 43px; border-radius: 8px; font-weight: 850; cursor: pointer; }
.battle-wild { border: 0; color: #06110c; background: var(--green); }
.run-wild { border: 1px solid #3e465b; color: #d5ddea; background: #191e2a; }
.encounter-actions button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.battle-demo-link { display: inline-block; margin-top: 14px; color: #a9b6c9; font-size: .75rem; font-weight: 750; text-decoration-color: #536078; text-underline-offset: 4px; }

@media (max-width: 900px) {
  .world-layout { grid-template-columns: 1fr; }
  .world-panel { grid-template-columns: 1fr 1fr; }
  .prototype-note { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .start-screen { padding: 10px; }
  .start-card { padding: 25px 16px; border-radius: 15px; }
  .save-options { grid-template-columns: 1fr; }
  .save-option { display: grid; grid-template-columns: 62px 1fr; align-items: center; min-height: 0; padding: 11px 12px; }
  .save-option span { grid-row: 1 / span 2; margin: 0; }
  .save-option strong, .save-option small { grid-column: 2; }
  .world-shell { width: min(100% - 18px,580px); }
  .world-heading { display: block; padding-top: 26px; }
  .world-heading > p { margin-top: 12px; text-align: left; }
  .world-layout { gap: 12px; }
  .map-console { padding: 7px; border-radius: 14px; }
  .map-hud { grid-template-columns: 1fr 58px 84px; }
  .zone-readout { display: none !important; }
  .map-hud > div { padding: 8px; }
  .map-hud strong { font-size: .68rem; }
  .map-viewport { min-height: 365px; aspect-ratio: auto; }
  .world-player { width: 44px; height: 44px; }
  .world-player img { width: 44px; height: 44px; }
  .world-nav nav { gap: 12px; }
  .world-nav nav button { display: none; }
  .world-panel { grid-template-columns: 1fr; }
  .prototype-note { grid-column: auto; }
  .map-prompt { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .world-player.attention img { animation-duration: .2s !important; animation-iteration-count: 4 !important; }
}
