:root {
  --bg-dark: #12141f;
  --bg-panel: #1c1f30;
  --accent: #ff7a3d;   /* orange - 펀치 */
  --accent2: #ffcb47;  /* gold */
  --accent3: #4dd6b8;  /* mint */
  --text-main: #f4f5f9;
  --text-dim: #9ca3b8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-dark); color: var(--text-main); font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ===================== 상단 네비 ===================== */
.top-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px;
  background: rgba(18,20,31,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.top-nav .logo-emoji { font-size: 20px; }
.top-nav .logo-text { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.top-nav .logo-text b { color: var(--accent); }

/* ===================== 전체 래퍼 ===================== */
.home-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 0 0 90px; }

/* ===================== 히어로 ===================== */
.hero-section {
  width: 100%; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 20px 34px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,122,61,0.25) 0%, transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(77,214,184,0.2) 0%, transparent 50%),
    radial-gradient(circle at 50% -20%, #262a45 0%, var(--bg-dark) 65%);
  position: relative; overflow: hidden;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  color: var(--accent2); margin-bottom: 18px;
}
.hero-mascot { font-size: 64px; margin-bottom: 6px; filter: drop-shadow(0 8px 20px rgba(255,122,61,0.4)); animation: mascot-bounce 2.4s ease-in-out infinite; }
@keyframes mascot-bounce { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.hero-title { font-size: 20px; font-weight: 800; color: var(--text-dim); line-height: 1.4; margin-bottom: 6px; }
.hero-title-main {
  font-size: 52px; font-weight: 900; line-height: 1.05;
  background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 70%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 14px; letter-spacing: -1px;
}
.hero-desc { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 26px; max-width: 320px; }
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #2a1500; border: none; padding: 16px 38px; border-radius: 32px;
  font-size: 16px; font-weight: 800; cursor: pointer;
  box-shadow: 0 10px 28px rgba(255,203,71,0.35); margin-bottom: 30px;
}
.hero-cta:active { transform: scale(0.96); }
.feature-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 420px; }
.feature-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px; padding: 10px 4px;
}
.feature-item .f-icon { font-size: 18px; }
.feature-item .f-label { font-size: 10.5px; font-weight: 700; color: var(--text-main); text-align: center; line-height: 1.3; }

/* ===================== 섹션 공통 ===================== */
.section-block { width: 100%; max-width: 640px; padding: 30px 20px 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head .title { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.section-head .desc { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; font-weight: 400; }

/* ===================== 인기 랭킹 ===================== */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 12px; background: var(--bg-panel); border-radius: 16px; padding: 12px 14px; border: 1px solid rgba(255,255,255,0.05); }
.rank-item .rank-num { font-size: 15px; font-weight: 900; width: 22px; text-align: center; color: var(--text-dim); }
.rank-item:nth-child(1) .rank-num { color: #ffd166; }
.rank-item:nth-child(2) .rank-num { color: #c9d3e0; }
.rank-item:nth-child(3) .rank-num { color: #e0a86f; }
.rank-item .rank-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.rank-item .rank-info { flex: 1; min-width: 0; }
.rank-item .rank-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.rank-item .rank-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.rank-item .rank-best { font-size: 11px; color: var(--accent3); font-weight: 700; white-space: nowrap; }

.badge-tag { font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 6px; color: #1a0d0d; }
.badge-tag.hot { background: var(--accent2); }
.badge-tag.new { background: var(--accent3); color: #072e26; }

/* ===================== 전체 게임 그리드 ===================== */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; }
@media (min-width: 480px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.game-card {
  background: var(--bg-panel); border-radius: 20px; padding: 20px 10px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform 0.15s ease; position: relative; overflow: hidden;
}
.game-card::before { content:''; position:absolute; inset:0; opacity:0.12; background: var(--card-accent, transparent); pointer-events: none; }
.game-card:active { transform: scale(0.95); }
.game-card.disabled { opacity: 0.4; cursor: not-allowed; }
.game-card .emoji { font-size: 38px; line-height: 1; position: relative; z-index: 1; }
.game-card .label { font-size: 15px; font-weight: 800; position: relative; z-index: 1; }
.game-card .sub { font-size: 11px; color: var(--text-dim); position: relative; z-index: 1; }
.game-card .best-score { font-size: 10.5px; color: var(--accent3); font-weight: 700; margin-top: 2px; position: relative; z-index: 1; min-height: 13px; }
.game-card .soon-badge { position: absolute; top: 8px; right: 8px; font-size: 9.5px; font-weight: 700; background: rgba(255,255,255,0.08); padding: 3px 7px; border-radius: 10px; color: var(--text-dim); z-index: 2; }
.game-card .corner-badge { position: absolute; top: 8px; left: 8px; z-index: 2; }

/* ===================== 하단 고정 네비 ===================== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; display: flex;
  background: rgba(17,20,36,0.95); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08); padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--text-dim); font-weight: 700; }
.bottom-nav .nav-icon { font-size: 19px; }
.bottom-nav a.active { color: var(--accent2); }
.bottom-nav .nav-item.highlight .nav-icon {
  background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #2a1500;
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-bottom: 2px;
}

.footer-note { margin-top: 36px; padding: 0 20px; font-size: 11.5px; color: var(--text-dim); text-align: center; line-height: 1.7; opacity: 0.7; }

/* ===================== 게임 공통 셸 (게임 페이지에서 사용) ===================== */
.game-shell { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg-dark); }
.game-topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
  background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.06);
}
.game-topbar .back-link { font-size: 14px; color: var(--text-dim); font-weight: 700; }
.game-topbar .timer { font-size: 14px; font-weight: 800; background: rgba(255,255,255,0.08); padding: 6px 12px; border-radius: 20px; }
.game-topbar .score { font-size: 14px; font-weight: 800; background: var(--accent); color: #2a1500; padding: 6px 14px; border-radius: 20px; }
.game-play-area { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; padding: 10px; }
.game-result {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: rgba(10,11,20,0.9); backdrop-filter: blur(4px);
}
.game-result.show { display: flex; }
.result-card { background: var(--bg-panel); border-radius: 24px; padding: 34px 28px; text-align: center; width: 86%; max-width: 340px; }
.result-card .r-title { font-size: 22px; font-weight: 900; margin-bottom: 18px; }
.result-card .r-score { font-size: 46px; font-weight: 900; color: var(--accent2); }
.result-card .r-score-label { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; }
.result-card .r-best { font-size: 13px; color: var(--accent3); font-weight: 700; margin-bottom: 22px; }
.result-card .r-btn {
  display: block; width: 100%; padding: 14px; border-radius: 16px; border: none;
  font-size: 15px; font-weight: 800; margin-bottom: 10px; cursor: pointer;
}
.result-card .r-btn.primary { background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #2a1500; }
.result-card .r-btn.secondary { background: rgba(255,255,255,0.08); color: var(--text-main); }
