:root {
  --bg: #10161d;
  --panel: #121820;
  --text: #eef4fb;
  --muted: #97a5b7;
  --accent: #3fb950;
  --accent-weak: #2ea043;
  --danger: #ef4444;
  --ad-width: 0px; /* set to e.g. 120px when ads enabled */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
  background: radial-gradient(1200px 1200px at 20% 0%, #1b2a3a 0%, var(--bg) 70%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 18px 48px;
  padding-left: calc(18px + var(--ad-width));
  padding-right: calc(18px + var(--ad-width));
}

.header {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.goal-inline {
  color: var(--muted);
  font-size: 13px;
}
#rabbitsBreakdown { font-size: 11px; }
.goal-inline .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px; vertical-align: middle; }
.dot.t0 { background: #fff; }
.dot.t1 { background: #ff5252; }
.dot.t2 { background: #ff9800; }
.dot.t3 { background: #ffeb3b; }
.dot.t4 { background: #4caf50; }
.dot.t5 { background: #2196f3; }
.dot.t6 { background: #3f51b5; }
.dot.t7 { background: #9c27b0; }

.title {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.2px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  background: var(--panel);
  border: 1px solid #1c2430;
  border-radius: 12px;
  padding: 12px 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stat strong {
  font-size: 20px;
}

.play {
  margin: 18px 0 10px;
}

.click-btn {
  width: 100%;
  padding: 18px 16px;
  font-size: 20px;
  border-radius: 14px;
  border: 1px solid #1f2a36;
  background: linear-gradient(180deg, #1a2430, #121820);
  color: var(--text);
  cursor: pointer;
  transition: transform .04s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 12px 28px rgba(0,0,0,.25);
}

.click-btn:hover { transform: translateY(-1px); }
.click-btn:active { transform: translateY(1px) scale(.995); }

.shop {
  margin-top: 22px;
}

.shop h2 { margin: 0 0 12px; font-size: 18px; color: var(--muted); }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  text-align: left;
  background: var(--panel);
  border: 1px solid #1c2430;
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 6px;
}
.card.small .card-title { font-size: 14px; }
.card.small .card-desc { font-size: 12px; }
.card.small .card-cost { font-size: 12px; }
.card.small { padding: 10px; }

.card[disabled] {
  opacity: .6;
  cursor: not-allowed;
}

.card-title { font-weight: 700; margin-bottom: 6px; }
.card-desc { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.card-cost { color: var(--accent); }

.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
}

.mini-btn {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #2a3544;
  background: #151c25;
  color: var(--muted);
  cursor: pointer;
}

.mini-btn:active {
  transform: translateY(1px);
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
}

.save-status { font-size: 12px; opacity: .9; }

.link-btn {
  background: transparent;
  border: 1px solid #2a3544;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.primary-btn { background: #2ea043; border: 1px solid #2ea043; color: #0b1116; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: min(560px, 92vw);
  background: var(--panel);
  border: 1px solid #1c2430;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.45);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #1e2b3b;
}
.modal-body {
  padding: 12px 14px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  max-height: 70vh;
  overflow-y: auto;
}
.modal-body ul { margin: 0; padding-left: 18px; }
.modal-body strong { color: var(--text); }

/* Manual pretty styles */
.manual-section { margin-bottom: 14px; }
.manual-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text);
}
.manual-section ul li { margin: 4px 0; }

/* Pretty stats card for sharing */
.stats-card {
  background: linear-gradient(180deg, #141b24, #0f151d);
  border: 1px solid #1e2b3b;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.stats-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.stats-rabbit { width: 72px; height: 72px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.stats-title { font-size: 18px; font-weight: 800; }
.stats-sub { font-size: 12px; color: var(--muted); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.stat-cell { background: #121820; border: 1px solid #1b2330; border-radius: 10px; padding: 10px; }
.stat-cell .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-cell .value { font-size: 18px; font-weight: 700; }
.share-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .app { padding: 20px 14px 44px; }
  .title { font-size: 24px; }
  .title-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .title-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .link-btn { padding: 8px 10px; font-size: 13px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .click-btn { font-size: 18px; padding: 16px 14px; }
  .card { padding: 10px; }
  .card-title { font-size: 15px; }
  .card-desc { font-size: 12px; }
  .card-cost { font-size: 13px; }
  .shop-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
}

/* Runner */
.runner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  pointer-events: none;
}

.runner .track {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 46px;
  background: repeating-linear-gradient(
    90deg,
    #0f1620 0px,
    #0f1620 20px,
    #132033 20px,
    #132033 40px
  );
  border-top: 1px solid #1e2b3b;
  transform: translateZ(0);
  animation: track-move 1.2s linear infinite;
}

@keyframes track-move {
  0% { background-position-x: 0; }
  100% { background-position-x: -80px; }
}

.runner-sprite {
  position: absolute;
  bottom: 32px;
  left: 24px;
  width: 32px;
  height: 32px;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
}

/* Rabbit color tiers: 기본 -> 빨 -> 주 -> 노 -> 초 -> 파 -> 남 -> 보 */
.runner-sprite.tier-0 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.runner-sprite.tier-1 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(330deg) saturate(1.6) brightness(1.05); }
.runner-sprite.tier-2 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(20deg)  saturate(1.5) brightness(1.06); }
.runner-sprite.tier-3 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(60deg)  saturate(1.4) brightness(1.08); }
.runner-sprite.tier-4 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(110deg) saturate(1.5) brightness(1.04); }
.runner-sprite.tier-5 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(200deg) saturate(1.5) brightness(1.04); }
.runner-sprite.tier-6 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(250deg) saturate(1.6) brightness(1.03); }
.runner-sprite.tier-7 { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)) hue-rotate(290deg) saturate(1.6) brightness(1.05); }

.runner-sprite.chomp {
  animation: rabbit-chomp 0.16s ease-in-out 1;
}

@keyframes rabbit-chomp {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

/* Rock obstacle */
.rock {
  position: absolute;
  bottom: 34px; /* slightly above track */
  width: 36px;
  height: 28px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
  will-change: transform, left;
}

.goal {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* Optional side ad slots */
.ad-slot {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--ad-width);
  pointer-events: none;
  opacity: 0; /* hidden by default; toggle via body.has-ads */
}
.ad-slot.left { left: 0; }
.ad-slot.right { right: 0; }

body.has-ads .ad-slot {
  opacity: 1;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
  border-right: 1px solid rgba(255,255,255,0.06);
  border-left: 1px solid rgba(255,255,255,0.06);
}

/* FX layer */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.fx-carrot {
  position: absolute;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.4));
}

.fx-carrot.boosted {
  filter: drop-shadow(0 0 6px rgba(255, 200, 0, 0.85)) hue-rotate(320deg) saturate(1.8) brightness(1.25);
}

/* Gain text FX */
.fx-gain {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  opacity: 0;
  animation: gain-float .8s ease-out forwards;
  will-change: transform, opacity;
}
.fx-gain.boosted { color: #ffd166; }

@keyframes gain-float {
  0% { transform: translate(-50%, -50%) translateY(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-24px); opacity: 0; }
}

/* Ad banners (top/bottom leaderboard) */
.ad-banner {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

