/* 받침 잭팟 — 화면 스타일. 폰 세로 우선. 그림 파일이 없으면 CSS 로 그린 모양을 쓴다. */
:root {
  --navy: #101a3a;
  --navy2: #18244d;
  --navy3: #22305e;
  --gold: #e9c46a;
  --gold2: #f7dc8a;
  --gold-dark: #9b7a2c;
  --ivory: #f4ead2;
  --ivory2: #e6d8b5;
  --ink: #1b1b1f;
  --red: #d9534f;
  --jade: #5fb49c;
  --muted: #8f9bc4;
  --tile-w: min(11vw, 52px);
  --tile-h: calc(var(--tile-w) * 1.32);
  --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: var(--navy) radial-gradient(ellipse at 50% 35%, #24336a 0%, #101a3a 60%, #0a1128 100%) fixed;
  color: var(--ivory);
  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;
}
body.has-bg { background-image: linear-gradient(rgba(10,17,40,.55), rgba(10,17,40,.75)), var(--bg-img); background-size: cover; background-position: center; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
#app { position: relative; max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: calc(10px + var(--safe-top)) 14px calc(10px + var(--safe-bot)); display: flex; flex-direction: column; }
.screen { display: none; flex: 1; flex-direction: column; animation: fadeIn .25s ease; }
.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: 12px; font-size: 19px; font-weight: 800; letter-spacing: .02em; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.96); }
.btn[disabled] { filter: grayscale(1) brightness(.6); pointer-events: none; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold) 55%, #c9a043); color: #3b2a07; box-shadow: 0 0 0 2px #fff3c4 inset, 0 0 0 3px var(--gold-dark), 0 6px 18px rgba(233,196,106,.35); }
.btn.gray { background: linear-gradient(180deg, #8a90a3, #5f6578); color: #eef; box-shadow: 0 0 0 2px #b5bacb inset, 0 0 0 3px #3b4052; }
.btn.ghost { background: rgba(255,255,255,.06); box-shadow: 0 0 0 1px rgba(233,196,106,.45) inset; color: var(--gold2); font-size: 16px; min-height: 44px; }
.btn.ad::before { content: "▶"; font-size: 12px; background: #3b2a07; color: var(--gold2); border-radius: 4px; padding: 2px 5px; }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 12px; }
.btn.wide { width: 100%; }

/* 첫 화면 */
#s-title { justify-content: center; align-items: center; text-align: center; gap: 18px; }
.logo-wrap { position: relative; width: 86%; max-width: 340px; }
.logo { width: 100%; display: block; }
.logo-name { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-58%); text-align: center; font-size: clamp(30px, 10vw, 42px); font-weight: 900; color: var(--gold2); text-shadow: 0 3px 0 #4a3608, 0 0 14px rgba(247,220,138,.6); letter-spacing: .04em; }
.title-sub { color: var(--muted); letter-spacing: .3em; font-size: 14px; margin-top: -6px; }
.logo-text { font-size: 50px; font-weight: 900; color: var(--gold2); text-shadow: 0 3px 0 #6b4f12, 0 0 24px rgba(247,220,138,.45); line-height: 1.05; }
.logo-text small { display: block; font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .3em; margin-top: 10px; text-shadow: none; }
.title-tiles { display: flex; gap: 6px; justify-content: center; margin: 6px 0 14px; }
.title-tiles .tile { animation: bob 2.4s ease-in-out infinite; }
.title-tiles .tile:nth-child(2) { animation-delay: .2s; } .title-tiles .tile:nth-child(3) { animation-delay: .4s; } .title-tiles .tile:nth-child(4) { animation-delay: .6s; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(-2deg); } }
.menu { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* 판 상단 */
.hud { text-align: center; }
.hud .stage { color: var(--muted); font-size: 15px; letter-spacing: .1em; }
.hud .stage b { color: var(--gold2); }
.hud .goal { font-size: 28px; font-weight: 900; color: var(--gold2); margin: 2px 0 6px; }
.boss-rule { display: none; margin: 0 auto 6px; padding: 4px 10px; border-radius: 999px; background: rgba(217,83,79,.18); color: #ffb3ae; font-size: 14px; box-shadow: 0 0 0 1px rgba(217,83,79,.6) inset; }
.boss .boss-rule { display: inline-block; }
.bar { position: relative; height: 26px; border-radius: 999px; background: #0b1230; box-shadow: 0 0 0 2px var(--gold-dark) inset; overflow: hidden; }
.bar .fill { position: absolute; inset: 3px auto 3px 3px; width: 0; border-radius: 999px; background: linear-gradient(180deg, var(--gold2), var(--gold)); transition: width .6s cubic-bezier(.2,1.4,.4,1); }
.bar .num { position: relative; z-index: 1; line-height: 26px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums; }
.stats { display: flex; justify-content: space-between; margin: 8px 2px 0; font-size: 15px; color: var(--muted); }
.stats b { color: var(--ivory); font-variant-numeric: tabular-nums; }

/* 부적 줄 */
.charms { display: flex; gap: 6px; margin: 10px 0 4px; min-height: 58px; overflow-x: auto; justify-content: center; }
.charm { position: relative; flex: 0 0 auto; width: 54px; height: 58px; border-radius: 8px; background: linear-gradient(180deg, #1c2858, #121b40); box-shadow: 0 0 0 1px var(--gold-dark) inset, 0 0 0 3px #0b1230; display: grid; place-items: center; font-size: 26px; }
.charm.img { background-size: 100% 100%; background-color: transparent; box-shadow: none; width: 48px; height: 70px; }
.charm .art { width: 78%; height: auto; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.charm.mini { width: 30px; height: 42px; font-size: 14px; }
.owned .row .ic { width: 34px; display: flex; justify-content: center; }
.offer .ic .charm { width: 44px; height: 62px; }
.dex .charm.img { width: 100%; height: 86px; }
.charm.fire { animation: charmFire .5s ease; box-shadow: 0 0 0 2px var(--gold2) inset, 0 0 18px var(--gold); }
@keyframes charmFire { 30% { transform: translateY(-8px) scale(1.15); } }
.charm .lv { position: absolute; right: 2px; bottom: 1px; font-size: 10px; color: var(--gold2); }
.charm.empty { opacity: .25; font-size: 14px; }

/* 낱말 판 */
.board { position: relative; flex: 1; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.board::before { content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%; border: 1px solid rgba(233,196,106,.16); box-shadow: 0 0 0 18px rgba(233,196,106,.03), 0 0 0 40px rgba(233,196,106,.02); pointer-events: none; }
.word { position: relative; display: flex; gap: 6px; min-height: 96px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 6px; border-radius: 14px; transition: background .2s; }
.word.drop-hot { background: rgba(233,196,106,.1); box-shadow: 0 0 0 2px dashed rgba(233,196,106,.5) inset; }
.word-empty { color: var(--muted); font-size: 15px; text-align: center; line-height: 1.6; }
.syl { position: relative; width: 82px; height: 92px; border-radius: 10px; background: linear-gradient(180deg, var(--ivory), var(--ivory2)); box-shadow: 0 4px 0 #b9a77a, 0 8px 18px rgba(0,0,0,.45); display: grid; place-items: center; color: var(--ink); font-size: 56px; font-weight: 900; animation: sylIn .25s cubic-bezier(.2,1.6,.4,1); }
.syl.partial { color: #555; font-size: 40px; background: linear-gradient(180deg, #fbf5e6, #ede2c6); }
.syl.has-jong::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 4px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.syl .parts { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font-size: 11px; color: #8b7a52; font-weight: 600; letter-spacing: .05em; }
@keyframes sylIn { from { transform: scale(.4); opacity: 0; } }
.syl.merge { animation: merge .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes merge { 0% { transform: scale(1.25); filter: brightness(1.4); } 100% { transform: none; } }
.word-meta { min-height: 22px; font-size: 15px; color: var(--muted); text-align: center; }
.word-meta .ok { color: var(--jade); font-weight: 700; }
.word-meta .bad { color: #ff9b96; }
.word-meta .mult { color: var(--gold2); font-weight: 800; }

/* 잭팟 연출 */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 30; }
.pop { position: absolute; left: 50%; transform: translate(-50%, 0); font-weight: 900; color: var(--gold2); text-shadow: 0 3px 0 #6b4f12, 0 0 16px rgba(247,220,138,.8); white-space: nowrap; animation: popUp 1s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes popUp { 0% { transform: translate(-50%, 20px) scale(.3); opacity: 0; } 25% { transform: translate(-50%, -10px) scale(1.25); opacity: 1; } 70% { transform: translate(-50%, -30px) scale(1); opacity: 1; } 100% { transform: translate(-50%, -60px) scale(.9); opacity: 0; } }
.score-panel { position: absolute; left: 50%; top: 4%; transform: translate(-50%, 0); display: none; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 16px; background: rgba(8,12,32,.86); box-shadow: 0 0 0 2px var(--gold-dark), 0 0 40px rgba(233,196,106,.35); z-index: 40; font-variant-numeric: tabular-nums; }
.score-panel.on { display: flex; }
.score-panel .chips { font-size: 34px; font-weight: 900; color: #9fd8ff; min-width: 70px; text-align: right; }
.score-panel .x { font-size: 24px; color: var(--muted); }
.score-panel .mul { font-size: 34px; font-weight: 900; color: #ff8d7a; min-width: 50px; }
.score-panel .bump { animation: bump .22s ease; }
@keyframes bump { 50% { transform: scale(1.45); } }
.total-pop { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 64px; font-weight: 900; color: var(--gold2); text-shadow: 0 4px 0 #6b4f12, 0 0 30px rgba(247,220,138,.9); z-index: 45; display: none; font-variant-numeric: tabular-nums; }
.total-pop.on { display: block; animation: totalIn .5s cubic-bezier(.2,1.8,.4,1); }
@keyframes totalIn { from { transform: translate(-50%, -50%) scale(.2); } }
.shake { animation: shake .35s cubic-bezier(.36,.07,.19,.97); }
.shake-big { animation: shakeBig .55s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%,90% { transform: translate(-1px, 1px); } 20%,80% { transform: translate(3px, -2px); } 30%,50%,70% { transform: translate(-5px, 2px); } 40%,60% { transform: translate(5px, -1px); } }
@keyframes shakeBig { 10%,90% { transform: translate(-2px, 2px) rotate(-.5deg); } 20%,80% { transform: translate(6px, -4px) rotate(.8deg); } 30%,50%,70% { transform: translate(-9px, 4px) rotate(-1deg); } 40%,60% { transform: translate(9px, -3px) rotate(1deg); } }
.coin-fly { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 50%, #a37a1d); box-shadow: 0 0 6px var(--gold); z-index: 50; pointer-events: none; }
.coin-fly.img { background: var(--coin-img) center/contain no-repeat; box-shadow: none; }
.spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--gold2); box-shadow: 0 0 8px var(--gold2); pointer-events: none; z-index: 50; }
.flash { position: fixed; inset: 0; background: radial-gradient(circle, rgba(255,240,180,.55), transparent 65%); pointer-events: none; z-index: 60; animation: flash .45s ease forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* 손패 */
.hand { display: flex; justify-content: center; gap: 4px; padding: 6px 0 10px; min-height: calc(var(--tile-h) + 22px); perspective: 600px; }
.tile { position: relative; width: var(--tile-w); height: var(--tile-h); border-radius: 7px; background: linear-gradient(180deg, var(--ivory), var(--ivory2)); box-shadow: 0 3px 0 #b9a77a, 0 6px 12px rgba(0,0,0,.45); display: grid; place-items: center; color: var(--ink); font-size: calc(var(--tile-w) * .58); font-weight: 900; touch-action: none; transition: transform .15s, opacity .15s; }
.tile.img { background: var(--tile-img) center/100% 100% no-repeat; }
.tile.rare { background: linear-gradient(180deg, #fff2c2, #e9c46a); box-shadow: 0 3px 0 #9b7a2c, 0 0 12px rgba(233,196,106,.7); }
.tile.rare.img { background: var(--tile-rare-img) center/100% 100% no-repeat; }
.tile .pt { position: absolute; right: 5px; bottom: 16%; font-size: 10px; font-weight: 700; color: #8b7a52; }
.tile .kind { position: absolute; left: 3px; top: 1px; font-size: 9px; color: #a0916a; font-weight: 700; }
.tile.vowel { color: #1d3b6e; }
.tile.used { opacity: .25; transform: translateY(8px) scale(.9); pointer-events: none; }
.tile.marked { transform: translateY(-14px); box-shadow: 0 3px 0 #b9a77a, 0 0 0 3px var(--red), 0 10px 14px rgba(0,0,0,.5); }
.tile.dragging { position: fixed; z-index: 100; pointer-events: none; transform: scale(1.2) rotate(-4deg); box-shadow: 0 16px 24px rgba(0,0,0,.6); transition: none; }
.tile.deal { animation: deal .35s cubic-bezier(.2,1.4,.4,1) backwards; }
@keyframes deal { from { transform: translateY(-120px) rotateX(70deg); opacity: 0; } }
.hand .tile:nth-child(odd) { rotate: -1.5deg; } .hand .tile:nth-child(even) { rotate: 1.5deg; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .btn { min-height: 56px; font-size: 21px; }
.sub-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.sub-actions .btn { flex: 1; }
.mode-chip { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; min-height: 18px; }

/* 덮개(판 깸·실패·전면 광고 안내) */
.overlay { position: fixed; inset: 0; background: rgba(5,8,22,.78); display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.overlay.on { display: flex; animation: fadeIn .2s ease; }
.card { width: 100%; max-width: 380px; border-radius: 18px; background: linear-gradient(180deg, #1f2c5c, #121b40); box-shadow: 0 0 0 2px var(--gold-dark), 0 20px 50px rgba(0,0,0,.6); padding: 22px 18px; text-align: center; }
.card h2 { margin: 0 0 6px; font-size: 30px; color: var(--gold2); }
.card h2.fail { color: #ff9b96; }
.card p { margin: 6px 0; color: var(--ivory2); line-height: 1.5; }
.card .rows { margin: 12px 0; text-align: left; font-size: 16px; }
.card .rows div { display: flex; justify-content: space-between; padding: 5px 2px; border-bottom: 1px dashed rgba(233,196,106,.2); }
.card .rows b { color: var(--gold2); font-variant-numeric: tabular-nums; }
.card .btns { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* 가게 */
.shop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.shop-head h2 { margin: 0; color: var(--gold2); font-size: 26px; }
.money { display: inline-flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 900; color: var(--gold2); font-variant-numeric: tabular-nums; }
.money::before { content: ""; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 50%, #a37a1d); }
.money.img::before { background: var(--coin-img) center/contain no-repeat; }
.sec-title { margin: 14px 0 6px; font-size: 14px; color: var(--muted); letter-spacing: .1em; }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.offer { border-radius: 12px; padding: 10px; background: linear-gradient(180deg, #1c2858, #121b40); box-shadow: 0 0 0 1px var(--gold-dark) inset; display: flex; flex-direction: column; gap: 6px; }
.offer .ic { font-size: 30px; height: 66px; display: grid; place-items: center; }
.offer .nm { font-weight: 800; color: var(--gold2); }
.offer .ds { font-size: 13px; color: var(--ivory2); line-height: 1.4; flex: 1; }
.offer .rar { font-size: 11px; color: var(--muted); }
.offer.sold { opacity: .35; pointer-events: none; }
.owned { display: flex; flex-direction: column; gap: 6px; }
.owned .row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.04); }
.owned .row .ic { font-size: 22px; width: 30px; text-align: center; }
.owned .row .tx { flex: 1; font-size: 14px; }
.owned .row .tx b { color: var(--gold2); }
.shop-foot { position: sticky; bottom: 0; margin-top: auto; padding: 14px 0 6px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(transparent, rgba(10,17,40,.95) 30%); }

/* 결과 · 기록 · 도감 */
.share-canvas { width: 100%; max-width: 360px; border-radius: 14px; box-shadow: 0 0 0 2px var(--gold-dark); margin: 0 auto; display: block; }
.tabs { display: flex; gap: 6px; margin: 6px 0 12px; }
.tabs button { flex: 1; min-height: 42px; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--muted); font-weight: 700; }
.tabs button.on { background: rgba(233,196,106,.16); color: var(--gold2); box-shadow: 0 0 0 1px var(--gold-dark) inset; }
.list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.list .row { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.04); font-size: 15px; }
.list .row b { color: var(--gold2); }
.dex { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dex .charm { width: 100%; height: 64px; }
.dex .charm.locked { filter: grayscale(1) brightness(.4); }
.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.top-bar h2 { margin: 0; font-size: 24px; color: var(--gold2); }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 20px; }

.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-bot)); transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: rgba(8,12,32,.92); box-shadow: 0 0 0 1px var(--gold-dark); color: var(--ivory); font-size: 15px; z-index: 90; opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap; }
.toast.on { opacity: 1; }
.banner-slot { height: 0; }
body.banner-on .banner-slot, body.banner-on #s-shop .shop-foot { padding-bottom: var(--ads-banner-h, 0px); }

@media (min-height: 760px) { :root { --tile-w: min(11vw, 54px); } .syl { width: 88px; height: 100px; font-size: 60px; } }
@media (max-width: 360px) { .syl { width: 66px; height: 76px; font-size: 44px; } .logo-text { font-size: 42px; } }
@media (prefers-reduced-motion: reduce) { .shake, .shake-big, .pop, .tile.deal { animation: none !important; } }

/* 오늘의 부적 */
.daily-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.daily-pick .opt { border-radius: 12px; padding: 8px 4px; background: rgba(255,255,255,.04); box-shadow: 0 0 0 1px var(--gold-dark) inset; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.daily-pick .opt.on { background: rgba(233,196,106,.18); box-shadow: 0 0 0 2px var(--gold2) inset, 0 0 14px rgba(233,196,106,.4); }
.daily-pick .opt .nm { font-size: 13px; font-weight: 800; color: var(--gold2); }
.daily-pick .opt .ds { font-size: 11px; color: var(--ivory2); line-height: 1.3; }
.daily-badge { color: var(--jade); font-size: 14px; }
