/* 🦫 카피바라 온천 클리커 — 도트 그래픽 스타일 */

:root {
  --ink:    #3a2a1c;
  --cream:  #fff6e9;
  --cream2: #ffeccf;
  --yuzu:   #ff9d28;
  --yuzu-d: #e07d12;
  --leaf:   #5fae3b;
  --water:  #6fc6dd;
  --shadow: #caa05f;
  --muted:  #9a7b58;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "DungGeunMo", "Galmuri11", "Press Start 2P", ui-monospace, Menlo, Consolas, monospace;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% -10%, #ffe7b3 0%, #ffc98a 36%, #ff9d7e 68%, #ff7f93 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: none;
  overflow-x: hidden;
}

/* 떠다니는 픽셀 구름 */
.cloud {
  position: fixed; z-index: 0; pointer-events: none; opacity: .8;
  width: 120px; height: 40px;
  background:
    radial-gradient(circle at 30% 60%, #fff 0 18px, transparent 19px),
    radial-gradient(circle at 55% 45%, #fff 0 24px, transparent 25px),
    radial-gradient(circle at 75% 62%, #fff 0 16px, transparent 17px);
  filter: drop-shadow(0 3px 0 rgba(58,42,28,.08));
}
.cloud.c1 { top: 10%; left: -140px; animation: cloud 38s linear infinite; }
.cloud.c2 { top: 24%; left: -180px; transform: scale(.7); animation: cloud 52s linear infinite 6s; }
@keyframes cloud { to { transform: translateX(120vw); } }

/* ── Topbar ── */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 940px; margin: 0 auto; padding: 16px 16px 6px;
}
.brand { font-size: clamp(17px, 4.4vw, 22px); font-weight: 800; letter-spacing: -.5px;
  text-shadow: 0 2px 0 rgba(255,255,255,.5); }
.back {
  color: var(--ink); text-decoration: none; font-size: 13px;
  background: rgba(255,255,255,.55); border: 2px solid var(--ink);
  border-radius: 8px; padding: 5px 10px; box-shadow: 0 2px 0 rgba(58,42,28,.2);
}
.back:hover { background: #fff; }

/* ── Layout ── */
.wrap {
  position: relative; z-index: 2;
  max-width: 940px; margin: 0 auto; padding: 8px 16px 48px;
  display: grid; gap: 16px;
  grid-template-columns: 1fr 360px; align-items: start;
}
@media (max-width: 820px) { .wrap { grid-template-columns: 1fr; } }
.col-left { display: flex; flex-direction: column; gap: 14px; }

.panel {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(58,42,28,.16);
}

/* ── Counter ── */
.counter { padding: 16px 14px; text-align: center; }
.counter .amt {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  font-size: clamp(34px, 9vw, 46px); font-weight: 800; letter-spacing: -1.5px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.counter .amt .ico { font-size: .82em; filter: drop-shadow(0 2px 0 rgba(224,125,18,.4)); }
.counter .rate { margin-top: 8px; font-size: 14px; color: var(--muted); }
.counter .rate b { color: var(--yuzu-d); }

/* ── Stage ── */
.stage {
  position: relative; height: 320px; overflow: hidden;
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 6px 0 rgba(58,42,28,.16);
  background:
    linear-gradient(180deg, #ffe3b0 0%, #ffd093 40%, transparent 40%),
    linear-gradient(180deg, #8fe1f1 40%, #54bcd6 100%);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; outline: none;
}
.stage:focus-visible { box-shadow: 0 0 0 3px var(--yuzu), 0 6px 0 rgba(58,42,28,.16); }
/* 물결 */
.stage::after {
  content: ''; position: absolute; left: 0; right: 0; top: 40%; height: 60%;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.18) 0 2px, transparent 2px 10px);
  animation: ripple 3s linear infinite; pointer-events: none;
}
@keyframes ripple { to { background-position: 0 12px; } }

.capy-shadow {
  position: absolute; left: 50%; top: 75%; width: 150px; height: 22px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(20,70,84,.34), transparent);
  border-radius: 50%; pointer-events: none;
  animation: shadowPulse 2.4s ease-in-out infinite;
}
@keyframes shadowPulse { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(.86); } }

.capy-bob {
  position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%);
  animation: bob 2.4s ease-in-out infinite; pointer-events: none;
}
@keyframes bob { 0%,100% { translate: 0 0; } 50% { translate: 0 -7px; } }
.capy {
  width: 208px; height: auto; display: block;
  image-rendering: pixelated; image-rendering: crisp-edges;
  transition: transform .09s ease-out;
  filter: drop-shadow(0 5px 0 rgba(40,80,90,.18));
}
.capy.squish { transform: scale(1.07, .9) translateY(7%); }

.steam {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,.55); filter: blur(5px); pointer-events: none;
  animation: rise 3.4s ease-in infinite;
}
@keyframes rise {
  0% { transform: translateY(0) scale(.5); opacity: 0; }
  25% { opacity: .7; }
  100% { transform: translateY(-150px) scale(1.5); opacity: 0; }
}

.hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(58,42,28,.78); color: #fff; font-size: 12px;
  padding: 5px 12px; border-radius: 20px; pointer-events: none;
  animation: hintPulse 1.8s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { opacity: .8; } 50% { opacity: .35; } }

/* 클릭 이펙트 */
.float {
  position: absolute; transform: translate(-50%,-50%); z-index: 7;
  font-weight: 800; font-size: 22px; color: #fff; pointer-events: none;
  text-shadow: 0 2px 0 var(--yuzu-d), 0 0 7px rgba(255,157,40,.7);
  animation: floatUp .9s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; scale: .5; }
  18% { opacity: 1; scale: 1.15; }
  100% { opacity: 0; translate: 0 -64px; }
}
.drop {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--yuzu); z-index: 6; pointer-events: none;
  box-shadow: 0 0 0 2px var(--yuzu-d);
  animation: dropFly .6s ease-out forwards;
}
@keyframes dropFly { 0% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: var(--dx) var(--dy); } }

/* 황금 유자 */
.golden {
  position: absolute; top: 25%; font-size: 42px; z-index: 8;
  background: none; border: none; cursor: pointer; padding: 4px;
  filter: drop-shadow(0 0 12px gold) drop-shadow(0 0 4px #fff);
  animation: goldDrift 12s linear forwards, goldSpin 1.4s linear infinite;
}
@keyframes goldDrift {
  0% { left: -14%; top: 22%; }
  50% { top: 58%; }
  100% { left: 110%; top: 26%; }
}
@keyframes goldSpin { 50% { transform: scale(1.18) rotate(8deg); } }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat {
  background: var(--cream); border: 3px solid var(--ink); border-radius: 10px;
  padding: 9px 6px; text-align: center; box-shadow: 0 4px 0 rgba(58,42,28,.14);
}
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 16px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ── Shop ── */
.shop { padding: 13px; display: flex; flex-direction: column; gap: 10px; }
.shop h2 { font-size: 15px; }
.shop-list { display: flex; flex-direction: column; gap: 9px; }

.shop-item {
  width: 100%; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center;
  background: var(--cream2); border: 3px solid var(--ink); border-radius: 10px;
  padding: 9px 11px; cursor: pointer; text-align: left; font: inherit; color: inherit;
  box-shadow: 0 3px 0 rgba(58,42,28,.15);
  transition: transform .07s, box-shadow .07s, opacity .12s, filter .12s;
}
.shop-item:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(58,42,28,.18); }
.shop-item:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(58,42,28,.15); }
.shop-item.afford { animation: nudge 1.6s ease-in-out infinite; }
.shop-item.locked { opacity: .5; filter: grayscale(.4); cursor: not-allowed; }
.shop-item.locked:hover { transform: none; box-shadow: 0 3px 0 rgba(58,42,28,.15); }
.shop-item.hidden { display: none; }
@keyframes nudge { 0%,100% { border-color: var(--ink); } 50% { border-color: var(--yuzu); } }

.si-icon { font-size: 26px; text-align: center; line-height: 1; }
.si-name { font-weight: 700; display: block; font-size: 14px; }
.si-blurb { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.si-right { text-align: right; }
.si-cost { display: block; font-size: 13px; color: var(--yuzu-d); font-weight: 700; white-space: nowrap; }
.si-cost.cant { color: #c0584f; }
.si-owned { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.settings { display: flex; gap: 8px; margin-top: 2px; }
.settings .btn { flex: 1; }

/* ── Buttons ── */
.btn {
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  border: 3px solid var(--ink); border-radius: 10px; padding: 9px 14px;
  background: var(--yuzu); color: #fff; box-shadow: 0 4px 0 var(--yuzu-d);
  transition: transform .07s, box-shadow .07s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--yuzu-d); }
.btn.ghost { background: var(--cream2); color: var(--ink); box-shadow: 0 4px 0 var(--shadow); }
.btn.ghost:active { box-shadow: 0 2px 0 var(--shadow); }

/* ── Toast ── */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  z-index: 50; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 4px 0 rgba(0,0,0,.25); white-space: nowrap;
  animation: toastIn .3s ease-out, toastOut .4s ease-in 2.5s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ── Overlay ── */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(58,42,28,.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay .box {
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px;
  padding: 26px 28px; text-align: center; max-width: 320px; margin: 20px;
  box-shadow: 0 8px 0 rgba(58,42,28,.28);
}
.overlay .box h3 { margin: 8px 0; font-size: 19px; }
.overlay .box p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.overlay .box p b { color: var(--yuzu-d); font-size: 16px; }
