/* ============================================================
   Animal Drop — style.css
   다크 네온 테마 | 반응형 | 애니메이션
   ============================================================ */

/* ─── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

/* ─── 디자인 토큰 ───────────────────────────────────────────── */
:root {
  --bg-base:     #090914;
  --bg-surface:  #111128;
  --bg-card:     rgba(255,255,255,0.045);
  --bg-board:    #0a0a1c;
  --border:      rgba(255,255,255,0.08);
  --border-glow: rgba(139,92,246,0.35);

  --text-main:   #EAEAEA;
  --text-sub:    rgba(234,234,234,0.55);
  --text-accent: #A78BFA;

  --purple-dark:  #5B21B6;
  --purple-mid:   #7C3AED;
  --purple-light: #A78BFA;
  --purple-glow:  rgba(124,58,237,0.45);

  --gold:         #FFD700;
  --gold-dim:     rgba(255,215,0,0.18);
  --gold-glow:    rgba(255,215,0,0.5);
  --green:        #10B981;
  --red:          #EF4444;

  --header-h:    54px;
  --ad-top-h:    90px;
  --ad-bot-h:    60px;
  --panel-w:     185px;
  --side-ad-w:   160px;
  --cell:        34px;
  --cell-gap:    1px;

  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  28px;

  --ease:  cubic-bezier(0.4,0,0.2,1);
  --t:     0.18s;
  --t-med: 0.35s;
}

/* ─── 리셋 ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  font-family: 'Nunito', 'Noto Sans KR', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ─── 앱 레이아웃 ────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,0.12) 0%, transparent 70%),
    var(--bg-base);
}

/* ═══════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════ */
#header {
  height: var(--header-h);
  background: rgba(9,9,20,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-logo { font-size: 22px; animation: float-anim 3s ease-in-out infinite; }
.header-title {
  font-size: 19px;
  font-weight: 900;
  background: linear-gradient(120deg, #A78BFA 0%, #60A5FA 50%, #34D399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}
.header-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  transition: background var(--t), border-color var(--t);
  font-family: inherit;
}
.icon-btn:hover {
  background: rgba(255,255,255,0.13);
  border-color: var(--border-glow);
}

/* ═══════════════════════════════════════════════════════════
   광고 배너
═══════════════════════════════════════════════════════════ */
.ad-banner {
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-top { height: var(--ad-top-h); }
.ad-bottom {
  height: var(--ad-bot-h);
  border-top: 1px solid var(--border);
  border-bottom: none;
}
.ad-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.12);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════════════════ */
#screens {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

.overlay-screen {
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(10px);
  z-index: 50;
}
.overlay-screen.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   MENU SCREEN
═══════════════════════════════════════════════════════════ */
#screen-menu {
  overflow-y: auto;
  justify-content: flex-start;
  align-items: center;
  scrollbar-width: none;
}
#screen-menu::-webkit-scrollbar { display: none; }

.menu-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 20px 18px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* 메뉴 히어로 */
.menu-hero { text-align: center; }
.hero-animals {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}
.hero-animal {
  font-size: 30px;
  animation: bounce-anim 1.1s ease-in-out infinite;
}
.hero-animal:nth-child(1){animation-delay:0.0s}
.hero-animal:nth-child(2){animation-delay:0.1s}
.hero-animal:nth-child(3){animation-delay:0.2s}
.hero-animal:nth-child(4){animation-delay:0.3s}
.hero-animal:nth-child(5){animation-delay:0.4s}

.menu-title {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 6px;
  background: linear-gradient(120deg, #C4B5FD, #60A5FA, #34D399);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.menu-subtitle { font-size: 13px; color: var(--text-sub); }

/* 난이도 탭 */
.menu-difficulty {
  display: flex;
  gap: 6px;
  width: 100%;
  background: rgba(255,255,255,0.05);
  padding: 4px;
  border-radius: var(--r-md);
  margin-bottom: 4px;
}
.diff-btn {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
}
.diff-btn.active {
  background: rgba(124,58,237,0.4);
  border: 1px solid rgba(124,58,237,0.8);
  color: white;
  box-shadow: 0 0 10px var(--purple-glow);
}

/* 모드 버튼 */
.menu-modes { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.mode-btn {
  width: 100%;
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: var(--r-md);
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  font-family: inherit;
  color: var(--text-main);
  text-align: left;
}
.mode-btn:hover {
  background: rgba(124,58,237,0.22);
  border-color: rgba(124,58,237,0.65);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--purple-glow);
}
.mode-btn:active { transform: translateY(0); }
.mode-icon { font-size: 26px; flex-shrink: 0; }
.mode-name { font-size: 15px; font-weight: 800; display: block; }
.mode-desc { font-size: 11px; color: var(--text-sub); display: block; margin-top: 2px; font-weight: 500; }

/* 메뉴 통계 */
.menu-stats {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.best-score-box { display: flex; flex-direction: column; }
.menu-best-label { font-size: 12px; color: var(--text-sub); font-weight: 700; }
.menu-best-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 16px var(--gold-glow);
}

/* 조작법 */
.menu-controls {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
}
.controls-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.ctrl-row {
  font-size: 12px;
  color: var(--text-sub);
  padding: 3px 0;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   GAME SCREEN LAYOUT
═══════════════════════════════════════════════════════════ */
#screen-game.active { display: block; overflow: hidden; }

.game-layout {
  display: flex;
  height: 100%;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

/* 사이드 광고 (PC) */
.side-ad {
  flex-shrink: 0;
  width: var(--side-ad-w);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.015);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ─── 게임 컬럼 ─────────────────────────────────────────── */
.game-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

/* 탑바 (모바일/태블릿) */
.top-bar {
  width: 100%;
  height: 40px;
  background: rgba(9,9,20,0.85);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  flex-shrink: 0;
}
.top-bar-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}
.bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 1px;
}
.bar-label { font-size: 9px; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.bar-value { font-size: 15px; font-weight: 900; color: var(--text-main); }
.icon-btn-sm {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  padding: 4px;
  line-height: 1;
}

/* ─── 보드 ──────────────────────────────────────────────── */
.board-wrapper {
  position: relative;
  flex-shrink: 0;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(10, var(--cell));
  grid-template-rows: repeat(20, var(--cell));
  gap: var(--cell-gap);
  background: var(--bg-board);
  border: 2px solid rgba(124,58,237,0.28);
  border-radius: var(--r-sm);
  padding: 2px;
  box-shadow:
    0 0 0 1px rgba(124,58,237,0.1),
    0 0 40px rgba(124,58,237,0.12),
    inset 0 0 30px rgba(0,0,0,0.6);
  transition: box-shadow var(--t-med);
}

.game-board.frozen {
  border-color: rgba(96,165,250,0.55);
  box-shadow:
    0 0 0 1px rgba(96,165,250,0.2),
    0 0 40px rgba(96,165,250,0.25),
    inset 0 0 30px rgba(0,0,0,0.6);
  animation: freeze-pulse 1s ease-in-out infinite;
}

/* ─── 셀 ────────────────────────────────────────────────── */
.cell {
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.64);
  line-height: 1;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: transform var(--t);
  position: relative;
  overflow: hidden;
  will-change: transform;
}
.cell.empty {
  background: rgba(255,255,255,0.018);
  border-color: rgba(255,255,255,0.025);
}
.cell.filled {
  border-width: 1px;
  border-style: solid;
}
.cell.filled::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, transparent 100%);
  border-radius: 4px 4px 0 0;
  pointer-events: none;
}
.cell.current {
  border-width: 1px;
  border-style: solid;
  animation: land-pulse 0.25s ease-out;
}
.cell.current::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  pointer-events: none;
}
.cell.ghost {
  opacity: 0.25;
  border-style: dashed;
  border-width: 1px;
}
.cell.popping {
  animation: pop-cell 0.38s ease-out forwards;
}
.cell.hammer-target {
  cursor: crosshair;
  animation: hammer-glow 0.6s ease-in-out infinite alternate;
}

/* ─── 콤보 플로팅 텍스트 ─────────────────────────────────── */
#combo-float {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  text-shadow: 0 2px 16px currentColor;
  opacity: 0;
}
#combo-float.combo-visible {
  animation: combo-rise 1.6s ease-out forwards;
}
#combo-float.combo-hidden { opacity: 0; }

/* ─── 모바일 컨트롤 ──────────────────────────────────────── */
.mobile-ctrl {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 14px;
  gap: 10px;
  background: rgba(9,9,20,0.9);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ctrl-mid {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.ctrl-btn {
  width: 50px;
  height: 50px;
  background: rgba(124,58,237,0.18);
  border: 1px solid rgba(124,58,237,0.45);
  border-radius: 50%;
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  touch-action: manipulation;
  transition: background var(--t), transform var(--t);
}
.ctrl-btn:active {
  background: rgba(124,58,237,0.45);
  transform: scale(0.88);
}
.ctrl-left, .ctrl-right {
  width: 56px;
  height: 56px;
  font-size: 20px;
}
.ctrl-hard-btn {
  display: none;
  width: 100%;
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.28);
  border-radius: var(--r-sm);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 7px;
  font-family: inherit;
  touch-action: manipulation;
  flex-shrink: 0;
}
.ctrl-hard-btn:active { background: rgba(124,58,237,0.3); }

/* ═══════════════════════════════════════════════════════════
   RIGHT PANEL
═══════════════════════════════════════════════════════════ */
.game-panel {
  display: flex;
  flex-direction: column;
  width: var(--panel-w);
  height: 100%;
  background: rgba(9,9,20,0.88);
  border-left: 1px solid var(--border);
  padding: 10px 8px;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  flex-shrink: 0;
}
.game-panel::-webkit-scrollbar { width: 4px; }
.game-panel::-webkit-scrollbar-track { background: transparent; }
.game-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 11px;
  flex-shrink: 0;
}
.panel-lbl {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
  display: block;
}
.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0;
}
.panel-key { font-size: 11px; color: var(--text-sub); font-weight: 700; }
.panel-val {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
}
#panel-score {
  font-size: 20px;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold-glow);
}
.panel-time-danger { color: var(--red) !important; animation: blink 0.5s ease-in-out infinite; }

/* 스테이지 배지 */
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(124,58,237,0.18);
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--purple-light);
}

/* 다음 피스 */
.next-grid {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  min-height: 60px;
  align-items: center;
  justify-content: center;
}
.next-cell {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.next-cell.filled { border-width: 1px; border-style: solid; }

/* 미션 */
.mission-text { font-size: 12px; color: var(--text-main); margin-bottom: 8px; font-weight: 700; }
.mission-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}
.mission-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-mid), var(--purple-light));
  border-radius: 3px;
  transition: width 0.4s var(--ease);
}
.mission-pct { font-size: 10px; color: var(--text-sub); text-align: right; font-weight: 700; }

/* 아이템 */
.items-row { display: flex; gap: 6px; margin-bottom: 7px; }
.item-btn {
  flex: 1;
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: var(--r-sm);
  color: var(--text-main);
  cursor: pointer;
  padding: 6px 4px 4px;
  font-size: 17px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: inherit;
  touch-action: manipulation;
  transition: background var(--t), border-color var(--t), transform var(--t);
  position: relative;
}
.item-btn:hover:not(:disabled) {
  background: rgba(124,58,237,0.28);
  border-color: rgba(124,58,237,0.65);
  transform: translateY(-2px);
}
.item-btn:active:not(:disabled) { transform: scale(0.92); }
.item-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.item-btn.active-item {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
  animation: item-pulse 0.7s ease-in-out infinite alternate;
}
.item-cnt { font-size: 10px; font-weight: 900; color: var(--purple-light); line-height: 1; }

.ad-item-btn {
  width: 100%;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.35);
  border-radius: var(--r-sm);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 7px;
  font-family: inherit;
  touch-action: manipulation;
  transition: background var(--t);
}
.ad-item-btn:hover { background: rgba(16,185,129,0.2); }

.pause-btn {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px;
  font-family: inherit;
  touch-action: manipulation;
  transition: background var(--t), color var(--t);
}
.pause-btn:hover { background: rgba(255,255,255,0.09); color: var(--text-main); }

/* 패널 내 광고 */
.panel-ad {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════
   OVERLAY CARDS (Pause / Game Over / Clear)
═══════════════════════════════════════════════════════════ */
.overlay-card {
  background: rgba(10,10,22,0.97);
  border: 1px solid rgba(124,58,237,0.38);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  width: 100%;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 0 0 1px rgba(124,58,237,0.12),
    0 0 60px rgba(124,58,237,0.22),
    0 24px 64px rgba(0,0,0,0.9);
  animation: overlay-in 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
.ov-icon { font-size: 48px; line-height: 1; }
.ov-icon-shake { animation: shake-anim 0.5s ease-in-out; }
.ov-icon-bounce { animation: bounce-once 0.6s cubic-bezier(0.175,0.885,0.32,1.275); }

.ov-title {
  font-size: 26px;
  font-weight: 900;
  background: linear-gradient(135deg, #C4B5FD, #60A5FA);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.score-box {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.score-row { display: flex; align-items: center; justify-content: space-between; }
.score-lbl { font-size: 12px; color: var(--text-sub); font-weight: 700; }
.score-val {
  font-size: 19px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow);
}

.new-record {
  font-size: 17px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
  animation: glow-pulse 0.75s ease-in-out infinite alternate;
}
.new-record.hidden { display: none; }

/* 게임오버 광고 슬롯 */
.go-ad {
  width: 100%;
  height: 90px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ov-btns { display: flex; flex-direction: column; gap: 8px; width: 100%; }

.ov-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), background var(--t);
  font-family: inherit;
  touch-action: manipulation;
}
.ov-btn.primary {
  background: linear-gradient(135deg, var(--purple-mid), var(--purple-light));
  border: none;
  color: white;
  box-shadow: 0 4px 20px var(--purple-glow);
}
.ov-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--purple-glow);
}
.ov-btn.secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.ov-btn.secondary:hover { background: rgba(255,255,255,0.11); color: var(--text-main); }
.ov-btn.ad-btn {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.38);
  color: var(--green);
}
.ov-btn.ad-btn:hover { background: rgba(16,185,129,0.22); }
.ov-btn:active { transform: scale(0.95) !important; }

/* 클리어 콘페티 */
.clear-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   KEYFRAME ANIMATIONS
═══════════════════════════════════════════════════════════ */
@keyframes float-anim {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes bounce-anim {
  0%,100% { transform: translateY(0) scale(1); }
  45%     { transform: translateY(-9px) scale(1.12); }
}
@keyframes land-pulse {
  0%   { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes pop-cell {
  0%   { transform: scale(1);   opacity: 1; filter: brightness(1); }
  30%  { transform: scale(1.35) rotate(-5deg); opacity: 1; filter: brightness(1.6); }
  60%  { transform: scale(1.4) rotate(5deg); opacity: 0.8; filter: brightness(1.8); }
  100% { transform: scale(0);   opacity: 0; filter: brightness(2); }
}
@keyframes combo-rise {
  0%   { transform: translate(-50%,-50%) scale(0.5); opacity: 1; }
  20%  { transform: translate(-50%,-65%) scale(1.25); opacity: 1; }
  75%  { transform: translate(-50%,-90%) scale(1.05); opacity: 0.85; }
  100% { transform: translate(-50%,-110%) scale(0.9); opacity: 0; }
}
@keyframes overlay-in {
  from { transform: scale(0.82) translateY(18px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes glow-pulse {
  from { text-shadow: 0 0 8px var(--gold-glow); }
  to   { text-shadow: 0 0 28px var(--gold-glow); }
}
@keyframes item-pulse {
  from { box-shadow: 0 0 6px var(--gold-glow); }
  to   { box-shadow: 0 0 18px var(--gold-glow); }
}
@keyframes shake-anim {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-8px); }
  40%     { transform: translateX(8px); }
  60%     { transform: translateX(-5px); }
  80%     { transform: translateX(5px); }
}
@keyframes bounce-once {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes freeze-pulse {
  0%,100% { box-shadow: 0 0 20px rgba(96,165,250,0.2); }
  50%     { box-shadow: 0 0 40px rgba(96,165,250,0.45); }
}
@keyframes hammer-glow {
  from { box-shadow: 0 0 8px rgba(255,215,0,0.5); }
  to   { box-shadow: 0 0 20px rgba(255,215,0,0.9); }
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */

/* PC (≥ 1200px) */
@media (min-width: 1200px) {
  :root { --cell: 36px; --panel-w: 195px; }
  .top-bar   { display: none; }
  .mobile-ctrl { display: none; }
  .ctrl-hard-btn { display: none; }
  .side-ad   { display: flex; }
  .game-panel { display: flex; }
}

/* PC 소형 (1024px ~ 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  :root { --cell: 32px; --panel-w: 175px; --side-ad-w: 130px; }
  .top-bar   { display: none; }
  .mobile-ctrl { display: none; }
  .ctrl-hard-btn { display: none; }
  .side-ad   { display: flex; }
  .game-panel { display: flex; }
}

/* 태블릿 (768px ~ 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --cell: 30px; --panel-w: 165px; --ad-top-h: 60px; }
  .side-ad   { display: none; }
  .top-bar   { display: none; }
  .mobile-ctrl { display: none; }
  .ctrl-hard-btn { display: none; }
  .game-panel { display: flex; }
  /* 태블릿에서는 상단바 숨기고 패널 사용 */
}

/* 태블릿 세로 소형 (600px ~ 767px) */
@media (min-width: 600px) and (max-width: 767px) {
  :root { --cell: 26px; --panel-w: 145px; --ad-top-h: 50px; }
  .side-ad   { display: none; }
  .top-bar   { display: flex; }
  .mobile-ctrl { display: flex; }
  .ctrl-hard-btn { display: flex; }
  .game-panel { display: none; }
}

/* 모바일 (< 600px) */
@media (max-width: 599px) {
  :root {
    --cell: 28px;
    --ad-top-h: 50px;
    --ad-bot-h: 50px;
    --header-h: 48px;
  }
  .header-title { font-size: 16px; }
  .side-ad   { display: none; }
  .top-bar   { display: flex; }
  .mobile-ctrl { display: flex; }
  .ctrl-hard-btn { display: flex; }
  .game-panel { display: none; }
}

/* 소형 모바일 (< 420px) */
@media (max-width: 420px) {
  :root { --cell: 25px; }
}

/* 초소형 (< 360px) */
@media (max-width: 360px) {
  :root { --cell: 22px; --ad-top-h: 40px; }
}

/* 가로 모드 모바일 */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --cell: 20px; --header-h: 40px; --ad-top-h: 0px; --ad-bot-h: 0px; }
  .ad-banner { display: none; }
  .top-bar { height: 34px; }
  .mobile-ctrl { padding: 4px 12px; }
  .ctrl-btn { width: 40px; height: 40px; font-size: 15px; }
  .ctrl-left, .ctrl-right { width: 46px; height: 46px; }
}

/* ══════════════════════════════════════════
   🏆 LEADERBOARD & RANKING FORM
══════════════════════════════════════════ */
.rank-btn {
  font-size: 13px;
  background: rgba(255,215,0,0.15);
  border: 1px solid rgba(255,215,0,0.4);
  color: #FFD700;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  margin-left: 10px;
}
.rank-btn:hover { background: rgba(255,215,0,0.3); }

.ranking-form {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ranking-form input {
  padding: 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.5);
  color: white;
  text-align: center;
  font-size: 16px;
  font-family: inherit;
}
.ranking-form input:focus {
  outline: none;
  border-color: var(--purple-mid);
}
.submit-btn {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
}

.lg-card {
  width: 100%;
  max-width: 450px;
}

.leaderboard-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
}
.lb-tab {
  flex: 1;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-sub);
  cursor: pointer;
  font-weight: 700;
  transition: all var(--t);
}
.lb-tab.active {
  background: var(--purple-mid);
  color: white;
}

.leaderboard-content {
  background: rgba(0,0,0,0.3);
  border-radius: var(--r-sm);
  padding: 10px;
  min-height: 250px;
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 20px;
}
.lb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lb-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-sm);
  font-size: 14px;
}
.lb-item.rank-1 { background: rgba(255,215,0,0.2); border: 1px solid rgba(255,215,0,0.5); }
.lb-item.rank-2 { background: rgba(192,192,192,0.2); border: 1px solid rgba(192,192,192,0.5); }
.lb-item.rank-3 { background: rgba(205,127,50,0.2); border: 1px solid rgba(205,127,50,0.5); }
.lb-rank { font-weight: 900; width: 30px; }
.lb-name { flex: 1; text-align: left; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.lb-score { font-family: monospace; font-size: 15px; font-weight: 700; color: #A8DADC; }
.lb-loading { text-align: center; padding: 20px; color: var(--text-sub); }


/* ==================================================
   SVG 블록 스타일
================================================== */
.cell svg, .next-cell svg {
  width: 100%;
  height: 100%;
  display: block;
  margin: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cell.popping svg {
  transform: scale(0);
}


/* ─── 파티클 폭발 효과 ───────────────────────────────────────── */
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -50%);
  animation: particle-burst 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes particle-burst {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0);
    opacity: 0;
  }
}


.board-shake {
  animation: shake-anim 0.4s ease-in-out;
}


/* ─── 플로팅 점수 효과 ───────────────────────────────────────── */
.floating-score {
  position: absolute;
  font-size: 24px;
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 0 10px #FFA500, 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 200;
  transform: translate(-50%, -50%);
  animation: float-score 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes float-score {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  20% { transform: translate(-50%, -80%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -150%) scale(0.8); opacity: 0; }
}

