/* ============================================================
   kessoku ball — Casino Arcade skin
   와인/버건디 바탕 · 금박 이중 테두리 · 마키 전구 · 벨벳 커튼 · 포커 칩
   ============================================================ */
:root {
  --wine-950: #0f050c;
  --wine-900: #170812;
  --wine-800: #210b1a;
  --wine-700: #2e0f24;
  --wine-600: #421632;
  --plum-700: #2a1238;
  --plum-500: #4b2266;

  --gold-0: #fff6d2;
  --gold-1: #ffe28a;
  --gold-2: #f2bb4a;
  --gold-3: #c4841f;
  --gold-4: #7a4a12;
  --gold-5: #3d2208;

  --ruby: #e0234f;
  --ruby-d: #7a0d27;
  --felt: #1d5a35;
  --cream: #f3e2c4;
  --neon-pink: #ff4fa3;
  --neon-cyan: #52e4ff;
  --mint: #6dffb0;

  --gold-grad: linear-gradient(180deg, #fff2be 0%, #f2bb4a 28%, #a8661a 52%, #f2bb4a 76%, #ffe9a3 100%);
  --display: "Arial Black", "Segoe UI Black", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --display-weight: 900;
  --body: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07020a;
  color: var(--cream);
  font-family: var(--body);
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  transform-origin: center center;
  transform: translate(-50%, -50%);
  overflow: hidden;
  /* 사이드바 쪽 하를레퀸(마름모) 패턴 */
  background:
    radial-gradient(ellipse at 80% 0%, rgba(255, 170, 60, 0.08), transparent 55%),
    conic-gradient(from 45deg at 50% 50%, #1f0a19 0 25%, #170812 0 50%, #1f0a19 0 75%, #170812 0) 0 0 / 34px 34px;
}

#board {
  position: absolute;
  left: 0;
  top: 0;
  width: 960px;
  height: 720px;
  cursor: crosshair;
  display: block;
}

/* ---------- 공용 부품 ---------- */

/* 금박 이중 테두리 */
.gframe {
  position: relative;
  border: 2px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(180deg, var(--wine-700), var(--wine-800)) padding-box,
    var(--gold-grad) border-box;
  box-shadow:
    inset 0 0 0 3px var(--wine-800),
    inset 0 0 0 4px rgba(242, 187, 74, 0.35),
    0 6px 18px rgba(0, 0, 0, 0.55);
}

/* 마키 전구 (테두리를 따라 균등 배치) */
.marquee { position: relative; }
.marquee::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  pointer-events: none;
  --bulb: radial-gradient(circle, #fffbe6 0 1.6px, #ffd257 2.4px, rgba(255, 196, 64, 0.35) 3.4px, transparent 4.4px);
  background:
    var(--bulb) top left / 16px 9px round no-repeat,
    var(--bulb) bottom left / 16px 9px round no-repeat,
    var(--bulb) top left / 9px 16px no-repeat round,
    var(--bulb) top right / 9px 16px no-repeat round;
  background-repeat: round no-repeat, round no-repeat, no-repeat round, no-repeat round;
  filter: drop-shadow(0 0 2px rgba(255, 190, 60, 0.9));
  animation: bulbs 1.2s steps(2) infinite;
}
@keyframes bulbs { 50% { filter: drop-shadow(0 0 4px rgba(255, 210, 90, 1)) brightness(1.25); } }

/* 정보 알약 (라운드 3/8 · 목표 점수 스타일) */
.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid transparent;
  background:
    linear-gradient(180deg, #2b0e22, #1a0814) padding-box,
    var(--gold-grad) border-box;
  box-shadow: inset 0 0 0 2px #1a0814, inset 0 0 0 3px rgba(242, 187, 74, 0.28), 0 3px 8px rgba(0, 0, 0, 0.5);
}
.pl { font-size: 13px; color: #d8bf9a; font-weight: 700; letter-spacing: 0.5px; }
.pv { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 900; font-size: 17px; color: #fff3da; font-variant-numeric: tabular-nums; }
.pv small { font-size: 13px; color: #a88a68; font-family: var(--body); font-weight: 800; }
.ps { font-size: 11px; color: #a88a68; }
.coin-pill .pv b { color: var(--gold-1); }

/* 금화 */
.coin {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8 0 18%, #f6c453 42%, #b9741c 75%, #7a4a12 100%);
  box-shadow: 0 0 0 1.5px #5a3208, inset 0 0 0 2.5px rgba(255, 240, 180, 0.55), 0 0 8px rgba(255, 190, 60, 0.45);
  flex: none;
}

/* 버튼 — 금테 알약 + 보석색 내부 */
.btn {
  --fill: linear-gradient(180deg, #ef3b5d 0%, #b5163a 55%, #7a0d27 100%);
  position: relative;
  font-family: var(--display); font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.5px;
  color: #fff6e6;
  padding: 12px 30px;
  border-radius: 999px;
  border: 2.5px solid transparent;
  background: var(--fill) padding-box, var(--gold-grad) border-box;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -3px 0 rgba(0, 0, 0, 0.3),
    0 0 0 2px rgba(0, 0, 0, 0.55),
    0 4px 0 #3a0614,
    0 0 18px rgba(255, 80, 100, 0.3);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.08s, filter 0.12s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 0 0 2px rgba(0, 0, 0, 0.55), 0 1px 0 #3a0614; }
.btn.big { font-size: 22px; padding: 15px 44px; }
.btn.gold { --fill: linear-gradient(180deg, #ffe48a 0%, #f2b23a 55%, #b8741a 100%); color: #3a1c02; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(0, 0, 0, 0.55), 0 4px 0 #4a2a06, 0 0 18px rgba(255, 190, 60, 0.35); }
.btn.plum { --fill: linear-gradient(180deg, #7a3aa6 0%, #4b2266 60%, #2a1238 100%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 0 0 2px rgba(0, 0, 0, 0.55), 0 4px 0 #1a0826; }
.btn:disabled { filter: grayscale(0.8) brightness(0.6); cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; justify-content: center; margin-top: 6px; }

/* 칩형 토글 버튼 (×1 ×2 ×4) */
.chip-btn {
  font-family: var(--display); font-weight: 900;
  font-size: 15px;
  color: #d8bf9a;
  height: 40px;
  min-width: 52px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: linear-gradient(180deg, #2b0e22, #1a0814) padding-box, linear-gradient(180deg, #8a5a22, #4a2a0c) border-box;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 3px 0 #0a0306;
  cursor: pointer;
}
.chip-btn:hover { color: #fff3da; }
.chip-btn.active {
  color: #3a1c02;
  background: linear-gradient(180deg, #ffe48a, #f2a93a 60%, #c4741a) padding-box, var(--gold-grad) border-box;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #4a2a06, 0 0 14px rgba(255, 190, 60, 0.55);
}
.chip-btn.sq { min-width: 46px; font-size: 18px; }
.speed { display: flex; gap: 6px; }

kbd {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 6px;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 800;
  color: #3a1c02;
  background: linear-gradient(180deg, #fff2be, #e6b04a);
  box-shadow: 0 2px 0 #7a4a12;
}

/* ---------- 사이드바 ---------- */
#sidebar {
  position: absolute;
  left: 960px;
  top: 0;
  width: 320px;
  height: 720px;
  padding: 16px 20px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sign {
  height: 54px;
  border-radius: 14px;
  border: 3px solid transparent;
  background:
    radial-gradient(ellipse at 50% 0%, #5a1838, #2a0b1e 70%) padding-box,
    var(--gold-grad) border-box;
  box-shadow: 0 0 22px rgba(255, 180, 60, 0.3), 0 6px 14px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sign-title {
  font-family: var(--display); font-weight: 900;
  font-size: 27px;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #fffbe6 0%, #ffe28a 40%, #d08a24 62%, #ffe9a3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #3d1505) drop-shadow(0 0 10px rgba(255, 190, 60, 0.45));
}
.suit { font-size: 18px; filter: drop-shadow(0 0 6px currentColor); }
.suit.l { color: #c9a6ff; }
.suit.r { color: #ff5c7a; }

.score-box { padding: 10px 14px 10px; }
.sb-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #d8bf9a; }
.sb-head b { font-family: var(--display); font-weight: 900; color: #fff3da; font-size: 14px; margin-left: 4px; }
.score {
  font-family: var(--display); font-weight: 900;
  font-size: 34px;
  line-height: 1.15;
  margin-top: 2px;
  color: #fff3da;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 #3a0a1e, 0 0 16px rgba(255, 120, 160, 0.25);
}
.score.bump { animation: bump 0.22s ease-out; }
.score.reached {
  background: linear-gradient(180deg, #fffbe6, #ffe28a 45%, #e0961f 60%, #ffe9a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 0 #3d1505) drop-shadow(0 0 12px rgba(255, 190, 60, 0.5));
}
@keyframes bump { 0% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* 사선 줄무늬 게이지 */
.meter {
  height: 14px;
  border-radius: 999px;
  padding: 2px;
  background: linear-gradient(#120510, #120510) padding-box, var(--gold-grad) border-box;
  border: 1.5px solid transparent;
  margin-top: 6px;
}
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: repeating-linear-gradient(-45deg, #ffd257 0 7px, #e08a1c 7px 14px);
  box-shadow: 0 0 10px rgba(255, 190, 60, 0.6);
  transition: width 0.15s;
  animation: stripes 0.8s linear infinite;
  background-size: 200% 100%;
}
@keyframes stripes { to { background-position: -20px 0; } }
.goal-msg { font-size: 11.5px; color: var(--mint); margin-top: 5px; min-height: 14px; font-weight: 700; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pill.tall {
  height: auto;
  border-radius: 14px;
  padding: 8px 12px;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.pill.tall .pv { font-size: 22px; }

.box-title { font-size: 12px; font-weight: 800; color: #d8bf9a; padding: 0 4px; }
.box-title span { color: #a88a68; }
.upg-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; align-content: start; }
.upg-grid .u {
  position: relative;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--c);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 22%, #1a0814), #140610 75%);
  border: 1.5px solid color-mix(in srgb, var(--c) 45%, #5a3a1a);
}
.upg-grid .u b {
  position: absolute;
  right: -3px;
  bottom: -4px;
  min-width: 13px;
  height: 12px;
  padding: 0 2px;
  border-radius: 6px;
  font-size: 8.5px;
  line-height: 12px;
  text-align: center;
  color: #3a1c02;
  background: linear-gradient(180deg, #fff2be, #e6b04a);
  font-family: var(--display); font-weight: 900;
}
.upg-grid .empty { grid-column: 1 / -1; color: #8a6e52; font-size: 12px; padding: 4px; }

.controls { display: flex; gap: 6px; justify-content: space-between; }
.controls .speed { flex: 1; }
.controls .speed .chip-btn { flex: 1; }

.hint { font-size: 12px; color: #a88a68; text-align: center; min-height: 16px; font-weight: 700; }
.hint.ready { color: var(--gold-1); }

/* ---------- 오버레이 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 8, 26, 0.72), rgba(8, 2, 6, 0.92));
  z-index: 10;
  animation: fadeIn 0.25s ease-out;
}
.overlay.hidden { display: none; }
#screen-result { background: radial-gradient(ellipse at 50% 45%, rgba(40, 8, 26, 0.5), rgba(8, 2, 6, 0.78)); }
#screen-gameover { padding-right: 96px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 벨벳 커튼 (상단 밸런스 + 좌우 드레이프) */
.curtain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.curtain::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 86px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 40%),
    repeating-linear-gradient(90deg, #4a0414 0, #9c0f2c 22px, #c41a3a 30px, #9c0f2c 38px, #4a0414 60px);
  -webkit-mask:
    radial-gradient(circle at 50% 0, #000 29px, transparent 30px) 0 100% / 60px 30px repeat-x,
    linear-gradient(#000, #000) 0 0 / 100% calc(100% - 29px) no-repeat;
  mask:
    radial-gradient(circle at 50% 0, #000 29px, transparent 30px) 0 100% / 60px 30px repeat-x,
    linear-gradient(#000, #000) 0 0 / 100% calc(100% - 29px) no-repeat;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6));
}
.curtain::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #3a0310 0, #8e0d28 10px, #c41a3a 20px, #8e0d28 32px, #5a0618 44px, #8e0d28 52px, transparent 64px) left top / 64px 100% no-repeat,
    linear-gradient(270deg, #3a0310 0, #8e0d28 10px, #c41a3a 20px, #8e0d28 32px, #5a0618 44px, #8e0d28 52px, transparent 64px) right top / 64px 100% no-repeat;
  -webkit-mask: linear-gradient(180deg, #000 55%, transparent 100%);
  mask: linear-gradient(180deg, #000 55%, transparent 100%);
  opacity: 0.85;
}

.panel {
  position: relative;
  padding: 34px 44px 30px;
  text-align: center;
  border-radius: 22px;
  border: 3px solid transparent;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 170, 60, 0.12), transparent 60%) padding-box,
    conic-gradient(from 45deg at 50% 50%, #2e0f24 0 25%, #26091d 0 50%, #2e0f24 0 75%, #26091d 0) 0 0 / 30px 30px padding-box,
    var(--gold-grad) border-box;
  box-shadow:
    inset 0 0 0 4px #1a0814,
    inset 0 0 0 5px rgba(242, 187, 74, 0.45),
    0 0 40px rgba(255, 170, 60, 0.18),
    0 24px 60px rgba(0, 0, 0, 0.7);
  animation: popIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes popIn { from { transform: scale(0.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 메뉴 */
.menu-panel { padding: 30px 54px 28px; margin-top: 30px; }
.title-sign {
  padding: 26px 46px 18px;
  border-radius: 20px;
  border: 3px solid transparent;
  background: radial-gradient(ellipse at 50% 20%, #6a1a40, #2a0b1e 75%) padding-box, var(--gold-grad) border-box;
  box-shadow: 0 0 34px rgba(255, 170, 60, 0.35), inset 0 0 30px rgba(0, 0, 0, 0.5);
  margin: 14px 0 26px;
}
.sevens { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); display: flex; gap: 4px; }
.sevens span {
  width: 34px; height: 40px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; font-size: 26px; color: var(--ruby);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffbe6, #f3e2c4);
  border: 2px solid var(--gold-3);
  box-shadow: 0 0 0 2px #3d1505, 0 0 14px rgba(255, 190, 60, 0.6);
  text-shadow: 0 2px 0 #7a0d27;
}
.title {
  font-family: var(--display); font-weight: 900;
  font-size: 84px;
  letter-spacing: 5px;
  line-height: 1;
  background: linear-gradient(180deg, #fffbe6 0%, #ffe28a 38%, #c97d1c 56%, #ffd56a 76%, #fff2be 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #3d1505) drop-shadow(0 0 18px rgba(255, 170, 60, 0.5));
}
.subtitle { margin-top: 12px; font-size: 13px; letter-spacing: 4px; color: #e3c79c; font-weight: 800; }
.howto { margin-top: 24px; font-size: 13.5px; color: #e3c79c; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.howto p { font-size: 12.5px; color: #b8977a; line-height: 1.7; }
.rule {
  width: 280px;
  height: 10px;
  margin: 6px 0 2px;
  background:
    radial-gradient(circle, #ffe28a 0 3px, transparent 3.5px) center / 10px 10px no-repeat,
    linear-gradient(90deg, transparent, #c4841f 20%, #ffe28a 50%, #c4841f 80%, transparent) center / 100% 2px no-repeat;
}

/* 리본 */
.ribbon {
  display: inline-block;
  position: relative;
  padding: 6px 30px;
  font-family: var(--display); font-weight: 900;
  font-size: 14px;
  letter-spacing: 3px;
  color: #3a1c02;
  background: linear-gradient(180deg, #ffe48a, #e6a93a);
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%);
  filter: drop-shadow(0 2px 0 #4a2a06);
}

.big-title { font-family: var(--display); font-weight: 900; font-size: 70px; letter-spacing: 4px; margin: 6px 0 20px; line-height: 1.05; }
.title-sprite { display: block; width: 470px; max-width: 100%; height: auto; margin: 0 auto; }

.title-sprite[hidden], .big-title span[hidden] { display: none; }
.sprite-heading:has(.title-sprite:not([hidden])) { background: none; filter: none; }
.big-title.green { color: var(--mint); text-shadow: 0 4px 0 #0b3a22, 0 0 26px rgba(109, 255, 176, 0.55); }
.big-title.red { color: #ff4d6d; text-shadow: 0 4px 0 #4a0414, 0 0 26px rgba(255, 77, 109, 0.6); }
.big-title.gold {
  background: linear-gradient(180deg, #fffbe6, #ffe28a 40%, #c97d1c 58%, #ffe9a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #3d1505) drop-shadow(0 0 22px rgba(255, 170, 60, 0.6));
}
.over { animation: popIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1), shakeX 0.5s 0.1s; }
@keyframes shakeX { 0%, 100% { translate: 0; } 20% { translate: -10px; } 40% { translate: 9px; } 60% { translate: -6px; } 80% { translate: 3px; } }

.result-stats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; min-width: 380px; }
.result-panel, .end-panel { min-width: 470px; }

/* ---------- 상점 ---------- */
#screen-shop { background: radial-gradient(ellipse at 50% 0%, #3a0d26, #10040b 70%); }
.shop-wrap { width: 1240px; height: 700px; display: flex; flex-direction: column; animation: popIn 0.3s ease-out; }
.shop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.shop-sign {
  height: 64px;
  padding: 0 26px 0 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 999px;
  border: 3px solid transparent;
  background: radial-gradient(ellipse at 50% 0%, #6a1a40, #2a0b1e 75%) padding-box,
    linear-gradient(90deg, #ff4fa3, #ffd257, #ff4fa3) border-box;
  box-shadow: 0 0 22px rgba(255, 79, 163, 0.45), 0 0 4px rgba(255, 210, 90, 0.8);
}
.shop-sign .cards { font-size: 26px; color: #fff3da; letter-spacing: -6px; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4)); }
.shop-sign .cards i { font-style: normal; display: inline-block; }
.shop-sign .cards i:nth-child(2) { color: #ff4d6d; transform: rotate(12deg); }
.shop-word {
  font-family: var(--display); font-weight: 900;
  font-size: 34px;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #fffbe6, #ffe28a 40%, #d08a24 62%, #ffe9a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #3d1505);
}
.shop-sub { font-size: 12px; color: #e3c79c; font-weight: 700; }
.shop-sub b { color: #ff7ea0; }
.shop-tools { display: flex; gap: 12px; align-items: center; }
.shop-coins { height: 48px; min-width: 180px; justify-content: flex-end; font-family: var(--display); font-weight: 900; font-size: 22px; color: var(--gold-1); }
.shop-coins .coin { width: 22px; height: 22px; }
.shop-coins b.bump { animation: bump 0.25s ease-out; }
#btn-next { padding: 13px 24px; font-size: 16px; }

.shop-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: auto auto; column-gap: 14px; row-gap: 30px; align-content: start; padding-top: 6px; }

/* 테마 묶음 = 카드 문양 패널 */
.grp {
  position: relative;
  padding: 26px 12px 10px;
  border-radius: 16px;
  border: 2.5px solid transparent;
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--g) 22%, transparent), transparent 65%) padding-box,
    linear-gradient(180deg, color-mix(in srgb, var(--g) 16%, #24091c), #170812) padding-box,
    var(--gold-grad) border-box;
  box-shadow:
    inset 0 0 0 3px #170812,
    inset 0 0 0 4px color-mix(in srgb, var(--g) 45%, transparent),
    0 8px 20px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grp header {
  position: absolute;
  left: 50%;
  top: -16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 18px 4px 6px;
  border-radius: 999px;
  white-space: nowrap;
  background: linear-gradient(180deg, color-mix(in srgb, var(--g) 50%, #2a0b1e), #2a0b1e) padding-box, var(--gold-grad) border-box;
  border: 2px solid transparent;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
}
.grp header .gi {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px; color: var(--g);
  background: #170812;
  box-shadow: inset 0 0 0 1.5px var(--g);
  text-shadow: 0 0 8px var(--g);
}
.grp header b { font-family: var(--display); font-weight: 900; font-size: 15px; color: #fff3da; letter-spacing: 1px; }
.grp header small { font-size: 11px; color: #e3c79c; }

/* 업그레이드 한 줄 (추가 공 ×1 알약 스타일) */
.ri {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 8px 9px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(26, 8, 20, 0.85), rgba(16, 4, 12, 0.85));
  border: 1.5px solid rgba(196, 132, 31, 0.35);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.ri:hover { border-color: var(--gold-2); background: linear-gradient(180deg, rgba(60, 18, 44, 0.9), rgba(30, 8, 22, 0.9)); }
.ri:active { transform: scale(0.98); }
.ri .ico {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; color: var(--c);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 25%, #1a0814), #120510 75%);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, #5a3a1a);
}
.ri .txt { min-width: 0; }
.ri .nm { font-size: 14px; font-weight: 900; color: #fff3da; display: flex; align-items: baseline; gap: 6px; }
.ri .lv { font-size: 11px; font-weight: 800; color: var(--gold-1); }
.ri .lv em { font-style: normal; color: #8a6e52; }
.ri .tag { font-size: 10px; font-weight: 900; color: #fff; background: var(--ruby); border-radius: 4px; padding: 1px 5px; box-shadow: 0 0 8px rgba(224, 35, 79, 0.6); }
.ri .eff { font-size: 11.5px; color: #c9ad8a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ri .eff i { font-style: normal; color: var(--mint); }
.ri .price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 96px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: var(--display); font-weight: 900;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #3a1c02;
  background: linear-gradient(180deg, #ffe48a, #f2a93a 60%, #c4741a);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.55), 0 0 0 1.5px #5a3208, 0 2px 0 #3d1f04;
  white-space: nowrap;
}
.ri .price .coin { width: 14px; height: 14px; }
.ri .price s { opacity: 0.55; font-size: 10px; font-family: var(--body); font-weight: 800; }
.ri.deal { border-color: rgba(224, 35, 79, 0.8); box-shadow: 0 0 12px rgba(224, 35, 79, 0.3); }
.ri.poor { cursor: not-allowed; }
.ri.poor .price { background: #2b1420; color: #8a6e52; box-shadow: 0 0 0 1.5px #4a2a14; }
.ri.poor .price .coin { filter: grayscale(1) brightness(0.6); }
.ri.maxed { cursor: default; opacity: 0.6; }
.ri.maxed .price { background: transparent; color: var(--gold-1); box-shadow: 0 0 0 1.5px var(--gold-3); }
.ri.just-bought { animation: rowBought 0.45s ease-out; }
@keyframes rowBought {
  0% { background: color-mix(in srgb, var(--gold-2) 55%, transparent); transform: scale(1.03); }
  100% { transform: scale(1); }
}
.shop-msg { min-height: 20px; margin-top: 10px; font-size: 13px; color: #a88a68; text-align: center; font-weight: 700; }
.shop-msg.ok { color: var(--gold-1); }

.sb-head .rnd { color: var(--gold-1); font-family: var(--display); font-weight: 900; letter-spacing: 1px; }
.sb-head .rnd b { margin-left: 2px; color: #fff3da; }
.sb-head .rnd small { color: #a88a68; font-size: 11px; margin-left: 2px; }
.pill.tall { padding: 6px 12px; }
.pill.tall .pv { font-size: 20px; }
.upg-strip { min-height: 26px; padding: 0 2px; }
.upg-grid .empty { grid-column: 1 / -1; font-size: 11px; text-align: center; padding: 6px 0; }

/* ---------- 리액션 캐릭터 무대 ---------- */
.bunny-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  z-index: 2;
  border-radius: 16px;
  /* 아래쪽만 잘라서 허벅지에서 끊기게, 위·옆은 귀와 이펙트가 튀어나올 수 있게 */
  clip-path: inset(-110px -30px 0 -30px round 0 0 16px 16px);
}
.stage-bg {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 100%, rgba(255, 170, 80, 0.35), transparent 70%),
    radial-gradient(ellipse 60% 80% at 50% 0%, rgba(255, 220, 150, 0.18), transparent 70%),
    conic-gradient(from 45deg at 50% 50%, #3a1030 0 25%, #2a0a22 0 50%, #3a1030 0 75%, #2a0a22 0) 0 0 / 26px 26px;
  transition: filter 0.3s;
}
/* 스포트라이트 광선 */
.stage-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(from 180deg at 50% -10%, transparent 0 160deg, rgba(255, 226, 150, 0.16) 170deg 190deg, transparent 200deg);
}
.stage-frame {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  border: 2px solid transparent;
  background: var(--gold-grad) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: inset 0 0 0 3px #170812;
}
.bunny-body {
  position: absolute;
  left: 50%;
  bottom: -46px;           /* 점프해도 잘린 아랫단이 보이지 않도록 여유 */
  width: 290px;
  height: 345px;
  margin-left: -145px;
  transform-origin: 50% 100%;
  will-change: transform;
}
.bunny-body img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  opacity: 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}
.bunny-body img.on { opacity: 1; visibility: visible; }
.bunny-body img:not(.on) { visibility: hidden; }

/* 단계별 무대 조명 */
.bunny-stage:is([data-pose="surprised"], [data-pose="failed"]) .stage-bg { filter: hue-rotate(-25deg) saturate(1.3) brightness(1.15); }
.bunny-stage[data-pose="excited"] .stage-bg { filter: saturate(1.5) brightness(1.4); animation: stageParty 0.35s steps(2) infinite; }
@keyframes stageParty { 50% { filter: saturate(1.8) brightness(1.7) hue-rotate(20deg); } }
.bunny-stage.flash1 .stage-frame { animation: frameFlash 0.5s ease-out; }
.bunny-stage.flash2 .stage-frame { animation: frameFlash 0.7s ease-out 2; }
@keyframes frameFlash {
  0% { box-shadow: inset 0 0 0 3px #170812, inset 0 0 40px rgba(255, 220, 120, 0.9), 0 0 30px rgba(255, 200, 80, 0.8); }
  100% { box-shadow: inset 0 0 0 3px #170812; }
}

/* 이펙트 레이어 */
.bunny-fx { position: absolute; inset: 0; pointer-events: none; }
.bfx {
  position: absolute;
  left: 50%;
  top: 38%;
  font-style: normal;
  font-size: var(--sz);
  text-shadow: 0 0 8px currentColor;
  animation: bfxFly 0.9s cubic-bezier(0.15, 0.8, 0.3, 1) forwards;
}
@keyframes bfxFly {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); opacity: 0; }
}
.bunny-caption {
  position: absolute;
  inset-inline: 12px;
  bottom: 14px;
  pointer-events: none;
  text-align: center;
}
.bfx-word {
  display: block;
  font: 900 18px/1.2 var(--body);
  color: #fff6d2;
  paint-order: stroke fill;
  -webkit-text-stroke: 3px #160710;
  text-shadow: 0 2px 6px #160710;
  word-break: keep-all;
  overflow-wrap: anywhere;
  animation: captionFade 1.7s ease-out forwards;
}
@keyframes captionFade {
  0%, 100% { opacity: 0; }
  10%, 86% { opacity: 1; }
}

/* 팝아웃: 뒤 프레임은 캐릭터 뒤, 앞 프레임은 아래쪽(허리 아래)만 캐릭터 앞에 그려서
   머리·귀·손은 테두리를 넘어 튀어나오고, 다리는 칸 안에 들어가 있는 것처럼 보이게 한다 */
.stage-frame.front { clip-path: inset(56% -4px -4px -4px); }
.bunny-stage[data-pose="failed"] { z-index: 11; pointer-events: none; }
.bunny-body { height: 368px; width: 310px; margin-left: -155px; }
.bunny-stage[data-char="noko"] .bunny-body {
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  transform-origin: center;
  zoom: 1;
}
.bunny-stage[data-char="noko"] .bunny-body img { object-position: center; }
/* 튀어나온 부분이 뒤 테두리에 그림자를 드리워 입체감을 준다 */
.bunny-body img { filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)); }

/* 재도전 기회 (하트) */
.lives { font-style: normal; margin-left: 8px; letter-spacing: 1px; }
.lives em, .lives-big em { font-style: normal; color: #4a2a3a; }
.lives em.on { color: #ff4d6d; text-shadow: 0 0 6px rgba(255, 77, 109, 0.7); }
.lives-big { display: flex; align-items: center; justify-content: center; gap: 4px; margin: -8px 0 18px; font-size: 26px; }
.lives-big em.on { color: #ff4d6d; text-shadow: 0 0 10px rgba(255, 77, 109, 0.8); animation: heartBeat 1s ease-in-out infinite; }
.lives-big span { font-size: 13px; font-weight: 800; color: #e3c79c; margin-left: 10px; }
@keyframes heartBeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }
.end-panel .btn-row { flex-wrap: nowrap; }
.end-panel .btn { padding: 12px 22px; font-size: 16px; }

/* 상점: 3열 세로 쌓기 */
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 14px; align-items: start; padding-top: 12px; }
.shop-grid .col { display: flex; flex-direction: column; gap: 26px; }
.ri { padding: 6px 8px 6px 10px; }
.grp { gap: 5px; padding-top: 24px; }

/* ============ 상점 v3: 탭 · 카드 · 상세 패널 ============ */
.shop-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 196px 1fr 330px; gap: 16px; }
.shop-tabs { display: flex; flex-direction: column; gap: 7px; }
.tab {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 14px 0 10px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: linear-gradient(180deg, #2b0e22, #1a0814) padding-box, linear-gradient(180deg, #6a4418, #3a220a) border-box;
  color: #d8bf9a; font-family: var(--body); cursor: pointer; text-align: left;
  transition: transform 0.1s, filter 0.12s;
}
.tab:hover:not(:disabled) { filter: brightness(1.2); }
.tab .ti {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 18px; color: var(--g); background: #120510; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--g) 60%, transparent);
}
.tab .tn { font-size: 15px; font-weight: 900; display: flex; flex-direction: column; line-height: 1.15; }
.tab .tn small { font-size: 10.5px; font-weight: 700; color: #8a6e52; }
.tab.on {
  color: #fff3da;
  background: linear-gradient(90deg, color-mix(in srgb, var(--g) 30%, #2a0b1e), #2a0b1e) padding-box, var(--gold-grad) border-box;
  box-shadow: 0 0 16px color-mix(in srgb, var(--g) 35%, transparent);
  transform: translateX(6px);
}
.tab.on .ti { background: color-mix(in srgb, var(--g) 25%, #120510); text-shadow: 0 0 8px var(--g); }
.tab.locked { opacity: 0.45; cursor: not-allowed; }
.tab .badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  font-style: normal; font-size: 11px; font-weight: 900; line-height: 20px; text-align: center;
  color: #0b2a18; background: var(--mint);
}
.tab .badge.new { color: #fff; background: var(--ruby); box-shadow: 0 0 10px rgba(224, 35, 79, 0.7); animation: heartBeat 1s infinite; }

.shop-main { display: flex; flex-direction: column; min-width: 0; }
.shop-tab-title { font-family: var(--display); font-weight: 900; font-size: 22px; color: #fff3da; padding: 4px 4px 12px; }
.shop-tab-title small { font-family: var(--body); font-size: 13px; color: #a88a68; margin-left: 8px; font-weight: 700; }
.shop-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-content: start; }
.shop-cards .empty { grid-column: 1 / -1; color: #8a6e52; padding: 40px; text-align: center; }

.card {
  position: relative;
  height: 196px;
  border-radius: 18px;
  border: 2.5px solid transparent;
  background:
    radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%) padding-box,
    linear-gradient(180deg, #2e0f24, #1a0814) padding-box,
    linear-gradient(180deg, #8a5a22, #3a220a) border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card:hover { transform: translateY(-4px); }
.card.sel {
  background:
    radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c) 32%, transparent), transparent 70%) padding-box,
    linear-gradient(180deg, #3d1430, #1f0a19) padding-box,
    var(--gold-grad) border-box;
  box-shadow: 0 0 0 3px rgba(255, 210, 90, 0.25), 0 10px 26px rgba(0, 0, 0, 0.5), 0 0 24px color-mix(in srgb, var(--c) 35%, transparent);
  transform: translateY(-4px);
}
.card .ico {
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  font-size: 32px; color: var(--c);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 28%, #1a0814), #120510 75%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 55%, #5a3a1a), 0 0 18px color-mix(in srgb, var(--c) 30%, transparent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent);
}
.card .nm { font-size: 16px; font-weight: 900; color: #fff3da; }
.card .lv { font-size: 12px; font-weight: 800; color: var(--gold-1); }
.card .pr {
  margin-top: 4px; display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 14px; border-radius: 999px;
  font-family: var(--display); font-weight: 900; font-size: 13px; color: #3a1c02;
  background: linear-gradient(180deg, #ffe48a, #f2a93a 60%, #c4741a);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.5), 0 2px 0 #3d1f04;
}
.card .pr .coin { width: 14px; height: 14px; }
.card.poor .pr { background: #2b1420; color: #8a6e52; box-shadow: none; }
.card.poor .pr .coin { filter: grayscale(1) brightness(0.6); }
.card.poor .ico { filter: saturate(0.5) brightness(0.8); }
.card.maxed { opacity: 0.6; }
.card.maxed .pr { background: transparent; color: var(--gold-1); box-shadow: 0 0 0 1.5px var(--gold-3); }
.card .ribbon-tag {
  position: absolute; top: 14px; right: -30px; transform: rotate(35deg);
  padding: 3px 34px; font-size: 12px; font-weight: 900; color: #fff; background: var(--ruby);
  box-shadow: 0 0 10px rgba(224, 35, 79, 0.6);
}
.card.just-bought { animation: cardBought 0.45s ease-out; }
@keyframes cardBought { 0% { transform: translateY(-4px) scale(1.06); filter: brightness(1.6); } 100% { transform: translateY(-4px) scale(1); } }

/* 상세 패널 */
.shop-detail {
  border-radius: 18px;
  border: 2.5px solid transparent;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 170, 60, 0.12), transparent 60%) padding-box,
    linear-gradient(180deg, #2e0f24, #170812) padding-box,
    var(--gold-grad) border-box;
  box-shadow: inset 0 0 0 4px #170812, inset 0 0 0 5px rgba(242, 187, 74, 0.35), 0 10px 24px rgba(0, 0, 0, 0.55);
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 14px;
  align-self: start;
}
.d-head { display: flex; gap: 14px; align-items: center; }
.d-ico {
  width: 72px; height: 72px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 36px; color: var(--c);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 30%, #1a0814), #120510 75%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 60%, #5a3a1a), 0 0 20px color-mix(in srgb, var(--c) 35%, transparent);
}
.d-grp { font-size: 12px; font-weight: 800; }
.d-name { font-family: var(--display); font-weight: 900; font-size: 24px; color: #fff3da; line-height: 1.15; }
.d-lv { font-size: 13px; font-weight: 800; color: var(--gold-1); }
.d-info { font-size: 13.5px; line-height: 1.6; color: #e3c79c; min-height: 44px; }
.d-cmp { border-radius: 12px; background: rgba(10, 2, 8, 0.55); border: 1px solid rgba(196, 132, 31, 0.35); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.d-cmp span { display: block; font-size: 11px; color: #a88a68; font-weight: 800; }
.d-cmp b { font-size: 15px; color: #fff3da; }
.d-cmp .nx b { color: var(--mint); font-size: 17px; }
.d-cmp .max span { color: var(--gold-1); font-size: 14px; }
.d-cmp .arrow { text-align: center; color: var(--gold-2); font-size: 11px; line-height: 1; }
.d-buy { font-size: 18px; padding: 14px 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.d-buy .coin { width: 18px; height: 18px; }
.d-buy s { font-size: 12px; opacity: 0.6; margin-right: 4px; }
.d-max { font-size: 14px; padding: 10px; }
.d-need { text-align: center; font-size: 12px; font-weight: 800; color: #ff7ea0; margin-top: -6px; }
.shop-msg { min-height: 20px; }

/* 사이드바 점수: 이미지 숫자 캔버스 */
.score { height: 48px; transform-origin: left center; }
.score canvas { display: block; width: 272px; height: 48px; }

/* ============ 상점 v4: 카드 안에서 바로 구매 (상세 패널 제거) ============ */
.shop-body { grid-template-columns: 196px 1fr; }
.shop-detail { display: none; }
.shop-cards { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  height: auto;
  min-height: 258px;
  padding: 16px 16px 14px;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  cursor: default;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 18px color-mix(in srgb, var(--c) 25%, transparent); }
.card .c-head { display: flex; align-items: center; gap: 12px; }
.card .ico { width: 54px; height: 54px; font-size: 26px; flex: none; }
.card .c-title { min-width: 0; }
.card .nm { font-size: 17px; }
.card .lv { font-size: 12px; }
.card .c-info { font-size: 12.5px; line-height: 1.55; color: #e3c79c; min-height: 39px; }
.card .c-eff {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(10, 2, 8, 0.55); border: 1px solid rgba(196, 132, 31, 0.3);
  font-size: 12.5px; color: #c9ad8a;
}
.card .c-eff .ar { font-size: 9px; color: var(--gold-2); }
.card .c-eff .nx { color: var(--mint); font-size: 14px; }
.card .c-eff b { color: #fff3da; }
.card .c-eff .mx { margin-left: auto; font-size: 11px; font-weight: 900; color: var(--gold-1); }
.card .c-btns { display: flex; gap: 8px; margin-top: auto; }
.c-buy, .c-max {
  height: 40px; border-radius: 999px; border: 2px solid transparent; cursor: pointer;
  font-family: var(--display); font-weight: 900; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: filter 0.12s, transform 0.08s;
}
.c-buy {
  flex: 1; font-size: 15px; color: #3a1c02;
  background: linear-gradient(180deg, #ffe48a, #f2a93a 60%, #c4741a) padding-box, var(--gold-grad) border-box;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #4a2a06;
}
.c-buy .coin { width: 16px; height: 16px; }
.c-buy s { font-family: var(--body); font-size: 10.5px; opacity: 0.55; margin-right: 2px; }
.c-max {
  flex: none; min-width: 74px; padding: 0 10px; font-size: 13px; color: #fff3da;
  background: linear-gradient(180deg, #7a3aa6, #4b2266 60%, #2a1238) padding-box, var(--gold-grad) border-box;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 3px 0 #1a0826;
  flex-direction: column; gap: 0; line-height: 1.05;
}
.c-max small { font-family: var(--body); font-size: 10px; font-weight: 800; color: var(--mint); }
.c-buy:hover:not(:disabled), .c-max:hover:not(:disabled) { filter: brightness(1.12); }
.c-buy:active:not(:disabled), .c-max:active:not(:disabled) { transform: translateY(2px); }
.c-buy:disabled, .c-max:disabled { filter: grayscale(0.85) brightness(0.55); cursor: not-allowed; box-shadow: none; }
.c-need { text-align: center; font-size: 11.5px; font-weight: 800; color: #ff7ea0; margin-top: -4px; }
.c-maxed { flex: 1; height: 40px; display: grid; place-items: center; border-radius: 999px; border: 1.5px solid var(--gold-3); color: var(--gold-1); font-weight: 900; font-size: 13px; }
.card.poor .ico { filter: saturate(0.5) brightness(0.8); }

/* ============ 상점 보기 전환 ============ */
.view-toggle { display: flex; padding: 3px; border-radius: 12px; background: #1a0814; border: 1.5px solid #5a3a1a; }
.view-toggle button {
  border: 0; background: transparent; cursor: pointer; padding: 9px 14px; border-radius: 9px;
  font-family: var(--body); font-weight: 900; font-size: 13px; color: #a88a68;
}
.view-toggle button:hover { color: #fff3da; }
.view-toggle button.on { color: #3a1c02; background: linear-gradient(180deg, #ffe48a, #f2a93a 60%, #c4741a); box-shadow: 0 2px 0 #4a2a06; }

/* 한눈에 보기: 탭 숨기고 넓게 */
.shop-body.overview { grid-template-columns: 1fr; }
.shop-body.overview .shop-tabs, .shop-body.overview .shop-tab-title { display: none; }
.ov { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.ov-col { display: flex; flex-direction: column; gap: 16px; }
.ovg {
  border-radius: 16px; padding: 10px 12px 12px;
  background: linear-gradient(180deg, #24091c, #170812);
  border: 1.5px solid rgba(196, 132, 31, 0.45);
}
.ovg header { display: flex; align-items: center; gap: 8px; padding: 0 2px 8px; }
.ovg header .gi { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: var(--g); background: #120510; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--g) 55%, transparent); }
.ovg header b { font-size: 14px; font-weight: 900; color: var(--g); letter-spacing: 0.5px; }
.ovg header small { margin-left: auto; font-size: 11px; color: #8a6e52; font-weight: 700; }
.ovg.locked { opacity: 0.45; }
.ovg.locked header { padding-bottom: 0; }

.ovr {
  display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 8px;
  height: 42px; padding: 0 6px 0 4px; border-radius: 10px;
  transition: background 0.12s;
}
.ovr + .ovr { border-top: 1px solid rgba(196, 132, 31, 0.14); }
.ovr:hover { background: rgba(255, 210, 90, 0.07); }
.ovr .ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: var(--c); background: #120510; }
.ovr .nm { font-size: 13.5px; font-weight: 800; color: #f3e2c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ovr .nm em { font-style: normal; font-size: 11px; font-weight: 800; color: #a88a68; margin-left: 6px; }
.ov-buy {
  min-width: 92px; height: 30px; padding: 0 10px; border-radius: 999px; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--display); font-weight: 900; font-size: 12px; color: #3a1c02;
  background: linear-gradient(180deg, #ffe48a, #f2a93a 60%, #c4741a);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.5), 0 2px 0 #3d1f04;
}
.ov-buy .coin { width: 13px; height: 13px; }
.ov-buy .dl { font-family: var(--body); font-size: 9.5px; color: #fff; background: var(--ruby); border-radius: 4px; padding: 1px 4px; margin-right: 2px; }
.ov-max {
  width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  font-weight: 900; font-size: 15px; color: #fff3da;
  background: linear-gradient(180deg, #7a3aa6, #4b2266); box-shadow: 0 2px 0 #1a0826;
}
.ov-buy:hover:not(:disabled), .ov-max:hover:not(:disabled) { filter: brightness(1.12); }
.ov-buy:disabled, .ov-max:disabled { filter: grayscale(0.85) brightness(0.5); cursor: not-allowed; box-shadow: none; }
.ov-maxed { grid-column: 3 / 5; justify-self: end; font-size: 11px; font-weight: 900; color: var(--gold-1); padding-right: 6px; }
.ovr.poor .ico, .ovr.poor .nm { opacity: 0.6; }
.ovr.maxed { opacity: 0.55; }
.ovr.just-bought { animation: rowFlash 0.45s ease-out; }
@keyframes rowFlash { 0% { background: rgba(255, 210, 90, 0.35); } 100% { background: transparent; } }

/* 안내줄 */
.shop-msg { font-size: 13px; color: #c9ad8a; }
.shop-msg .ib { margin-left: 8px; color: #fff3da; font-weight: 800; }
.shop-msg .ib em { font-style: normal; color: var(--mint); }
.shop-body.overview .shop-cards { display: block; }

/* 한눈에 보기: 모든 묶음 패널을 같은 크기로 */
.ov { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; align-items: stretch; gap: 16px; }
.ovg { display: flex; flex-direction: column; min-height: 268px; }
.ovg.locked header small { display: none; }
.ov-lock { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 26px; }
.ov-lock span { font-size: 12px; font-weight: 800; color: #a88a68; }

/* 상점 아이콘 */
.tab .ti img, .card .ico img, .ovr .ico img, .ovg header .gi img, .upg-grid .u img { display: block; width: 82%; height: 82%; object-fit: contain; }
.tab .ti img[hidden], .card .ico img[hidden], .ovr .ico img[hidden], .ovg header .gi img[hidden], .upg-grid .u img[hidden], .icon-symbol[hidden], .title-icon img[hidden], .info-icon img[hidden] { display: none; }
.title-icon, .info-icon { display: inline-grid; place-items: center; vertical-align: middle; }
.title-icon { width: 28px; height: 28px; }
.info-icon { width: 22px; height: 22px; }
.title-icon img, .info-icon img { display: block; width: 82%; height: 82%; object-fit: contain; }
.ovr.poor .ico { filter: saturate(0.5) brightness(0.8); }

/* 바니걸 실패 대사 */
.bfx-word.sad {
  color: #dbe8ff;
  animation-duration: 2.6s;
}

/* ============ 목표 달성 후 '피버' 색 전환 ============ */
#stage { transition: filter 0.6s; }
#stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 0 0 rgba(255, 190, 60, 0);
  transition: box-shadow 0.6s;
}
#stage.fever::after { box-shadow: inset 0 0 60px 6px rgba(255, 190, 60, 0.55); animation: feverEdge 1.1s ease-in-out infinite; }
@keyframes feverEdge { 50% { box-shadow: inset 0 0 90px 12px rgba(255, 210, 90, 0.75); } }
#stage.fever { background:
    radial-gradient(ellipse at 80% 0%, rgba(255, 200, 80, 0.25), transparent 60%),
    conic-gradient(from 45deg at 50% 50%, #3a2008 0 25%, #2a1606 0 50%, #3a2008 0 75%, #2a1606 0) 0 0 / 34px 34px; }
#stage.fever .score-box, #stage.fever .pill, #stage.fever .sign {
  box-shadow: 0 0 18px rgba(255, 190, 60, 0.55), inset 0 0 0 2px #1a0814;
}
#stage.fever .sb-head .rnd, #stage.fever .goal-msg { color: #ffe28a; }
#stage.fever .meter-fill { background: repeating-linear-gradient(-45deg, #fff0a8 0 7px, #ffbf2a 7px 14px); box-shadow: 0 0 16px rgba(255, 220, 110, 0.9); }
#stage.fever .stage-bg { filter: sepia(0.5) saturate(1.6) hue-rotate(-12deg) brightness(1.15); }

/* 클리어 창: 게임 오버처럼 바니걸이 창 옆에 보이게 */
#screen-result { padding-right: 96px; }
#stage[data-state="ROUND_RESULT"] .bunny-stage { z-index: 11; pointer-events: none; }
/* 단축키 표시 */
.btn .key { margin-left: 8px; padding: 2px 6px; border-radius: 5px; font-size: 10px; letter-spacing: 1px;
  background: rgba(0,0,0,0.25); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35); vertical-align: middle; }

/* 상점 나가기 확인 팝업 */
.confirm { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 2, 6, 0.6); animation: fadeIn 0.15s ease-out; }
.confirm.hidden { display: none; }
.confirm-box {
  min-width: 440px; padding: 26px 32px 24px; text-align: center; border-radius: 20px;
  border: 3px solid transparent;
  background: linear-gradient(180deg, #2e0f24, #170812) padding-box, var(--gold-grad) border-box;
  box-shadow: inset 0 0 0 4px #170812, inset 0 0 0 5px rgba(242,187,74,0.45), 0 20px 50px rgba(0,0,0,0.7);
  animation: popIn 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.confirm-title { font-family: var(--display); font-weight: 900; font-size: 26px; color: var(--gold-1); text-shadow: 0 3px 0 #3d1505; }
.confirm-text { margin: 12px 0 20px; font-size: 14px; line-height: 1.7; color: #e3c79c; }
.confirm-text b { color: #fff3da; }
.confirm-text small { color: #a88a68; }

/* ================================================================
   스마트폰 세로 레이아웃 (body.portrait)
   보드(960×720)는 위에 가로 꽉 차게, 정보 패널·바니걸은 아래.
   글자가 너무 작아지지 않도록 패널·창은 zoom으로 키운다.
   ================================================================ */
#board { touch-action: none; }
body.portrait { overscroll-behavior: none; }

body.portrait #sidebar {
  zoom: 1.8;
  left: 0; top: 400px;              /* 720px / 1.8 */
  width: 533px;                     /* 960px / 1.8 */
  height: calc((var(--sh) - 720px) / 1.8);
  padding: 10px 12px 12px;
  display: grid;
  grid-template-columns: 1fr 236px;
  grid-template-rows: auto auto auto auto 1fr auto;
  grid-template-areas: "sign bunny" "score bunny" "duo bunny" "ctrl bunny" "hint bunny" "upg upg";
  gap: 8px;
}
body.portrait #sidebar .sign { grid-area: sign; }
body.portrait #sidebar .score-box { grid-area: score; }
body.portrait #sidebar .duo { grid-area: duo; }
body.portrait #sidebar .bunny-stage { grid-area: bunny; }
body.portrait #sidebar .controls { grid-area: ctrl; }
body.portrait #sidebar .hint { grid-area: hint; align-self: start; }
body.portrait #sidebar .upg-strip { grid-area: upg; }
body.portrait .bunny-body { zoom: 0.78; }
body.portrait .bfx-word { font-size: 20px; }
body.portrait .score canvas { width: 100%; height: auto; }

/* 일반 창(메뉴 · 결과 · 게임오버 · 승리) */
body.portrait .overlay .panel { zoom: 1.45; max-width: 650px; }
body.portrait .menu-panel { padding: 22px 18px; margin-top: 0; }
body.portrait .title { font-size: 60px; letter-spacing: 3px; }
body.portrait .title-sign { padding: 22px 20px 14px; }
body.portrait .howto p br { display: none; }
body.portrait .result-panel, body.portrait .end-panel { min-width: 0; width: 600px; }
body.portrait .result-stats { min-width: 0; }
body.portrait .end-panel .btn-row { flex-wrap: wrap; }
/* 결과 창은 보드 쪽(위)에 띄워 아래 바니걸과 겹치지 않게 */
body.portrait #screen-result, body.portrait #screen-gameover, body.portrait #screen-victory {
  padding-right: 0; align-items: flex-start; padding-top: 40px;
}

/* 상점 */
body.portrait .shop-wrap { zoom: 1.5; width: 620px; height: calc(var(--sh) / 1.5 - 24px); }
body.portrait .shop-head { flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
body.portrait .shop-sign { height: 46px; padding: 0 16px; }
body.portrait .shop-word { font-size: 26px; }
body.portrait .shop-tools { width: 100%; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
body.portrait #btn-next { flex: 1 1 100%; }
body.portrait .shop-body { display: flex; flex-direction: column; min-height: 0; flex: 1; gap: 10px; }
body.portrait .shop-tabs { flex-direction: row; overflow-x: auto; gap: 6px; flex: none; padding-bottom: 4px; }
body.portrait .tab { flex: none; height: 44px; padding: 0 10px 0 6px; gap: 6px; }
body.portrait .tab.on { transform: none; }
body.portrait .tab .tn small { display: none; }
body.portrait .tab .ti { width: 28px; height: 28px; font-size: 15px; }
body.portrait .shop-main { min-height: 0; flex: 1; overflow-y: auto; }
body.portrait .shop-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
body.portrait .card { min-height: 0; padding: 12px; }
body.portrait .card .c-info { min-height: 0; }
body.portrait .ov { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; }
body.portrait .ovg { min-height: 0; }
body.portrait .ovr .nm em { display: none; }
body.portrait .ov-buy { min-width: 76px; }
body.portrait .shop-msg { font-size: 12px; }

/* 모바일: 페이지 자체는 화면 크기로 고정하고, 게임 스테이지는 틀 안에서만 확대·축소 */
html, body { position: fixed; inset: 0; width: 100%; height: 100%; }
#viewport { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; contain: strict; }

/* 폰: 강화 내역을 배속 버튼 바로 아래(왼쪽 칸)로 */
body.portrait #sidebar {
  grid-template-rows: auto auto auto auto auto 1fr;
  grid-template-areas: "sign bunny" "score bunny" "duo bunny" "ctrl bunny" "upg bunny" "hint bunny";
}
body.portrait .upg-grid { grid-template-columns: repeat(6, 1fr); gap: 4px; }

/* ============ 캐릭터 선택 (메인 메뉴) ============ */
.char-select { margin: -6px 0 18px; }
.char-label { font-size: 13px; font-weight: 800; color: #e3c79c; margin-bottom: 10px; }
.char-list { display: flex; gap: 14px; justify-content: center; }
.char-card {
  width: 128px; min-width: 0; padding: 8px 8px 10px; border-radius: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2.5px solid transparent;
  background: linear-gradient(180deg, #2b0e22, #1a0814) padding-box, linear-gradient(180deg, #6a4418, #3a220a) border-box;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
  filter: saturate(0.6) brightness(0.8);
}
.char-card:hover { transform: translateY(-3px); filter: none; }
.char-card.on {
  filter: none; transform: translateY(-4px);
  background: radial-gradient(ellipse at 50% 20%, color-mix(in srgb, var(--cc) 30%, #2b0e22), #1a0814 75%) padding-box, var(--gold-grad) border-box;
  box-shadow: 0 0 22px color-mix(in srgb, var(--cc) 45%, transparent), 0 8px 18px rgba(0,0,0,0.5);
}
.char-face {
  width: min(108px, 100%); aspect-ratio: 1; border-radius: 12px;
  background-color: #120510; background-repeat: no-repeat;
  background-size: 230% auto; background-position: 50% 2%;
  box-shadow: inset 0 0 0 1.5px rgba(242,187,74,0.35);
}
.char-name { font-size: 14px; font-weight: 900; color: #fff3da; }
.char-card.on .char-name { color: var(--cc); }
.char-card.on::after { content: '✔ 선택됨'; font-size: 10.5px; font-weight: 800; color: var(--gold-1); }
