* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: 100dvh; overflow: hidden; background: #8fd3ff; font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; touch-action: none; }
#game { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.hidden { display: none !important; }
body.intro #hud, body.intro #btn-dex, body.intro #touch { display: none !important; } /* 시작 화면에서는 HUD 숨김 */

#hud { position: fixed; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.hud-row { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.85); border-radius: 999px; padding: 6px 14px 6px 8px; font-size: 18px; font-weight: 700; color: #333; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.hud-icon { width: 22px; height: 22px; border-radius: 6px; display: inline-block; }
.hud-icon.block { background: #fff; border: 2px solid #999; }
.hud-icon.mon { background: #ffd93d; border-radius: 50%; }
.hud-icon.map { background: linear-gradient(135deg, #7ccf5a, #3fb8e8); border: 2px solid #20232e; }
.hud-icon.poke { background: linear-gradient(#e8453c 0 50%, #f4f4f8 50%); border: 2px solid #20232e; border-radius: 50%; }
.hud-icon.boss { background: #a569bd; border-radius: 30%; border: 2px solid #20232e; }
.hud-icon.nb { background: linear-gradient(#f7cf3e 0 33%, #f2872f 33% 66%, #e8453c 66%); border: 2px solid #20232e; }

#msg { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.96); border-radius: 20px; padding: 12px 24px 12px 12px; width: max-content; max-width: min(96vw, 1040px); box-shadow: 0 4px 14px rgba(0,0,0,.2); z-index: 6; }
body.battle #msg { bottom: auto; top: 14px; }
#msg-face { width: 44px; height: 44px; border-radius: 8px; background: #e8453c; border: 3px solid #20232e; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; color: #333; flex-shrink: 0; }
#msg-text { font-size: clamp(17px, 2.2vw, 22px); font-weight: 700; color: #333; line-height: 1.4; word-break: keep-all; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .45s; z-index: 15; }
#fade.on { opacity: 1; pointer-events: auto; }

#battle { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(96vw, 620px); background: rgba(255,251,230,.96); border-radius: 22px; padding: 12px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 10; }
@media (min-width: 900px) { #battle { left: auto; right: 16px; transform: none; } } /* 넓은 화면: 패널은 오른쪽, 내 포켓몬은 왼쪽 아래 */
#battle-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#battle-name { font-size: 22px; font-weight: 900; }
#battle-hp { display: flex; gap: 4px; flex-wrap: wrap; }
.hp-cube { width: 22px; height: 22px; border-radius: 5px; border: 2px solid #20232e; display: inline-block; transition: transform .25s, opacity .25s; }
.hp-cube.gone { opacity: .15; transform: scale(.6); }
#battle-hpnum { font-weight: 800; color: #555; margin-left: auto; }
#battle-msg { min-height: 26px; font-size: 18px; font-weight: 700; color: #333; margin: 8px 0; }
#battle-mine { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(255,255,255,.6); border-radius: 14px; padding: 6px 10px; margin-bottom: 8px; }
#battle-mine-name { font-size: 18px; font-weight: 900; }
#battle-mine-name::before { content: '내 포켓몬 '; font-size: 12px; color: #777; font-weight: 800; }
#battle-mine-hp { display: flex; gap: 3px; flex-wrap: wrap; }
#battle-mine-hpnum, #battle-mine-atk { font-weight: 800; color: #555; font-size: 14px; }
#battle-mine-atk { margin-left: auto; }
#battle-hp.many .hp-cube, #battle-mine-hp.many .hp-cube { width: 14px; height: 14px; border-radius: 3px; border-width: 1.5px; }
#battle-mine-hp .hp-cube { width: 16px; height: 16px; border-radius: 4px; }
#battle-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#battle-skills { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
#battle-skills .skill { display: flex; flex-direction: column; align-items: center; min-width: 110px; padding: 8px 12px; border-radius: 14px; border: 3px solid transparent; background: #ffd93d; box-shadow: 0 3px 0 #c99400; cursor: pointer; font-weight: 900; color: #20232e; }
#battle-skills .skill.sel { border-color: #20232e; }
#battle-skills .skill:active { transform: translateY(2px); box-shadow: none; }
#battle-skills .skill:disabled { opacity: .5; cursor: default; }
#battle-skills .skill.locked { background: #e9e9e9; box-shadow: 0 3px 0 #bbb; opacity: .7; }
#battle-skills .skill-name { font-size: 16px; }
#battle-skills .skill-dmg { font-size: 13px; color: #7a1f1f; }
#battle-skills .skill.locked .skill-dmg { color: #777; }
#battle-controls > button { font-size: 18px; font-weight: 900; padding: 12px 16px; border-radius: 14px; border: 0; cursor: pointer; box-shadow: 0 3px 0 #ccc; background: #fff; color: #333; }
#battle-controls > button:active { transform: translateY(2px); box-shadow: none; }
#btn-ball { background: #66e0ff !important; animation: pulse .8s infinite alternate; }
#btn-run { background: #eee !important; color: #666 !important; font-size: 15px !important; }
#btn-run.primary { background: #57b947 !important; color: #fff !important; font-size: 18px !important; }
#battle-controls > button:disabled { opacity: .35; cursor: default; }
#battle-help { font-size: 12px; color: #999; margin-top: 8px; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.07); } }

#battle-banner { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); font-size: clamp(34px, 7vw, 64px); font-weight: 900; color: #fff; -webkit-text-stroke: 2px #20232e; text-shadow: 0 6px 0 #e8453c, 0 10px 20px rgba(0,0,0,.35); z-index: 11; pointer-events: none; white-space: nowrap; }
#battle-float { position: fixed; transform: translate(-50%, -50%); font-size: 40px; font-weight: 900; -webkit-text-stroke: 1.5px #20232e; z-index: 11; pointer-events: none; }
.pop { animation: popIn .35s ease-out; }
@keyframes popIn { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
#battle-banner.pop { animation: bannerIn .4s ease-out; }
@keyframes bannerIn { from { transform: translateX(-50%) scale(.3); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

#touch { position: fixed; inset: 0; pointer-events: none; z-index: 7; }
#joy-zone { position: absolute; left: 24px; bottom: 96px; width: 150px; height: 150px; pointer-events: auto; touch-action: none; }
#joy-base { position: absolute; left: 50%; top: 50%; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; background: rgba(255,255,255,.22); border: 3px solid rgba(255,255,255,.65); pointer-events: none; transition: background .15s; }
#joy-base.active { background: rgba(255,255,255,.35); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 3px 8px rgba(0,0,0,.25); }
#touch-actions { position: absolute; right: 16px; bottom: 90px; display: flex; gap: 10px; pointer-events: auto; }
#touch button { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255,255,255,.8); font-size: 18px; font-weight: 800; color: #333; box-shadow: 0 3px 8px rgba(0,0,0,.2); }
#touch-actions button { width: 72px; height: 72px; }
#touch-actions button.run { background: rgba(255,217,61,.85); }

#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; z-index: 20; padding: 28px 16px 22px; pointer-events: none; background: linear-gradient(rgba(60,120,220,.25), rgba(0,0,0,0) 35%, rgba(0,0,0,0) 65%, rgba(20,60,20,.45)); }
#title > * { pointer-events: auto; }
#title-top, #title-bottom { display: flex; flex-direction: column; align-items: center; text-align: center; }
#title-badge { background: #fff; color: #e8453c; font-weight: 900; font-size: 15px; padding: 6px 16px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0,0,0,.15); letter-spacing: .5px; animation: title-drop .7s cubic-bezier(.2,1.4,.4,1) both; }
#title h1 { margin: 12px 0 8px; display: flex; flex-direction: column; align-items: center; line-height: 1; font-weight: 900; }
#title h1 span { display: block; color: #fff; -webkit-text-stroke: 2px #20232e; paint-order: stroke fill; text-shadow: 0 6px 0 #20232e, 0 10px 18px rgba(0,0,0,.35); animation: title-bounce 2.4s ease-in-out infinite; }
#title h1 .w1 { font-size: clamp(40px, 9vw, 74px); color: #ffd93d; }
#title h1 .w2 { font-size: clamp(48px, 11vw, 92px); color: #fff; animation-delay: .25s; }
#title p { margin: 0; color: #20232e; background: rgba(255,255,255,.88); font-weight: 800; font-size: clamp(14px, 2.6vw, 19px); padding: 8px 18px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0,0,0,.12); max-width: 92vw; animation: title-drop .9s cubic-bezier(.2,1.4,.4,1) both; }
#btn-start { font-size: clamp(24px, 4.5vw, 34px); font-weight: 900; padding: 16px 52px; border-radius: 999px; border: 4px solid #fff; background: linear-gradient(#ffe066, #ffc300); color: #20232e; cursor: pointer; box-shadow: 0 7px 0 #c99400, 0 14px 26px rgba(0,0,0,.3); animation: btn-pulse 1.4s ease-in-out infinite; }
#title-buttons { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.title-btn { font-size: clamp(22px, 4vw, 30px); font-weight: 900; padding: 14px 40px; border-radius: 999px; border: 4px solid #fff; background: linear-gradient(#ffe066, #ffc300); color: #20232e; cursor: pointer; box-shadow: 0 7px 0 #c99400, 0 14px 26px rgba(0,0,0,.3); animation: btn-pulse 1.4s ease-in-out infinite; }
.title-btn.secondary { background: linear-gradient(#bff0ff, #66d3f4); box-shadow: 0 7px 0 #2a9bc4, 0 14px 26px rgba(0,0,0,.3); animation: none; }
.title-btn:disabled { background: #e8e8e8; color: #999; box-shadow: 0 6px 0 #bbb; animation: none; cursor: default; }
.title-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 #c99400; }
#btn-start:disabled { animation: none; background: #e8e8e8; color: #999; border-color: #f6f6f6; box-shadow: 0 6px 0 #bbb; cursor: wait; }
#btn-start:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 #c99400; }
#title-loading { margin-top: 12px; font-size: 13px; font-weight: 800; color: #20232e; background: rgba(255,255,255,.85); padding: 4px 12px; border-radius: 999px; }
#title-help { margin-top: 14px; font-size: 13px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); font-weight: 700; }
@keyframes title-bounce { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
@keyframes title-drop { from { transform: translateY(-30px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes btn-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- 도감 ---------- */
#btn-dex { position: fixed; top: 12px; right: 12px; z-index: 6; font-size: 18px; font-weight: 800; padding: 8px 14px; border-radius: 999px; border: 0; background: rgba(255,255,255,.9); color: #333; box-shadow: 0 2px 6px rgba(0,0,0,.15); cursor: pointer; }
#dex { position: fixed; inset: 0; background: rgba(20,30,50,.6); z-index: 14; display: flex; align-items: center; justify-content: center; padding: 12px; }
#dex-card { background: #fffbe6; border-radius: 22px; width: min(960px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,.3); overflow: hidden; }
#dex-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 2px solid #f0e6c0; }
#dex-title { font-size: 20px; font-weight: 900; color: #333; white-space: nowrap; }
#dex-count { font-weight: 800; color: #777; white-space: nowrap; }
#dex-blocks { font-weight: 900; color: #fff; background: #bbb; padding: 4px 12px; border-radius: 999px; font-size: 14px; }
#dex-body { flex: 1; min-height: 0; overflow-y: auto; }
#dex-grid-title { font-size: 16px; font-weight: 900; color: #555; padding: 10px 12px 0; }
#btn-dex-close { margin-left: auto; width: 40px; height: 40px; font-size: 20px; font-weight: 900; line-height: 1; padding: 0; border-radius: 50%; border: 0; background: #eee; color: #20232e; cursor: pointer; }
#dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px; }
.dex-item { background: #fff; border-radius: 16px; padding: 8px; text-align: center; border: 3px solid transparent; position: relative; }
.dex-item.caught { border-color: #ffd93d; }
.dex-item { cursor: pointer; transition: transform .12s; }
.dex-item:hover { transform: translateY(-2px); }
.dex-item.sel { border-color: #e8453c !important; box-shadow: 0 0 0 3px rgba(232,69,60,.25); }
.dex-item img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.dex-item.unknown img { opacity: .55; }
.dex-item .dex-q { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-size: 46px; font-weight: 900; color: #fff; -webkit-text-stroke: 2px #20232e; pointer-events: none; }
.dex-name { font-size: 16px; font-weight: 900; color: #333; margin-top: 4px; }
.dex-sub { font-size: 12px; color: #777; margin-top: 2px; }
.dex-num { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 8px; color: #fff; font-weight: 900; font-size: 13px; margin-top: 4px; }

/* ---------- 내 포켓몬 (도감 위 패널) ---------- */
#dex-party { padding: 6px 12px 10px; }
.party-empty { color: #777; font-weight: 800; }
.party-card { flex: 0 0 min(340px, 84vw); background: #fff; border-radius: 16px; padding: 10px; border: 3px solid #ddd; display: flex; flex-direction: column; gap: 8px; }
.party-card.leader { box-shadow: 0 0 0 3px #ffd93d inset; }
.party-top { display: flex; gap: 10px; align-items: flex-start; }
.party-top img { width: 84px; height: 84px; object-fit: contain; flex-shrink: 0; background: #f7f3e3; border-radius: 12px; }
.party-info { flex: 1; min-width: 0; }
.party-name { font-size: 18px; font-weight: 900; color: #333; }
.party-badge { font-size: 11px; background: #ffd93d; color: #333; padding: 2px 8px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.party-stat { font-size: 14px; font-weight: 800; margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.party-stat .hp { color: #c0392b; }
.party-stat .atk { color: #1f5fa8; }
.party-skills { font-size: 12px; color: #444; font-weight: 700; margin-top: 4px; line-height: 1.35; }
.party-evo { font-size: 12px; font-weight: 800; margin-top: 4px; }
.party-evo.ready { color: #8c4fd0; animation: pulse .8s infinite alternate; display: inline-block; }
.dim { color: #999; }
.party-actions { display: flex; flex-direction: column; gap: 6px; }
.party-up { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 800; color: #666; }
.party-up button, .party-side button { font-size: 13px; font-weight: 900; padding: 7px 10px; border-radius: 10px; border: 0; background: #fff3c4; color: #333; box-shadow: 0 2px 0 #d9c56e; cursor: pointer; }
.party-up button:disabled { opacity: .4; cursor: default; }
.party-up button:active:not(:disabled), .party-side button:active { transform: translateY(2px); box-shadow: none; }
.party-side { display: flex; gap: 6px; flex-wrap: wrap; }
.party-side .btn-leader { background: #d9f2ff; box-shadow: 0 2px 0 #8cc6e6; }
.party-side .btn-evolve { background: linear-gradient(#e6ccff, #c99bff); box-shadow: 0 2px 0 #8c4fd0; animation: pulse .8s infinite alternate; }
.party-side .btn-evolve:disabled { background: #e9e9e9; box-shadow: 0 2px 0 #bbb; color: #999; animation: none; cursor: default; }

/* ---------- 시작 포켓몬 고르기 ---------- */
#starter { position: fixed; inset: 0; z-index: 21; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(20,30,50,.35); }
#starter-card { background: rgba(255,251,230,.97); border-radius: 22px; padding: 18px 16px; width: min(860px, 100%); max-height: 94vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.3); text-align: center; }
#starter-title { font-size: clamp(22px, 4vw, 30px); font-weight: 900; color: #20232e; }
#starter-sub { font-size: 14px; font-weight: 700; color: #666; margin: 6px 0 14px; }
#starter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.starter-item { background: #fff; border-radius: 18px; padding: 10px; border: 4px solid transparent; cursor: pointer; transition: transform .15s; box-shadow: 0 4px 0 #e0d8b8; }
.starter-item:hover, .starter-item:focus { transform: translateY(-4px); border-color: #ffd93d; outline: none; }
.starter-item:active { transform: translateY(1px); }
.starter-item img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; background: #f7f3e3; border-radius: 12px; }
.starter-name { font-size: 20px; font-weight: 900; color: #333; margin-top: 6px; }
.starter-stat { font-size: 13px; font-weight: 800; color: #555; margin-top: 2px; }
.starter-skill { font-size: 12px; color: #888; font-weight: 700; margin-top: 2px; }

/* ---------- 지역 배너 ---------- */
#zone-banner { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); font-size: clamp(30px, 6vw, 56px); font-weight: 900; color: #fff; -webkit-text-stroke: 2px #20232e; text-shadow: 0 6px 0 #3fb8e8, 0 10px 20px rgba(0,0,0,.35); z-index: 11; pointer-events: none; white-space: nowrap; }
#zone-banner.pop { animation: bannerIn .4s ease-out; }

/* ---------- 구출 문제 ---------- */
#quiz { position: fixed; inset: 0; background: rgba(20,30,50,.55); z-index: 14; display: flex; align-items: center; justify-content: center; padding: 12px; }
#quiz-card { background: #fffbe6; border-radius: 22px; width: min(760px, 100%); max-height: 94vh; overflow-y: auto; padding: 18px 20px; box-shadow: 0 10px 30px rgba(0,0,0,.3); text-align: center; }
#quiz-title { font-size: 16px; font-weight: 900; color: #e8453c; }
#quiz-text { font-size: clamp(19px, 3vw, 26px); font-weight: 900; color: #20232e; margin: 8px 0 12px; line-height: 1.35; word-break: keep-all; }
#quiz-icons { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.quiz-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; background: #fff; border-radius: 14px; padding: 8px 10px; width: 100%; }
.quiz-cell { width: 52px; height: 52px; border-radius: 12px; background: #f7f3e3; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; color: #999; }
.quiz-cell img { width: 100%; height: 100%; object-fit: contain; }
.quiz-cell.faded { opacity: .22; position: relative; }
.quiz-cell.faded::after { content: '✕'; position: absolute; color: #c0392b; font-size: 30px; opacity: 1; }
.quiz-cell.ghost { border: 2px dashed #bbb; background: transparent; }
.quiz-label { width: 100%; font-size: 13px; font-weight: 800; color: #666; }
#quiz-choices { display: flex; gap: 12px; justify-content: center; margin: 14px 0 8px; flex-wrap: wrap; }
#quiz-choices button { min-width: 84px; font-size: 30px; font-weight: 900; padding: 10px 18px; border-radius: 16px; border: 4px solid transparent; background: #ffd93d; box-shadow: 0 4px 0 #c99400; cursor: pointer; color: #20232e; }
#quiz-choices button:active { transform: translateY(3px); box-shadow: none; }
#quiz-choices button.right { background: #57b947; color: #fff; border-color: #fff; }
#quiz-choices button.wrong { background: #eee; color: #aaa; box-shadow: 0 4px 0 #ccc; animation: shake .3s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
#quiz-hint { min-height: 22px; font-size: 15px; font-weight: 800; color: #8c4fd0; }
#btn-quiz-skip { margin-top: 6px; font-size: 14px; font-weight: 800; padding: 8px 14px; border-radius: 12px; border: 0; background: #eee; color: #666; cursor: pointer; }
.party-type { font-size: 11px; background: #e6f4ff; color: #1f5fa8; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }

/* ---------- 도감 상세 (선택한 한 마리) ---------- */
#dex-members { display: flex; gap: 8px; align-items: center; padding: 10px 12px 0; overflow-x: auto; }
.members-title { font-size: 13px; font-weight: 900; color: #666; white-space: nowrap; }
.member-chip { display: inline-flex; align-items: center; gap: 6px; border: 3px solid #ddd; background: #fff; border-radius: 999px; padding: 3px 10px 3px 4px; font-size: 13px; font-weight: 900; color: #333; cursor: pointer; white-space: nowrap; }
.member-chip img { width: 30px; height: 30px; object-fit: contain; border-radius: 50%; background: #f7f3e3; }
.member-chip.leader { border-color: #ffd93d; }
.member-chip.sel { border-color: #e8453c; background: #fff2f0; }
.member-chip i { font-style: normal; color: #e8b400; }
.detail-card { background: #fff; border-radius: 16px; padding: 12px; border: 3px solid #ddd; display: flex; flex-direction: column; gap: 10px; }
.detail-top { display: flex; gap: 14px; align-items: flex-start; }
.detail-top img { width: 130px; height: 130px; object-fit: contain; flex-shrink: 0; background: #f7f3e3; border-radius: 14px; }
.detail-card.unknown img { opacity: .6; }
.detail-info { flex: 1; min-width: 0; }
.detail-name { font-size: 22px; font-weight: 900; color: #333; }
.detail-sub { font-size: 13px; color: #666; font-weight: 700; margin-top: 3px; }
.detail-desc { font-size: 14px; color: #555; font-weight: 700; margin-top: 8px; }
.detail-stat { font-size: 15px; font-weight: 800; margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.detail-stat .hp, .member-row .hp { color: #c0392b; }
.detail-stat .atk, .member-row .atk { color: #1f5fa8; }
.detail-skills { font-size: 13px; color: #444; font-weight: 700; margin-top: 6px; line-height: 1.4; }
.detail-skills small { color: #999; font-weight: 700; }
.detail-evo { font-size: 13px; color: #8c4fd0; font-weight: 800; margin-top: 6px; }
.party-badge.boss { background: #e8453c; color: #fff; }
.detail-members { display: flex; flex-direction: column; gap: 8px; border-top: 2px dashed #eee; padding-top: 8px; }
.member-row { background: #fffbe6; border-radius: 12px; padding: 8px 10px; border: 2px solid transparent; }
.member-row.leader { border-color: #ffd93d; }
.member-head { font-size: 14px; font-weight: 900; color: #333; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.member-head small { width: 100%; font-size: 12px; color: #666; font-weight: 700; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 12px; font-weight: 800; color: #666; }
.member-actions button { font-size: 13px; font-weight: 900; padding: 7px 10px; border-radius: 10px; border: 0; background: #fff3c4; color: #333; box-shadow: 0 2px 0 #d9c56e; cursor: pointer; }
.member-actions button:disabled { opacity: .4; cursor: default; }
.member-actions button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.member-actions .btn-leader { background: #d9f2ff; box-shadow: 0 2px 0 #8cc6e6; }
.member-actions .btn-evolve { background: linear-gradient(#e6ccff, #c99bff); box-shadow: 0 2px 0 #8c4fd0; animation: pulse .8s infinite alternate; }
.member-actions .btn-evolve:disabled { background: #e9e9e9; box-shadow: 0 2px 0 #bbb; color: #999; animation: none; }

/* ---------- 새로하기 / 이어서하기 ---------- */
#newgame, #continue { position: fixed; inset: 0; z-index: 21; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(20,30,50,.35); }
.menu-card { background: rgba(255,251,230,.97); border-radius: 22px; padding: 20px 18px; width: min(520px, 100%); box-shadow: 0 10px 30px rgba(0,0,0,.3); text-align: center; }
.menu-card.wide { width: min(760px, 100%); max-height: 92vh; overflow-y: auto; }
.menu-title { font-size: clamp(22px, 4vw, 30px); font-weight: 900; color: #20232e; }
.menu-sub { font-size: 14px; font-weight: 700; color: #666; margin: 6px 0 14px; }
#name-input { width: 100%; font-size: 28px; font-weight: 900; text-align: center; padding: 12px; border-radius: 16px; border: 4px solid #ffd93d; outline: none; color: #20232e; background: #fff; }
#name-input:focus { border-color: #e8453c; }
.menu-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.menu-actions button { font-size: 18px; font-weight: 900; padding: 12px 22px; border-radius: 14px; border: 0; background: #ffd93d; color: #20232e; box-shadow: 0 4px 0 #c99400; cursor: pointer; }
.menu-actions button.secondary { background: #eee; color: #666; box-shadow: 0 4px 0 #bbb; }
.menu-actions button:active { transform: translateY(3px); box-shadow: none; }
#continue-list { display: flex; flex-direction: column; gap: 8px; }
.save-row { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 16px; padding: 8px 10px; border: 3px solid #ffd93d; text-align: left; }
.save-row img, .save-noimg { width: 56px; height: 56px; border-radius: 12px; background: #f7f3e3; object-fit: contain; flex-shrink: 0; }
.save-info { flex: 1; min-width: 0; }
.save-name { font-size: 20px; font-weight: 900; color: #333; }
.save-sub { font-size: 12px; color: #666; font-weight: 700; margin-top: 2px; }
.save-go { font-size: 15px; font-weight: 900; padding: 10px 14px; border-radius: 12px; border: 0; background: #57b947; color: #fff; box-shadow: 0 3px 0 #3d8a32; cursor: pointer; white-space: nowrap; }
.save-del { font-size: 14px; font-weight: 900; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #eee; color: #999; cursor: pointer; }
.save-empty { color: #777; font-weight: 800; padding: 14px; }
#btn-save { position: fixed; top: 12px; right: 190px; z-index: 6; font-size: 16px; font-weight: 800; padding: 8px 12px; border-radius: 999px; border: 0; background: rgba(255,255,255,.9); color: #333; box-shadow: 0 2px 6px rgba(0,0,0,.15); cursor: pointer; }
body.intro #btn-save { display: none !important; }
#save-toast { position: fixed; top: 58px; right: 12px; z-index: 6; background: #57b947; color: #fff; font-weight: 900; font-size: 15px; padding: 8px 14px; border-radius: 999px; box-shadow: 0 3px 8px rgba(0,0,0,.2); }

/* ---------- 도감: 탭 + 지도 ---------- */
#dex-tabs { display: flex; gap: 4px; background: #f0e6c0; border-radius: 999px; padding: 3px; }
#dex-tabs button { white-space: nowrap; font-size: 14px; font-weight: 900; padding: 6px 14px; border-radius: 999px; border: 0; background: transparent; color: #666; cursor: pointer; }
#dex-tabs button.on { background: #fff; color: #e8453c; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
#dex-mapview { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
#dex-map { position: relative; flex: 0 0 auto; width: 100%; aspect-ratio: 110 / 72; max-height: 44vh; background: linear-gradient(#bfe9ff, #dff7d0); border-radius: 18px; overflow: hidden; border: 3px solid #f0e6c0; }
#dex-map svg { width: 100%; height: 100%; display: block; }
#dex-map .region { cursor: pointer; }
#dex-map .region .blob { stroke: #7a7a7a; stroke-width: .5; fill: #d8d8d8; transition: transform .15s; }
#dex-map .region.conquered .blob { stroke: #e8b400; stroke-width: .8; }
#dex-map .region.sel .blob { stroke: #e8453c; stroke-width: 1; }
#dex-map .region text { font-family: inherit; font-weight: 900; pointer-events: none; }
#dex-map .region .name { font-size: 4.6px; fill: #20232e; }
#dex-map .region .icon { font-size: 9px; }
#dex-map .region .star { font-size: 4px; fill: #e8b400; }
#dex-map .path { fill: none; stroke: #8b6a3c; stroke-width: .9; stroke-dasharray: 2 1.2; opacity: .8; }
#dex-map .rail { fill: none; stroke: #555b66; stroke-width: 1; stroke-dasharray: 1.5 1; }
#dex-map .flight { fill: none; stroke: #e8453c; stroke-width: .7; stroke-dasharray: 1 1.5; }
#dex-map .here { font-size: 3.6px; font-weight: 900; fill: #e8453c; }
#dex-map-detail { flex: 0 0 auto; background: #fff; border-radius: 16px; padding: 12px; border: 3px solid #ddd; }
.map-title { font-size: 20px; font-weight: 900; color: #333; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-title .badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: #eee; color: #666; }
.map-title .badge.done { background: #ffd93d; color: #333; }
.map-desc { font-size: 14px; font-weight: 700; color: #555; margin-top: 4px; }
.map-how { font-size: 13px; font-weight: 800; color: #1f5fa8; margin-top: 4px; }
.map-count { font-size: 13px; font-weight: 800; color: #666; margin-top: 8px; }
.map-pokes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.map-poke { background: #fffbe6; border-radius: 12px; padding: 6px; text-align: center; border: 3px solid transparent; position: relative; cursor: pointer; }
.map-poke.caught { border-color: #ffd93d; }
.map-poke.boss { background: #ffe9e6; }
.map-poke img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.map-poke.unknown img { opacity: .5; }
.map-poke .nm { font-size: 13px; font-weight: 900; color: #333; margin-top: 2px; }
.map-poke .sub { font-size: 11px; color: #777; font-weight: 700; }
.map-poke .bossmark { position: absolute; top: 4px; left: 4px; font-size: 10px; background: #e8453c; color: #fff; border-radius: 999px; padding: 1px 6px; font-weight: 900; }

#dex-map-nav { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#dex-map-nav button { font-size: 15px; font-weight: 900; padding: 10px 16px; border-radius: 12px; border: 0; background: #ffd93d; color: #20232e; box-shadow: 0 3px 0 #c99400; cursor: pointer; }
#dex-map-nav button:active { transform: translateY(2px); box-shadow: none; }
#map-pos { font-size: 14px; font-weight: 900; color: #666; }
@media (max-width: 640px) { #btn-save { top: 56px; right: 12px; } #save-toast { top: 100px; } } /* 좁은 화면: 저장 버튼을 도감 버튼 아래로 */

/* ---------- 도감: 휴대폰(좁은 화면)에서는 전체 화면 + 상단 큰 ✕ 버튼 ---------- */
@media (max-width: 640px) {
  #dex { padding: 0; align-items: stretch; }
  #dex-card { width: 100%; max-height: none; height: 100dvh; border-radius: 0; }
  #dex-head { position: sticky; top: 0; background: #fffbe6; z-index: 2; gap: 8px; padding: 8px 10px; }
  #dex-title { font-size: 15px; }
  #dex-count { display: none; }
  #dex-blocks { font-size: 12px; padding: 3px 9px; }
  #dex-tabs button { font-size: 13px; padding: 5px 10px; }
  #btn-dex-close { width: 46px; height: 46px; font-size: 24px; background: #ffd93d; box-shadow: 0 3px 0 #c99400; }
  #dex-map { max-height: 34vh; height: calc(100vw * 72 / 110 - 16px); }
  .detail-top img { width: 96px; height: 96px; }
  #touch-actions { right: 12px; bottom: 80px; gap: 8px; }
  #touch-actions button { width: 64px; height: 64px; font-size: 16px; }
}
