/* ==========================================================
   巨大化 vs 縮小化：サイズランナー - style.css
   ========================================================== */

:root {
  --color-bg-top: #120a2e;
  --color-bg-mid: #1d0f45;
  --color-bg-bottom: #2c0f52;
  --color-primary: #ff2e9a;
  --color-primary-2: #00e0ff;
  --color-accent: #ffcc33;
  --color-danger: #ff3d63;
  --color-text: #f2ecff;
  --color-text-muted: #a99bd6;
  --color-border: rgba(255, 255, 255, 0.14);
  --color-panel: #1a0f38;
  --header-h: 56px;
  --score-h: 52px;
  --ad-h: 64px;
  --ad-gap-h: 18px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at 50% 0%, var(--color-bg-top) 0%, var(--color-bg-mid) 45%, var(--color-bg-bottom) 100%);
  color: var(--color-text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* ---------- ヘッダー ---------- */
.game-header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.7rem;
  background: linear-gradient(135deg, rgba(30, 16, 64, 0.85), rgba(20, 10, 46, 0.7));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 16px rgba(255, 46, 154, 0.2);
  z-index: 20;
}

.back-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #241442;
  border: 1px solid var(--color-border);
  box-shadow: 0 0 10px rgba(0, 224, 255, 0.25);
  flex: 0 0 auto;
}

.back-link:active {
  transform: translateY(2px);
}

.game-title {
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  margin: 0 0.4rem;
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(255, 46, 154, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: #241442;
  color: var(--color-text);
  font-size: 1.02rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 224, 255, 0.25);
}

.icon-btn:active {
  transform: translateY(2px);
}

.icon-btn.is-muted {
  color: var(--color-text-muted);
  opacity: 0.65;
  box-shadow: none;
}

/* ---------- スコアバー ---------- */
.score-bar {
  height: var(--score-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 15;
  flex-wrap: wrap;
}

.stat-box {
  background: linear-gradient(135deg, #241442, #1a0f38);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.12), inset 0 0 8px rgba(255, 46, 154, 0.08);
}

.stat-box__label {
  font-size: 0.64rem;
  font-weight: bold;
  color: var(--color-text-muted);
}

.stat-box__value {
  font-size: 1rem;
  font-weight: 900;
  color: var(--color-primary-2);
  text-shadow: 0 0 8px rgba(0, 224, 255, 0.5);
}

.stat-box__value small {
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 0.1rem;
}

/* ---------- ゲームステージ ---------- */
.game-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}

/* ふわふわ漂うネオンスパークの装飾レイヤー */
.stage-decor {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.deco-item {
  position: absolute;
  bottom: -10%;
  opacity: 0;
  animation: deco-float linear infinite;
}

.deco-item.spark-pink {
  color: var(--color-primary);
  text-shadow: 0 0 10px rgba(255, 46, 154, 0.9);
}

.deco-item.spark-cyan {
  color: var(--color-primary-2);
  text-shadow: 0 0 10px rgba(0, 224, 255, 0.9);
}

@keyframes deco-float {
  0% { transform: translateY(0) scale(0.7) rotate(-10deg); opacity: 0; }
  12% { opacity: 0.9; }
  88% { opacity: 0.7; }
  100% { transform: translateY(-120vh) scale(1.2) rotate(16deg); opacity: 0; }
}

.deco-item:nth-child(1) { left: 6%;  font-size: 1rem;   animation-duration: 14s; animation-delay: 0s; }
.deco-item:nth-child(2) { left: 20%; font-size: 0.7rem;  animation-duration: 10.5s; animation-delay: 2.5s; }
.deco-item:nth-child(3) { left: 36%; font-size: 1.2rem;  animation-duration: 16s; animation-delay: 5s; }
.deco-item:nth-child(4) { left: 60%; font-size: 0.8rem;  animation-duration: 12s; animation-delay: 1s; }
.deco-item:nth-child(5) { left: 76%; font-size: 1.05rem; animation-duration: 15s; animation-delay: 7s; }
.deco-item:nth-child(6) { left: 90%; font-size: 0.65rem; animation-duration: 12.5s; animation-delay: 3.5s; }
.deco-item:nth-child(7) { left: 48%; font-size: 0.9rem;  animation-duration: 17s; animation-delay: 9s; }
.deco-item:nth-child(8) { left: 12%; font-size: 0.6rem;  animation-duration: 10s; animation-delay: 6s; }

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
}

/* ---------- サイズバッジ ---------- */
.size-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) scale(1);
  z-index: 6;
  font-size: 0.9rem;
  font-weight: 900;
  color: #0c0620;
  background: var(--color-primary-2);
  padding: 0.35rem 1.3rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 0 18px rgba(0, 224, 255, 0.75), 0 3px 0 rgba(0, 0, 0, 0.3);
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.04em;
}

.size-badge.is-big {
  background: var(--color-primary);
  box-shadow: 0 0 18px rgba(255, 46, 154, 0.8), 0 3px 0 rgba(0, 0, 0, 0.3);
  transform: translateX(-50%) scale(1.15);
}

/* ---------- 操作ヒント ---------- */
.control-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 0.74rem;
  font-weight: bold;
  color: var(--color-text);
  background: rgba(26, 15, 56, 0.9);
  border: 1px dashed rgba(0, 224, 255, 0.55);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 1;
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.2);
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.control-hint.is-hidden {
  opacity: 0;
}

/* ---------- オーバーレイ ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 3, 18, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay__box {
  text-align: center;
  padding: 1.8rem 2rem;
  background: linear-gradient(165deg, #201042, #150a2c);
  border: 1px solid var(--color-border);
  border-radius: 26px;
  max-width: 85%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 46, 154, 0.25);
}

.overlay__box--wide {
  max-width: min(92%, 460px);
  max-height: 88%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay__title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 0 0 0.5rem;
  color: var(--color-primary);
  text-shadow: 0 0 14px rgba(255, 46, 154, 0.5);
}

.overlay__desc {
  color: var(--color-text-muted);
  margin: 0 0 1.3rem;
  font-size: 1rem;
  font-weight: bold;
}

.overlay__btn {
  border: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  color: #0c0620;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 46, 154, 0.5), 0 4px 0 #7a0f52;
}

.overlay__btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 14px rgba(255, 46, 154, 0.5), 0 1px 0 #7a0f52;
}

/* ---------- ガイド画面 ---------- */
.guide-section {
  text-align: left;
  margin: 1rem 0;
}

.guide-section__title {
  font-size: 0.92rem;
  color: var(--color-primary-2);
  text-shadow: 0 0 8px rgba(0, 224, 255, 0.4);
  margin: 0 0 0.4rem;
}

.guide-section__text {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

.guide-section__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.guide-section__list li {
  margin-bottom: 0.3rem;
}

/* ---------- 広告スペース ---------- */
.ad-gap {
  flex: 0 0 var(--ad-gap-h);
  background: transparent;
}

.ad-slot {
  flex: 0 0 var(--ad-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px dashed rgba(0, 224, 255, 0.35);
  background: rgba(26, 15, 56, 0.6);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  z-index: 20;
  overflow: hidden;
}

@media (max-height: 640px) {
  .ad-slot {
    --ad-h: 44px;
    font-size: 0.65rem;
  }
  .ad-gap {
    --ad-gap-h: 10px;
  }
}

@media (max-width: 360px) {
  .game-title {
    font-size: 0.74rem;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
}
