/* ==========================================================
   ブラックホール・クラッシュ - style.css
   ========================================================== */

:root {
  --color-bg: #05030f;
  --color-primary: #b45cff;
  --color-primary-2: #33e6ff;
  --color-accent: #ffe14d;
  --color-danger: #ff3d6b;
  --color-text: #f1ecff;
  --color-text-muted: #8f84c2;
  --color-border: #3a2c72;
  --color-panel: #140b30;
  --header-h: 56px;
  --score-h: 48px;
  --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: var(--color-bg);
  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: rgba(180, 92, 255, 0.06);
  border-bottom: 2px solid var(--color-border);
  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: rgba(255, 255, 255, 0.07);
  flex: 0 0 auto;
}

.back-link:active {
  background: rgba(255, 255, 255, 0.18);
}

.game-title {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0.4rem;
  color: var(--color-primary-2);
  text-shadow: 0 0 10px rgba(51, 230, 255, 0.5);
  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: none;
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.icon-btn.is-muted {
  color: var(--color-text-muted);
  opacity: 0.6;
}

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

.stat-box {
  background: rgba(180, 92, 255, 0.08);
  border: 2px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

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

.stat-box__value {
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--color-primary-2);
}

/* ---------- ゲームステージ ---------- */
.game-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(ellipse at center, rgba(180, 92, 255, 0.08), transparent 60%),
    var(--color-bg);
}

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

/* ---------- 操作ヒント ---------- */
.control-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 0.76rem;
  font-weight: bold;
  color: var(--color-text-muted);
  background: rgba(20, 11, 48, 0.75);
  border: 1px solid var(--color-border);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

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

/* ---------- オーバーレイ ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 1, 10, 0.78);
  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: var(--color-panel);
  border: 2px solid var(--color-primary);
  border-radius: 22px;
  max-width: 85%;
  box-shadow: 0 0 60px rgba(180, 92, 255, 0.35), 0 20px 50px rgba(0, 0, 0, 0.6);
}

.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-accent);
  text-shadow: 0 0 12px rgba(255, 225, 77, 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: #0a0518;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.overlay__btn:active {
  filter: brightness(0.9);
}

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

.guide-section__title {
  font-size: 0.92rem;
  color: var(--color-accent);
  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: var(--color-bg);
}

.ad-slot {
  flex: 0 0 var(--ad-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 2px dashed var(--color-border);
  background: rgba(180, 92, 255, 0.04);
  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.76rem;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.92rem;
  }
}
