/* ============================================
   マグネドッツ - MagneDots
   ============================================ */

:root {
  --c-bg: #0a1028;
  --c-sky: #3fd0ff;
  --c-gold: #ffb03a;
  --c-pink: #ff5f9e;
  --c-mint: #6ff2d6;
  --c-lime: #a6ee4a;
  --c-text: #eef4ff;
  --c-dim: #8b9cc8;
  --font-num: 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  --font-jp: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  font-family: var(--font-jp);
  color: var(--c-text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game-container {
  position: fixed;
  inset: 0;
  /* 共通ヘッダーぶんだけ下げる */
  top: var(--sgh-top, 0px);
  /* フッター固定バナー広告ぶんだけ縮める（広告なしのときは 0px） */
  bottom: var(--ad-space, 0px);
  overflow: hidden;
}

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

.hidden { display: none !important; }

/* ---------- HUD ---------- */
/* HUD はプレイ範囲（最大 780px・中央寄せ）に合わせる */
#hud {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 780px);
  /* #game-container は共通ヘッダーの下（--sgh-top はセーフエリア込み）から始まるので、
     上のセーフエリアはヘッダーが無いときだけ見る（二重に空けない） */
  padding: max(10px, calc(env(safe-area-inset-top, 0px) - var(--sgh-top, 0px))) 16px 0;
  pointer-events: none;
  z-index: 10;
}

#hud-score {
  text-align: center;
  font-family: var(--font-num);
  font-size: clamp(30px, 5.8vw, 50px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--c-text);
  text-shadow: 0 0 18px rgba(63, 208, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
}

#hud-best,
#hud-level {
  position: absolute;
  top: max(14px, calc(env(safe-area-inset-top, 0px) - var(--sgh-top, 0px)));
  left: 18px;
  font-family: var(--font-num);
  font-size: clamp(12px, 2vw, 16px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#hud-best {
  color: var(--c-mint);
  text-shadow: 0 0 12px rgba(111, 242, 214, 0.55), 0 1px 4px rgba(0, 0, 0, 0.5);
}
#hud-level {
  top: calc(max(14px, calc(env(safe-area-inset-top, 0px) - var(--sgh-top, 0px))) + 20px);
  color: var(--c-gold);
  text-shadow: 0 0 12px rgba(255, 176, 58, 0.55), 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ---------- かたまりの大きさゲージ ---------- */
.size-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  font-family: var(--font-num);
  font-size: clamp(10px, 1.9vw, 12px);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.size-track {
  position: relative;
  width: min(44vw, 190px);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(10, 18, 44, 0.75);
  box-shadow: inset 0 0 0 1px rgba(139, 156, 200, 0.4);
}
.size-fill {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--c-mint) 0%, var(--c-sky) 100%);
}
.size-text {
  font-variant-numeric: tabular-nums;
  min-width: 4.8em;
  text-align: left;
  letter-spacing: 0.06em;
}
.size-bar.warn .size-fill { background: linear-gradient(90deg, #ffd05c 0%, var(--c-gold) 100%); }
.size-bar.warn { color: var(--c-gold); }
.size-bar.danger .size-fill { background: linear-gradient(90deg, #ff9a6a 0%, #ff5f7a 100%); }
.size-bar.danger {
  color: #ff8fa5;
  animation: size-blink 0.6s ease-in-out infinite;
}
@keyframes size-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- ミュートボタン ---------- */
.icon-btn {
  position: absolute;
  top: max(10px, calc(env(safe-area-inset-top, 0px) - var(--sgh-top, 0px)));
  /* プレイ範囲の右端に合わせる（横長の画面では中央 780px が遊ぶ範囲） */
  right: max(12px, calc(50% - 378px));
  z-index: 40;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(139, 156, 200, 0.45);
  border-radius: 10px;
  background: rgba(10, 16, 40, 0.55);
  color: var(--c-text);
  font-size: 20px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: border-color 0.15s, transform 0.1s;
}
.icon-btn:hover { border-color: var(--c-sky); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.muted { opacity: 0.5; }

/* ---------- 反発パルスのボタン ---------- */
.pulse-btn {
  position: absolute;
  right: max(14px, env(safe-area-inset-right), calc(50% - 376px));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 35;
  width: 74px;
  height: 74px;
  padding: 0;
  border: 2px solid rgba(111, 242, 214, 0.35);
  border-radius: 50%;
  background: rgba(10, 20, 44, 0.62);
  color: var(--c-dim);
  cursor: pointer;
  overflow: hidden;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  transition: border-color 0.2s, color 0.2s, transform 0.1s, box-shadow 0.25s;
}
.pulse-btn:active { transform: scale(0.93); }
.pulse-btn.ready {
  border-color: rgba(111, 242, 214, 0.95);
  color: #0a1c26;
  box-shadow: 0 0 22px rgba(111, 242, 214, 0.45);
  animation: pulse-ready 1.6s ease-in-out infinite;
}
@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 0 16px rgba(111, 242, 214, 0.35); }
  50% { box-shadow: 0 0 30px rgba(111, 242, 214, 0.7); }
}

.pulse-gauge {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: 50%;
}
.pulse-fill {
  position: absolute;
  inset: 0;
  display: block;
  background: linear-gradient(180deg, rgba(111, 242, 214, 0.9) 0%, rgba(63, 208, 255, 0.75) 100%);
  transform-origin: 50% 100%;
  transform: scaleY(0);
}

.pulse-mark,
.pulse-label {
  position: relative;
  display: block;
  text-align: center;
  pointer-events: none;
}
.pulse-mark {
  font-size: 26px;
  line-height: 1;
  margin-top: 15px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
.pulse-label {
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin-top: 3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

@media (max-width: 380px), (max-height: 560px) {
  .pulse-btn { width: 62px; height: 62px; }
  .pulse-mark { font-size: 22px; margin-top: 12px; }
}

/* ---------- スクリーン共通 ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 背の低い画面（スマホ横向き等）で中身が収まらないときは、上から並べてスクロールさせる
     （center のままだと上下が同じだけ見切れて、下のボタンに届かない） */
  justify-content: safe center;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 16px;
  /* backdrop-filter は使わない（背後でキャンバスが動き続けるため、毎フレームのぼかし直しが重い） */
  background: radial-gradient(ellipse at center, rgba(10, 16, 40, 0.58) 0%, rgba(4, 7, 18, 0.93) 100%);
  animation: screen-in 0.35s ease-out;
  padding: 20px;
  text-align: center;
}

@keyframes screen-in {
  from { opacity: 0; transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1); }
}

/* タイトルは背景でドットが漂っているので、覆いを薄くして見せる */
#screen-title {
  background: radial-gradient(ellipse at center, rgba(10, 16, 40, 0.34) 0%, rgba(4, 7, 18, 0.86) 100%);
}

/* ---------- タイトル ---------- */
.title-logo { line-height: 1.1; }

.title-jp {
  font-size: clamp(36px, 9vw, 78px);
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #ffffff 8%, var(--c-sky) 50%, #1f6fb8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(63, 208, 255, 0.5));
  animation: logo-float 3.4s ease-in-out infinite;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.title-en {
  font-family: var(--font-num);
  font-size: clamp(14px, 2.9vw, 23px);
  font-weight: 700;
  letter-spacing: 0.5em;
  margin-left: 0.5em;
  color: var(--c-mint);
  text-shadow: 0 0 14px rgba(111, 242, 214, 0.6);
  margin-top: 8px;
}

.title-desc {
  font-size: clamp(14px, 2.6vw, 18px);
  color: var(--c-dim);
  line-height: 1.7;
}

.title-best {
  font-family: var(--font-num);
  font-size: clamp(18px, 3.4vw, 26px);
  font-weight: 700;
  color: var(--c-gold);
  text-shadow: 0 0 14px rgba(255, 176, 58, 0.4);
}
.best-label {
  font-size: 0.72em;
  opacity: 0.8;
  margin-right: 10px;
  letter-spacing: 0.15em;
}
.best-unit { font-family: var(--font-jp); font-size: 0.6em; margin-left: 4px; }

.title-subbtns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- ボタン ---------- */
.btn {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: clamp(16px, 3vw, 20px);
  padding: 14px 52px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
  letter-spacing: 0.08em;
}
.btn:active { transform: scale(0.94); }

.btn-primary {
  position: relative;
  background: linear-gradient(135deg, var(--c-sky) 0%, #1f6fb8 100%);
  color: #04203c;
  box-shadow: 0 0 20px rgba(63, 208, 255, 0.35), 0 4px 14px rgba(0, 0, 0, 0.5);
}
.btn-primary:hover { filter: brightness(1.15); }

/* 脈動は疑似要素の opacity で行う（box-shadow を直接アニメすると毎フレーム再ペイントになる） */
.btn-primary::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 34px rgba(63, 208, 255, 0.6);
  opacity: 0;
  animation: btn-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btn-pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.btn-sub {
  background: rgba(16, 24, 56, 0.82);
  border-color: rgba(139, 156, 200, 0.5);
  color: var(--c-text);
  padding: 11px 26px;
  font-size: clamp(14px, 2.6vw, 17px);
  animation: none;
}
.btn-sub:hover { border-color: var(--c-mint); }

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: clamp(11px, 2vw, 13px);
  color: var(--c-dim);
}

/* ---------- 自己ベスト一覧（タイトル） ---------- */
.ranking {
  list-style: none;
  font-family: var(--font-num);
  font-size: clamp(12px, 2.2vw, 15px);
  color: var(--c-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  font-variant-numeric: tabular-nums;
}
.ranking li { display: flex; gap: 14px; justify-content: center; }
.ranking li:first-child { color: var(--c-gold); }
.ranking .rank-no { width: 2.2em; text-align: right; opacity: 0.7; }

/* ---------- ゲームオーバー ---------- */
.gameover-title {
  font-family: var(--font-num);
  font-size: clamp(34px, 7.6vw, 64px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--c-pink);
  text-shadow: 0 0 28px rgba(255, 95, 158, 0.6);
}

.new-record {
  font-family: var(--font-num);
  font-size: clamp(16px, 3.4vw, 24px);
  font-weight: 700;
  color: var(--c-gold);
  text-shadow: 0 0 16px rgba(255, 176, 58, 0.7);
  animation: record-blink 0.7s ease-in-out infinite;
}
@keyframes record-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.06); }
}

.result-score {
  font-family: var(--font-num);
  font-size: clamp(48px, 11vw, 96px);
  font-weight: 700;
  color: var(--c-text);
  text-shadow: 0 0 30px rgba(63, 208, 255, 0.5);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-unit { font-family: var(--font-jp); font-size: 0.3em; margin-left: 8px; color: var(--c-dim); }

.result-stats {
  display: flex;
  gap: clamp(14px, 4vw, 40px);
  flex-wrap: wrap;
  justify-content: center;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 11px; letter-spacing: 0.2em; color: var(--c-dim); }
.stat span:last-child { font-size: clamp(15px, 3.2vw, 22px); font-weight: 700; }

.gameover-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* ---------- ポーズ ---------- */
.pause-title {
  font-family: var(--font-num);
  font-size: clamp(34px, 7vw, 60px);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--c-mint);
  text-shadow: 0 0 24px rgba(111, 242, 214, 0.5);
}
.pause-desc { color: var(--c-dim); }

/* ---------- 遊び方 ---------- */
.howto {
  justify-content: flex-start;
  gap: 12px;
  padding-top: max(18px, calc(env(safe-area-inset-top, 0px) - var(--sgh-top, 0px)));
  overflow: hidden;
  /* タイトル画面の上に重ねて出すので、下が透けないよう濃くする */
  background: radial-gradient(ellipse at center, rgba(9, 14, 34, 0.97) 0%, rgba(4, 6, 16, 0.99) 100%);
}

.howto-title {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 800;
  color: var(--c-sky);
  text-shadow: 0 0 18px rgba(63, 208, 255, 0.5);
  flex: none;
}

.howto-body {
  width: min(520px, 100%);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
  padding-bottom: 8px;
}

.howto-sec h3 {
  font-size: clamp(14px, 2.8vw, 17px);
  color: var(--c-gold);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}
.howto-sec ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
  font-size: clamp(12px, 2.4vw, 15px);
  line-height: 1.6;
  color: var(--c-text);
}
.howto-sec ul:not(.howto-list) li { padding-left: 1.1em; position: relative; }
.howto-sec ul:not(.howto-list) li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--c-dim);
}
.howto-sec b { color: var(--c-mint); font-weight: 700; }

/* アイコン付きの行は、丸を文章の中に流し込む（折り返しが崩れないように） */
.howto-list li { display: block; }

.chip {
  display: inline-block;
  vertical-align: -0.24em;
  width: 17px;
  height: 17px;
  margin-right: 2px;
  border-radius: 0;
}
/* ゲーム内のドットと同じく、単色のベタ塗り */
.chip-c0 { background: #3fd0ff; }
.chip-c1 { background: #ff5f9e; }
.chip-c2 { background: #a6ee4a; }
.chip-c3 { background: #ffb03a; }
.chip-c4 { background: #b07bff; }

/* ---------- タイトルフッター ---------- */
.title-footer {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: clamp(11px, 2vw, 13px);
  color: var(--c-dim);
  text-align: center;
}
.footer-version { opacity: 0.85; }
.footer-copyright a {
  color: var(--c-mint);
  text-decoration: none;
  transition: text-shadow 0.15s;
}
.footer-copyright a:hover {
  text-decoration: underline;
  text-shadow: 0 0 10px rgba(111, 242, 214, 0.6);
}

/* ---------- モバイル微調整 ---------- */
@media (max-height: 700px) {
  .screen { gap: 10px; }
  .controls-hint { display: none; }
  #title-ranking { display: none; }
}
@media (max-height: 620px) {
  .title-footer { position: static; margin-top: 6px; }
}
/* 小さい画面ではロゴを縮め、右上のサウンドボタンと重ならないように上を空ける */
@media (max-width: 360px), (max-height: 640px) {
  .title-jp { font-size: clamp(30px, 8.2vw, 52px); }
  .title-en { font-size: clamp(12px, 2.6vw, 18px); letter-spacing: 0.42em; }
  #screen-title { padding-top: 58px; }
  .howto-title { margin-top: 4px; }
}

/* ---------- 全国ランキング（SGRanking 共通モジュール） ---------- */
.sgr-hidden {
  display: none !important;
}

.sgr-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(6, 10, 32, 0.74);
  backdrop-filter: blur(3px);
}

.sgr-panel {
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(14, 22, 56, 0.96);
  color: var(--c-text);
  border: 1px solid rgba(111, 199, 255, 0.35);
  border-radius: 12px;
  padding: 20px 18px;
  box-shadow: 0 0 30px rgba(111, 199, 255, 0.18), 0 12px 40px rgba(0, 0, 0, 0.6);
}

.sgr-title {
  margin: 0;
  font-size: 20px;
  text-align: center;
  color: var(--c-text);
  text-shadow: 0 0 14px rgba(111, 199, 255, 0.45);
}

.sgr-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.sgr-tab {
  border: 1px solid rgba(142, 160, 200, 0.5);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  font-family: var(--font-jp);
  background: rgba(18, 26, 62, 0.82);
  color: var(--c-text);
  cursor: pointer;
}

.sgr-tab-active {
  background: linear-gradient(135deg, var(--c-sky) 0%, #2f7fd6 100%);
  border-color: transparent;
  color: #04203c;
}

.sgr-register-msg {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  color: var(--c-gold);
  text-shadow: 0 0 12px rgba(255, 207, 92, 0.4);
}

.sgr-form {
  display: flex;
  gap: 8px;
}

.sgr-name {
  flex: 1;
  min-width: 0;
  font-size: 16px; /* iOSズーム防止のため16px以上 */
  font-family: var(--font-jp);
  padding: 8px 10px;
  border: 2px solid rgba(142, 160, 200, 0.5);
  border-radius: 8px;
  background: rgba(6, 10, 32, 0.8);
  color: var(--c-text);
  -webkit-user-select: text;
  user-select: text;
}

.sgr-name::placeholder {
  color: var(--c-dim);
}

.sgr-name:focus {
  outline: none;
  border-color: var(--c-sky);
  box-shadow: 0 0 12px rgba(111, 199, 255, 0.35);
}

.sgr-submit {
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: bold;
  font-family: var(--font-jp);
  background: linear-gradient(135deg, var(--c-sky) 0%, #2f7fd6 100%);
  color: #04203c;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.sgr-submit:hover { filter: brightness(1.12); }
.sgr-submit:active { transform: scale(0.95); }
.sgr-submit:disabled { opacity: 0.5; cursor: default; }

.sgr-error {
  margin: 6px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--c-pink);
}

.sgr-status {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--c-dim);
}

.sgr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.sgr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
}
.sgr-row:nth-child(even) { background: rgba(142, 160, 200, 0.08); }

.sgr-row-me {
  background: rgba(111, 199, 255, 0.16) !important;
  box-shadow: inset 0 0 0 1px rgba(111, 199, 255, 0.5);
}

.sgr-rank {
  width: 2em;
  text-align: center;
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--c-dim);
  flex: none;
}
.sgr-rank-top1, .sgr-rank-top2, .sgr-rank-top3 { font-size: 16px; }

.sgr-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sgr-row-score {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--c-mint);
  flex: none;
}

.sgr-close {
  border: 1px solid rgba(142, 160, 200, 0.5);
  border-radius: 999px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: bold;
  font-family: var(--font-jp);
  background: rgba(18, 26, 62, 0.82);
  color: var(--c-text);
  cursor: pointer;
  transition: border-color 0.15s;
}
.sgr-close:hover { border-color: var(--c-mint); }

/* ゲームオーバー画面に差し込む登録CTA */
.sgr-cta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.sgr-cta-msg {
  margin: 0;
  font-size: clamp(13px, 2.6vw, 16px);
  font-weight: bold;
  color: var(--c-gold);
  text-shadow: 0 0 12px rgba(255, 207, 92, 0.5);
  animation: record-blink 0.9s ease-in-out infinite;
}

.sgr-cta-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 36px;
  font-size: clamp(14px, 2.8vw, 17px);
  font-weight: bold;
  font-family: var(--font-jp);
  background: linear-gradient(135deg, var(--c-gold) 0%, #f0a52c 100%);
  color: #3d2400;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 207, 92, 0.4);
  transition: filter 0.15s, transform 0.1s;
}
.sgr-cta-btn:hover { filter: brightness(1.1); }
.sgr-cta-btn:active { transform: scale(0.95); }

.sgr-cta-link {
  border: none;
  background: none;
  font-size: 13px;
  font-family: var(--font-jp);
  color: var(--c-mint);
  text-decoration: underline;
  cursor: pointer;
}

/* ==========================================================================
   フッター固定バナー広告（スマホ表示時のみ / js/ad-banner.js が挿入する）
   --ad-h    : 広告そのものの高さ。広告なしのときは 0px
   --ad-space: レイアウトが空けるべき高さ（広告 + セーフエリア）
   ========================================================================== */
:root {
  --ad-h: 0px;
  --ad-space: 0px;
}
html.has-ad-banner {
  --ad-space: calc(var(--ad-h, 0px) + env(safe-area-inset-bottom, 0px));
}

.ad-banner {
  /* height は広告そのものの高さ。セーフエリアぶんの padding は外側に足す */
  box-sizing: content-box;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* ランキング・リザルト等の全画面オーバーレイ（2147483000）よりは下に置く */
  z-index: 2147482000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  height: var(--ad-h, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  background: rgba(14, 16, 20, 0.86);
  /* border ではなく inset shadow にして、枠線ぶん高さがずれないようにする */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.ad-banner__frame {
  display: block;
  width: 100%;
  height: var(--ad-h, 0px);
  border: 0;
  color-scheme: light;
}

@media print {
  .ad-banner { display: none; }
}
