#scr-title, #scr-map, #scr-codex, #scr-deck { overflow: hidden; }
.screen .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.screen img { -webkit-user-drag: none; }
.screen button { font-family: var(--font-ui); }

/* title */
#scr-title .logo-wrap { position: absolute; left: 50%; top: 4%; width: 82%; height: 30%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; }
#scr-title .logo { max-width: 100%; max-height: 100%; object-fit: contain; animation: logo-drop .6s cubic-bezier(.3,1.6,.5,1) both, float 3.4s ease-in-out .6s infinite; filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); }
#scr-title .prompt { position: absolute; left: 12%; right: 12%; top: 85%; text-align: center; font-size: 18px; font-weight: 800; color: #fff6e6; animation: pulse 1.6s ease-in-out infinite; padding: 8px 12px; border-radius: 22px; background: rgba(43,29,26,.55); border: 2px solid rgba(255,214,140,.7); text-shadow: 0 2px 0 #3a2418, 0 0 4px #3a2418; }
@keyframes logo-drop { 0% { transform: translateY(-120%) scale(.8); opacity: 0; } 65% { transform: translateY(6%) scale(1.04); opacity: 1; } 100% { transform: none; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; min-height: 36px; border-radius: 18px; background: rgba(43,29,26,.72); border: 2px solid var(--gold); color: #fff6e6; font-size: 16px; font-weight: 700; }
.chip img { width: 26px; height: 26px; object-fit: contain; }
.chip.sm { min-height: 28px; padding: 2px 10px; font-size: 14px; border-width: 1.5px; }
.chip.sm img { width: 22px; height: 22px; }

/* map */
.map-top { position: absolute; left: 64px; top: 12px; right: 76px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 3; }
.map-field { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.node { position: absolute; margin-left: -60px; margin-top: -34px; display: flex; flex-direction: column; align-items: center; width: 120px; animation: slide-up .4s both; }
.medal { width: 68px; height: 68px; border-radius: 50%; border: 4px solid var(--ink); font-size: 28px; font-weight: 900; color: #fff; cursor: pointer; font-family: var(--font-title);
  background: radial-gradient(circle at 35% 28%, #c8f5e4 0 12%, #5fd0ad 40%, #2f8f78 100%); box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), inset 0 4px 0 rgba(255,255,255,.5), 0 5px 0 rgba(43,29,26,.55); transition: transform .12s; }
.medal:active { transform: scale(.9); }
.medal.focus { transform: scale(1.12); box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.85); }
.node.locked .medal { background: radial-gradient(circle at 35% 28%, #eee 0 12%, #aaa 45%, #777 100%); font-size: 24px; }
.node.next .medal { animation: bounce 1.1s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.node .stars { display: flex; gap: 1px; margin-top: 2px; font-size: 16px; line-height: 1; }
.st { color: rgba(43,29,26,.45); text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.st.on { color: var(--gold); text-shadow: 0 0 0 var(--ink), 1px 1px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink); }
.node .tag { margin-top: 2px; max-width: 120px; padding: 2px 8px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; font-size: 14px; font-weight: 700; text-align: center; line-height: 1.15; }
.node.locked .tag { opacity: .7; }

.bottom-nav { position: absolute; left: 4%; right: 4%; bottom: 12px; height: 12%; min-height: 76px; display: flex; gap: 8px; justify-content: center; align-items: stretch; z-index: 3; padding: 6px; border-radius: 20px; background: rgba(255,246,230,.82); border: 3px solid var(--ink); animation: slide-up .35s both; }
.nav-btn { flex: 1; min-width: 64px; min-height: 64px; border: 2px solid var(--ink); border-radius: 14px; background: linear-gradient(#fff6e6, #f3d9a8); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 2px; font-size: 14px; font-weight: 700; color: #fff; transition: transform .12s; }
.nav-btn img { width: 36px; height: 36px; object-fit: contain; }
.nav-btn span { font-size: 14px; }
.nav-btn:active { transform: scale(.92); }
.nav-btn.focus { transform: scale(1.06); box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.85); }

/* modal */
.modal { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(20,10,8,.55); pointer-events: auto; animation: fade-in .2s both; padding: 8px; }
.modal.out { opacity: 0; transition: opacity .12s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal .panel { width: min(100%, 372px); max-height: 94%; overflow-y: auto; background: none; padding: 0; }
.modal .inner { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 10px 8px; text-align: center; color: var(--ink); }
.modal .pt { font-size: 24px; color: var(--ink); text-shadow: 0 2px 0 rgba(255,255,255,.6); }
.modal .pd { font-size: 14px; line-height: 1.35; font-weight: 600; }
.modal .small { font-size: 14px; line-height: 1.3; font-weight: 600; }
.modal .row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.modal .lbl { font-size: 14px; font-weight: 800; color: #7a2a1c; }
.modal .emb { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.6); border: 2px solid var(--ink); display: inline-flex; }
.modal .emb.good { border-color: var(--jade); box-shadow: 0 0 6px var(--jade); }
.modal .emb img, .modal .fam { width: 100%; height: 100%; object-fit: contain; }
.modal .row .fam { width: 28px; height: 28px; }
.modal .goals { list-style: none; margin: 0; padding: 0; font-size: 14px; font-weight: 700; text-align: left; }
.modal .goals li { color: #a8741a; }
.modal .rcard { width: 40px; height: 40px; display: inline-flex; }
.modal .rcard img, .charm-img { width: 100%; height: 100%; object-fit: contain; }
.charm-row .charm-img { width: 40px; height: 40px; }
.modal .btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.btn.big { min-width: 120px; font-size: 20px; }
.btn.sm { min-height: 44px; font-size: 15px; padding: 0 8px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; background: none; border: none; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.toggle i { width: 28px; height: 28px; border-radius: 8px; border: 3px solid var(--ink); background: #fff; position: relative; }
.toggle.on i { background: var(--jade); }
.toggle.on i::after { content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 20px; text-align: center; line-height: 22px; font-style: normal; }
.toggle.focus { box-shadow: 0 0 0 3px #fff3b0; border-radius: 10px; }

/* detail */
.dart { width: 55%; aspect-ratio: 1; animation: float 3s ease-in-out infinite; }
.dart img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 6px rgba(0,0,0,.3)); }
.recipe { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: 22px; font-weight: 900; }
.recipe img { width: 48px; height: 48px; object-fit: contain; }
.recipe .rc { display: inline-flex; align-items: center; gap: 2px; }
.recipe .rc img { width: 38px; height: 38px; }
.recipe b { color: var(--seal); }
.modal .pet { display: flex; align-items: center; gap: 6px; text-align: left; }

/* codex / deck */
.paper-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 20% 10%, rgba(120,170,150,.35), transparent 55%), radial-gradient(ellipse at 85% 80%, rgba(255,159,176,.3), transparent 55%), #f6ead0; }
.hdr { position: absolute; left: 0; right: 0; top: 0; height: 70px; display: flex; align-items: center; gap: 8px; padding: 12px 76px 6px 12px; z-index: 2; }
.hdr-title { flex: 1; font-size: 24px; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-extra { display: flex; align-items: center; }
.back-btn { flex: none; }
.grid { position: absolute; left: 0; right: 0; top: 74px; bottom: 0; overflow-y: auto; padding: 8px 12px 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-content: start; touch-action: pan-y; animation: slide-up .3s both; }
.cell { position: relative; border: 3px solid var(--ink); border-radius: 16px; background: linear-gradient(#fffaf0, #f1dcae); padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 140px; cursor: pointer; animation: slide-up .3s both; }
.cell.focus { box-shadow: 0 0 0 3px #fff3b0, 0 0 14px 4px rgba(255,220,120,.85); transform: scale(1.04); }
.cell:active { transform: scale(.94); }
.cell .art { width: 100%; aspect-ratio: 1; }
.cell .art img, .drow .art img { width: 100%; height: 100%; object-fit: contain; }
.cell .nm { font-size: 14px; font-weight: 800; color: #fff; text-align: center; line-height: 1.1; }
.cell .fams { display: flex; gap: 2px; height: 24px; }
.cell .fams img { width: 24px; height: 24px; object-fit: contain; }
.dark .art img { filter: brightness(0) opacity(.35); }
.dark .nm { color: #8a7a68; text-shadow: none; }
.ribbon { position: absolute; top: 6px; left: -6px; padding: 1px 8px; background: var(--seal); color: #fff; font-size: 12px; font-weight: 800; border: 2px solid var(--ink); border-radius: 4px; transform: rotate(-8deg); }
.paw { position: absolute; top: 2px; right: 4px; font-size: 18px; }
.deck-count { position: absolute; left: 0; right: 0; top: 66px; text-align: center; font-size: 16px; font-weight: 800; color: var(--paper); z-index: 2; padding: 0 12px; }
.list { position: absolute; left: 0; right: 0; top: 96px; bottom: 0; overflow-y: auto; padding: 4px 10px 24px; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; animation: slide-up .3s both; }
.drow { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 3px solid var(--ink); border-radius: 14px; background: linear-gradient(#fffaf0, #f1dcae); min-height: 74px; animation: slide-up .3s both; flex: none; }
.drow .art { width: 54px; height: 54px; flex: none; }
.drow .info { flex: 1; min-width: 0; }
.drow .nm { font-size: 15px; font-weight: 800; color: #fff; }
.drow.dark .nm { color: #8a7a68; text-shadow: none; }
.drow .mini { display: flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 700; color: var(--ink); flex-wrap: wrap; }
.drow .mini .fam { width: 20px; height: 20px; }
.drow .ctl { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 52%; }
.icon-btn.sm { width: 44px; height: 44px; font-size: 24px; font-weight: 900; color: #fff; }
.dcount { min-width: 18px; text-align: center; font-size: 18px; font-weight: 900; color: #fff; }
.maxed { font-size: 14px; font-weight: 800; color: var(--seal); }

/* help */
.pent { position: relative; width: min(78vw, 280px); aspect-ratio: 1; margin: 0 auto; }
.pent svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pent-node { position: absolute; transform: translate(-50%, -50%); width: 58px; display: flex; flex-direction: column; align-items: center; }
.pent-node img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 0 3px var(--fam)); }
.pent-node span { font-size: 14px; font-weight: 800; color: #fff; white-space: nowrap; }
.help-lines { margin: 0; padding: 0 0 0 18px; text-align: left; font-size: 14px; line-height: 1.35; font-weight: 600; }
.help-lines li { margin-bottom: 4px; }
