@charset "utf-8";
/* 뽀글뽀글 — 화면
 * GUI Pack Cartoon 의 스프라이트를 그대로 쓰고, 늘어나야 하는 것만 CSS 로 흉내 낸다.
 * (구름 팝업·리본·알약 버튼은 팩 그림, 늘어나는 판은 CSS)
 */

@font-face {
  font-family: 'Lilita';
  src: url('font/LilitaOne.ttf?v=5') format('truetype');
  font-display: swap;
}

:root {
  --sky1: #b8f0ff;
  --sky2: #35b6dd;
  --teal: #16b2d6;
  --teal-d: #0d8dac;
  --ink: #37506b;
  --ink-2: #6d8399;
  --gold: #ffb524;
  --pink: #f7548f;
  --panel: #ffffff;
  --panel-ring: #d9f2fb;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --fnt: 'Lilita', 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', system-ui, sans-serif;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #6fd4ee;
  font-family: var(--fnt);
  color: var(--ink);
  /* 내 앱은 전부 모바일이다 — 확대도 선택도 없다 */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

img { max-width: 100%; height: auto; -webkit-user-drag: none; user-drag: none; pointer-events: none; }

button {
  font-family: inherit; color: inherit;
  border: 0; background: none; padding: 0; margin: 0;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

/* ── 틀 ──────────────────────────────────────────────── */
#app {
  position: fixed; top: 0; left: 0; right: 0;
  height: 100%;
  height: 100dvh;
  height: var(--appH, 100dvh); /* 사파리 아래 띠에 도구가 가리지 않게 — JS 가 재 준다 */
  display: flex; flex-direction: column;
  padding: calc(var(--sat) + 6px) calc(var(--sar) + 10px) calc(var(--sab) + 6px) calc(var(--sal) + 10px);
}

#sky {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 50% at 50% 0%, #e7fbff 0%, rgba(231,251,255,0) 62%),
    linear-gradient(180deg, var(--sky1) 0%, #7fd9f0 45%, var(--sky2) 100%);
}
#cloudA, #cloudB {
  position: absolute; bottom: -6%;
  width: 78%; max-width: 620px; aspect-ratio: 600 / 323;
  background: url('art/ui/clouds.png?v=5') center/contain no-repeat;
  opacity: .5;
}
#cloudA { left: -14%; bottom: auto; top: -8%; transform: scaleY(-1); }
#cloudB { right: -18%; bottom: auto; top: 4%; width: 56%; opacity: .3; transform: scale(-1,-1); }

/* ── 위 띠 ───────────────────────────────────────────── */
#hud {
  display: flex; align-items: center; gap: 7px;
  height: 40px; flex: 0 0 auto;
}
#hud .spacer { flex: 1; }

.purse {
  display: flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 9px 0 4px;
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  box-shadow: 0 2px 0 rgba(12,110,140,.22), inset 0 1px 0 #fff;
}
.purse img { width: 24px; height: 24px; }
.purse span { font-size: 16px; letter-spacing: .3px; color: #2f4a63; min-width: 20px; text-align: left; }
.purse i {
  font-style: normal; font-size: 15px; line-height: 1;
  width: 18px; height: 18px; border-radius: 50%;
  background: #7ac70c; color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 1px 0 #5c9a06;
}
.purse span.bump { animation: bump .32s ease; }
@keyframes bump { 0%{transform:scale(1)} 40%{transform:scale(1.28)} 100%{transform:scale(1)} }

.icobtn {
  position: relative;
  width: 38px; height: 38px;
  background: url('art/ui/cbtn-blue.png?v=5') center/100% 100% no-repeat;
  display: grid; place-items: center;
}
.icobtn img { width: 22px; height: 22px; }
.icobtn img.wi { width: 19px; height: 19px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.18)); }
.icobtn:active { transform: translateY(2px); }
.dot {
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #ff4d6d; border: 2px solid #fff;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.25)} }

/* ── 점수 ────────────────────────────────────────────── */
#scoreRow {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 4px 2px 2px;
}
#scoreRow .sc { flex: 1; position: relative; display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.lives { display: flex; gap: 2px; align-items: center; min-width: 72px; }
.lives img { width: 22px; height: 22px; transition: transform .18s ease; }
.lives img.off { filter: grayscale(1) brightness(1.5); opacity: .45; }
.lives img.pop { animation: heartpop .45s ease; }
@keyframes heartpop {
  0% { transform: scale(1.5) } 40% { transform: scale(.7) } 100% { transform: scale(1) }
}
.best { min-width: 72px; justify-content: flex-end; }
#score {
  font-size: 38px; line-height: 1;
  color: #fff;
  text-shadow: 0 2px 0 #1b9cc0, 0 4px 0 rgba(10,90,115,.5), 0 6px 12px rgba(10,70,95,.25);
  letter-spacing: 1px;
}
#score.hit { animation: bump .25s ease; }
#comboTag {
  font-style: normal; font-size: 19px; color: #fff;
  background: linear-gradient(180deg,#ffb524,#f7861a);
  padding: 2px 9px 3px; border-radius: 999px;
  box-shadow: 0 2px 0 #cf6408;
  transform-origin: left center;
  animation: bumpsm .22s ease;
}
@keyframes bumpsm { 0%{transform:scale(1)} 40%{transform:scale(1.14)} 100%{transform:scale(1)} }
.best {
  display: flex; align-items: center; gap: 4px;
  font-size: 15px; color: #0d708c; opacity: .85;
}
.best img { width: 15px; height: 15px; }
.best .wi { filter: brightness(0) saturate(100%) invert(30%) sepia(60%) saturate(900%) hue-rotate(160deg); }

/* ── 판 ──────────────────────────────────────────────── */
#stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  touch-action: none;           /* 안드로이드 웹뷰가 끌기를 스크롤로 가로채는 걸 막는다 */
}
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#armHint {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  background: rgba(20,60,80,.82); color: #fff;
  font-size: 14px; padding: 7px 14px; border-radius: 999px;
  pointer-events: none; white-space: nowrap;
}

/* ── 도구 띠 ─────────────────────────────────────────── */
#tools {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding-top: 6px;
}
.tool {
  position: relative;
  width: 58px; height: 52px;
  background: url('art/ui/sq-blue.png?v=5') center/100% 100% no-repeat;
  display: grid; place-items: center;
}
.tool img { width: 30px; height: 30px; }
.tool img.wi { width: 22px; height: 22px; }
.tool b {
  position: absolute; right: -3px; bottom: -3px;
  min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 999px; background: #fff; color: #2f4a63;
  font-size: 13px; line-height: 20px; text-align: center;
  box-shadow: 0 1px 0 rgba(12,110,140,.35);
}
.tool.none { filter: grayscale(.85) brightness(.95); opacity: .8; }
.tool.none b { background: #e7eef2; color: #93a7b5; }
.tool.on {
  background-image: url('art/ui/sq-orange.png?v=5');
  filter: none; opacity: 1;
  animation: pulse 1s ease-in-out infinite;
}
.tool:active { transform: translateY(2px); }
.tool.dexbtn { background-image: url('art/ui/sq-gray.png?v=5'); }

/* ── 덮는 화면 ───────────────────────────────────────── */
.screen {
  position: fixed; top: 0; left: 0; right: 0;
  height: 100%; height: 100dvh; height: var(--appH, 100dvh);
  z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
}
.screen.dim { background: rgba(10,60,80,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.screen.in { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

/* 첫 화면 — 점수와 도구는 숨긴다 */
#scTitle { background: transparent; pointer-events: none; }
#scTitle .titleWrap { pointer-events: auto; }
body.title #scoreRow, body.title #tools { visibility: hidden; }
.titleWrap { text-align: center; width: 100%; max-width: 340px; }
.logoBalls { display: flex; justify-content: center; align-items: flex-end; margin-bottom: 4px; }
.logoBalls img { width: 54px; height: 54px; margin: 0 -8px; }
.logoBalls img:nth-child(2) { width: 74px; height: 74px; margin-bottom: -4px; animation: bob 2.6s ease-in-out infinite; }
.logoBalls img:nth-child(3) { width: 46px; height: 46px; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
#scTitle h1 {
  margin: 2px 0 2px; font-size: 52px; font-weight: 400; letter-spacing: -1px;
  color: #fff;
  text-shadow: 0 3px 0 #17a3c8, 0 6px 0 rgba(8,88,112,.55), 0 10px 18px rgba(8,70,95,.3);
}
#scTitle .sub { margin: 0 0 22px; font-size: 15px; color: #0c6d8a; }
.quiet { font-size: 13px; color: rgba(12,90,115,.75); margin: 12px 0 0; }
.quiet.mid { text-align: center; }

/* 판(팝업) */
.panel {
  position: relative;
  width: 100%; max-width: 330px;
  background: var(--panel);
  border: 7px solid var(--panel-ring);
  border-radius: 34px;
  padding: 44px 20px 20px;
  box-shadow: 0 14px 0 rgba(9,86,112,.22), 0 22px 44px rgba(6,60,85,.3);
  text-align: center;
  animation: popin .26s cubic-bezier(.2,1.5,.5,1);
}
.panel.wide { max-width: 372px; }
@keyframes popin { from { transform: scale(.82); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.ribbon {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
  width: 250px; aspect-ratio: 620 / 198;
  background: url('art/ui/ribbon.png?v=5') center/contain no-repeat;
  display: grid; place-items: center;
}
.ribbon span {
  display: block; margin-top: -4px;
  font-size: 22px; color: #fff;
  text-shadow: 0 2px 0 #c62f65, 0 3px 6px rgba(120,20,60,.4);
  white-space: nowrap;
}
.close {
  position: absolute; top: -14px; right: -12px;
  width: 42px; height: 42px;
  background: url('art/ui/cbtn-gray.png?v=5') center/100% 100% no-repeat;
  display: grid; place-items: center;
}
.close img { width: 17px; height: 17px; }
.close:active { transform: translateY(2px); }

/* 알약 버튼 — 팩 그림을 9분할로 늘린다 */
.big {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 58px; margin: 9px 0 0;
  font-size: 20px; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.22);
  border-style: solid; border-width: 0;
  border-image-slice: 49 fill;
  border-image-width: 29px;
  border-image-repeat: stretch;
  border-image-source: url('art/ui/btn-green.png?v=5');
}
.big img { width: 24px; height: 24px; }
.big:active { transform: translateY(3px); }
.big.green  { border-image-source: url('art/ui/btn-green.png?v=5'); }
.big.orange { border-image-source: url('art/ui/btn-orange.png?v=5'); }
.big.blue   { border-image-source: url('art/ui/btn-blue.png?v=5'); }
.big.yellow { border-image-source: url('art/ui/btn-yellow.png?v=5'); }
.big.pink   { border-image-source: url('art/ui/btn-pink.png?v=5'); }
.big.gray   { border-image-source: url('art/ui/btn-gray.png?v=5'); color: #f2f6f8; }
.big[disabled] { filter: grayscale(.9) brightness(1.05); opacity: .75; pointer-events: none; }

.flat {
  display: block; width: 100%; margin: 12px 0 0;
  font-size: 15px; color: #7b94a8; padding: 6px;
}
.flat.danger { color: #d8657f; }

/* 끝났을 때 */
.bigscore { margin: 2px 0 6px; }
.bigscore span {
  font-size: 50px; color: #2f4a63; line-height: 1;
  text-shadow: 0 2px 0 #dfeaf2;
}
.overRow { display: flex; justify-content: center; gap: 18px; margin-bottom: 4px; }
.overRow div { display: flex; align-items: center; gap: 5px; font-size: 17px; color: #5d7789; }
.overRow img { width: 20px; height: 20px; }
.overRow .wi { filter: brightness(0) saturate(100%) invert(48%) sepia(9%) saturate(700%) hue-rotate(160deg); }
.newrec { margin: 2px 0 6px; color: #f7861a; font-size: 16px; animation: pulse 1s ease-in-out infinite; }

/* 탭 */
.tabs { display: flex; gap: 6px; margin: 0 0 12px; }
.tab {
  flex: 1; height: 38px; font-size: 15px; color: #7e94a6;
  background: #eef5f9; border-radius: 12px;
}
.tab.on { background: var(--teal); color: #fff; box-shadow: 0 2px 0 var(--teal-d); }

/* 목록 */
.list { max-height: min(54vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch; text-align: left; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 16px; background: #f5fafc;
  margin-bottom: 8px;
}
.row > img { width: 42px; height: 42px; flex: 0 0 42px; }
.row .txt { flex: 1; min-width: 0; }
.row .txt b { display: block; font-size: 16px; color: #38536c; font-weight: 400; }
.row .txt small { display: block; font-size: 12.5px; color: #86a0b2; line-height: 1.35; margin-top: 1px; }
.row .pips { display: flex; gap: 3px; margin-top: 4px; }
.row .pips i { width: 16px; height: 5px; border-radius: 3px; background: #dbe7ee; }
.row .pips i.f { background: #7ac70c; }
.buy {
  flex: 0 0 auto; min-width: 84px; height: 42px; padding: 0 12px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 15px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.2);
  border-style: solid; border-width: 0;
  border-image-slice: 49 fill; border-image-width: 21px; border-image-repeat: stretch;
  border-image-source: url('art/ui/btn-green.png?v=5');
}
.buy img { width: 17px; height: 17px; }
.buy:active { transform: translateY(2px); }
.buy.no { border-image-source: url('art/ui/btn-gray.png?v=5'); color: #eef4f7; }
.buy.max { border-image-source: url('art/ui/btn-blue.png?v=5'); }
.buy.soon { border-image-source: url('art/ui/btn-violet.png?v=5'); font-size: 13px; }

/* 룰렛 */
.wheelBox { position: relative; width: 100%; max-width: 280px; margin: 0 auto 6px; aspect-ratio: 1; }
#wheelCv { width: 100%; height: 100%; display: block; }
.wheelMsg { font-size: 14px; color: #7b94a8; margin: 2px 0 0; min-height: 19px; }

/* 도감 */
.dexGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 8px; }
.dexCell {
  position: relative; border-radius: 16px; background: #f2f8fb;
  padding: 7px 3px 5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dexBall { position: relative; display: block; width: 100%; aspect-ratio: 1; }
.dexBall img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.dexBall img.ic { width: 54%; height: 54%; inset: 23%; }
.dexCell.lock .dexBall img { filter: grayscale(1) brightness(1.45) contrast(.4); opacity: .55; }
.dexCell.lock .dexBall::after {
  content: ''; position: absolute; inset: 0;
  background: url('art/ui/lock.png?v=5') center/34% no-repeat; opacity: .85;
}
.dexCell em {
  font-style: normal; font-size: 10.5px; color: #8fa6b6; line-height: 1.2;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* 설정 */
.toggles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tgl {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 16px; background: #f5fafc;
  font-size: 16px; color: #38536c;
}
.tgl img { width: 20px; height: 20px; }
.tgl .wi { filter: brightness(0) saturate(100%) invert(30%) sepia(20%) saturate(600%) hue-rotate(165deg); }
.tgl span { flex: 1; text-align: left; }
.tgl em { font-style: normal; font-size: 14px; color: #7ac70c; }
.tgl.off em { color: #b9c8d2; }
.tgl.off img { opacity: .45; }
.howto { text-align: left; font-size: 13.5px; color: #86a0b2; line-height: 1.6; }
.howto p { margin: 0 0 6px; }
.howto b { color: #38536c; font-weight: 400; font-size: 15px; }
.credit { font-size: 11.5px; color: #b3c4cf; margin: 14px 0 0; }

/* 알림 */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--sab) + 124px);
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(20,60,80,.9); color: #fff;
  font-size: 15px; padding: 10px 18px; border-radius: 999px;
  animation: fadein .16s ease;
  pointer-events: none; white-space: nowrap; max-width: 86vw;
}

/* 넓은 화면에서는 세로 폰처럼 가운데 한 칸 */
@media (min-width: 620px) {
  #app { max-width: 470px; margin: 0 auto; box-shadow: 0 0 80px rgba(6,60,85,.18); }
}
