:root {
  --bg: #1b2330;
  --bg2: #232d3d;
  --panel-bg: rgba(28, 36, 50, 0.96);
  --accent: #ffc24b;
  --accent2: #ff9d3c;
  --text: #f3f6fb;
  --muted: #9aa6b8;
  --line: #ff5a6e;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#app {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg2), var(--bg));
}

/* ---------- 広告枠 ---------- */
.ad-slot[hidden] { display: none; }
.legal a { color: var(--muted); }
.ad-slot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #20283500, #20283500 10px, #ffffff08 10px, #ffffff08 20px);
  border: 1px dashed #ffffff22;
}
#ad-banner-top { height: 56px; }
.ad-rect { width: 100%; height: 120px; margin: 14px 0; border-radius: 10px; }
.ad-placeholder { color: var(--muted); font-size: 12px; letter-spacing: 1px; }

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 4px;
}
.hud-box {
  background: #ffffff10;
  border-radius: 10px;
  padding: 6px 12px;
  min-width: 78px;
  text-align: center;
}
.hud-label { font-size: 10px; color: var(--muted); letter-spacing: 2px; }
.hud-value { font-size: 22px; font-weight: 800; color: var(--accent); }
.hud-title { font-size: 15px; font-weight: 700; letter-spacing: 2px; opacity: 0.85; }

/* ---------- NEXT ---------- */
#next-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 16px 6px;
}
.next-label { font-size: 11px; color: var(--muted); letter-spacing: 2px; }
#next-canvas { width: 36px; height: 36px; }
#evolve-hint { margin-left: auto; font-size: 11px; color: var(--muted); }
.icon-btn {
  margin-left: 8px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid #ffffff20;
  background: #ffffff10;
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.muted { opacity: 0.55; }

/* ---------- ステージ ---------- */
#stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
}
#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- オーバーレイ ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 22, 0.62);
  backdrop-filter: blur(3px);
  z-index: 10;
  padding: 18px;
}
.overlay.hidden { display: none; }
.panel {
  width: 100%;
  max-width: 340px;
  background: var(--panel-bg);
  border: 1px solid #ffffff16;
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.panel h2 {
  font-size: 26px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}
.panel p { font-size: 15px; margin: 8px 0; }
.panel .how { color: var(--text); line-height: 1.7; }
.panel .how.small { color: var(--muted); font-size: 13px; }
.panel #final-score, .panel #final-best { color: var(--accent); font-weight: 800; font-size: 20px; }
.best-line { color: var(--muted); }

.btn {
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 800;
  color: #2a1c00;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 #c9761f;
  transition: transform 0.05s, box-shadow 0.05s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #c9761f; }

/* リワード広告コンティニュー用 */
.btn-reward {
  color: #06250f;
  background: linear-gradient(180deg, #6fe08a, #36b85e);
  box-shadow: 0 6px 0 #1f8a42;
}
.btn-reward:active { box-shadow: 0 2px 0 #1f8a42; }
