/* 한 줄 마을 — 화면 스타일. 폰 세로 우선(360~430px). 그림 파일이 없으면 CSS 로 그린 모양을 쓴다. */
:root {
  --sky1: #8fd3f4; --sky2: #cdeefa; --grass: #8cc76b; --grass2: #6aa84f; --grass3: #4f8a3a;
  --wood: #c88a4a; --wood2: #a66a30; --wood3: #6b4226; --cream: #fbf3e2; --cream2: #efe1c3;
  --ink: #3b2a1a; --ink2: #6b5843; --gold: #f2c14e; --gold2: #ffe08a; --red: #d9534f; --green: #5aa94a; --blue: #4a8fd9;
  --cell: min(calc((100vw - 44px) / 8), 50px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 38%, #b9e39d 62%, var(--grass) 100%) fixed;
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  overflow: hidden;
}
html.img-bg-village body { background: var(--img-bg-village) center / cover fixed, var(--grass); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
#app { position: relative; z-index: 0; isolation: isolate; max-width: 480px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; }
/* 10-04 회장 「이런 이미지 오류」: 지도 건물(.plot z-index 2+y/10 → 100 넘음)이 창(.overlay z 40) 위로 올라왔다.
   #app 을 한 층(z 0)으로 묶어 화면 속 무엇도 창·효과(body 에 붙음) 위로 못 오게 · 지도는 .map-scroll 안에 가둬 윗줄(z 5)도 안 덮게.
   되돌림: 위 #app 의 z-index·isolation 과 아래 .map-scroll isolation 을 지운다. 검사: 화면사진/_자동시험_drive.mjs 「창 위 겹침」 */
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; animation: fadeIn .25s ease; padding: calc(8px + var(--safe-top)) 12px calc(8px + var(--safe-bot)); }
.screen.on { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 단추 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 0 20px; border-radius: 16px; font-size: 19px; font-weight: 800; transition: transform .08s, filter .15s; position: relative; }
.btn:active { transform: scale(.95); }
.btn[disabled] { filter: grayscale(1) brightness(.85); opacity: .6; pointer-events: none; }
.btn.green { background: linear-gradient(180deg, #8fdc6e, #5aa94a 60%, #4b9140); color: #fff; text-shadow: 0 2px 0 #2f6a28; box-shadow: 0 0 0 2px #c9f2b4 inset, 0 4px 0 #2f6a28, 0 8px 16px rgba(47,106,40,.3); }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #d9a43a); color: #5a3b06; box-shadow: 0 0 0 2px #fff3c4 inset, 0 4px 0 #9b6f1c, 0 8px 16px rgba(155,111,28,.3); }
.btn.wood { background: linear-gradient(180deg, #e0a868, var(--wood) 60%, var(--wood2)); color: #fff; text-shadow: 0 2px 0 var(--wood3); box-shadow: 0 0 0 2px #f2c993 inset, 0 4px 0 var(--wood3); }
.btn.ghost { background: rgba(255,255,255,.75); color: var(--ink); box-shadow: 0 0 0 2px rgba(107,66,38,.25) inset; font-size: 16px; min-height: 44px; }
.btn.ad::before { content: "▶ 광고"; font-size: 11px; background: rgba(0,0,0,.25); color: #fff; border-radius: 6px; padding: 2px 6px; text-shadow: none; }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 14px; border-radius: 12px; }
.btn.wide { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.8); box-shadow: 0 0 0 2px rgba(107,66,38,.2) inset, 0 3px 0 rgba(107,66,38,.25); font-size: 20px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.icon-btn:active { transform: scale(.92); }

/* ───── 블록 (CSS 로 그린 모양 · 그림 있으면 그림) ───── */
.blk { position: relative; display: block; border-radius: 18%; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.35), 0 1px 2px rgba(0,0,0,.25); background-size: cover; }
.blk.wood { background: repeating-linear-gradient(8deg, rgba(120,70,20,.0) 0 5px, rgba(120,70,20,.22) 5px 6px), linear-gradient(180deg, #e7ae66, #c88340); }
.blk.stone { background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.55) 0 8%, transparent 30%), radial-gradient(circle at 70% 70%, rgba(0,0,0,.12) 0 15%, transparent 40%), linear-gradient(160deg, #c6c9cc, #8e9398); }
.blk.brick { background: linear-gradient(0deg, transparent 47%, rgba(255,230,210,.55) 47% 53%, transparent 53%), linear-gradient(90deg, transparent 47%, rgba(255,230,210,.55) 47% 53%, transparent 53%) 0 0 / 100% 50%, linear-gradient(180deg, #e0715a, #b84a35); }
.blk.glass { background: linear-gradient(135deg, rgba(255,255,255,.85) 0 18%, transparent 19% 48%, rgba(255,255,255,.4) 49% 55%, transparent 56%), linear-gradient(180deg, #a9e3f7, #5bb7dc); }
.blk.gold { background: radial-gradient(circle at 30% 25%, #fff8d6 0 10%, transparent 35%), linear-gradient(160deg, #ffe08a, #e2a72e 70%, #b9801f); }
html.img-wood .blk.wood { background: var(--img-wood) center / cover; }
html.img-stone .blk.stone { background: var(--img-stone) center / cover; }
html.img-brick .blk.brick { background: var(--img-brick) center / cover; }
html.img-glass .blk.glass { background: var(--img-glass) center / cover; }
html.img-gold .blk.gold { background: var(--img-gold) center / cover; }
html.img-wood .blk.wood, html.img-stone .blk.stone, html.img-brick .blk.brick, html.img-glass .blk.glass, html.img-gold .blk.gold { box-shadow: none; border-radius: 12%; }
.blk.ico { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; border-radius: 5px; }
.blk.chip { width: calc(var(--cell) * .62); height: calc(var(--cell) * .62); }
.mat-fly { position: fixed; z-index: 60; pointer-events: none; will-change: transform; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }

/* ───── 첫 화면 ───── */
#s-title { justify-content: space-between; align-items: center; text-align: center; padding-top: calc(24px + var(--safe-top)); }
.title-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.cloud { position: absolute; width: 120px; height: 40px; background: #fff; border-radius: 40px; opacity: .85; animation: drift 40s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 54px; height: 54px; left: 18px; top: -26px; }
.cloud::after { width: 40px; height: 40px; left: 60px; top: -16px; }
@keyframes drift { from { transform: translateX(-160px); } to { transform: translateX(520px); } }
.logo-box { margin-top: 10px; }
.logo-img { width: 82%; max-width: 330px; }
.logo-text { font-size: clamp(46px, 14vw, 60px); font-weight: 900; color: #fff; letter-spacing: .02em; line-height: 1;
  text-shadow: 0 3px 0 var(--wood2), 0 6px 0 var(--wood3), 0 10px 18px rgba(0,0,0,.25); -webkit-text-stroke: 1.5px var(--wood3); }
.logo-text small { display: block; font-size: 16px; color: var(--ink2); -webkit-text-stroke: 0; text-shadow: none; font-weight: 700; margin-top: 14px; letter-spacing: .08em; }
.title-scene { position: relative; width: 100%; height: 24vh; max-height: 220px; }
.title-scene .hill { position: absolute; left: -10%; right: -10%; bottom: 0; height: 70%; background: radial-gradient(ellipse at 50% 100%, var(--grass2) 0 55%, transparent 56%); }
.title-scene .bld { position: absolute; bottom: 12%; width: 30%; }
.title-blocks { display: flex; gap: 6px; justify-content: center; margin: 6px 0; }
.title-blocks .blk { width: 34px; height: 34px; animation: bob 2.4s ease-in-out infinite; }
.title-blocks .blk:nth-child(2) { animation-delay: .2s; } .title-blocks .blk:nth-child(3) { animation-delay: .4s; } .title-blocks .blk:nth-child(4) { animation-delay: .6s; } .title-blocks .blk:nth-child(5) { animation-delay: .8s; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
.menu { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; margin-bottom: 8px; }
.menu-row { display: flex; gap: 8px; }
.menu-row .btn { flex: 1; }
.foot-note { font-size: 12px; color: rgba(59,42,26,.6); margin-top: 6px; }

/* ───── 마을 지도 ───── */
#s-map { padding: 0; }
.map-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-top)) 10px 8px; background: linear-gradient(180deg, rgba(251,243,226,.97), rgba(251,243,226,.88)); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.mats { display: flex; gap: 4px; min-width: 0; flex-wrap: nowrap; overflow: hidden; align-items: center; flex: none; }
.map-top .mats { flex: 1; }
.mat { display: inline-flex; align-items: center; gap: 3px; background: linear-gradient(180deg, #fffaf0, #f1e2c2); border-radius: 999px; padding: 3px 8px 3px 4px; font-weight: 900; font-size: 14px; box-shadow: 0 0 0 1.5px rgba(107,66,38,.35) inset, 0 2px 0 rgba(107,66,38,.25); white-space: nowrap; }
.mat .blk.ico { width: 20px; height: 20px; }
.mat.bump, .bump { animation: bumpA .25s ease; }
@keyframes bumpA { 40% { transform: scale(1.25); } }
.mat.zero { opacity: .45; }
.map-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; position: relative; isolation: isolate; }
.map-world { position: relative; padding: 10px 0 30px; }
.district { position: relative; margin: 0 0 6px; min-height: 520px; overflow: hidden; }
.district .land { position: absolute; inset: 0; }
.district-name { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 3; background: linear-gradient(180deg, #e0a868, var(--wood2)); color: #fff; font-weight: 900; padding: 6px 18px; border-radius: 10px; box-shadow: 0 3px 0 var(--wood3), 0 0 0 2px #f2c993 inset; font-size: 16px; white-space: nowrap; text-shadow: 0 1px 0 var(--wood3); }
.district-name small { font-weight: 700; opacity: .85; margin-left: 6px; font-size: 12px; }
.district.locked .land { filter: saturate(.25) brightness(.9); }
.district.locked .district-name::after { content: " · 잠김"; }
.path-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.node { position: absolute; z-index: 4; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #9be07c, #4b9140); box-shadow: 0 4px 0 #2f6a28, 0 0 0 3px #fff, 0 6px 12px rgba(0,0,0,.25); text-shadow: 0 1px 0 #2f6a28; }
.node.locked { background: radial-gradient(circle at 35% 30%, #d9d4c8, #a59f92); box-shadow: 0 4px 0 #77716a, 0 0 0 3px #fff; color: #f6f3ee; text-shadow: none; }
.node.current { background: radial-gradient(circle at 35% 30%, #ffe08a, #e2a72e); box-shadow: 0 4px 0 #9b6f1c, 0 0 0 3px #fff, 0 0 0 9px rgba(255,224,138,.5); color: #5a3b06; text-shadow: none; animation: pulse 1.4s ease-in-out infinite; width: 56px; height: 56px; margin: -28px 0 0 -28px; font-size: 19px; }
@keyframes pulse { 50% { box-shadow: 0 4px 0 #9b6f1c, 0 0 0 3px #fff, 0 0 0 15px rgba(255,224,138,.15); } }
.node .stars { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #f2c14e; text-shadow: 0 1px 0 #7a5a10; letter-spacing: -1px; white-space: nowrap; }
.node.boss::after { content: "★"; position: absolute; top: -10px; right: -8px; font-size: 16px; color: #ff6b4a; text-shadow: 0 1px 0 #fff; }
.plot { position: absolute; z-index: 2; width: 40%; aspect-ratio: 1; transform: translate(-50%, -82%); display: flex; flex-direction: column; align-items: center; }
.plot .bld-svg, .plot .bld-img { width: 100%; height: auto; display: block; overflow: visible; }
.plot .bld-img { filter: drop-shadow(0 6px 4px rgba(0,0,0,.25)); }
.plot .tag { margin-top: -6px; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.9); border-radius: 8px; padding: 2px 8px; box-shadow: 0 2px 0 rgba(107,66,38,.25); white-space: nowrap; }
.plot.ready .tag { background: var(--gold2); animation: bob 1.6s ease-in-out infinite; }
.plot button { position: absolute; inset: 0; }
.rise { animation: riseA .9s cubic-bezier(.2,1.4,.4,1) both; transform-origin: 50% 90%; }
@keyframes riseA { 0% { transform: scaleY(0) translateY(20px); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.blades { animation: spin 6s linear infinite; }
.wheel { animation: spin 5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.smoke { animation: smoke 3s ease-out infinite; }
@keyframes smoke { 0% { transform: translateY(0) scale(.6); opacity: .7; } 100% { transform: translateY(-16px) scale(1.6); opacity: 0; } }
.flag { animation: wave 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: left center; }
@keyframes wave { 50% { transform: skewY(8deg) scaleX(.9); } }
.beam { animation: beam 2s ease-in-out infinite; }
@keyframes beam { 50% { opacity: .35; } }
.villager { position: absolute; z-index: 3; width: 14px; height: 22px; animation: walk 9s ease-in-out infinite alternate; }
.villager::before { content: ""; position: absolute; left: 3px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: #f2c9a0; }
.villager::after { content: ""; position: absolute; left: 1px; top: 8px; width: 12px; height: 13px; border-radius: 5px 5px 3px 3px; background: var(--c, #d9534f); }
@keyframes walk { from { transform: translateX(-30px); } to { transform: translateX(30px); } }
.tree { position: absolute; z-index: 1; width: 26px; height: 36px; transform: translate(-50%, -100%); }
.tree::before { content: ""; position: absolute; left: 11px; bottom: 0; width: 5px; height: 10px; background: #7a4f2a; }
.tree::after { content: ""; position: absolute; left: 0; bottom: 8px; width: 26px; height: 28px; border-radius: 50% 50% 45% 45%; background: radial-gradient(circle at 35% 30%, #8fd36e, #3f7f30); }
.tree.pine::after { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: linear-gradient(180deg, #4f9a4a, #2f6a28); }
.tree.snowy::after { clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; background: linear-gradient(180deg, #fff 0 30%, #4f8a6a 30%); }
.map-bottom { display: flex; gap: 8px; padding: 8px 10px calc(8px + var(--safe-bot)); background: linear-gradient(0deg, rgba(251,243,226,.97), rgba(251,243,226,.88)); box-shadow: 0 -2px 10px rgba(0,0,0,.08); }
.map-bottom .btn { flex: 1; padding: 0 8px; font-size: 16px; }
.banner-slot { min-height: 0; }
.banner-slot:not(:empty) { min-height: 50px; }

/* ───── 판 ───── */
#s-play { padding-top: calc(6px + var(--safe-top)); gap: 6px; }
.play-top { display: flex; align-items: center; gap: 6px; }
.goal-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(255,250,240,.92); border-radius: 14px; padding: 6px 10px; box-shadow: 0 0 0 2px rgba(107,66,38,.25) inset, 0 3px 0 rgba(107,66,38,.2); }
.goal-box .lv { font-weight: 900; font-size: 15px; white-space: nowrap; }
.goals { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; flex: 1; }
.goal { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-size: 15px; }
.goal.done { color: var(--green); }
.goal.done::after { content: "✓"; }
.goal .gi { width: 20px; height: 20px; display: inline-block; border-radius: 5px; }
.moves { min-width: 54px; text-align: center; background: linear-gradient(180deg, #e0a868, var(--wood2)); color: #fff; border-radius: 12px; padding: 4px 6px; font-weight: 900; line-height: 1.05; box-shadow: 0 3px 0 var(--wood3); }
.moves small { display: block; font-size: 10px; opacity: .9; }
.moves b { font-size: 20px; }
.moves.low { background: linear-gradient(180deg, #f08a6a, #c8452d); box-shadow: 0 3px 0 #7a2a1a; animation: pulseRed 1s ease-in-out infinite; }
@keyframes pulseRed { 50% { transform: scale(1.06); } }
.play-mats { justify-content: center; }
.score-line { text-align: center; font-weight: 900; font-size: 13px; color: var(--ink2); min-height: 16px; }

.board-wrap { position: relative; align-self: center; padding: 8px; border-radius: 18px; background: linear-gradient(180deg, #d79a5a, #a66a30); box-shadow: 0 0 0 3px #f2c993 inset, 0 0 0 5px var(--wood3), 0 10px 22px rgba(60,30,10,.35); }
html.img-bg-board .board-wrap { background: var(--img-bg-board) center / 100% 100%; box-shadow: 0 10px 22px rgba(60,30,10,.35); }
.board { position: relative; display: grid; grid-template-columns: repeat(8, var(--cell)); grid-template-rows: repeat(8, var(--cell)); gap: 0; background: #3e2a1c; border-radius: 10px; padding: 2px; box-shadow: inset 0 3px 8px rgba(0,0,0,.5); touch-action: none; }
.cell { position: relative; margin: 2px; border-radius: 7px; background: rgba(255,255,255,.06); box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.cell > .blk { position: absolute; inset: 0; }
.cell.ghost::before { content: ""; position: absolute; inset: 0; border-radius: 7px; background: var(--ghost, rgba(255,255,255,.45)); opacity: .55; box-shadow: 0 0 0 2px rgba(255,255,255,.75) inset; z-index: 2; }
.cell.ghost-bad::before { content: ""; position: absolute; inset: 0; border-radius: 7px; background: rgba(217,83,79,.45); z-index: 2; }
.cell.will-clear > .blk, .cell.will-clear.ghost::before { animation: glow .6s ease-in-out infinite alternate; }
@keyframes glow { from { filter: brightness(1.1); box-shadow: 0 0 0 0 #fff8; } to { filter: brightness(1.6) saturate(1.2); box-shadow: 0 0 10px 3px #fff9; } }
.cell.clearing > .blk { animation: clearA .32s ease-in forwards; }
@keyframes clearA { 0% { transform: scale(1); filter: brightness(2.2); } 100% { transform: scale(.2) rotate(30deg); opacity: 0; } }
.cell.placed > .blk { animation: placeA .22s ease-out; }
@keyframes placeA { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
.ob { position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: 7px; }
.ob.rock { background: radial-gradient(circle at 30% 30%, #8f8a84 0 12%, transparent 13%), radial-gradient(circle at 65% 60%, #6d6862 0 16%, transparent 17%), radial-gradient(circle at 40% 70%, #7a756f 0 10%, transparent 11%), linear-gradient(160deg, #6a645e, #45403b); box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.2); }
html.img-rock .ob.rock { background: var(--img-rock) center / cover; box-shadow: none; }
.ob.rock[data-hp="2"]::after { content: ""; position: absolute; inset: 20%; border-top: 2px solid rgba(255,255,255,.35); transform: rotate(-20deg); }
.ob.ice { background: linear-gradient(135deg, rgba(255,255,255,.75) 0 14%, transparent 15% 50%, rgba(255,255,255,.35) 51% 56%, transparent 57%), rgba(150,215,245,.55); box-shadow: inset 0 0 0 2px rgba(255,255,255,.8); backdrop-filter: blur(1px); }
html.img-ice .ob.ice { background: var(--img-ice) center / cover; opacity: .85; box-shadow: none; }
.ob.ice[data-hp="2"] { background-color: rgba(120,195,235,.75); }
.ob.lock { background: none; }
.ob.lock::before { content: ""; position: absolute; left: 50%; top: 52%; width: 46%; height: 36%; transform: translate(-50%, -20%); background: linear-gradient(180deg, #ffd56b, #c8901f); border-radius: 4px; box-shadow: 0 2px 0 #7a5a10; }
.ob.lock::after { content: ""; position: absolute; left: 50%; top: 22%; width: 30%; height: 32%; transform: translateX(-50%); border: 3px solid #b8b8b8; border-bottom: 0; border-radius: 10px 10px 0 0; }
html.img-lock .ob.lock { background: var(--img-lock) center / 80% no-repeat; }
html.img-lock .ob.lock::before, html.img-lock .ob.lock::after { display: none; }
.ob.hit { animation: hitA .3s ease; }
@keyframes hitA { 40% { transform: scale(1.2); filter: brightness(1.8); } }
.line-flash { position: absolute; z-index: 5; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(255,255,220,.95), transparent); border-radius: 6px; animation: lineA .45s ease-out forwards; }
.line-flash.col { background: linear-gradient(180deg, transparent, rgba(255,255,220,.95), transparent); }
@keyframes lineA { 0% { opacity: 0; transform: scale(.6); } 30% { opacity: 1; transform: scale(1.04); } 100% { opacity: 0; transform: scale(1.1); } }

.tray { display: flex; justify-content: space-around; align-items: center; min-height: calc(var(--cell) * 2.6); background: rgba(255,250,240,.75); border-radius: 18px; box-shadow: 0 0 0 2px rgba(107,66,38,.18) inset; padding: 6px; touch-action: none; }
.slot { flex: 1; display: flex; justify-content: center; align-items: center; min-height: calc(var(--cell) * 2.4); position: relative; }
.piece { display: grid; gap: 2px; transform: scale(.62); transform-origin: center; transition: transform .12s, opacity .15s; cursor: grab; touch-action: none; }
.piece .pc { width: calc(var(--cell) - 4px); height: calc(var(--cell) - 4px); }
.piece .pc.blk { margin: 0; }
.piece.cant { opacity: .35; filter: grayscale(.7); }
.piece.dragging { opacity: .25; }
.piece.special::after { content: "선물"; position: absolute; top: -18px; left: 50%; transform: translateX(-50%) scale(1.6); background: var(--gold); color: #5a3b06; font-size: 10px; font-weight: 900; border-radius: 6px; padding: 1px 5px; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; display: grid; gap: 2px; filter: drop-shadow(0 10px 10px rgba(0,0,0,.35)); }
.drag-ghost .pc { width: calc(var(--cell) - 4px); height: calc(var(--cell) - 4px); }

.powers { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 46px; }
.power { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 4px; border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: 0 0 0 2px rgba(107,66,38,.25) inset, 0 3px 0 rgba(107,66,38,.25); font-weight: 800; font-size: 13px; min-height: 44px; }
.power .pw-ico { width: 36px; height: 36px; flex: none; }
.power .pw-ico svg, .power .pw-ico img { width: 100%; height: 100%; }
.power .cnt { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; padding: 0 5px; box-shadow: 0 0 0 2px #fff; }
.power.armed { background: var(--gold2); box-shadow: 0 0 0 3px #e2a72e inset, 0 3px 0 #9b6f1c; animation: pulse 1.2s infinite; }
.power[disabled] { opacity: .4; }
.power-empty { font-size: 12px; color: var(--ink2); align-self: center; text-align: center; }
.arm-hint { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 10px; white-space: nowrap; z-index: 6; }
.board.armed .cell { cursor: crosshair; }
.board.armed .cell:hover { box-shadow: 0 0 0 3px var(--gold) inset; }

/* 콤보·글자 튀기기 */
.pop { position: fixed; left: 50%; top: 42%; z-index: 70; pointer-events: none; font-weight: 900; color: #fff; white-space: nowrap;
  -webkit-text-stroke: 2px var(--wood3); text-shadow: 0 4px 0 var(--wood3), 0 8px 18px rgba(0,0,0,.3); }
.pop.combo { color: var(--gold2); }
.pop.great { color: #ffd2e0; -webkit-text-stroke-color: #9b2f5a; text-shadow: 0 4px 0 #9b2f5a, 0 8px 18px rgba(0,0,0,.3); }
.pop.small { -webkit-text-stroke-width: 1px; text-shadow: 0 2px 0 var(--wood3); }
.spark { position: fixed; z-index: 65; width: 9px; height: 9px; border-radius: 50%; background: #fff6c8; box-shadow: 0 0 8px #ffe08a; pointer-events: none; }
.confetti { position: fixed; top: -12px; z-index: 80; width: 8px; height: 13px; border-radius: 2px; pointer-events: none; }
.shake { animation: shakeA .35s; } .shake-big { animation: shakeA .5s; }
@keyframes shakeA { 15%, 55% { transform: translateX(-5px); } 35%, 75% { transform: translateX(5px); } }
.combo-meter { position: absolute; right: 10px; top: -12px; z-index: 6; background: linear-gradient(180deg, #ff9b6a, #e0563a); color: #fff; font-weight: 900; font-size: 13px; border-radius: 10px; padding: 2px 10px; box-shadow: 0 2px 0 #8a2a1a; transform-origin: center; }

/* ───── 덮개(깸·실패·짓기) ───── */
.overlay { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(40,28,14,.5); padding: 18px; -webkit-backdrop-filter: blur(3px) saturate(.75); backdrop-filter: blur(3px) saturate(.75); } /* 창 뒤 지도는 흐리게 (10-04) */
.overlay.on { display: flex; animation: fadeIn .2s; }
.card { width: 100%; max-width: 380px; max-height: 90dvh; overflow: auto; background: linear-gradient(180deg, #fffaf0, var(--cream2)); border-radius: 24px; padding: 20px 18px 18px; text-align: center; box-shadow: 0 0 0 3px #fff inset, 0 0 0 6px var(--wood2), 0 18px 40px rgba(0,0,0,.35); position: relative; }
.card h2 { margin: 2px 0 6px; font-size: 26px; font-weight: 900; color: var(--wood3); }
.card p { margin: 6px 0; color: var(--ink2); font-size: 15px; line-height: 1.5; }
.card .btns { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.big-stars { font-size: 46px; letter-spacing: 4px; color: #e6dccb; margin: 2px 0 4px; text-shadow: 0 3px 0 rgba(0,0,0,.12); }
.big-stars .on { color: var(--gold); text-shadow: 0 3px 0 #9b6f1c, 0 0 14px rgba(255,224,138,.8); display: inline-block; animation: starIn .45s cubic-bezier(.2,1.6,.4,1) both; }
.big-stars .on:nth-child(2) { animation-delay: .18s; } .big-stars .on:nth-child(3) { animation-delay: .36s; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.reward-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.reward-row .mat { font-size: 16px; }
.ribbon { position: relative; display: inline-block; margin: -4px auto 4px; background: linear-gradient(180deg, #8fdc6e, #4b9140); color: #fff; font-weight: 900; padding: 6px 22px; border-radius: 10px; box-shadow: 0 3px 0 #2f6a28; white-space: nowrap; font-size: 15px; }
.ribbon.red { background: linear-gradient(180deg, #f08a6a, #c8452d); box-shadow: 0 3px 0 #7a2a1a; }

/* 짓기 · 건물 고르기 */
.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.top-bar h2 { margin: 0; font-size: 22px; font-weight: 900; color: var(--wood3); }
.list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; }
.bcard { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: center; background: rgba(255,250,240,.95); border-radius: 18px; padding: 10px; box-shadow: 0 0 0 2px rgba(107,66,38,.2) inset, 0 3px 0 rgba(107,66,38,.18); text-align: left; }
.bcard .pic { width: 92px; height: 92px; background: radial-gradient(ellipse at 50% 85%, #b6df98 0 45%, transparent 46%), linear-gradient(180deg, #d9f1fb, #eaf6e0); border-radius: 14px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.bcard .pic svg, .bcard .pic img { width: 100%; height: 100%; object-fit: contain; }
.bcard h3 { margin: 0 0 2px; font-size: 17px; font-weight: 900; }
.bcard .ab { font-size: 13px; color: var(--ink2); margin-bottom: 6px; line-height: 1.4; }
.bcard .cost { display: flex; gap: 6px; flex-wrap: wrap; font-weight: 900; font-size: 14px; margin-bottom: 6px; }
.bcard .cost .short { color: var(--red); }
.bcard.built { background: rgba(233,246,224,.95); }
.bcard.locked > * { opacity: .5; }
.bcard.locked { background: rgba(240,232,214,.97); }
.bcard .btn { min-height: 40px; font-size: 15px; padding: 0 14px; }
.sec-title { font-weight: 900; color: var(--wood3); margin: 6px 2px 0; font-size: 15px; }
.build-hero { position: relative; height: 200px; margin: -6px -18px 4px; background: radial-gradient(ellipse 60% 22% at 50% 96%, #8cc76b 0 70%, transparent 71%), linear-gradient(180deg, #bfe8f8, #eaf7e3); border-radius: 20px 20px 0 0; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.build-hero svg, .build-hero img { height: 190px; width: auto; }

/* 상점 */
.shop-item { display: flex; align-items: center; gap: 10px; background: rgba(255,250,240,.95); border-radius: 16px; padding: 10px 12px; box-shadow: 0 0 0 2px rgba(107,66,38,.2) inset; text-align: left; }
.shop-item .t { flex: 1; } .shop-item .t b { display: block; font-size: 16px; } .shop-item .t small { color: var(--ink2); font-size: 13px; }
.shop-item .owned-tag { color: var(--green); font-weight: 900; }

/* 설정 */
.set-row { display: flex; align-items: center; justify-content: space-between; background: rgba(255,250,240,.95); border-radius: 14px; padding: 12px 14px; font-weight: 800; box-shadow: 0 0 0 2px rgba(107,66,38,.15) inset; }
.toggle { width: 54px; height: 32px; border-radius: 16px; background: #cfc6b6; position: relative; transition: background .2s; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 3px rgba(0,0,0,.2); transition: left .2s; }
.toggle.on { background: var(--green); } .toggle.on::after { left: 25px; }
.doc { background: rgba(255,250,240,.95); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.6; color: var(--ink2); box-shadow: 0 0 0 2px rgba(107,66,38,.15) inset; }
.doc h4 { margin: 0 0 4px; color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bot)); transform: translateX(-50%) translateY(20px); background: rgba(59,42,26,.92); color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 800; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 90; max-width: 86vw; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.endless-best { font-weight: 900; font-size: 15px; }

/* 장애물 더 (덩굴·폭탄·상자·금 칸·열쇠) */
.floor-gold { position: absolute; inset: 0; border-radius: 7px; background: radial-gradient(circle at 50% 50%, rgba(255,224,138,.9) 0 22%, rgba(242,193,78,.35) 23% 60%, transparent 61%); box-shadow: inset 0 0 0 2px rgba(242,193,78,.8); animation: beam 1.8s ease-in-out infinite; }
.ob.vine { background: radial-gradient(circle at 25% 30%, #7cc36a 0 18%, transparent 19%), radial-gradient(circle at 70% 25%, #5aa94a 0 16%, transparent 17%), radial-gradient(circle at 45% 70%, #4b9140 0 20%, transparent 21%), radial-gradient(circle at 80% 75%, #7cc36a 0 14%, transparent 15%), linear-gradient(135deg, #2f6a28, #3f7f30); box-shadow: inset 0 -3px 0 rgba(0,0,0,.3); }
.ob.vine::after { content: ""; position: absolute; inset: 15%; border: 2px solid #9be07c; border-radius: 50% 10% 50% 10%; opacity: .7; }
.ob.bomb { display: flex; align-items: center; justify-content: center; }
.ob.bomb span { width: 62%; height: 62%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #666 0 15%, #222 60%); color: #fff; font-weight: 900; font-size: calc(var(--cell) * .3); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff, 0 2px 0 #000; }
.ob.bomb.hot span { background: radial-gradient(circle at 35% 30%, #ff8a6a 0 15%, #c8452d 60%); animation: pulseRed .6s infinite; }
.ob.crate { background: linear-gradient(45deg, transparent 44%, #7a4f2a 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #7a4f2a 44% 56%, transparent 56%), linear-gradient(180deg, #d79a5a, #a66a30); box-shadow: inset 0 0 0 3px #6b4226, inset 0 -3px 0 rgba(0,0,0,.3); }
.key-badge { position: absolute; right: 6%; bottom: 6%; width: 38%; height: 38%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff3c4, #e2a72e); box-shadow: 0 0 0 1.5px #7a5a10; z-index: 2; }
.key-badge::after { content: ""; position: absolute; left: 35%; top: 25%; width: 30%; height: 50%; border: 2px solid #7a5a10; border-radius: 50% 50% 2px 2px; border-bottom: 0; }
.hold-box { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--ink2); }
.hold-box .piece { transform: scale(.35); transform-origin: left center; }

/* 지도 꾸밈 */
.sea { position: absolute; top: 0; bottom: 0; z-index: 0; background: repeating-linear-gradient(170deg, rgba(255,255,255,.0) 0 22px, rgba(255,255,255,.28) 22px 24px), linear-gradient(90deg, #5bb7dc, #3a93c4); border-radius: 40px; box-shadow: 0 0 0 10px #f1e2b0, 0 0 0 14px rgba(255,255,255,.4); }
.river { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.pond { position: absolute; z-index: 0; width: 26%; aspect-ratio: 1.6; border-radius: 50%; background: radial-gradient(ellipse at 40% 35%, #bfe7fa, #5bb7dc 70%); box-shadow: 0 0 0 5px #a59f92; }
.deco { position: absolute; z-index: 1; transform: translate(-50%, -100%); pointer-events: none; }
.deco.flower { width: 16px; height: 16px; background: radial-gradient(circle, #ffe08a 0 22%, #f4a3c4 23% 55%, transparent 56%); }
.deco.wheat { width: 18px; height: 22px; background: repeating-linear-gradient(90deg, #d9a43a 0 3px, transparent 3px 6px); border-radius: 50% 50% 2px 2px; }
.deco.shell { width: 12px; height: 10px; border-radius: 50% 50% 20% 20%; background: #f4c7b8; box-shadow: 0 1px 0 #c98f80; }
.deco.mush { width: 14px; height: 14px; background: radial-gradient(circle at 50% 35%, #fff 0 10%, transparent 11%), radial-gradient(ellipse 50% 40% at 50% 40%, #d9534f 0 100%, transparent 101%), linear-gradient(#f3e2c0, #f3e2c0) 50% 100% / 4px 6px no-repeat; }
.deco.cobble { width: 22px; height: 10px; border-radius: 50%; background: #a59f92; box-shadow: 8px 3px 0 -2px #8d8577; }
.deco.snow { width: 20px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 #c9d6de; }
.deco.rock { width: 18px; height: 12px; border-radius: 50% 50% 40% 40%; background: linear-gradient(160deg, #a59f92, #77716a); }
.tree.palm::after { border-radius: 50% 50% 10% 10%; background: radial-gradient(circle at 50% 80%, #5aa94a 0 30%, transparent 31%), conic-gradient(from 200deg, #4b9140 0 40deg, transparent 40deg 70deg, #5aa94a 70deg 120deg, transparent 120deg 150deg, #4b9140 150deg 200deg, transparent 200deg); }
.plot.lv2 .bld-svg, .plot.lv2 .bld-img { transform: scale(1.12); transform-origin: 50% 90%; filter: drop-shadow(0 0 8px rgba(255,224,138,.9)); }
.plot.built .tag { background: #fffaf0; }
.district + .district { border-top: 4px solid rgba(255,255,255,.5); }
.coins { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; font-size: 14px; background: linear-gradient(180deg, #fff3c4, #f2c14e); border-radius: 999px; padding: 3px 8px 3px 4px; box-shadow: 0 0 0 1.5px #9b6f1c inset, 0 2px 0 #9b6f1c; white-space: nowrap; }
.coins::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8d6 0 15%, #e2a72e 60%); box-shadow: 0 0 0 1.5px #9b6f1c; }
.gi { position: relative; display: inline-block; width: 20px; height: 20px; border-radius: 5px; background: #4a3424; vertical-align: -5px; overflow: hidden; }
.gi .ob, .gi .floor-gold { border-radius: 5px; }
.gi .ob.bomb span { font-size: 10px; width: 80%; height: 80%; box-shadow: none; }
.goal .gi { width: 20px; height: 20px; }
.bcard .cost .short, .cost .short { color: var(--red); }

/* 그림 파일 크기 맞춤 */
.bld-img { width: 100%; height: auto; display: block; }
.title-scene .bld { width: 34%; }
.logo-wrap { position: relative; width: 84%; max-width: 360px; margin: 0 auto; }
.logo-wrap .logo-img { width: 100%; display: block; filter: drop-shadow(0 10px 16px rgba(60,30,10,.3)); animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px); } }
.logo-name { position: absolute; left: 18%; right: 18%; top: 68%; height: 15%; display: flex; align-items: center; justify-content: center; font-size: clamp(28px, 9.5vw, 40px); font-weight: 900; color: #7a3b1a; letter-spacing: .04em; text-shadow: 0 2px 0 #fff3c4; white-space: nowrap; }
.logo-sub { font-size: 15px; font-weight: 800; color: var(--ink2); margin-top: 4px; background: rgba(255,250,240,.8); display: inline-block; padding: 4px 12px; border-radius: 10px; }
html.img-bg-village .title-scene .hill { display: none; }
.play-mats .mat { padding: 3px 10px 3px 4px; font-size: 15px; }

.top-bar h2 { background: rgba(255,250,240,.94); padding: 4px 14px; border-radius: 12px; box-shadow: 0 2px 0 rgba(107,66,38,.2); }
/* 짓는 중 건물 (흐린 윤곽 위로 차오름) */
.bp { position: relative; width: 100%; aspect-ratio: 1; }
.bp .bld-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.bp .ghost { filter: grayscale(1) brightness(1.7) contrast(.55) drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); opacity: .62; }
.bp .fill { transition: clip-path .5s cubic-bezier(.2,.9,.3,1.2); filter: drop-shadow(0 4px 4px rgba(0,0,0,.2)); }
.bp.full .fill { animation: readyGlow 1.4s ease-in-out infinite; }
@keyframes readyGlow { 50% { filter: drop-shadow(0 0 10px rgba(255,224,138,1)) brightness(1.08); } }
/* 판 위 공사장 */
.site { position: relative; flex: 1 1 auto; min-height: 92px; max-height: 230px; display: flex; align-items: flex-end; justify-content: center; border-radius: 18px; }
.site::before { content: ""; position: absolute; left: 14%; right: 14%; bottom: 26px; height: 22%; border-radius: 50%; background: radial-gradient(ellipse, rgba(80,120,40,.35), transparent 70%); }
.site-bld { position: absolute; left: 50%; bottom: 18px; height: calc(100% - 22px); aspect-ratio: 1; transform: translateX(-50%); }
.site-bld .bp, .site-bld svg, .site-bld .bld-img { width: 100%; height: 100%; }
.site-info { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); background: rgba(255,250,240,.92); border-radius: 10px; padding: 2px 10px; font-size: 12px; font-weight: 900; white-space: nowrap; box-shadow: 0 2px 0 rgba(107,66,38,.2); z-index: 2; }
.site-info.ready { background: var(--gold2); }
.site .play-mats { position: relative; z-index: 3; margin-bottom: 0; }
.score-line { margin-top: 2px; }

.district .land::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.16) 0 1.5px, transparent 2.5px) 0 0 / 26px 31px; }
.bush { position: absolute; z-index: 1; width: 30px; height: 18px; transform: translate(-50%, -100%); border-radius: 50% 50% 40% 40%; background: radial-gradient(circle at 30% 40%, #8fd36e 0 30%, transparent 31%), radial-gradient(circle at 70% 45%, #6fb256 0 32%, transparent 33%), radial-gradient(ellipse at 50% 80%, #4f8a3a 0 55%, transparent 56%); }
.fence { position: absolute; z-index: 1; width: 46px; height: 14px; transform: translate(-50%, -100%); background: linear-gradient(#b07a42, #b07a42) 0 4px / 100% 3px no-repeat, linear-gradient(#b07a42, #b07a42) 0 9px / 100% 3px no-repeat, repeating-linear-gradient(90deg, #8a5a3b 0 4px, transparent 4px 14px); }
.score-line { margin: 4px auto 0; background: rgba(255,250,240,.85); border-radius: 10px; padding: 1px 10px; align-self: center; }
.power-empty { background: rgba(255,250,240,.85); border-radius: 10px; padding: 4px 10px; }
.bp.locked .ghost { opacity: .4; }
