/* 스티커 느낌: 진한 자두색 테두리 + 아래로 떨어지는 단단한 그림자. 글꼴 Jua는 굵기가 하나뿐이다 */
:root {
  --ink: #4a1d4f;
  --pink: #ff5c93;
  --violet: #8567ff;
  --yellow: #ffcf3f;
  --mint: #4fdcb0;
  --cream: #fff8ee;
  --dim: #8b6890;
  --candy:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.34) 3px, transparent 3.6px) 0 0 / 34px 34px,
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.22) 2px, transparent 2.6px) 0 0 / 34px 34px,
    linear-gradient(180deg, #ffb7ce 0%, #d2b3ff 58%, #a9d8ff 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; font-synthesis-weight: none; }
body {
  background: #3b2a68;
  color: var(--ink);
  font-family: "Jua", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100dvh;
}
button, input { font-family: inherit; font-weight: 400; }
button { color: var(--ink); cursor: pointer; }
b, strong, h2, h3 { font-weight: 400; }
#app { position: relative; width: 100%; max-width: 480px; height: 100dvh; background: var(--candy); display: flex; flex-direction: column; overflow: hidden; }
.ic { width: 1.15em; height: 1.15em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ic .gold { fill: var(--yellow); stroke: var(--ink); stroke-width: 2; }
.ic .solid { fill: currentColor; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

/* ---------- 공통 부품 ---------- */
.pill { background: var(--cream); border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 13px; font-size: 15px; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.round-btn { width: 46px; height: 46px; flex: 0 0 46px; border: 2.5px solid var(--ink); border-radius: 15px; background: var(--cream); font-size: 21px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 0 var(--ink); }
.big-btn { position: relative; width: min(270px, 84%); display: flex; align-items: center; justify-content: center; gap: 9px; border: 3px solid var(--ink); border-radius: 22px; padding: 12px 10px; font-size: 24px; color: #fff; text-shadow: -1.5px 0 var(--ink), 1.5px 0 var(--ink), 0 -1.5px var(--ink), 0 3px var(--ink); box-shadow: 0 6px 0 var(--ink), inset 0 -5px 0 rgba(0, 0, 0, 0.13); }
.big-btn::before { content: ""; position: absolute; top: 5px; left: 14px; right: 14px; height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.38); }
.big-btn .ic { filter: drop-shadow(0 2px 0 var(--ink)); }
.big-btn.pink { background: var(--pink); }
.big-btn.violet { background: var(--violet); }
.big-btn.yellow { background: var(--yellow); }
.big-btn:active, .round-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.text-btn { border: none; background: none; padding: 7px 16px; font-size: 16px; color: var(--dim); }
.card { background: var(--cream); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); }
.modal-backdrop { position: fixed; inset: 0; z-index: 999; background: rgba(46, 18, 62, 0.62); display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop.show { display: flex; }
.modal-card { width: 100%; max-height: 100%; overflow-y: auto; padding: 20px 18px; }
.modal-card h2 { font-size: 25px; text-align: center; }
.modal-card.show-in, .modal-backdrop.show .modal-card { animation: pop-in 0.22s ease-out; }
@keyframes pop-in { from { transform: scale(0.88); opacity: 0; } }

/* ---------- 로고: 통통한 젤리 글자, '컷'은 비스듬히 잘려 어긋난다 ---------- */
.logo { display: inline-flex; align-items: flex-end; padding-bottom: 12px; font-size: clamp(66px, 11.5dvh, 92px); line-height: 1.1; white-space: nowrap; }
.logo .ch { display: inline-block; color: #fff; -webkit-text-stroke: 11px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); animation: jelly 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
.logo .ch:nth-child(1) { rotate: -9deg; }
.logo .ch:nth-child(2) { rotate: 4deg; margin-left: -2px; color: #ffe3ee; animation-delay: 0.18s; }
.logo .cut { position: relative; margin-left: 6px; font-size: 1.14em; rotate: 7deg; -webkit-text-stroke: 0; text-shadow: none; animation-delay: 0.36s; }
.logo .cut i { display: block; font-style: normal; color: var(--yellow); -webkit-text-stroke: 11px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink);
  clip-path: polygon(-30% -30%, 130% -30%, 130% 36%, -30% 66%); translate: 4px -5px; }
.logo .cut i + i { position: absolute; inset: 0; color: #ff9f2e; clip-path: polygon(-30% 66%, 130% 36%, 130% 140%, -30% 140%); translate: -2px 2px; }
.logo .cut::after { content: ""; position: absolute; left: -22%; width: 146%; top: 47%; height: 7px; background: #fff; border-radius: 50%; rotate: -16.5deg; box-shadow: 0 0 10px #fff, 0 0 3px var(--pink); animation: glint 2.6s ease-in-out infinite; }
@keyframes jelly { 0%, 70%, 100% { transform: scale(1); } 78% { transform: scale(1.09, 0.9); } 86% { transform: scale(0.95, 1.06); } 93% { transform: scale(1.02, 0.98); } }
@keyframes glint { 0%, 100% { opacity: 0.75; scale: 0.94 1; } 50% { opacity: 1; scale: 1.06 1; } }
.tagline { display: inline-block; margin-top: 10px; padding: 2px 14px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 15px; }

/* ---------- 로딩 ---------- */
.art { opacity: 0; transition: opacity 0.35s ease; pointer-events: none; }
.art.ready { opacity: 1; }
#boot-screen { z-index: 1000; padding: 0; background: var(--candy); }
.boot-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.boot-art { width: min(300px, 80vw); aspect-ratio: 1; margin: -14px 0; }
.boot-art.pop { animation: boot-pop 0.35s ease-out; }
@keyframes boot-pop { 35% { transform: scale(1.14); } }
.boot-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.boot-art canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 10px 6px rgba(74, 29, 79, 0.25)); }
.boot-bar { width: 230px; height: 24px; padding: 3px; border: 3px solid var(--ink); border-radius: 999px; background: var(--cream); }
#boot-progress-bar { width: 0; height: 100%; border-radius: 999px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 9px, #ffe07d 9px 18px); transition: width 0.2s ease-out; }
#boot-status-text { margin-top: 10px; font-size: 14px; }

/* ---------- 홈 ---------- */
.top-row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px 14px 0; z-index: 10; }
.best-pill { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
#home { position: absolute; inset: 0; z-index: 40; display: none; flex-direction: column; align-items: center; background: var(--candy); overflow-y: auto; }
#home.show { display: flex; }
.home-title { margin-top: 3dvh; text-align: center; }
.home-art { position: relative; flex: 1 0 148px; width: 100%; max-width: 380px; max-height: 350px; container-type: size; }
.home-art img { position: absolute; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 10px 6px rgba(74, 29, 79, 0.28)); }
.home-art .main { height: 80%; left: 50%; bottom: -6%; transform: translateX(-50%); z-index: 1; }
/* 제목 글자(jelly, 2.6초)가 튄 뒤를 이어 아래 말랑이들도 차례로 콩 튄다. rotate·transform과 겹치지 않게 translate·scale만 쓴다 */
.home-art img { transform-origin: 50% 78%; animation: hop 2.6s ease-in-out infinite; }
.home-art .left { animation-delay: 0.1s; }
.home-art .main { animation-delay: 0.22s; }
.home-art .right { animation-delay: 0.34s; }
@keyframes hop {
  0%, 74%, 100% { translate: 0 0; scale: 1; }
  79% { translate: 0 0; scale: 1.06 0.92; }
  85% { translate: 0 -13px; scale: 0.96 1.05; }
  91% { translate: 0 0; scale: 1.05 0.94; }
  96% { translate: 0 -2px; scale: 0.99 1.01; }
}
.home-art .side { height: 74%; top: 2%; }
.home-art .left { left: calc(50% - 58cqh); rotate: -6deg; }
.home-art .right { right: calc(50% - 58cqh); rotate: 6deg; }
.home-buttons { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 17px; padding: 6px 0 22px; }
.home-nav { margin-top: auto; width: 100%; display: flex; justify-content: space-around; padding: 9px 0 max(12px, env(safe-area-inset-bottom)); background: var(--cream); border-top: 3px solid var(--ink); }
.home-nav button { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; min-width: 70px; }
.home-nav .ic { width: 26px; height: 26px; }

/* ---------- 게임 화면 ---------- */
.score-area { text-align: center; z-index: 10; }
.score-big { font-size: clamp(38px, 7.4dvh, 58px); line-height: 1.1; color: #fff; text-shadow: -2.5px 0 var(--ink), 2.5px 0 var(--ink), 0 -2.5px var(--ink), 0 5px var(--ink), 2px 2px var(--ink), -2px 2px var(--ink); font-variant-numeric: tabular-nums; }
.score-sub { font-size: 12px; margin-top: 2px; }
.target-area { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 5px 10px 0; z-index: 10; }
.name-tag { position: relative; display: flex; align-items: center; gap: 9px; max-width: 100%; padding: 4px 18px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--cream); box-shadow: 0 3px 0 var(--ink); font-size: 19px; }
.name-tag.pulse { animation: tag-in 0.35s ease-out; }
@keyframes tag-in { 0% { scale: 0.7; } 65% { scale: 1.08; } }
#item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-grade { display: flex; align-items: center; gap: 3px; padding: 1px 9px 1px 6px; border-radius: 999px; background: #fff; font-size: 13px; white-space: nowrap; }
.tag-grade .ic { width: 15px; height: 15px; }
.tag-grade:empty { display: none; }
.tag-target { font-size: 13px; padding: 1px 9px; border-radius: 999px; background: var(--pink); color: #fff; white-space: nowrap; }
.tag-target[hidden] { display: none; }
.name-tag.rare, .name-tag.legend { padding-left: 5px; }
.name-tag.rare { border-color: #1f3f9e; box-shadow: 0 3px 0 #1f3f9e; background: linear-gradient(180deg, #74a8ff, #4a6fe8); color: #fff; text-shadow: 0 1.5px 0 #1f3f9e; }
.name-tag.rare .tag-grade { color: #1f3f9e; text-shadow: none; }
.name-tag.legend { border-color: #8a5200; box-shadow: 0 3px 0 #8a5200, 0 0 16px 3px #ffd84a; background: linear-gradient(110deg, #ffb627 20%, #ffe98a 40%, #fff9d6 50%, #ffe98a 60%, #ffb627 80%); background-size: 250% 100%; color: #5a3200; }
.name-tag.legend.pulse { animation: tag-in 0.35s ease-out, shine 2s linear infinite; }
.name-tag.legend .tag-grade { background: #8a5200; color: #ffe98a; }
.name-tag.legend::before, .name-tag.legend::after { content: "✦"; position: absolute; color: #fff; text-shadow: 0 0 5px #ffb627, 0 0 2px #8a5200; font-size: 19px; animation: twinkle 1.2s ease-in-out infinite; }
.name-tag.legend::before { left: -13px; top: -11px; }
.name-tag.legend::after { right: -11px; bottom: -11px; animation-delay: -0.6s; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -66% 0; } }
@keyframes twinkle { 50% { scale: 0.45; opacity: 0.5; } }
.rarity-banner { position: absolute; left: 50%; top: 7%; z-index: 6; transform: translateX(-50%); white-space: nowrap; padding: 4px 16px; border: 3px solid var(--ink); border-radius: 999px; color: #fff; background: #3f6fe0; font-size: 15px; opacity: 0; pointer-events: none; }
.rarity-banner.legend { background: linear-gradient(90deg, #ff9f1c, #ffcf3f, #ff9f1c); background-size: 200% 100%; color: var(--ink); font-size: 18px; box-shadow: 0 0 18px #ffcf3f; }
.rarity-banner.show { animation: banner 2.4s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; scale: 0.4; } 10% { opacity: 1; scale: 1.15; } 18%, 80% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1; } }
.legend-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; animation: flash 0.7s ease-out forwards; }
@keyframes flash { from { opacity: 0.95; } to { opacity: 0; } }
.core-tag { background: #ffc4da; border: 2px solid var(--ink); font-size: 12px; padding: 1px 10px; border-radius: 999px; visibility: hidden; }
.core-tag.show { visibility: visible; }
#load-progress-wrap { width: 160px; height: 6px; background: rgba(255, 255, 255, 0.5); border-radius: 999px; overflow: hidden; }
#load-progress-bar { width: 0; height: 100%; background: var(--yellow); }
#canvas-wrap { position: relative; flex: 1; min-height: 0; width: 100%; overflow: hidden; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; }
.tray-section { padding: 4px 12px max(12px, env(safe-area-inset-bottom)); z-index: 10; }
.tray-slots { display: flex; justify-content: center; gap: 8px; }
.slot { width: 42px; display: flex; flex-direction: column; align-items: center; }
.heart { width: 35px; height: 32px; overflow: visible; }
.heart path { fill: rgba(255, 255, 255, 0.55); stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.heart.on path { fill: #ff3d6e; }
.slot.danger .heart { animation: beat 0.8s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.16); } }
.slot-pct { min-height: 15px; font-size: 11px; margin-top: 2px; white-space: nowrap; }
.tray-foot { display: flex; justify-content: center; align-items: center; gap: 9px; margin-top: 3px; }
.tray-foot .pill { font-size: 13px; padding: 2px 11px; }
.tray-foot small { font-size: 12px; }

/* ---------- 결과 ---------- */
#overlay { position: absolute; inset: 0; z-index: 30; display: none; flex-direction: column; background: var(--candy); text-align: center; }
#overlay.show { display: flex; animation: rise 0.4s cubic-bezier(0.2, 1.25, 0.4, 1); }
@keyframes rise { from { translate: 0 60px; opacity: 0; } }
.result-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 16px 12px; }
.result-body > * { flex: 0 0 auto; width: 100%; max-width: 330px; }
.result-head .mode { font-size: 17px; }
.result-record { display: none; width: auto; margin: 0 auto; padding: 2px 14px; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 999px; font-size: 16px; transform: rotate(-4deg); animation: beat 0.9s ease-in-out infinite; }
.result-record.show { display: inline-block; }
.result-card { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 6px; text-align: left; }
.result-hero { flex: 0 0 118px; text-align: center; }
.result-hero img { width: 108px; height: 108px; margin-bottom: -8px; }
.stamp { display: inline-block; padding: 0 9px; border: 2.5px solid var(--pink); border-radius: 9px; color: var(--pink); font-size: 15px; transform: rotate(-7deg); white-space: nowrap; }
.result-stats { flex: 1; list-style: none; }
.result-stats li { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; border-bottom: 2px dotted #e3cfe6; }
.result-stats li:last-child { border-bottom: none; }
.result-stats b { font-size: 17px; }
.rank-box { padding: 12px; text-align: left; }
.rank-box h3 { font-size: 16px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.rank-box h3 span:last-child { color: var(--dim); font-size: 12px; }
.rank-form { display: flex; gap: 7px; margin-bottom: 8px; }
.rank-input { flex: 1; min-width: 0; background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 8px 11px; color: var(--ink); font-size: 16px; user-select: text; -webkit-user-select: text; }
.rank-submit { background: var(--violet); color: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 0 15px; font-size: 16px; }
.result-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 12px max(10px, env(safe-area-inset-bottom)); }
.result-actions { display: flex; gap: 30px; }
.result-actions button { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
.result-actions .ic { width: 23px; height: 23px; }

/* ---------- 랭킹 ---------- */
.rank-list { list-style: none; max-height: 168px; overflow-y: auto; }
.rank-item { display: flex; align-items: center; gap: 9px; padding: 5px 9px; margin-bottom: 5px; border-radius: 12px; background: #f6ecfb; font-size: 15px; }
.rank-no { flex: 0 0 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 14px; }
.top1 .rank-no { background: var(--yellow); border: 2px solid var(--ink); }
.top2 .rank-no { background: #d8dfea; border: 2px solid var(--ink); }
.top3 .rank-no { background: #f0b27a; border: 2px solid var(--ink); }
.rank-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-name small { margin-left: 6px; font-size: 11px; color: var(--dim); }
.rank-item strong { font-size: 16px; }
.rank-item.me { background: #ffd9e6; outline: 2.5px solid var(--pink); outline-offset: -2.5px; }
.rank-item.note { justify-content: center; text-align: center; color: var(--dim); font-size: 14px; padding: 16px 8px; }
.rank-card { max-width: 380px; height: min(620px, 100%); display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.rank-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-btn { padding: 7px 0; border: 2.5px solid var(--ink); border-radius: 14px; font-size: 16px; background: #fff; }
.mode-btn.active { background: var(--pink); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14); }
.rank-modal-list { flex: 1; min-height: 0; max-height: none; }
.rank-mine { display: flex; justify-content: space-between; padding: 7px 12px; border-radius: 13px; background: var(--yellow); border: 2.5px solid var(--ink); font-size: 15px; }
.rank-card .big-btn { align-self: center; font-size: 20px; padding: 8px; }

/* ---------- 일시정지 · 설정 ---------- */
#pause-modal { z-index: 998; }
.pause-card { max-width: 300px; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.pause-card .big-btn { width: 100%; font-size: 21px; padding: 9px; }
.pause-card.settings .in-game { display: none; }
.setting { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: none; border-radius: 14px; background: #f6ecfb; font-size: 17px; }
.setting .ic { width: 22px; height: 22px; }
.switch { margin-left: auto; width: 52px; height: 28px; position: relative; border: 2.5px solid var(--ink); border-radius: 99px; background: #d9cadd; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: left 0.15s; }
.setting.on .switch { background: var(--mint); }
.setting.on .switch::after { left: 26px; }

/* ---------- 게임 방법 ---------- */
.guide-card { max-width: 380px; padding-bottom: 0; }
.guide-card h2 { margin-bottom: 12px; }
.guide-step { display: flex; align-items: center; gap: 10px; background: #f6ecfb; border-radius: 16px; padding: 9px 11px; margin-bottom: 9px; }
.guide-illus { flex: 0 0 64px; display: flex; align-items: center; justify-content: center; }
.guide-desc { display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.45; word-break: keep-all; }
.guide-desc strong, .guide-block strong { font-size: 16px; }
.guide-desc b, .guide-grades b { color: #e5316f; }
.guide-block { background: #f6ecfb; border-radius: 16px; padding: 9px 11px; margin-bottom: 9px; font-size: 13px; }
.guide-grades { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 7px 0; padding: 0; }
.guide-grades li { display: flex; align-items: center; gap: 9px; }
.guide-grades b { margin-left: auto; font-weight: 400; font-size: 15px; }
.grade-chip { min-width: 52px; text-align: center; padding: 1px 8px; border: 2px solid var(--ink); border-radius: 99px; background: var(--cream); }
.grade-chip.rare { border-color: #1f3f9e; background: linear-gradient(180deg, #74a8ff, #4a6fe8); color: #fff; }
.grade-chip.legend { border-color: #8a5200; background: linear-gradient(110deg, #ffb627, #fff3b0 50%, #ffb627); color: #5a3200; box-shadow: 0 0 8px #ffd84a; }
.guide-block p { color: var(--dim); }
.guide-foot { position: sticky; bottom: 0; background: var(--cream); padding: 4px 0 14px; }
.guide-check { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; font-size: 13px; color: var(--dim); cursor: pointer; }
.guide-check input { width: 17px; height: 17px; accent-color: var(--pink); }
.guide-card .big-btn { width: 100%; font-size: 21px; padding: 9px; }

/* 카드 오른쪽 위 닫기: 목록을 내려도 따라온다 */
.card-x-row { position: sticky; top: 0; z-index: 5; width: 100%; height: 0; flex: 0 0 0; display: flex; justify-content: flex-end; }
.card-x { flex: 0 0 auto; width: 38px; height: 38px; margin: -10px -8px 0 0; display: flex; align-items: center; justify-content: center; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--pink); color: #fff; box-shadow: 0 3px 0 var(--ink); }
.card-x .ic { width: 20px; height: 20px; }

/* ---------- 말랑 도감 ---------- */
.dex-card { max-width: 380px; text-align: center; }
.dex-card .dex-detail-view, .dex-card.detail .dex-list-view { display: none; }
.dex-card.detail .dex-detail-view, .dex-list-view { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dex-card .big-btn { flex: 0 0 auto; width: 100%; font-size: 20px; padding: 8px; }
.dex-summary { display: flex; gap: 10px; font-size: 14px; }
.dex-summary .pill { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.dex-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.dex-cell { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 3px 3px 7px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--ink); font-size: 11px; line-height: 1.25; word-break: keep-all; }
.dex-cell img { width: 100%; max-width: 84px; aspect-ratio: 1; }
.dex-cell img:not([src]) { visibility: hidden; }
.dex-cell.locked { background: #e9dcee; color: var(--dim); cursor: default; }
.dex-cell.locked img { filter: brightness(0); opacity: 0.2; }
.dex-star { position: absolute; top: 3px; right: 4px; font-size: 18px; }
.dex-cell.rare { background: #eaf2ff; border-color: #3f6fe0; box-shadow: 0 3px 0 #3f6fe0; }
.dex-cell.legend { background: linear-gradient(160deg, #fff7c2, #ffd75a); border-color: #b97800; box-shadow: 0 3px 0 #b97800, 0 0 10px #ffd75a; }
.dex-cell.locked.rare { background: #dfe3f5; }
.dex-cell.locked.legend { background: linear-gradient(160deg, #f3e8c4, #dcc27a); }
.dex-grade { position: absolute; top: 3px; left: 4px; padding: 0 6px; border-radius: 99px; background: #3f6fe0; color: #fff; font-size: 10px; z-index: 1; }
.dex-cell.legend .dex-grade { background: #b97800; }
.dex-hint { font-size: 13px; color: var(--dim); }
.dex-pics { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.dex-pics figure { border-radius: 16px; background: #e4d3f3; padding-bottom: 5px; font-size: 13px; }
.dex-pics img { width: 100%; aspect-ratio: 1; display: block; }
.dex-pics img:not([src]) { visibility: hidden; }
.dex-detail-view .result-stats { flex: 0 0 auto; width: 100%; }

/* ---------- 화면 전환 (fadeTo) ---------- */
#fade { position: fixed; inset: 0; z-index: 2000; background: var(--candy); animation: fade-in 0.15s ease both; }
#fade.done { animation: fade-out 0.22s ease both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
#boot-screen.leaving { opacity: 0; transition: opacity 0.35s ease; }
@media (prefers-reduced-motion: reduce) { #overlay.show { animation-duration: 0.01s; } }

/* ---------- 첫 판 안내 (showTutorial) ---------- */
#tutorial { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#tutorial p { position: absolute; left: 50%; bottom: 12%; translate: -50% 0; margin: 0; padding: 10px 18px; white-space: nowrap; text-align: center; font-size: 19px; line-height: 1.4; color: var(--ink); background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); }
#tutorial .line { position: absolute; left: 50%; top: 24%; height: 46%; margin-left: -2px; border-left: 4px dashed #fff; filter: drop-shadow(0 0 3px var(--ink)); }
#tutorial .finger { position: absolute; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); border: 4px solid var(--pink); box-shadow: 0 0 0 8px rgba(255, 92, 147, 0.25); animation: finger-slide 1.6s ease-in-out infinite; }
@keyframes finger-slide { 0% { top: 22%; opacity: 0; } 15% { opacity: 1; } 75% { top: 72%; opacity: 1; } 100% { top: 72%; opacity: 0; } }
