/* Nuku 웹 프로토타입.
   보이는 모양은 그림 인계본 시안(design/nuku-v1/preview.css · responsive.css)의 값을 그대로 옮겼다.
   설계 720×1280을 논리 360×640으로 그리고, .game-surface를 화면에 맞게 통째로 확대한다(05 3장 · 13). */

:root {
  --bg: #F4EEF7; --cream: #FFF7F3; --ink: #5B4B57; --muted: #80727D; --pink: #FA82A3; --accent: #C74D76;
  --line: #E9DFE8; --mint: #A8E6CF;
  --logical-w: 360px; --logical-h: 640px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  color: var(--ink); background: #F9F6F2;
  font: 14px/1.6 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #8B70C5; outline-offset: 4px; }
img { max-width: 100%; -webkit-user-drag: none; }
button img { pointer-events: none; }

/* ── 화면 틀: 휴대폰은 화면 가득, 가로로 넓은 창은 가운데 세로 화면(폭 ≤ 높이 × 3/4, 10 D013) ── */
#app { position: fixed; inset: 0; display: flex; justify-content: center; background: #F9F6F2; }
#frame { position: relative; height: 100%; width: 100%; background: var(--cream); overflow: hidden; touch-action: none; }
#safe-probe { position: absolute; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.game-surface { position: absolute; left: 0; top: 0; width: 360px; height: 640px; transform-origin: top left;
  display: flex; flex-direction: column; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ── 공통 부품 ── */
.icon { width: 24px; height: 24px; vertical-align: middle; }
.round { width: 44px; height: 44px; flex-shrink: 0; display: inline-grid; place-items: center; background: white; border-radius: 16px; box-shadow: 0 3px 0 #EDE3E8; }
.round img { width: 25px; height: 25px; }
.pill { display: inline-flex; align-items: center; gap: 5px; background: white; padding: 6px 12px; border-radius: 999px; white-space: nowrap; font-weight: 700; line-height: 1.3; box-shadow: 0 3px 8px #59425707; }
.pill img { width: 25px; height: 25px; }
.primary, .secondary { min-height: 44px; border-radius: 999px; padding: 10px 12px; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.35; }
.primary { background: linear-gradient(#FD94B1, #F4799F); color: #593443; box-shadow: 0 4px 0 #D66286; }
.secondary { background: white; border: 1px solid #E6D4DE; box-shadow: 0 3px 0 #ECE0E8; }
.primary:active, .secondary:active { transform: translateY(2px); }
.full { width: 100%; }
.action-row { display: flex; gap: 10px; }
.action-row > * { flex: 1; min-width: 0; }
.subtle { font-size: 11px; color: var(--muted); margin: 10px 0; line-height: 1.8; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: #A46E85; margin: 0 0 8px; }

/* ── S03 퍼즐 ── */
.topbar { height: 56px; width: 100%; max-width: 480px; margin: 0 auto; padding: 6px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.topbar strong { font-size: 17px; }
.topbar .level { text-align: center; line-height: 1.45; }
.level small { display: block; font-size: 13px; }
.score-dots { color: #B794D1; letter-spacing: 2px; font-size: 9px; transition: opacity .2s; }
.score-dots.off { opacity: 0; }
.moves { text-align: center; border-radius: 16px; background: #FCE5ED; padding: 5px 12px; line-height: 1.3; font-size: 10px; min-width: 56px; }
.moves b { display: block; font-size: 22px; color: #B9436D; }
.moves.low b { color: #F06A93; }
.moves.bump { animation: bump .3s; }

.goals { display: flex; gap: 8px; padding: 3px 16px 11px; height: 54px; flex-shrink: 0; justify-content: center; }
.goal { display: flex; align-items: center; gap: 7px; border: 1px solid #E9D8E2; background: white; border-radius: 16px; padding: 5px 12px; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 #EDDEE833; position: relative; }
.goal img { width: 27px; height: 27px; }
.goal.done { border-color: #A8E6CF; }
.goal.done span::after { content: " ✓"; color: #5FAE8E; }
.goal.bump { animation: bump .3s; }
.goal.pouch { border-style: dashed; font-weight: 700; font-size: 12px; color: var(--muted); padding: 5px 10px; }
.goal.pouch img { width: 22px; height: 22px; }
.goal.pouch[hidden] { display: none; }

.board-wrap { width: min(calc(var(--logical-w) - 32px), calc(var(--logical-h) - 306px), 400px); flex-shrink: 0; padding: 8px; margin: 0 auto; border-radius: 20px; background: white; box-shadow: 0 7px 0 #EAE0EC, 0 12px 22px #7D54750B; position: relative; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; aspect-ratio: 1; position: relative; }
.cell { border-radius: 6px; background: #F5EFF8; position: relative; box-shadow: inset 0 1px 1px #D2C3DC18; aspect-ratio: 1; }
.cell.p { background: #FFB3C8; box-shadow: inset 0 -3px #EAA0B7, inset 0 2px #FFFFFF55; }
.cell.y { background: #FFE08A; box-shadow: inset 0 -3px #E4C573, inset 0 2px #FFFFFF55; }
.cell.l { background: #C9B8FF; box-shadow: inset 0 -3px #B5A2EA, inset 0 2px #FFFFFF55; }
.cell.m { background: #A8E6CF; box-shadow: inset 0 -3px #8CCAB3, inset 0 2px #FFFFFF55; }
.cell img { width: 87%; height: 87%; position: absolute; inset: 6.5%; pointer-events: none; }
.cell.ghost { background: #C9B8FF44; border: 2px dashed #AA8DDA; box-shadow: none; }
.cell.will-clear { box-shadow: inset 0 0 0 3px #FFFFFFEE, 0 0 10px #FFFFFF; filter: brightness(1.08); }
.cell.aim { box-shadow: inset 0 0 0 3px #FFE08A, 0 0 8px #FFD25E; }
.cell.aim-empty { box-shadow: inset 0 0 0 2px #CFC6D6; }
.cell.pop { animation: pop .12s ease-out; }
.board-wrap.shake { animation: shake .3s; }
.board-wrap.aiming { box-shadow: 0 0 0 3px #FFE08A, 0 7px 0 #EAE0EC; }

.tray { height: 86px; min-height: 86px; width: 100%; max-width: 430px; margin: 0 auto; padding: 14px 25px 8px; display: flex; justify-content: space-around; align-items: center; gap: 20px; flex-shrink: 0; }
.tray-slot { flex: 1; height: 100%; display: grid; place-items: center; touch-action: none; }
.piece { display: grid; gap: 3px; }
.piece .cell { border-radius: 5px; }
.piece .blank { visibility: hidden; }
.tray-slot.dragging .piece { opacity: 0; }
.tray-slot.disabled .piece { opacity: .35; }
.tray-slot .piece.new { animation: popin .25s ease-out both; }
.tray-slot.back .piece { animation: popin .18s ease-out; }
/* 손 6칸(3칸씩 밀어 넘김) + 보관함 (3차 피드백 I-01 · I-02, 2차 H-10). 보관 칸 그림은 코덱스 ui/hold (MDs/16) */
.tray { position: relative; }
.tray.with-hold { padding: 12px 12px 8px; gap: 8px; }
.hand { flex: 1; min-width: 0; height: 100%; overflow: hidden; position: relative; touch-action: none; }
.hand-track { display: flex; height: 100%; width: calc(100% * var(--pages, 1)); transition: transform .25s ease-out; }
.hand .tray-slot { flex: 0 0 calc(100% / (3 * var(--pages, 1))); }
.hold-box { display: flex; gap: 5px; height: 100%; flex: 0 0 auto; touch-action: none; }
/* 칸 폭은 flex-basis가 아니라 width로(사파리는 flex-basis를 바깥 상자 폭 계산에 안 써서 상자가 좁아지고 칸이 옆 능력 칸 위로 넘쳤다, 10 K-01) */
.hold-box .tray-slot.hold { flex: none; width: 74px; }
.hold-box[data-n="2"] .tray-slot.hold { width: 62px; }
.hold-box[data-n="3"] .tray-slot.hold { width: 54px; }
.tray-slot.hold.born { animation: popin .35s ease-out; }
.tray-slot.pressed .piece { transform: scale(.9); transition: transform .08s; }
.tray-slot.nope .piece { animation: shake .3s; }
.tray-foot { height: 18px; width: 100%; max-width: 430px; margin: -4px auto 0; padding: 0 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; flex-shrink: 0; }
.turns { justify-self: start; font-size: 12px; font-weight: 800; color: #B94E76; background: white; border-radius: 10px; padding: 0 9px; line-height: 18px; box-shadow: 0 2px 0 #EDDEE8; }
.turns.none { color: #B9A5C4; }
.turns.bump { animation: bump .35s; }
.pages { display: flex; justify-content: center; }
.pages i { width: 22px; height: 18px; display: grid; place-items: center; cursor: pointer; }
.pages i::after { content: ""; width: 6px; height: 6px; border-radius: 3px; background: #E3CFE0; transition: width .2s; }
.pages i.on::after { width: 16px; background: #F06A93; }
.fx-say.turn { font-size: 11px; color: white; background: #B48BE0; border-radius: 10px; padding: 1px 7px; text-shadow: none; }
.tray-slot.hold { position: relative; border: 2px dashed #E3CFE0; border-radius: 18px; background: #FFFFFF80; }
.tray-slot.hold.full { border-style: solid; border-color: #E9D8E2; background: white; }
.tray-slot.hold.drop { border-color: #F06A93; background: #FFF0F5; }
.hold-box.drop .tray-slot.hold:not(.drop) { border-color: #F5B8CB; }
.hold-mark { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 1px; pointer-events: none; color: #B9A5C4; font-size: 10px; font-weight: 700; }
.hold-mark img { width: 28px; height: 28px; opacity: .55; }
.tray-slot.hold.full .hold-mark { place-items: start; align-content: start; padding: 3px 0 0 5px; }
.tray-slot.hold.full .hold-mark img { width: 16px; height: 16px; opacity: .8; }
.tray-slot.hold.full .hold-mark small { display: none; }
.tray-slot.hold .piece { position: relative; }
.mode-erase .board-wrap { box-shadow: 0 0 0 3px #C9EEFF, 0 7px 0 #EAE0EC; }
.mode-erase .board .cell:not(.fixed):not(.box):not([class="cell"]) { cursor: pointer; }
.piece.spin { animation: spin90 .3s ease-out; }
@keyframes spin90 { from { transform: rotate(-90deg); } to { transform: none; } }

/* 새 칸 (H-18 · H-22 · H-23 · H-21). 그림은 코덱스 puzzle/cell-fixed · gift-box · tape, ui/badge-x2 */
.cell.fixed, .cell.box { background: transparent; box-shadow: none; }
.cell.fixed img { width: 100%; height: 100%; inset: 0; }
.cell.box img { width: 96%; height: 96%; inset: 2%; }
.cell img.tape { width: 100%; height: 100%; inset: 0; }
.cell img.x2, .piece img.x2 { width: 52%; height: 52%; inset: -8% -8% auto auto; }
.fx-tape { animation: tapeOff .55s ease-in forwards; }
.fx-tape img { width: 100%; height: 100%; }
@keyframes tapeOff { 0% { transform: none; opacity: 1; } 100% { transform: translate(14px, 30px) rotate(28deg); opacity: 0; } }
.fx-cloud { animation: puff .55s ease-out forwards; }
.fx-cloud img { width: 100%; height: 100%; }
@keyframes puff { 0% { transform: scale(.4); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }

/* 점수 막대 (H-12): 3칸, 칸 끝마다 보상 표시(코덱스 ui/score-gift) */
.score-bar { position: relative; width: 112px; height: 6px; margin: 4px auto 0; border-radius: 3px; background: #F1E6EF; }
.score-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: linear-gradient(90deg, #FFB3C8, #F06A93); transition: width .5s ease-out; }
.score-bar .mark { position: absolute; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); }
.score-bar .mark img { width: 100%; height: 100%; opacity: .45; filter: grayscale(.6); }
.score-bar .mark.on img { opacity: 1; filter: none; }
.score-bar .mark.bump { animation: bump .35s; }
.topbar .level { line-height: 1.3; }

.drag-piece { position: absolute; z-index: 20; display: grid; pointer-events: none; filter: drop-shadow(0 6px 6px #5B4B5722); }
.drag-piece .cell { border-radius: 6px; }

.loadout { height: 74px; min-height: 74px; width: calc(100% - 32px); max-width: 430px; margin: auto auto 14px; flex-shrink: 0; background: #FFFFFFA0; border-radius: 22px; padding: 7px 10px; display: flex; justify-content: space-around; align-items: center; text-align: center; gap: 10px; }
.slot em { font-style: normal; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; line-height: 14px; color: var(--muted); min-width: 68px; background: none; padding: 0; }
.slot > span { display: grid; place-items: center; width: 44px; height: 44px; background: #FFF0F5; border: 2px solid #F79EB9; border-radius: 15px; }
.slot img { width: 35px; height: 35px; }
.slot.locked > span { border: 1px dashed #D6C9DD; background: #F5F0F7; }
.slot.locked img { width: 22px; height: 22px; opacity: .6; }
.slot.off > span { filter: grayscale(1); opacity: .5; }
.slot.armed > span { background: #FFE08A; border-color: #F0B93A; }
.slot.blink > span { animation: blink 1s infinite; }

/* 판 위 떠오르는 것들 */
.fx { position: absolute; z-index: 15; pointer-events: none; }
.fx-cell { border-radius: 6px; animation: vanish .25s ease-in forwards; }
.fx-cell img { width: 87%; height: 87%; position: absolute; inset: 6.5%; }
.fx-sticker { transition: transform .45s cubic-bezier(.4, -0.3, .6, 1), opacity .1s .4s; }
.fx-score { font-weight: 800; font-size: 18px; color: #B9436D; text-shadow: 0 2px 0 white, 0 0 6px white; animation: rise .6s ease-out forwards; white-space: nowrap; }
.fx-combo { font-weight: 900; color: #F06A93; text-shadow: 0 3px 0 white, 0 0 10px white; animation: comboPop .6s ease-out forwards; white-space: nowrap; }
.fx-plus { font-size: 11px; font-weight: 800; background: #F06A93; color: white; border-radius: 10px; padding: 1px 7px; animation: rise .6s ease-out forwards; white-space: nowrap; }
.fx-star { border-radius: 8px; background: linear-gradient(90deg, #FFE08A00, #FFE08A, #FFF7CC, #FFE08A00); animation: sweep .4s ease-in-out forwards; }
/* 판 위 글자 (H-13): "2줄! +30" · "3연속!" · 같은 색 · 연쇄 · 싹 비우기 · 신나는 시간 · 신기록 */
.fx-say { font-weight: 900; font-size: 16px; color: #B9436D; text-shadow: 0 2px 0 white, 0 0 8px white; white-space: nowrap; animation: rise .8s ease-out forwards; }
.fx-say.score { font-size: 18px; }
.fx-say.same { color: #5FAE8E; font-size: 14px; }
.fx-say.chain { color: #8A6BD8; font-size: 15px; }
.fx-say.big, .fx-say.fever { font-size: 24px; color: #F06A93; animation: comboPop 1.4s ease-out forwards; }
.fx-say.fever { font-size: 18px; color: #E39B12; }
.fx-say.best { font-size: 15px; color: white; background: #F06A93; border-radius: 12px; padding: 2px 10px; text-shadow: none; animation: rise 1.4s ease-out forwards; }
.fx-say.bar, .fx-say.tea { font-size: 11px; color: white; background: #F0A64F; border-radius: 10px; padding: 1px 7px; text-shadow: none; }
.fx-say.tea { background: #5FAE8E; }

/* 클리어: 남은 이동 · 점수 막대 스티커 줄 (2차 피드백 H-12 · H-17) */
.reward-bonus { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #EBDDE6; animation: popin .3s ease-out both; }
.reward-bonus small { width: 100%; font-size: 11px; color: var(--muted); font-weight: 700; }
.reward-bonus .reward-item img { width: 26px; height: 26px; }
.score-total .best-was { margin-left: 6px; font-size: 11px; color: var(--muted); }

/* 방 셋 넘기기 (2차 피드백 H-16) */
.room-name { display: flex; align-items: center; justify-content: center; gap: 8px; }
.room-name .room-nav { width: 30px; height: 30px; padding: 0; border-radius: 15px; background: white; color: #F06A93; font-size: 20px; font-weight: 800; line-height: 1; box-shadow: 0 2px 0 #EDE3E8; }
.room-count { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.room-next { margin: 2px 0 0; font-size: 11px; }
.item.tpl.locked { opacity: .6; }
.item.tpl.locked .tpl-box { display: grid; place-items: center; background: #F5F0F7; }
.item.tpl.locked .tpl-box img { width: 26px; height: 26px; opacity: .6; }
.room-open { margin: 10px 0 0; font-weight: 800; color: #5FAE8E; font-size: 13px; }

/* 마지막 기회 · 안내 */
.notice { position: absolute; z-index: 18; left: 16px; right: 16px; top: 112px; max-width: 410px; margin: 0 auto; background: white; border-radius: 21px; box-shadow: 0 9px 24px #50344920; padding: 12px; display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 700; }
.notice img { width: 40px; height: 40px; }
.notice .secondary { min-height: 36px; padding: 6px 12px; font-size: 12px; flex-shrink: 0; margin-left: auto; }

/* 모달 */
.modal-bg { position: absolute; inset: 0; background: #51425366; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { position: relative; background: #FFFAF6; border-radius: 28px; width: 100%; max-width: 390px; max-height: calc(100% - 12px); overflow-y: auto; padding: 20px 16px; box-shadow: 0 14px 60px #50304426; text-align: center; }
.modal h2 { font-size: 23px; line-height: 1.3; margin: 0 0 12px; letter-spacing: -1px; }
.modal-list { display: grid; gap: 8px; }

/* 임시 레벨 고르기 (N-06에서 지도로 바뀐다) */
.level-list { flex: 1; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-content: start; }
.level-list button { aspect-ratio: 1; border-radius: 50%; background: white; border: 2px solid #D7C8E9; font-size: 17px; font-weight: 800; color: #9B88AD; box-shadow: 0 5px 0 #C8B6DA40; }
.level-list button.tut { border-color: #F591B1; color: #C74D76; }
.level-list h2 { grid-column: 1 / -1; margin: 8px 0 0; font-size: 18px; }

/* 레벨 데이터 오류 띠 (07 2-1) */
.data-error { position: fixed; z-index: 100; left: 0; right: 0; top: 0; background: #D8394C; color: white; font-size: 13px; padding: 8px 12px; white-space: pre-line; }

/* 디버그 패널 (?debug=1) */
.debug-gear { position: fixed; z-index: 90; right: 10px; bottom: 10px; width: 40px; height: 40px; border-radius: 50%; background: #5B4B57; color: white; font-size: 20px; opacity: .7; }
.debug-panel { position: fixed; z-index: 91; right: 10px; bottom: 58px; width: 260px; max-height: 80vh; overflow-y: auto; background: #2E2530F2; color: #F5ECF2; border-radius: 12px; padding: 10px; font-size: 12px; line-height: 1.5; }
.debug-panel h3 { margin: 4px 0; font-size: 12px; color: #FFB3C8; }
.debug-panel button, .debug-panel select, .debug-panel input { font: inherit; font-size: 12px; margin: 2px 2px 2px 0; padding: 4px 8px; border-radius: 6px; border: 0; background: #F5ECF2; color: #2E2530; }
.debug-panel input { width: 110px; }
.debug-panel .row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 6px; }

@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes pop { 0% { transform: scale(.82); } 100% { transform: scale(1); } }
@keyframes popin { 0% { transform: translateY(14px) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes vanish { 0% { transform: scale(1); box-shadow: 0 0 0 3px white; } 100% { transform: scale(.1); opacity: 0; } }
@keyframes rise { 0% { transform: translate(-50%, 0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(-50%, -28px); opacity: 0; } }
@keyframes comboPop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 70% { transform: translate(-50%, -60%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes blink { 50% { transform: scale(1.1); box-shadow: 0 0 0 4px #FFE08A; } }
@keyframes sweep { 0% { clip-path: inset(0 100% 0 0); } 60% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { clip-path: inset(0 0 0 0); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ── S04 클리어 · S05 실패 (시안 값) — 퍼즐 화면 위에 덮는다(이어 하기로 돌아갈 수 있게) ── */
.screen.overlay { z-index: 40; }
.result { background: radial-gradient(ellipse at 50% 12%, #FFF4F5, #F3E9FB 65%); }
.result-body { width: 100%; max-width: 480px; margin: 0 auto; padding: 16px 20px 18px; min-height: 0; text-align: center; flex: 1; display: flex; flex-direction: column; }
.rating { display: flex; justify-content: center; align-items: center; margin-top: 12px; gap: 2px; }
.rating img { width: 54px; }
.rating img:nth-child(2) { width: 66px; transform: translateY(-6px); }
.rating img.drop { animation: starDrop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.rating img:nth-child(2).drop { animation-name: starDrop2; }
.result-body h2 { font-size: 27px; margin: 10px 0 2px; color: #B94E76; letter-spacing: -1px; }
.chapter-done { display: inline-block; margin: 4px auto 0; border-radius: 12px; background: #FCE5ED; color: #B9436D; padding: 2px 12px; font-size: 12px; font-weight: 800; }
.result-body .reward { background: #FFFCFA; border-radius: 24px; padding: 18px 16px; margin-top: 14px; box-shadow: 0 8px 18px #8967830D; }
.reward h3 { font-size: 13px; margin: 0 0 15px; }
.reward-icons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.reward-item { position: relative; background: #F5EFFB; flex: 1; min-width: 64px; max-width: 110px; border-radius: 18px; padding: 12px 4px 8px; font-weight: 800; font-size: 14px; }
.reward-item img { width: 50px; height: 50px; display: block; margin: auto; }
.new-tag { position: absolute; right: 1px; top: -8px; font-size: 8px; letter-spacing: 1px; border-radius: 10px; padding: 2px 7px; background: #A8E6CF; color: #477863; }
.score-total { padding: 15px 0 13px; font-size: 12px; }
.score-total strong { display: block; font-size: 28px; line-height: 1.3; }
.record { display: inline-block; border-radius: 12px; background: #FFF1CC; color: #8E723D; padding: 2px 9px; font-size: 10px; }
.record[hidden] { display: none; }
.result-body > .action-row { margin-top: auto; padding-top: 8px; flex-shrink: 0; }
/* 작은 휴대폰 (3차 피드백 I-07): 내용이 화면보다 길면 촘촘하게 줄이고, 그래도 넘치면 스크롤 + 단추 줄은 아래에 붙어 있다 */
.result { overflow-y: auto; overscroll-behavior: contain; }
.result .result-body { flex: 1 0 auto; }
.result-body > .action-row { position: sticky; bottom: 0; z-index: 2; padding-bottom: 6px; background: linear-gradient(#F3E9FB00, #F3E9FB 35%); }
.result.compact .rating { margin-top: 0; }
.result.compact .rating img { width: 40px; }
.result.compact .rating img:nth-child(2) { width: 50px; }
.result.compact .result-body { padding-top: 8px; }
.result.compact .result-body h2 { font-size: 22px; margin-top: 4px; }
.result.compact .room-open { margin: 4px 0 0; }
.result.compact .result-body .reward { padding: 12px 12px; margin-top: 8px; }
.result.compact .reward h3 { margin-bottom: 8px; }
.result.compact .reward-item { padding: 6px 4px 4px; font-size: 13px; }
.result.compact .reward-item img { width: 34px; height: 34px; }
.result.compact .reward-bonus { margin-top: 8px; padding-top: 8px; }
.result.compact .reward-bonus .reward-item img { width: 24px; height: 24px; }
.result.compact .score-total { padding: 8px 0 4px; }
.result.compact .score-total strong { font-size: 24px; }
.result-body > .subtle { margin-top: 10px; margin-bottom: 8px; }
.failure-bunny { width: 104px; height: 104px; margin: 0 auto 7px; }
.fail .result-body { padding-top: 38px; }
.fail h2 { color: var(--ink); }
.fail .goals { padding: 14px 0 0; height: auto; }
.fail .goal.done span::after { content: ""; }
.fail .primary { margin-top: auto; margin-bottom: 4px; }
.fail .heart-note { margin: 0 0 10px; }
.fail .heart-note .icon { width: 18px; height: 18px; }
.heart-break { position: absolute; z-index: 70; width: 44px; height: 44px; animation: heartBreak .4s ease-in forwards; pointer-events: none; }

/* ── 광고 자리 (05 8-1) ── */
.ad-screen { background: #5B4B57; color: #FFF7F3; z-index: 50; }
.ad-screen .topbar { justify-content: flex-end; font-weight: 800; }
.ad-screen .result-body { justify-content: center; }
.ad-screen h2 { font-size: 24px; color: #FFF7F3; }
.ad-screen .subtle { color: #E2D7DF; }
.ad-count { font-size: 56px; font-weight: 800; }
.ad-screen .primary { margin-top: 36px; }
.ad-screen .primary[hidden] { display: none; }

/* ── 작은 창 (하트 없음 등) ── */
.modal-bg { z-index: 60; }
.modal > img { width: 70px; margin-bottom: 12px; }
.modal p { margin: 8px 0; }
.modal .secondary { margin-top: 0; }

/* 임시 지도(레벨 목록) 위 하트 표시 */
.list-hearts { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 15px; }
.list-hearts img { width: 24px; height: 24px; }
.list-hearts small { font-size: 10px; color: var(--muted); font-weight: 600; }
.level-list button.cleared { background: #FFB3C8; border-color: #F591B1; color: #77485A; }
.level-list button small { display: block; font-size: 9px; color: #B08B33; line-height: 1; }

@keyframes starDrop { 0% { transform: translateY(-40px) scale(1.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes starDrop2 { 0% { transform: translateY(-46px) scale(1.4); opacity: 0; } 100% { transform: translateY(-6px); opacity: 1; } }
@keyframes heartBreak { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3) rotate(-8deg); } 100% { transform: scale(.6) translateY(20px) rotate(12deg); opacity: 0; } }

/* ── S01 챕터 맵 (시안 값). 챕터 둘을 한 길로 쌓아 세로로 스크롤한다(05 4장 · 13 6장) ── */
.map .topbar .pill small { font-size: 10px; font-weight: 500; color: var(--muted); }
.map-content { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; background: #F4EEF7; touch-action: pan-y; }
.map-content::-webkit-scrollbar { display: none; }
.chapter-title { position: sticky; top: 8px; height: 70px; margin: 8px 12px -78px; z-index: 6; text-align: center; padding-top: 12px; border-radius: 22px; background: #FFF9F2E8; border: 1px solid #FFFFFF; backdrop-filter: blur(8px); box-shadow: 0 4px 20px #92748C0D; pointer-events: none; }
.chapter-title small { font-size: 9px; letter-spacing: 2px; color: #A07186; }
.chapter-title h3 { font-size: 20px; margin: 0; }
.map-inner { position: relative; width: 100%; max-width: 480px; margin: 0 auto; }
.map-section { position: relative; height: 690px; overflow: hidden; }
.map-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: .44; pointer-events: none; }
/* 꽃 지도 아트 (MDs/15, 코덱스 그림 assets/art-v1/map · 시안 design/nuku-v1/responsive.css 값). 설계 640 상자 = 논리 320 */
.flower-mist { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 54%, #FFF9F1EB 0%, #FFF8F0A0 38%, #F4EEF733 78%); pointer-events: none; }
.flower { position: absolute; z-index: 1; width: 320px; height: 320px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.petal-img { position: absolute; width: 76px; height: 152px; left: 122px; top: 19.0833px; transform-origin: 38px 140.9167px; }
.petal-img.fresh { animation: petalIn .25s ease-out both; }
.flower-leaves { position: absolute; width: 140px; height: auto; left: 90px; top: 260px; opacity: .8; }
.map-dest { position: absolute; width: 102px; left: 109px; top: 109px; z-index: 3; text-align: center; }
.map-dest .dest-pic { display: block; width: 102px; height: 102px; filter: drop-shadow(0 4px 6px #B995AC20); }
.map-dest b { display: block; position: absolute; top: 90px; left: 50%; transform: translateX(-50%); padding: 4px 9px; border-radius: 12px; background: #FFFCF5; border: 1px solid #EEDCD0; white-space: nowrap; color: #967868; font-size: 10px; font-weight: 700; }
.flower-seal { position: absolute; z-index: 5; width: 38px; height: 38px; left: 202px; top: 199px; }
.flower-seal.fresh { animation: sealIn .2s ease-out .5s both; }
.flower-caption { position: absolute; left: 0; right: 0; margin: 0; text-align: center; color: #927786; font-size: 11px; letter-spacing: .3px; z-index: 2; pointer-events: none; }
.node { position: absolute; transform: translate(-50%, -50%); width: 40px; height: 40px; border: 2px solid #FFFEFA; background: #FFF9F0; color: #957786; border-radius: 50%; font-size: 15px; font-weight: 800; box-shadow: 0 3px 6px #99768C15; z-index: 4; padding: 0; }
.node::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; } /* 누르는 자리 44 이상 (15장) */
.node.done { background: #FFF2D5; color: #926953; border-color: #FFFDF6; }
.node.current { background: #D56390; color: white; border: 3px solid white; box-shadow: 0 0 0 3px #E58BAB40, 0 4px 9px #AD4D7840; }
.node.locked { color: #A895A3; background: #FFF9F5E8; }
.node .icon { position: absolute; width: 10px; height: 10px; bottom: -6px; right: -2px; background: #FFF9F5; border-radius: 6px; padding: 1px; box-sizing: content-box; }
.node .tiny-stars { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-size: 7px; line-height: 1.4; color: #B98742; background: #FFF6E1; border-radius: 7px; padding: 1px 4px; white-space: nowrap; letter-spacing: 0; }
.node .tiny-stars i { font-style: normal; color: #D9CFE0; }
.node.shake { animation: nodeShake .3s; }
.map-goal { position: absolute; border-radius: 15px; background: white; padding: 8px 10px; font-size: 10px; box-shadow: 0 5px 18px #72545B10; z-index: 3; line-height: 1.6; pointer-events: none; }
.map-goal img { width: 20px; height: 20px; vertical-align: middle; }
.map-goal.under { left: 50%; transform: translateX(-50%); width: 230px; min-height: 42px; text-align: center; border-radius: 18px; border: 1px solid #FFFFFF; background: #FFFCF6E8; padding: 8px 12px; line-height: 1.8; font-size: 11px; white-space: nowrap; }
@keyframes petalIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sealIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .flower-seal.fresh { animation-name: petalIn; } } /* 저감 모션: 색 · 투명도만 (15장) */
.bottom-nav { height: 60px; width: 100%; flex-shrink: 0; background: #FFFCFA; display: flex; border-top: 1px solid var(--line); margin-top: auto; }
.bottom-nav button { flex: 1; background: none; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; color: var(--muted); min-height: 44px; position: relative; }
.bottom-nav button.active { color: var(--accent); }
.bottom-nav img { width: 25px; }
.bottom-nav .dot { position: absolute; top: 12px; right: calc(50% - 40px); width: 8px; height: 8px; border-radius: 50%; background: #F06A93; }

/* ── S02 레벨 시작 (시안 값) ── */
.modal .x { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; background: transparent; }
.x img { width: 20px; }
.modal .goal-tiles { display: flex; gap: 8px; margin-bottom: 8px; }
.goal-tile { flex: 1; background: #F7EFF7; border-radius: 18px; padding: 10px 5px; font-size: 11px; font-weight: 700; }
.goal-tile img { display: block; width: 44px; height: 44px; margin: 0 auto 4px; }
.modal .eyebrow { margin-bottom: 8px; }
.modal .equip-caption { font-size: 12px; text-align: left; font-weight: 700; margin: 12px 0 6px; }
.modal .loadout { margin: 8px 0; background: white; width: 100%; height: 74px; }
.loadout .slot.empty > span { background: #FFF7FA; border: 2px dashed #F3B6C9; filter: none; opacity: 1; }
.equip-pick { display: flex; justify-content: center; gap: 8px; margin: 4px 0 6px; flex-wrap: wrap; }
.equip-pick .pick { display: grid; grid-template-columns: 26px auto; grid-template-rows: auto auto; align-items: center; column-gap: 4px; padding: 5px 9px; border-radius: 14px; background: #F7EFF7; font-size: 12px; text-align: left; }
.equip-pick .pick img { grid-row: span 2; width: 26px; height: 26px; }
.equip-pick .pick small { font-size: 9px; color: var(--muted); font-weight: 500; }
.equip-pick .pick:disabled { opacity: .45; }
.loadout .slot.empty img { opacity: 0; }
.modal .subtle .icon { width: 20px; height: 20px; }
.my-star { display: inline-flex; align-items: center; gap: 6px; background: none; padding: 4px 8px; border-radius: 12px; font-size: 11px; color: var(--muted); }
.my-star:disabled { opacity: .5; }
.best-line { font-size: 11px; color: var(--muted); margin: -6px 0 8px; }

@keyframes breathe { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.08); } }
@keyframes nodeShake { 0%, 100% { transform: translate(-50%, -50%); } 25% { transform: translate(calc(-50% - 5px), -50%); } 75% { transform: translate(calc(-50% + 5px), -50%); } }

/* ── S06 내 방 · S07 꾸미기 (시안 값). 꾸미기 아래는 템플릿 카드 셋(2-5 결정, 시안 요청 중 Q-01) ── */
.room-intro { height: 84px; padding: 8px 16px 0; flex-shrink: 0; text-align: center; }
.room-intro .eyebrow { font-size: 9px; line-height: 12px; margin: 0 0 4px; }
.room-intro h2 { font-size: 21px; line-height: 27px; margin: 0; letter-spacing: -1px; }
.room-intro p { font-size: 11px; line-height: 17px; margin: 4px 0; color: var(--muted); }
.room-view { background: radial-gradient(ellipse at center, #FFF7F4, #F5E8F7); border-radius: 24px; width: calc(100% - 32px); max-width: 440px; margin: 4px auto 0; padding: 0; flex-shrink: 0; position: relative; touch-action: none; }
.room-view > svg { display: block; width: 100%; height: min(calc(var(--logical-h) * .43), 350px); }
.room-actions { width: 100%; max-width: 440px; padding: 8px 20px 12px; margin: auto auto 0; display: grid; gap: 8px; }
.room-actions .secondary img { width: 22px; height: 22px; }
.edit .room-holder { height: calc(var(--logical-h) * .32); min-height: 0; flex-shrink: 0; position: relative; }
/* 꾸미기 첫 안내는 방 그림 위쪽 작은 말풍선 (3차 피드백 I-05). 꼬리는 아래 방을 가리킨다 */
.tip.in-room { left: 28px; right: 28px; min-height: 0; padding: 7px 12px 7px 8px; gap: 8px; border-radius: 16px; font-size: 11px; box-shadow: 0 6px 16px #50344922; }
.tip.in-room img { width: 30px; height: 30px; }
.tip.in-room .tip-text { line-height: 1.45; }
.tip.in-room::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: white; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 3px 0; }
.room-view.zoomed { box-shadow: 0 0 0 2px #F5B8CB; }
.edit .room-view { height: calc(100% - 4px); margin-top: 0; }
.edit .room-view > svg { height: 100%; }
.edit-panel { width: 100%; max-width: 480px; margin: 8px auto 0; padding: 10px 16px; min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #FFFCFA; border-radius: 28px 28px 0 0; }
.inventory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.inventory .item { position: relative; background: #F7F0FA; border: 1px solid #E9DEEF; border-radius: 15px; padding: 6px 4px; font-size: 11px; font-weight: 700; text-align: center; line-height: 1.4; }
.inventory .item.selected { border: 2px solid #EC84A5; background: #FFF3F7; padding: 5px 3px; }
.inventory .item.selected::after { content: "✓"; position: absolute; top: -6px; right: -4px; width: 20px; height: 20px; border-radius: 50%; background: #EC84A5; color: white; font-size: 11px; line-height: 20px; }
.item small { display: block; color: var(--muted); font-size: 9px; font-weight: 500; }
.tpl-box { display: block; }
.tpl-room { width: 100%; aspect-ratio: 1; display: block; border-radius: 10px; background: radial-gradient(ellipse at center, #FFF7F4, #F5E8F7); }
.edit-panel > .subtle { font-size: 10px; margin: 6px 0; line-height: 16px; text-align: center; }
.edit-panel .action-row { margin-top: auto; }
.room-bubble { position: absolute; z-index: 5; transform: translate(-50%, -100%); background: white; border-radius: 14px; box-shadow: 0 6px 16px #50344920; padding: 4px; display: flex; gap: 4px; }
.room-bubble button { min-height: 36px; padding: 4px 10px; border-radius: 10px; background: #FFF0F5; font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.room-bubble img { width: 18px; height: 18px; }
.room-view svg [data-i].wiggle { animation: wiggle .3s; transform-box: fill-box; transform-origin: center; }
.flash { position: absolute; inset: 0; z-index: 80; background: white; animation: flash .35s ease-out forwards; pointer-events: none; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* ── S08 튜토리얼 (시안 값) ── */
.tutorial-shade { position: absolute; inset: 0; background: #493D5366; z-index: 5; }
.tut-hi { position: relative; z-index: 6; }
.tutorial .tut-pulse { animation: tutPulse 1.1s ease-in-out infinite; }
@keyframes tutPulse { 50% { transform: scale(1.06); filter: drop-shadow(0 0 8px #FFFFFF); } }
.tutorial .board-wrap.tut-hi { box-shadow: 0 0 0 3px white, 0 0 0 6px #FFFFFF66; }
.tutorial .board-wrap .cell:not(.target) { filter: brightness(.65) saturate(.6); }
.tutorial .tray-slot.tut-dim .piece { opacity: .3; }
.cell.tut-drop { background: #C9B8FF44; border: 2px dashed #AA8DDA; box-shadow: none; }
.tip { position: absolute; z-index: 7; left: 16px; right: 16px; max-width: 410px; margin: 0 auto; background: white; border-radius: 21px; box-shadow: 0 9px 24px #50344920; padding: 12px; display: flex; gap: 12px; align-items: center; font-size: 12px; font-weight: 700; min-height: 62px; }
.tip img { width: 40px; height: 40px; flex-shrink: 0; }
.tip-text { white-space: pre-line; line-height: 1.55; }
.tip small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; margin-top: 2px; }
.tip.once { z-index: 35; animation: popin .25s ease-out; }
.tut-hand { position: absolute; z-index: 7; width: 38px; pointer-events: none; transform: rotate(-15deg); transform-origin: 6px 2px; }
.tut-hand[hidden] { display: none; }
.tutorial .step { position: absolute; left: 20px; bottom: 96px; z-index: 7; color: white; font-size: 10px; }
.tutorial .skip { position: absolute; right: 16px; bottom: 86px; z-index: 7; background: #FFFFFFCC; border-radius: 20px; padding: 10px 13px; font-size: 11px; min-height: 44px; }

/* 디버그 "봇 한 수" */
.cell.bot-hint { outline: 2px dashed #5B4B57; outline-offset: -4px; }
.tray-slot.bot-hint { outline: 2px dashed #5B4B57; outline-offset: -2px; border-radius: 12px; }

/* 스티커 도감 S09 (10 G-01 · G-03 · G-05). 모양은 구현자 임시 — 그림 쪽 시안 요청 Q-09 */
.book .topbar .book-count { font-size: 11px; color: var(--muted); padding: 6px 10px; }
.book-content { flex: 1; min-height: 0; overflow-y: auto; width: 100%; max-width: 480px; margin: 0 auto; padding: 4px 16px 16px; display: flex; flex-direction: column; }
.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.book-card { position: relative; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; box-shadow: 0 3px 0 #F1E8EE; }
.book-card img { width: 44px; height: 44px; margin-bottom: 2px; }
.book-card b { font-size: 12px; }
.book-card .cnt { font-size: 17px; font-weight: 900; color: var(--accent); line-height: 1.2; }
.book-card small { font-size: 9px; color: var(--muted); line-height: 1.4; min-height: 13px; }
.book-card.empty .cnt { color: #C9BBC4; }
.book-card.unknown { background: #F7F2F6; box-shadow: none; }
.book-card.unknown img.sil { filter: brightness(0); opacity: .14; }
.book-card.unknown b { color: #B5A7B1; letter-spacing: 2px; }
.book-card .new-tag { top: -7px; right: -3px; }
.book-special-title { margin: 16px 0 6px; font-size: 11px; letter-spacing: 3px; color: #C7972E; font-weight: 900; }
.book-special { display: flex; gap: 10px; align-items: center; background: #FFF8E4; border: 1px solid #F4E1B0; border-radius: 18px; padding: 8px; }
.book-special .book-card { width: 34%; flex-shrink: 0; border-color: #F4E1B0; }
.book-special .book-card .cnt { color: #B8862A; }
.book-special p { margin: 0; font-size: 10px; line-height: 1.6; color: #8A7450; white-space: pre-line; }
.book-hint { white-space: pre-line; text-align: center; margin: 12px 0 8px; font-size: 10px; line-height: 1.6; }
.book-content > .primary { margin-top: auto; }

/* 꾸미기 탭 셋 (10 G-02 · G-06) */
.edit-tabs { display: flex; gap: 6px; flex-shrink: 0; }
.edit-tabs button { flex: 1; min-height: 34px; border-radius: 999px; background: #F2EAF4; font-size: 12px; font-weight: 800; color: var(--muted); }
.edit-tabs button.on { background: linear-gradient(#FD94B1, #F4799F); color: #593443; }
.tab-body { flex: 1; min-height: 0; overflow-y: auto; margin-top: 4px; }
.edit-panel > .hint.note { color: var(--accent); font-weight: 700; }
.empty-note { text-align: center; }
.inventory.stickers .st-card { touch-action: none; cursor: grab; user-select: none; padding: 6px 4px 4px; }
.inventory.stickers .st-card img { width: 30px; height: 30px; display: block; margin: 0 auto 1px; pointer-events: none; }
.inventory.stickers .st-card small { font-size: 11px; font-weight: 800; color: var(--accent); }
.inventory.stickers .st-card.empty { opacity: .45; cursor: default; }
.inventory.stickers .st-card.empty small { color: var(--muted); }
.st-card.wiggle { animation: wiggle .3s; }
.sticker-ghost { position: absolute; z-index: 30; width: 40px; height: 40px; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 4px 6px #50344933); }
.sticker-ghost img { width: 100%; height: 100%; }
.inventory.furn .f-card { padding: 4px 3px 5px; }
.inventory.furn .f-thumb { width: 38px; height: 38px; display: block; margin: 0 auto; }
.inventory.furn small { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; font-size: 9px; }
.inventory.furn .cost { display: inline-flex; align-items: center; gap: 1px; color: #B39AAA; }
.inventory.furn .cost.ok { color: #3E8E6B; }
.inventory.furn .cost img { width: 12px; height: 12px; }
.inventory.furn .f-card.ready { border: 2px solid #EC84A5; background: #FFF3F7; padding: 3px 2px 4px; }
.inventory.furn .f-card.spare { border: 2px solid #8ED3B3; background: #F1FBF6; padding: 3px 2px 4px; }
.inventory.furn .f-card.spare small { color: #3E8E6B; font-weight: 800; }
.ready-tag { position: absolute; top: -7px; right: -3px; font-style: normal; font-size: 8px; border-radius: 10px; padding: 2px 6px; background: #EC84A5; color: white; }
.make-head { display: flex; flex-direction: column; align-items: center; }
.make-head .f-big { width: 84px; height: 84px; }
.make-head h2 { margin: 2px 0 0; }
.make-head small { color: var(--muted); font-size: 11px; }
.cost-list { display: grid; gap: 6px; margin: 12px 0 0; }
.cost-row { display: flex; align-items: center; gap: 8px; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px; font-size: 13px; }
.cost-row img { width: 26px; height: 26px; }
.cost-row span { margin-left: auto; font-weight: 800; color: #C2556F; }
.cost-row.ok span { color: #3E8E6B; }
.modal .primary:disabled { opacity: .5; filter: grayscale(.4); }

/* ── 4차 피드백 (MDs/10 J) ── */
/* J-01 보관함은 맨 아래 능력 줄 왼쪽. 손 3칸이 한 줄을 다 쓴다 */
.loadout.has-hold { justify-content: flex-start; gap: 6px; padding: 7px 8px; }
.loadout.has-hold .hold-box { height: 60px; padding-right: 8px; margin-right: 2px; border-right: 1px dashed #EBDDE6; }
.loadout.has-hold .hold-box .tray-slot.hold { flex: none; width: 64px; border-radius: 16px; }
.loadout.has-hold .hold-box[data-n="2"] .tray-slot.hold { width: 54px; }
.loadout.has-hold .hold-box[data-n="3"] .tray-slot.hold { width: 46px; }
.loadout.has-hold .slot { flex: 1; min-width: 0; }
.loadout.has-hold .slot em, .loadout.has-hold .slot.locked { font-size: 8.5px; line-height: 11px; }
/* J-04 마지막 기회 안내: 판 바로 위(목표 줄 자리)에 들어가게 납작하게 */
.notice { padding: 7px 10px; gap: 8px; font-size: 12px; line-height: 1.4; border-radius: 18px; }
.notice img { width: 34px; height: 34px; }
.notice .secondary { min-height: 34px; }
/* J-07 놓기 되돌리기: 손 아래 오른쪽. 누르는 자리는 보이지 않게 넓힌다 */
.tray-foot .undo { justify-self: end; position: relative; font-size: 12px; font-weight: 800; color: #8A6BD8; background: white; border-radius: 10px; padding: 0 9px; line-height: 18px; min-height: 0; box-shadow: 0 2px 0 #EDDEE8; }
.tray-foot .undo::before { content: ""; position: absolute; inset: -12px -8px; }
.undo-body { white-space: pre-line; }
/* J-09 덤 선물 상자가 바닥에 닿음 */
.fx-box { animation: boxPop .9s ease-out forwards; }
.fx-box img { width: 100%; height: 100%; }
.fx-say.gift { font-size: 12px; color: white; background: #F0A64F; border-radius: 10px; padding: 2px 9px; text-shadow: none; }
@keyframes boxPop { 0% { transform: scale(1); } 30% { transform: translateY(-6px) scale(1.4); } 100% { transform: translateY(-40px) scale(.6); opacity: 0; } }

/* J-06 클리어 화면을 한 화면에: 별 · 제목 · 보상 칸을 줄이고 덤 스티커는 작은 묶음 한 줄로 */
.result:not(.fail) .result-body { padding-top: 10px; }
.result:not(.fail) .rating { margin-top: 4px; }
.result:not(.fail) .rating img { width: 44px; }
.result:not(.fail) .rating img:nth-child(2) { width: 54px; }
.result:not(.fail) .result-body h2 { font-size: 24px; margin: 4px 0 2px; }
.clear-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin-top: 2px; }
.clear-tags .chapter-done { margin: 0; }
.clear-tags .room-open { display: inline-block; margin: 0; border-radius: 12px; background: #E4F6EE; color: #3E8E6B; padding: 2px 12px; font-size: 12px; }
.result-body .reward { padding: 12px 14px; margin-top: 10px; }
.reward h3 { margin: 0 0 8px; }
.reward-item { padding: 8px 4px 6px; }
.reward-item img { width: 40px; height: 40px; }
.reward-bonus { gap: 4px 12px; margin-top: 8px; padding-top: 8px; }
.bonus-group { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; }
.reward-bonus .bonus-group small { width: auto; font-size: 11px; }
.mini { display: inline-flex; align-items: center; gap: 1px; }
.mini img { width: 20px; height: 20px; }
.gift-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 8px; border-radius: 14px; background: #FFF6E4; text-align: left; }
.gift-row .gift-icon { width: 28px; height: 28px; flex-shrink: 0; }
.gift-row b { font-size: 12px; white-space: nowrap; }
.gift-row .gift-sum { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.gift-row .gift-open { min-height: 34px; padding: 4px 12px; font-size: 12px; margin-left: auto; flex-shrink: 0; animation: blink 1.2s infinite; }
.gift-row .gift-open.seen { animation: none; }
.score-total { padding: 10px 0 2px; }
.score-total strong { display: inline; font-size: 24px; margin-left: 6px; vertical-align: -2px; }
.score-total .record { margin-left: 6px; }

/* J-02 받은 선물 열기 */
.gift-open-box .gift-count { margin: 0 0 4px; }
.gift-stage { position: relative; height: 150px; display: grid; place-items: center; cursor: pointer; }
.gift-stage .gift-big { width: 110px; height: 110px; }
.gift-stage.closed .gift-big { animation: giftShake 1.2s ease-in-out infinite; }
.gift-stage.open > :not(.gift-spark) { animation: giftPop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.gift-spark { position: absolute; width: 150px; height: 150px; opacity: .7; animation: spin360 5s linear infinite; pointer-events: none; }
.gift-items { position: relative; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.gift-items span { display: flex; flex-direction: column; align-items: center; font-weight: 900; color: var(--accent); }
.gift-items img { width: 56px; height: 56px; }
.gift-furn { position: relative; width: 110px; height: 110px; }
.gift-ticket { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 20px; border-radius: 16px; background: #FFF1CC; border: 2px dashed #F0B93A; font-weight: 900; color: #8E723D; }
.gift-ticket img { width: 44px; height: 44px; }
.gift-text { font-weight: 700; min-height: 22px; }
@keyframes giftShake { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-8deg); } 80% { transform: rotate(8deg); } 90% { transform: rotate(-4deg); } }
@keyframes giftPop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin360 { to { transform: rotate(360deg); } }

/* J-03 방 넓히기 줄 (꾸미기 방 탭) */
.expand-row { width: 100%; margin-top: 8px; display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 15px; background: #F7F0FA; border: 1px solid #E9DEEF; font-size: 12px; text-align: left; }
.expand-row.ready { border: 2px solid #EC84A5; background: #FFF3F7; padding: 7px 11px; }
.expand-row .expand-to { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; color: var(--accent); margin-left: auto; flex-shrink: 0; }
.expand-row .expand-to .icon { width: 16px; height: 16px; }
.expand-row small { flex: 1; min-width: 0; display: flex; gap: 6px; flex-wrap: wrap; font-size: 10px; }
.expand-row .cost { display: inline-flex; align-items: center; gap: 1px; color: #B39AAA; font-weight: 700; }
.expand-row .cost.ok { color: #3E8E6B; }
.expand-row .cost img { width: 14px; height: 14px; }
.expand-row.max { justify-content: space-between; }
.expand-row.max small { width: auto; color: var(--muted); }

/* ── 겹침 정리 (4차 뒤 사용자 "아래쪽 왼쪽 UI가 겹친다", 10 J-10) ── */
/* 보관함에 블록이 들면 바구니 표시를 숨긴다(작은 칸에서 블록 칸 위에 겹쳤다). 실선 테두리가 "들어 있음"을 알린다 */
.tray-slot.hold.full .hold-mark { display: none; }
/* 손 줄과 그 아래 줄(회전 · 쪽 점 · 되돌리기)이 겹치지 않게: 손 아래 여백을 줄이고 아래 줄을 당기지 않는다 */
.tray, .tray.with-hold { padding-bottom: 4px; }
.tray-foot { margin-top: 0; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.tray-foot .undo { white-space: nowrap; }
/* 능력 칸이 많으면(디버그 판 다섯 · 보관함 3칸) 칸이 줄 안에서 나눠 쓰고 그림을 줄인다 */
.loadout .slot { flex: 1 1 0; min-width: 0; }
.loadout.crowded .slot > span { width: 38px; height: 38px; border-radius: 13px; }
.loadout.crowded .slot img { width: 28px; height: 28px; }
.loadout.crowded .slot em, .loadout.crowded .slot.locked { font-size: 8px; line-height: 10px; }
/* 내 방 머리: 방 이름 · 방 수 · 다음 방 줄이 방 그림 밑으로 숨지 않게 높이를 내용에 맞춘다 */
.room-intro { height: auto; min-height: 84px; padding-bottom: 2px; }
.room-name .room-count { margin: 0; font-size: 11px; color: var(--muted); }
/* 꾸미기 방 탭: 템플릿 카드 그림을 낮춰 아래 넓히기 줄이 잘리지 않게 */
.tpl-room { aspect-ratio: 5 / 4; object-fit: contain; }
/* 튜토리얼 단계 글자 · 건너뛰기는 손 아래 줄 높이에 맞춰 둔다(손 칸 · 능력 줄과 안 겹침, 자리는 tutorial.js) */
.tutorial .step { bottom: auto; line-height: 18px; }
.tutorial .skip { bottom: auto; min-height: 0; padding: 0 12px; line-height: 18px; }
.tutorial .skip::before { content: ""; position: absolute; inset: -10px -6px; }
/* 처음 한 번 안내를 화면 흐름 안에 끼워 넣을 때(떠 있으면 글자를 가렸다) */
.tip.inline { position: relative; left: auto; right: auto; top: auto; margin: 8px 0 0; z-index: 1; text-align: left; }
.modal > .eyebrow { padding: 0 40px; } /* 닫기(X) 단추 자리를 비운다 */
.equip-caption.hint-new { color: var(--accent); white-space: pre-line; line-height: 1.5; animation: popin .3s ease-out; }

/* ── 5차 피드백 (MDs/10 K) ── */
/* K-02 선물 별(레벨 15부터 판마다 1장): 판의 능력 줄 끝 칸 · 시작 팝업 이동 줄의 작은 띠. 다 장착한 스티커는 ×0 대신 "장착함" */
.loadout .slot.gift > span { background: #FFF6E4; border-color: #F0B93A; }
.loadout .slot.gift em { color: #B07A1E; font-weight: 800; }
.gift-star { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; padding: 1px 9px 1px 4px; border-radius: 12px; background: #FFF1CC; color: #8E6A1E; font-size: 12px; font-weight: 800; vertical-align: 1px; }
.gift-star img { width: 18px; height: 18px; }
.equip-pick .pick.all-in b { font-size: 10px; color: var(--accent); }
/* K-03 선물 상자 창 제목을 크게 */
.gift-open-box .gift-count { font-size: 19px; letter-spacing: 0; color: var(--accent); margin: 2px 0 6px; }
/* K-04 클리어 화면: 별 · "클리어!"는 조금 작게, 얻은 스티커는 크게(새 스티커는 테두리 줄), 덤은 표("어디서 | 무엇을") */
.result:not(.fail) .rating img { width: 36px; }
.result:not(.fail) .rating img:nth-child(2) { width: 44px; transform: translateY(-4px); }
.result:not(.fail) .result-body h2 { font-size: 21px; margin: 2px 0 0; }
.reward h3 { margin: 0 0 12px; }
.reward-item { max-width: 120px; padding: 12px 4px 8px; font-size: 17px; border-radius: 20px; }
.reward-item img { width: 58px; height: 58px; margin-bottom: 2px; }
.reward-item.new { background: #F0FAF5; box-shadow: inset 0 0 0 2px #8ED8B8; }
.bonus-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 12px; font-size: 12px; }
.bonus-table th, .bonus-table td { padding: 7px 6px; border-top: 1px dashed #EBDDE6; vertical-align: middle; }
.bonus-table th { text-align: left; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bonus-table td { text-align: right; }
.bonus-table .mini { margin-left: 10px; font-size: 13px; font-weight: 800; }
.bonus-table .mini img { width: 22px; height: 22px; }
.bonus-table tr.gift th, .bonus-table tr.gift td { background: #FFF6E4; }
.bonus-table tr.gift th { border-radius: 12px 0 0 12px; }
.bonus-table tr.gift td { border-radius: 0 12px 12px 0; }
.bonus-table tr.gift + tr th, .bonus-table tr.gift + tr td { border-top-color: transparent; }
.bonus-table .gift-icon { width: 24px; height: 24px; vertical-align: -7px; margin-right: 4px; }
.bonus-table .gift-cell { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.bonus-table .gift-sum { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; min-width: 0; }
.bonus-table .gift-sum .mini { margin-left: 0; }
.bonus-table .gift-sum .mini img { width: 18px; height: 18px; }
.bonus-table .gift-open { flex-shrink: 0; min-height: 30px; padding: 3px 10px; font-size: 12px; white-space: nowrap; animation: blink 1.2s infinite; }
.bonus-table .gift-open.seen { animation: none; }
.bonus-table tr.spent th, .bonus-table tr.spent .mini { color: #B39AAA; }
.result.compact .bonus-table { margin-top: 8px; }
.result.compact .bonus-table th, .result.compact .bonus-table td { padding: 4px 6px; }
.result.compact .bonus-table .mini img { width: 20px; height: 20px; }
/* K-04 결과 화면 단추 줄은 아래에 붙이지 않는다(sticky 풀기): 사파리(WebKit)는 크기를 바꾼 화면(#surface scale) 안의 sticky 자리를 잘못 재
   단추 줄이 떠올라 점수 · 표를 가렸다(WebKit 검사, 375 × 560). 내용은 논리 640 안에 들어가고(J-06 · compact), 그래도 넘치면 스크롤해서 닿는다 */
.result-body > .action-row { position: relative; bottom: auto; background: none; }
