/* 물감 팡 화면 스타일: 흰 바탕 물감 공방 */
:root {
  --paper: #fffdf9; --paper2: #f6f3ee; --ink: #2f3550; --ink2: #7a7f96;
  --red: #f2414b; --red-d: #c42a33; --blue: #2c7be5; --blue-d: #1b5bb3;
  --yellow: #ffcf2e; --yellow-d: #d9a400; --green: #23b26d; --green-d: #16834f;
  --line: #e7e2da; --warn: #ff4d6d; --gold: #ffcf4a;
}
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: #141a33; overflow: hidden; position: fixed;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: rgba(0,0,0,0);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; touch-action: manipulation; }
button { font-family: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
button:focus { outline: 4px solid var(--blue); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
.hidden { display: none !important; }

/* ===== 바탕: 흰 종이 위 물감 방울 ===== */
#app {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 8% 12%, rgba(242,65,75,0.10) 0, rgba(242,65,75,0.10) 70px, transparent 72px),
    radial-gradient(circle at 92% 22%, rgba(44,123,229,0.10) 0, rgba(44,123,229,0.10) 90px, transparent 92px),
    radial-gradient(circle at 85% 88%, rgba(255,207,46,0.16) 0, rgba(255,207,46,0.16) 110px, transparent 112px),
    radial-gradient(circle at 12% 80%, rgba(35,178,109,0.10) 0, rgba(35,178,109,0.10) 80px, transparent 82px),
    radial-gradient(rgba(47,53,80,0.05) 12%, transparent 14%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 28px 28px;
}
.q0 #app { background-image: none; }
.screen {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}

/* ===== 공통 버튼 ===== */
.ibtn {
  min-width: 56px; height: 56px; border: 0; border-radius: 18px; background: #fff; font-size: 26px; line-height: 1;
  box-shadow: 0 4px 0 var(--line), 0 6px 14px rgba(47,53,80,0.10); padding: 0 10px;
  display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  -webkit-transition: -webkit-transform 0.08s; transition: transform 0.08s; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.ibtn:active, .bigbtn:active, .lv:active, .modebtn:active, .tool:active { -webkit-transform: scale(0.94); transform: scale(0.94); }
.bigbtn {
  min-height: 60px; border: 0; border-radius: 22px; padding: 10px 22px; font-size: 21px; font-weight: 900;
  background: var(--red); color: #fff; box-shadow: 0 5px 0 var(--red-d), 0 8px 18px rgba(196,42,51,0.22);
  -webkit-transition: -webkit-transform 0.08s; transition: transform 0.08s; margin: 6px;
}
.bigbtn.blue { background: var(--blue); color: #fff; box-shadow: 0 5px 0 var(--blue-d), 0 8px 18px rgba(27,91,179,0.22); }
.bigbtn.green { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-d), 0 8px 18px rgba(22,131,79,0.22); }
.bigbtn.yellow { background: var(--yellow); color: #5a4300; box-shadow: 0 5px 0 var(--yellow-d), 0 8px 18px rgba(217,164,0,0.22); }
.bigbtn.plain { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line), 0 8px 18px rgba(47,53,80,0.10); }
.bigbtn[disabled] { opacity: 0.45; cursor: default; }
.coinpill {
  display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; height: 56px; padding: 0 14px 0 10px;
  background: #fff8dc; border-radius: 18px; font-weight: 900; font-size: 21px; color: #6b4d00; box-shadow: 0 4px 0 #f0d98a; white-space: nowrap; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.coinpill .ci { font-size: 24px; margin-right: 5px; }
.q0 .ibtn, .q0 .bigbtn, .q0 .coinpill, .q0 .tool { box-shadow: none; border: 2px solid var(--line); }

/* ===== 지도 ===== */
#map { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.mapwrap { max-width: 920px; margin: 0 auto; padding: 12px 16px 40px; }
.topbar { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
.topbar > * { margin-right: 8px; }
.topbar > *:last-child { margin-right: 0; }
.grow { -webkit-flex: 1; flex: 1; min-width: 0; }
.gametitle { font-size: 34px; font-weight: 900; letter-spacing: -1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gametitle .t1 { color: var(--red); }
.gametitle .t2 { color: var(--blue); }
.gametitle .t3 { color: var(--green); }
.tagline { margin: 10px 4px 6px; font-size: 18px; color: var(--ink2); font-weight: 700; }
.banner { margin: 10px 0; padding: 12px 16px; border-radius: 18px; background: #ffe3e3; color: #a2283f; font-weight: 800; font-size: 17px; }
.chapter {
  margin: 16px 0; padding: 14px 14px 10px; border-radius: 28px; background: rgba(255,255,255,0.92);
  box-shadow: 0 8px 22px rgba(47,53,80,0.08); border: 3px solid var(--chc, #ffd6d9);
}
.q0 .chapter { box-shadow: none; }
.chapter.locked { opacity: 0.72; }
.chhead { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; margin: 0 4px 8px; }
.chicon { font-size: 34px; width: 56px; height: 56px; border-radius: 18px; background: var(--chc, #ffd6d9); display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; margin-right: 12px; -webkit-flex-shrink: 0; flex-shrink: 0; }
.chname { font-size: 22px; font-weight: 900; }
.chname small { display: block; font-size: 15px; font-weight: 700; color: var(--ink2); margin-top: 2px; }
.lvgrid { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.lvcell { width: 12.5%; padding: 4px; }
.lv {
  width: 100%; min-height: 76px; border: 0; border-radius: 20px; background: #fff; padding: 6px 2px;
  box-shadow: 0 4px 0 var(--chd, #f3b9bd); border: 2px solid var(--chc, #ffd6d9); font-size: 26px; font-weight: 900; line-height: 1.1;
  -webkit-transition: -webkit-transform 0.08s; transition: transform 0.08s; position: relative;
}
.lv small { display: block; font-size: 13px; font-weight: 800; color: var(--ink2); margin-top: 4px; white-space: nowrap; }
.lv.done { background: var(--chc, #ffd6d9); }
.lv.done small { color: var(--ink); }
.lv.locked { background: #f1eee9; color: #b5ada3; box-shadow: 0 4px 0 #e2dbd1; border-color: #ebe5dc; cursor: default; }
.lv.next { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-d); border-color: var(--red); }
.lv.next small { color: #fff; }
.q2 .lv.next { -webkit-animation: bob 1.4s ease-in-out infinite; animation: bob 1.4s ease-in-out infinite; }
@-webkit-keyframes bob { 0%,100% { -webkit-transform: translateY(0); } 50% { -webkit-transform: translateY(-4px); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.modes { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 8px -6px 0; }
.modecell { width: 50%; padding: 6px; }
.modebtn {
  width: 100%; min-height: 128px; border: 0; border-radius: 28px; padding: 16px; text-align: left; position: relative;
  -webkit-transition: -webkit-transform 0.08s; transition: transform 0.08s; display: block;
}
.modebtn.daily { background: linear-gradient(135deg, #fff1b3, #ffd0d3); box-shadow: 0 6px 0 #f0b3b7, 0 10px 24px rgba(242,65,75,0.14); }
.modebtn.endless { background: linear-gradient(135deg, #cfe6ff, #c9f2dc); box-shadow: 0 6px 0 #9fc4ea, 0 10px 24px rgba(44,123,229,0.14); }
.q0 .modebtn { box-shadow: none; }
.modebtn.locked { background: #f1eee9; box-shadow: 0 6px 0 #e2dbd1; color: #9d958b; cursor: default; }
.modebtn .mt { font-size: 25px; font-weight: 900; }
.modebtn .ms { font-size: 16px; font-weight: 800; margin-top: 6px; color: var(--ink); opacity: 0.85; }
.modebtn.locked .ms { color: #9d958b; }
.modebtn .mi { position: absolute; right: 14px; top: 12px; font-size: 40px; }
.dots { margin-top: 10px; line-height: 0; padding-left: 3px; }
.dots i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.8); margin: 0 2px 4px 0; }
.dots i.on { background: var(--red); }
.dots i.today { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue); }
.qualrow { text-align: center; margin-top: 18px; }
.qualrow .bigbtn { font-size: 17px; min-height: 56px; }

/* ===== 게임 화면 ===== */
#game { display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; }
.hud { padding: 8px 12px 0; -webkit-flex-shrink: 0; flex-shrink: 0; }
.ttl { text-align: center; line-height: 1.05; min-width: 0; }
.ttl b { display: block; font-size: 27px; font-weight: 900; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttl small { display: block; font-size: 15px; font-weight: 800; color: var(--ink2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; margin-top: 8px; }
.stat {
  display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center;
  background: #fff; border-radius: 16px; padding: 6px 12px; margin: 3px; font-weight: 900; font-size: 18px; min-height: 48px; white-space: nowrap;
  box-shadow: 0 3px 0 var(--line);
}
.q0 .stat { box-shadow: none; border: 2px solid var(--line); }
.stat .k { font-size: 15px; color: var(--ink2); margin-right: 6px; font-weight: 800; }
.stat .v { font-size: 26px; }
.stat.left { background: #e3f0ff; box-shadow: 0 3px 0 #a9cdf5; }
.stat.left .v { color: var(--blue-d); }
.stat.left.low { background: #ffe0e6; box-shadow: 0 3px 0 #ffadbd; }
.stat.left.low .v { color: #d3214a; }
.q1 .stat.left.low, .q2 .stat.left.low { -webkit-animation: lowBlink 0.7s ease-in-out infinite alternate; animation: lowBlink 0.7s ease-in-out infinite alternate; }
@-webkit-keyframes lowBlink { from { -webkit-transform: scale(1); } to { -webkit-transform: scale(1.08); } }
@keyframes lowBlink { from { transform: scale(1); } to { transform: scale(1.08); } }
.stat.spare { background: #fff4d6; box-shadow: 0 3px 0 #f2d58a; font-size: 16px; }
.hudcoins { display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; margin: 3px; }
.hudcoins .coinpill { height: 48px; font-size: 18px; }
.hudcoins .ibtn { height: 48px; min-width: 52px; margin-left: 6px; font-size: 24px; }
.hint {
  text-align: center; font-size: 19px; font-weight: 900; margin: 8px 0 0; min-height: 28px; color: var(--ink); line-height: 1.35;
}
.hint.warn { color: #c42a33; }
.hint .sw { display: inline-block; min-width: 1.6em; padding: 0 0.3em; border-radius: 0.6em; color: #fff; margin: 0 2px; }
.boardwrap { -webkit-flex: 1; flex: 1; position: relative; min-height: 0; margin: 4px 8px 0; }
#board { position: absolute; left: 0; top: 0; }
.tools {
  -webkit-flex-shrink: 0; flex-shrink: 0; display: -webkit-flex; display: flex; -webkit-justify-content: center; justify-content: center;
  padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px));
}
.tool {
  min-height: 60px; min-width: 132px; border: 0; border-radius: 22px; margin: 0 6px; padding: 6px 16px; font-size: 20px; font-weight: 900;
  background: #fff; box-shadow: 0 5px 0 var(--line), 0 8px 18px rgba(47,53,80,0.10);
  display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  -webkit-transition: -webkit-transform 0.08s; transition: transform 0.08s; white-space: nowrap;
}
.tool .ti { font-size: 26px; margin-right: 6px; }
.tool .cnt { display: inline-block; min-width: 1.6em; margin-left: 8px; padding: 2px 6px; border-radius: 12px; background: #e3f0ff; color: var(--blue-d); font-size: 18px; }
.tool[disabled] { opacity: 0.4; cursor: default; }
.tool.pulse { background: #fff4d6; }
.q2 .tool.pulse, .q1 .tool.pulse { -webkit-animation: lowBlink 0.6s ease-in-out infinite alternate; animation: lowBlink 0.6s ease-in-out infinite alternate; }

/* ===== 병 ===== */
.bottle {
  position: absolute; left: 0; top: 0; border: 0; padding: 0; margin: 0; background: transparent;
  font-size: inherit; line-height: 1;
  width: 4.6em; height: 12.2em; z-index: 1;
  -webkit-transform-origin: 50% 1em; transform-origin: 50% 1em;
  -webkit-transition: -webkit-transform 0.18s ease-out; transition: transform 0.18s ease-out;
}
.withtags .bottle { height: 14.2em; }
.bottle:focus { outline-offset: 4px; border-radius: 1em; }
.bottle.sel { -webkit-transform: translateY(-1.3em); transform: translateY(-1.3em); z-index: 3; }
.bottle.flying { z-index: 6; }
.glass {
  position: absolute; left: 0.3em; top: 1em; width: 4em; height: 10.6em;
  border-radius: 0.9em 0.9em 1.9em 1.9em; background: #cfdbea; overflow: hidden;
}
.inner {
  position: absolute; left: 0.26em; top: 0.26em; right: 0.26em; bottom: 0.26em;
  border-radius: 0.7em 0.7em 1.7em 1.7em; background: rgba(255,255,255,0.88); overflow: hidden;
  -webkit-transform: translateZ(0); transform: translateZ(0);
}
.liq { position: absolute; left: 0; right: 0; bottom: 0; height: 88%; }
.cell {
  position: absolute; left: 0; right: 0; height: 25%; overflow: hidden;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  font-size: 1.35em; font-weight: 900; line-height: 1; color: #fff;
  box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.35);
}
.cell .sy { display: block; text-shadow: 0 0.04em 0 rgba(0,0,0,0.25); pointer-events: none; }
.cell.dark .sy { color: #3a2f00; text-shadow: none; }
.cell.q {
  background-color: #b9c0cf; color: #4b5470;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.35) 0, rgba(255,255,255,0.35) 0.22em, transparent 0.22em, transparent 0.5em);
}
.cell.q .sy { color: #3c4560; text-shadow: 0 0.05em 0 rgba(255,255,255,0.6); }
.cell.grow { height: 0; }
.animating .cell { -webkit-transition: height 0.4s linear; transition: height 0.4s linear; }
.cell.reveal { -webkit-animation: revealPop 0.45s ease-out; animation: revealPop 0.45s ease-out; }
@-webkit-keyframes revealPop { 0% { -webkit-filter: brightness(1.8); filter: brightness(1.8); } 100% { -webkit-filter: none; filter: none; } }
@keyframes revealPop { 0% { -webkit-filter: brightness(1.8); filter: brightness(1.8); } 100% { -webkit-filter: none; filter: none; } }
.glass::after {
  content: ''; position: absolute; left: 0.55em; top: 1.2em; width: 0.42em; bottom: 1.6em; border-radius: 0.3em;
  background: rgba(255,255,255,0.55); pointer-events: none;
}
.q0 .glass::after { display: none; }
.rim {
  position: absolute; left: 0.05em; top: 0.62em; width: 4.5em; height: 0.62em; border-radius: 0.32em; background: #b4c3d8; z-index: 2;
}
.cork {
  position: absolute; left: 1.05em; top: -0.35em; width: 2.5em; height: 1.35em; border-radius: 0.4em 0.4em 0.22em 0.22em; z-index: 3;
  background-color: #d39a5c;
  background-image: repeating-linear-gradient(90deg, rgba(120,70,30,0.22) 0, rgba(120,70,30,0.22) 0.12em, transparent 0.12em, transparent 0.5em);
  box-shadow: inset 0 -0.18em 0 rgba(120,70,30,0.3);
  display: none;
}
.bottle.capped .cork { display: block; }
.bottle.done .cork { display: block; -webkit-animation: corkIn 0.35s ease-out; animation: corkIn 0.35s ease-out; }
.q0 .bottle.done .cork { -webkit-animation: none; animation: none; }
@-webkit-keyframes corkIn { 0% { -webkit-transform: translateY(-1.4em); opacity: 0; } 100% { -webkit-transform: translateY(0); opacity: 1; } }
@keyframes corkIn { 0% { transform: translateY(-1.4em); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.bottle.done .glass { box-shadow: 0 0 0 0.16em #fff, 0 0 0 0.3em #ffe066; }
.q0 .bottle.done .glass { box-shadow: 0 0 0 0.2em #ffd23a; }
.spark { position: absolute; left: 0; top: 0; right: 0; height: 12em; pointer-events: none; z-index: 4; display: none; }
.bottle.done .spark { display: block; }
.spark i { position: absolute; font-style: normal; font-size: 1.1em; opacity: 0; color: #ffc400; text-shadow: 0 0 0.3em #fff; }
.spark i:nth-child(1) { left: -0.2em; top: 3em; }
.spark i:nth-child(2) { right: -0.3em; top: 5.5em; }
.spark i:nth-child(3) { left: 1.8em; top: 0.4em; }
.q2 .bottle.done .spark i { -webkit-animation: twinkle 1.6s ease-in-out infinite; animation: twinkle 1.6s ease-in-out infinite; }
.q2 .bottle.done .spark i:nth-child(2) { -webkit-animation-delay: 0.5s; animation-delay: 0.5s; }
.q2 .bottle.done .spark i:nth-child(3) { -webkit-animation-delay: 1s; animation-delay: 1s; }
.q1 .bottle.done.fresh .spark i { -webkit-animation: twinkle 0.8s ease-in-out 2; animation: twinkle 0.8s ease-in-out 2; }
@-webkit-keyframes twinkle { 0%,100% { opacity: 0; -webkit-transform: scale(0.4); } 50% { opacity: 1; -webkit-transform: scale(1.2); } }
@keyframes twinkle { 0%,100% { opacity: 0; transform: scale(0.4); } 50% { opacity: 1; transform: scale(1.2); } }
.bottle.fresh .glass { -webkit-animation: donePop 0.5s ease-out; animation: donePop 0.5s ease-out; }
.q0 .bottle.fresh .glass { -webkit-animation: none; animation: none; }
@-webkit-keyframes donePop { 0% { -webkit-transform: scale(1); } 40% { -webkit-transform: scale(1.07); } 100% { -webkit-transform: scale(1); } }
@keyframes donePop { 0% { transform: scale(1); } 40% { transform: scale(1.07); } 100% { transform: scale(1); } }

/* 선택된 병: 테두리 빛 */
.bottle.sel .glass { box-shadow: 0 0 0 0.2em #fff, 0 0 0 0.42em var(--blue); }
.q2 .bottle.sel .glass { box-shadow: 0 0 0 0.2em #fff, 0 0 0 0.42em var(--blue), 0 0.6em 1.2em rgba(44,123,229,0.35); }

/* 못 부을 때 흔들림 */
.bottle.shake .glass, .bottle.shake .rim, .bottle.shake .cork { -webkit-animation: shake 0.42s ease-in-out; animation: shake 0.42s ease-in-out; }
@-webkit-keyframes shake { 0%,100% { -webkit-transform: translateX(0); } 20% { -webkit-transform: translateX(-0.4em); } 40% { -webkit-transform: translateX(0.4em); } 60% { -webkit-transform: translateX(-0.28em); } 80% { -webkit-transform: translateX(0.2em); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-0.4em); } 40% { transform: translateX(0.4em); } 60% { transform: translateX(-0.28em); } 80% { transform: translateX(0.2em); } }

/* 이름표 */
.tag {
  position: absolute; left: 0; right: 0; top: 11.95em; height: 2.15em; border-radius: 0.7em; background: #fff;
  border: 0.2em solid var(--tagc, #999); display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  font-size: 1em; font-weight: 900; white-space: nowrap; z-index: 2;
}
.tag::before { content: ''; position: absolute; left: 50%; top: -0.62em; width: 0.16em; height: 0.5em; margin-left: -0.08em; background: var(--tagc, #999); }
.tag .tsw {
  display: inline-block; width: 1.45em; height: 1.45em; line-height: 1.45em; border-radius: 50%; text-align: center; color: #fff; font-size: 0.95em;
  background: var(--tagc, #999); margin-right: 0.15em;
}
.tag .tsw.dark { color: #3a2f00; }
.tag .tnm { font-size: 0.72em; color: var(--ink); }
.tag.ok { background: #eafff3; }
.tag.ok .tnm::after { content: ' ✓'; color: var(--green-d); }

/* 붓는 물줄기 */
.stream {
  position: absolute; width: 0.55em; border-radius: 0.3em; z-index: 5; pointer-events: none;
  -webkit-transform-origin: 50% 0; transform-origin: 50% 0;
  -webkit-transform: scaleY(0); transform: scaleY(0);
  -webkit-transition: -webkit-transform 0.14s linear; transition: transform 0.14s linear;
}
.stream.on { -webkit-transform: scaleY(1); transform: scaleY(1); }

/* ===== 병 스킨: 모양과 유리 무늬가 모두 다르다 ===== */
/* 바다 유리병: 가늘고 긴 시험관, 물결 무늬 청록 유리 */
.skin-sea-glass .glass {
  left: 0.5em; width: 3.6em; border-radius: 0.7em 0.7em 1.8em 1.8em;
  background-color: #8fe0d6;
  background-image: radial-gradient(circle at 50% 0, transparent 0.32em, #3fb8ad 0.34em, #3fb8ad 0.46em, transparent 0.48em);
  background-size: 0.9em 0.55em;
}
.skin-sea-glass .inner { border-radius: 0.5em 0.5em 1.6em 1.6em; background: rgba(240,255,252,0.88); }
.skin-sea-glass .rim { left: 0.3em; width: 4em; background: #2fa39a; border-radius: 0.5em; }
.skin-sea-glass .cork { background-color: #f5f0e0; background-image: radial-gradient(#7fd3cb 25%, transparent 28%); background-size: 0.6em 0.6em; }
/* 노을 병: 아래가 넓은 둥근 물병, 노을 줄무늬 유리 */
.skin-sunset .glass {
  border-radius: 1.3em 1.3em 2.2em 2.2em / 1.2em 1.2em 4.4em 4.4em;
  background-color: #ff9a5a;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.55) 0, rgba(255,255,255,0.55) 0.12em, transparent 0.12em, transparent 0.7em),
    linear-gradient(180deg, #ffd36e 0%, #ff8a5c 50%, #e0508f 100%);
}
.skin-sunset .inner { border-radius: 1em 1em 1.9em 1.9em / 1em 1em 4em 4em; background: rgba(255,250,244,0.9); }
.skin-sunset .rim { background: #f06a6a; border-radius: 0.5em 0.5em 0.2em 0.2em; }
.skin-sunset .cork { background-color: #ffb547; border-radius: 1.2em 1.2em 0.2em 0.2em; }
/* 산호 병: 통통하고 모서리 둥근 항아리, 점박이 무늬 */
.skin-coral .glass {
  left: 0.1em; width: 4.4em; border-radius: 1.7em;
  background-color: #ff8a7a;
  background-image: radial-gradient(#ffd9d2 22%, transparent 25%), radial-gradient(#ffd9d2 22%, transparent 25%);
  background-size: 0.75em 0.75em, 0.75em 0.75em; background-position: 0 0, 0.375em 0.375em;
}
.skin-coral .inner { left: 0.32em; right: 0.32em; top: 0.32em; bottom: 0.32em; border-radius: 1.4em; background: rgba(255,248,246,0.9); }
.skin-coral .rim { left: -0.05em; width: 4.7em; height: 0.72em; background: #e8665a; border-radius: 0.6em; }
.skin-coral .cork { background-color: #fff2e0; border-radius: 50% 50% 0.3em 0.3em; background-image: none; box-shadow: inset 0 -0.18em 0 #f2b8a8; }
/* 축제 병: 네모난 병, 알록달록 마름모 무늬 */
.skin-carnival .glass {
  border-radius: 0.55em 0.55em 0.9em 0.9em;
  background-color: #ffd23a;
  background-image: linear-gradient(45deg, #ff5a7a 25%, transparent 25%, transparent 75%, #ff5a7a 75%),
    linear-gradient(45deg, #36a3ff 25%, transparent 25%, transparent 75%, #36a3ff 75%);
  background-size: 0.9em 0.9em, 0.9em 0.9em; background-position: 0 0, 0.45em 0.45em;
}
.skin-carnival .inner { border-radius: 0.35em 0.35em 0.7em 0.7em; background: rgba(255,255,255,0.92); }
.skin-carnival .rim { background: #8a4fe0; border-radius: 0.2em; }
.skin-carnival .cork {
  background-color: #8a4fe0; background-image: none; border-radius: 0.3em;
  box-shadow: none; text-align: center; color: #ffd23a; line-height: 1.35em; font-size: 1em;
}
.skin-carnival .cork::before { content: '★'; }

/* ===== 겹쳐 뜨는 창 ===== */
.ov {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 20; background: rgba(47,53,80,0.42);
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  padding: 16px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.sheet {
  width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--paper); border-radius: 32px; padding: 22px 18px 16px; text-align: center; border: 4px solid #fff;
  box-shadow: 0 16px 40px rgba(47,53,80,0.3);
}
.q0 .sheet { box-shadow: none; }
.sheet h2 { margin: 2px 0 10px; font-size: 30px; font-weight: 900; color: var(--red); }
.btnrow { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-justify-content: center; justify-content: center; margin-top: 12px; }
.bubblewrap { display: -webkit-flex; display: flex; -webkit-align-items: flex-end; align-items: flex-end; text-align: left; }
.mascot { font-size: 60px; line-height: 1; margin-right: 10px; -webkit-flex-shrink: 0; flex-shrink: 0; }
.bubble {
  position: relative; background: #e8f2ff; border-radius: 26px; padding: 18px 20px; font-size: 25px; font-weight: 900; line-height: 1.4; color: #1d4a80;
  -webkit-flex: 1; flex: 1;
}
.bubble::before { content: ''; position: absolute; left: -14px; bottom: 18px; border: 10px solid transparent; border-right: 14px solid #e8f2ff; border-left: 0; }
.scene {
  position: relative; margin: 0 auto 12px; display: -webkit-flex; display: flex; -webkit-align-items: flex-end; align-items: flex-end; -webkit-justify-content: center; justify-content: center;
  font-size: 11px; min-height: 160px;
}
.scene .mini { position: relative; width: 4.6em; height: 12.2em; margin: 0 0.6em; }
.scene .mini.tagged { height: 14.2em; }
.scene .mini .bottle { position: absolute; left: 0; top: 0; -webkit-transition: none; transition: none; }
.scene .arrow { font-size: 3.2em; font-weight: 900; color: var(--blue); margin: 0 0.1em 1.6em; }
.scene .big { font-size: 4.4em; margin: 0 0.1em 0.5em; }
.pagedots { margin-top: 10px; }
.pagedots i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e3ddd4; margin: 0 3px; }
.pagedots i.on { background: var(--red); }
.rface { font-size: 64px; line-height: 1.1; }
.score { font-size: 54px; font-weight: 900; color: var(--red); line-height: 1.1; margin: 4px 0; }
.score small { font-size: 24px; margin-left: 4px; }
.rline { font-size: 18px; font-weight: 800; color: var(--ink2); margin: 4px 0; }
.rbest { font-size: 18px; font-weight: 900; margin: 6px 0; }
.rbest .newrec { display: inline-block; background: var(--gold); color: #5a3d00; border-radius: 10px; padding: 2px 8px; margin-left: 6px; font-size: 15px; }
.rcoins { margin: 10px auto 4px; display: inline-block; background: #fff8dc; border-radius: 20px; padding: 8px 20px; font-size: 30px; font-weight: 900; color: #6b4d00; min-height: 54px; }
.rcoins.wait { font-size: 19px; color: var(--ink2); padding-top: 14px; }
.rnote { font-size: 16px; font-weight: 800; color: var(--ink2); margin: 2px 0; }
.rerr { margin: 10px 0 4px; background: #ffe3e3; color: #a2283f; font-weight: 900; font-size: 18px; border-radius: 16px; padding: 10px 12px; }
.unlock { margin: 8px 0; background: #e3f8ec; color: #16683f; font-weight: 900; font-size: 19px; border-radius: 16px; padding: 10px 12px; }
.pausebtns { display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: stretch; align-items: stretch; max-width: 320px; margin: 0 auto; }

/* 상점 */
.shophead { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; margin-bottom: 10px; }
.shophead h2 { margin: 0; text-align: left; font-size: 26px; }
.items { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 0 -5px; }
.itemcell { width: 50%; padding: 5px; }
.item { background: #fff; border-radius: 22px; padding: 12px 8px 10px; border: 3px solid var(--line); height: 100%; }
.item.using { border-color: var(--green); background: #f0fff6; }
.skinprev { display: block; position: relative; width: 4.6em; height: 12.2em; margin: 0 auto 8px; font-size: 17px; }
@media (max-width: 400px) { .skinprev { font-size: 14px; } }
.skinprev .bottle { -webkit-transition: none; transition: none; }
.iname { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.item .bigbtn { width: 100%; margin: 0; min-height: 56px; font-size: 18px; padding: 8px 6px; }
.usingtag { display: block; min-height: 56px; line-height: 56px; font-size: 18px; font-weight: 900; color: var(--green-d); }
.shopmsg { margin-top: 10px; font-weight: 800; color: var(--ink2); font-size: 16px; }

/* 알림·효과 */
#toast {
  position: absolute; left: 50%; top: 18%; z-index: 40; -webkit-transform: translateX(-50%); transform: translateX(-50%);
  background: rgba(47,53,80,0.92); color: #fff; font-weight: 900; font-size: 20px; padding: 12px 20px; border-radius: 20px; max-width: 88%; text-align: center; pointer-events: none;
}
.confetti { position: absolute; top: -40px; z-index: 18; pointer-events: none; font-size: 28px; -webkit-animation: fall 1.8s ease-in forwards; animation: fall 1.8s ease-in forwards; }
@-webkit-keyframes fall { to { -webkit-transform: translateY(110vh) rotate(540deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* 작은 화면 */
@media (max-width: 700px) {
  .lvcell { width: 25%; }
  .gametitle { font-size: 28px; }
}
@media (max-width: 560px) {
  .modecell { width: 100%; }
  .ttl b { font-size: 23px; }
  .stat { padding: 4px 9px; min-height: 44px; }
  .stat .k { font-size: 13px; }
  .stat .v { font-size: 22px; }
  .hint { font-size: 17px; }
  .bubble { font-size: 21px; }
  .coinpill { font-size: 18px; padding: 0 10px 0 8px; }
  .tool { min-width: 0; -webkit-flex: 1; flex: 1; font-size: 18px; padding: 6px 10px; }
}
@media (max-width: 400px) {
  .gametitle { font-size: 23px; }
  .lv { min-height: 70px; font-size: 23px; }
  .lv small { font-size: 12px; }
  .hudcoins .coinpill { font-size: 16px; }
}
/* 낮은 가로 화면: 상태 표시와 도구를 왼쪽 세로 줄로 */
@media (orientation: landscape) and (max-height: 560px) {
  #game { display: block; }
  .hud { position: absolute; left: env(safe-area-inset-left, 0px); top: env(safe-area-inset-top, 0px); width: 250px; bottom: 150px; padding: 8px 4px 0 10px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .stats { -webkit-justify-content: flex-start; justify-content: flex-start; }
  .hint { text-align: left; font-size: 16px; }
  .ttl b { font-size: 21px; }
  .tools { position: absolute; left: env(safe-area-inset-left, 0px); bottom: 0; width: 250px; -webkit-flex-direction: column; flex-direction: column; padding: 4px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .tool { margin: 4px 0; min-height: 56px; }
  .boardwrap { position: absolute; left: calc(250px + env(safe-area-inset-left, 0px)); right: env(safe-area-inset-right, 0px); top: env(safe-area-inset-top, 0px); bottom: env(safe-area-inset-bottom, 0px); margin: 6px 8px; }
}
.sy svg, .tsw svg, .sw svg { display: inline-block; width: 1em; height: 1em; fill: currentColor; vertical-align: -0.12em; }
.cell .sy svg { display: block; }
.tsw svg { vertical-align: -0.15em; }
/* 무늬 있는 스킨은 유리 테두리를 조금 두껍게 해서 무늬가 잘 보이게 */
.skin-sea-glass .inner, .skin-sunset .inner, .skin-carnival .inner { left: 0.38em; right: 0.38em; top: 0.38em; bottom: 0.38em; }
.skin-coral .inner { left: 0.42em; right: 0.42em; top: 0.42em; bottom: 0.42em; }
/* 기기의 '동작 줄이기'가 켜져 있으면(body.reduce) 계속 반복되는 움직임을 멈춘다.
   지도 버튼 들썩임·남은 붓기 확대·축소·도구 깜빡임은 멈추고, 완성 병의 반짝임은 움직이지 않는 별로 보여 준다. */
.reduce .lv.next,
.reduce .stat.left.low,
.reduce .tool.pulse { -webkit-animation: none; animation: none; }
.reduce .bottle.done .spark i, .reduce .bottle.done.fresh .spark i { -webkit-animation: none; animation: none; opacity: 0.85; -webkit-transform: none; transform: none; }
