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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a5ec4;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

/* 3D の描画面。共通ヘッダー（--sgh-top）とフッター固定バナー広告（--ad-space）の
   ぶんだけ縮める。body の padding-top ではなく自前の固定枠にすることで、
   JS 側（resize()）が canvas の実寸をそのまま測れる（＝画面比がずれない） */
#game {
  display: block;
  position: fixed;
  top: var(--sgh-top, 0px);
  left: 0;
  width: 100%;
  height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
}

.hidden { display: none !important; }

/* =========================================================
   HUD
========================================================= */
#hud {
  position: fixed;
  /* 共通ヘッダーぶんだけ下げる（--sgh-top はセーフエリア込みなので、ここで足し直さない） */
  top: calc(10px + var(--sgh-top, env(safe-area-inset-top, 0px)));
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 5;
  text-align: center;
}
#hud-stage {
  display: inline-block;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .06em;
  background: linear-gradient(180deg, #4aa8ff, #1f6fe0);
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 4px 26px;
  box-shadow: 0 4px 0 rgba(9, 48, 120, .45), 0 8px 18px rgba(0, 20, 60, .35);
  text-shadow: 0 2px 0 rgba(9, 48, 120, .5);
}
#progress-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
#progress-bar {
  width: min(58vw, 300px);
  height: 16px;
  background: rgba(9, 40, 100, .45);
  border: 3px solid #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 20, 60, .3);
}
#progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(180deg, #ffe57a 0%, #ffb300 60%, #ff9800 100%);
  border-radius: 6px;
  transition: width .15s linear;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .6);
}
#progress-crown {
  font-size: 20px;
  filter: drop-shadow(0 2px 3px rgba(0, 20, 60, .5));
}

/* =========================================================
   浮遊テキスト（ゲート効果）
========================================================= */
#float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}
.float-text {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 56px;
  -webkit-text-stroke: 3px rgba(10, 30, 80, .65);
  text-shadow: 0 4px 0 rgba(10, 30, 80, .35), 0 8px 22px rgba(0, 20, 60, .45);
  animation: floatUp 1.1s ease-out forwards;
}
.float-text.gold {
  font-size: 74px;
  animation: floatUpGold 1.2s ease-out forwards;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.5); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  30%  { transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}
@keyframes floatUpGold {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.4) rotate(-8deg); }
  18%  { opacity: 1; transform: translate(-50%, -52%) scale(1.35) rotate(3deg); }
  34%  { transform: translate(-50%, -55%) scale(1.05) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -175%) scale(1.05); }
}

/* =========================================================
   スクリーン共通
========================================================= */
.screen {
  position: fixed;
  inset: 0;
  /* フッター固定バナー広告ぶんだけ縮める（広告なしのときは 0px） */
  /* 共通ヘッダーぶんだけ下げる */
  top: var(--sgh-top, 0px);
  bottom: var(--ad-space, 0px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 広告ぶん縮んで中身がはみ出したとき、上端が見切れないようにする */
  justify-content: safe center;
  gap: 18px;
  z-index: 10;
  text-align: center;
  color: #fff;
  /* 広告があるときは --ad-space がセーフエリア込みなので、下のセーフエリアは広告が無いときだけ足す */
  padding: 24px 20px calc(24px + max(0px, env(safe-area-inset-bottom, 0px) - var(--ad-space, 0px)));
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(16, 58, 140, .78);
  backdrop-filter: blur(4px);
}
/* 縦が足りないときにボタンが潰れて文字が切れないようにする（はみ出したぶんは .screen がスクロールする） */
.screen > .btn { flex-shrink: 0; }

/* メニュー系（タイトル・選択・ガチャ）はリッチな青空背景 */
.screen.menu {
  background:
    radial-gradient(130% 80% at 50% -10%, rgba(150, 215, 255, .85) 0%, rgba(80, 165, 245, .3) 45%, transparent 70%),
    linear-gradient(180deg, #3d95f5 0%, #1e63cc 55%, #123f96 100%);
  backdrop-filter: none;
}
.screen.menu::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, .05) 0 16px,
    transparent 16px 52px
  );
}

.screen-title {
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 900;
  letter-spacing: .08em;
  color: #fff;
  text-shadow:
    0 3px 0 #1450a8,
    0 6px 0 rgba(9, 40, 100, .45),
    0 10px 24px rgba(0, 20, 60, .5);
}

/* =========================================================
   タイトル
========================================================= */
/* ロゴ＋キャッチのまとまり（<header>）。
   .screen の縦並び・間隔をそのまま引き継ぎ、見た目は据え置く */
.title-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: inherit;
  width: 100%;
  /* footer 側の margin-top: auto と対（もとは .logo-wrap が担っていた） */
  margin-top: auto;
}

.logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* footer 側の margin-top: auto と対で、コンテンツを中央・フッターを最下部に配置 */
  margin-top: auto;
}
/* サンバーストは position:fixed（スクロール領域を一切広げない） */
.logo-wrap::before {
  content: "";
  position: fixed;
  left: 50%;
  top: 30%;
  width: min(140vmin, 700px);
  height: min(140vmin, 700px);
  margin-left: calc(min(140vmin, 700px) / -2);
  margin-top: calc(min(140vmin, 700px) / -2);
  background: repeating-conic-gradient(
    rgba(255, 255, 255, .16) 0deg 9deg,
    transparent 9deg 22deg
  );
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 62%);
  mask-image: radial-gradient(circle, #000 25%, transparent 62%);
  animation: sunSpin 26s linear infinite;
  pointer-events: none;
}
@keyframes sunSpin {
  to { transform: rotate(360deg); }
}
.logo {
  position: relative;
  width: min(84vw, 470px);
  height: auto;
  filter: drop-shadow(0 16px 30px rgba(0, 25, 80, .5));
  animation: logoFloat 3.2s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-10px) rotate(-1deg); }
}

.catch {
  position: relative;
  display: inline-block;
  background: #10131c;
  color: #fff;
  font-weight: 900;
  font-size: clamp(15px, 4.4vw, 21px);
  padding: 10px 28px;
  transform: skewX(-8deg) rotate(-2deg);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 10, 40, .5);
  letter-spacing: .05em;
}
.catch .y { color: #ffd54a; }

/* 共通ヘッダーとフッター広告で縦が詰まったときにタイトル画面を収める */
@media (max-height: 820px) {
  .screen { gap: 10px; }
  .logo { width: min(66vw, 360px); }
  .catch { padding: 7px 22px; }
  .desc { line-height: 1.7; padding: 9px 20px; }
}

.desc {
  position: relative;
  font-size: clamp(14px, 3.9vw, 17px);
  font-weight: 800;
  line-height: 1.9;
  background: rgba(255, 255, 255, .95);
  color: #14418f;
  border: 3px solid #fff;
  border-radius: 18px;
  padding: 12px 26px;
  box-shadow: 0 6px 0 rgba(9, 48, 120, .22), 0 12px 26px rgba(0, 20, 60, .3);
}
.desc .blue { color: #1e88e5; }
.desc .red  { color: #e53935; }

/* バッジ（進捗・ポイント） */
.badge-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.progress-text, .points-text {
  display: inline-block;
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 900;
  color: #fff;
  background: rgba(9, 40, 100, .45);
  border: 2px solid rgba(255, 255, 255, .5);
  border-radius: 999px;
  padding: 6px 20px;
  letter-spacing: .03em;
}
.progress-text:empty, .points-text:empty { display: none; }
.points-text { color: #ffe082; }

/* =========================================================
   ボタン
========================================================= */
.btn {
  position: relative;
  overflow: hidden;
  font-family: inherit;
  font-size: clamp(17px, 4.6vw, 22px);
  font-weight: 900;
  letter-spacing: .04em;
  color: #5d3200;
  background: linear-gradient(180deg, #ffe259 0%, #ffc107 55%, #ffa801 100%);
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 13px 48px;
  cursor: pointer;
  box-shadow:
    0 6px 0 #c77c00,
    0 12px 24px rgba(0, 20, 60, .4),
    inset 0 2px 2px rgba(255, 255, 255, .7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
  transition: transform .08s, box-shadow .08s;
}
.btn::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -80%;
  width: 46%;
  height: 220%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transform: rotate(18deg);
  animation: shineSweep 3s ease-in-out infinite;
  pointer-events: none;
}
/* left ではなく transform で動かす（合成だけで済み、毎フレームのレイアウトが起きない）。
   移動量はボタン幅の 240%（left: -80% → 160%）＝ 自身の幅（46%）の 240 / 46 倍 */
@keyframes shineSweep {
  0%, 55% { transform: translateX(0) rotate(18deg); }
  85%, 100% { transform: translateX(521.74%) rotate(18deg); }
}
.btn:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 #c77c00,
    0 6px 14px rgba(0, 20, 60, .4),
    inset 0 2px 2px rgba(255, 255, 255, .7);
}
.btn-big {
  font-size: clamp(20px, 5.6vw, 26px);
  padding: 16px 58px;
  animation: btnBeat 1.6s ease-in-out infinite;
}
@keyframes btnBeat {
  0%, 100% { scale: 1; }
  50% { scale: 1.045; }
}
.btn-sub {
  font-size: clamp(14px, 4vw, 17px);
  padding: 10px 34px;
  color: #1a4b9c;
  background: linear-gradient(180deg, #ffffff, #dbe7ff);
  box-shadow:
    0 5px 0 #9db7e8,
    0 10px 20px rgba(0, 20, 60, .3),
    inset 0 2px 2px rgba(255, 255, 255, .9);
  text-shadow: none;
}
.btn-sub:active {
  box-shadow: 0 1px 0 #9db7e8, 0 5px 12px rgba(0, 20, 60, .3), inset 0 2px 2px rgba(255, 255, 255, .9);
}
.btn-gacha {
  font-size: clamp(15px, 4.2vw, 18px);
  padding: 11px 34px;
  color: #fff;
  background: linear-gradient(180deg, #d97bf2 0%, #a832d6 60%, #8e24aa 100%);
  box-shadow:
    0 5px 0 #5e1178,
    0 10px 20px rgba(0, 20, 60, .35),
    inset 0 2px 2px rgba(255, 255, 255, .5);
  text-shadow: 0 2px 0 rgba(80, 10, 110, .5);
}
.btn-gacha:active {
  box-shadow: 0 1px 0 #5e1178, 0 5px 12px rgba(0, 20, 60, .35), inset 0 2px 2px rgba(255, 255, 255, .5);
}
.btn:disabled {
  filter: grayscale(.6) brightness(.85);
  cursor: default;
}

.btn-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.btn-row-h {
  position: relative;
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.hint {
  position: relative;
  font-size: 13px;
  font-weight: 700;
  opacity: .8;
}

/* ---- フッター（タイトル画面最下部） ---- */
#site-footer {
  position: relative;
  margin-top: auto;
  padding-top: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  color: rgba(255, 255, 255, .75);
  letter-spacing: .03em;
}
#site-footer .ftitle {
  font-size: 11px;
}
#site-footer a {
  color: #cfe8ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#site-footer a:active {
  color: #ffe082;
}

/* =========================================================
   ステージ選択
========================================================= */
#stage-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: min(90vw, 430px);
  max-height: 48vh;
  overflow-y: auto;
  padding: 6px;
}
.stage-btn {
  font-family: inherit;
  aspect-ratio: 1;
  border-radius: 16px;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #1a4b9c;
  background: linear-gradient(180deg, #ffffff, #dce8ff);
  border: 3px solid #fff;
  box-shadow: 0 4px 0 #9db7e8, 0 7px 14px rgba(0, 20, 60, .25);
  transition: transform .08s;
}
.stage-btn:active { transform: translateY(3px); }
.stage-btn .star { font-size: 13px; line-height: 1; }
.stage-btn.cleared {
  color: #6b3c00;
  background: linear-gradient(180deg, #ffe57a, #ffb300);
  border-color: #fff3c2;
  box-shadow: 0 4px 0 #c07d00, 0 7px 14px rgba(0, 20, 60, .25);
}
.stage-btn.next {
  color: #fff;
  background: linear-gradient(180deg, #63c1ff, #1f78e8);
  border-color: #fff;
  text-shadow: 0 2px 0 rgba(9, 48, 120, .5);
  animation: nextGlow 1.3s ease-in-out infinite;
}
@keyframes nextGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 0 #0f4fae, 0 0 0 0 rgba(120, 210, 255, .8); }
  50% { transform: scale(1.07); box-shadow: 0 4px 0 #0f4fae, 0 0 0 9px rgba(120, 210, 255, 0); }
}
.stage-btn.locked {
  background: rgba(10, 30, 70, .4);
  color: rgba(255, 255, 255, .45);
  border-color: rgba(255, 255, 255, .18);
  cursor: default;
  box-shadow: none;
}
/* スマホ幅では右下のサウンドボタン（下から 14px + 48px）が「タイトルへ」の右端に重なるので、
   そのぶん下を空ける（ステージ一覧が縮んで中でスクロールする） */
@media (max-width: 480px) {
  #select-screen {
    padding-bottom: calc(72px + max(0px, env(safe-area-inset-bottom, 0px) - var(--ad-space, 0px)));
  }
}

/* =========================================================
   クリア / ゲームオーバー
========================================================= */
.clear-title {
  font-size: clamp(38px, 10vw, 60px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: .02em;
  background: linear-gradient(180deg, #fff3b0 0%, #ffd54a 45%, #f9a825 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 3px 0 #a35d00)
    drop-shadow(0 7px 2px rgba(20, 40, 90, .55))
    drop-shadow(0 0 26px rgba(255, 213, 74, .6));
  animation: stampIn .5s cubic-bezier(.2, 1.8, .4, 1);
}
.over-title {
  font-size: clamp(38px, 10vw, 60px);
  font-weight: 900;
  font-style: italic;
  color: #ff5252;
  -webkit-text-stroke: 2px #fff;
  text-shadow: 0 4px 0 #7f1010, 0 8px 24px rgba(0, 0, 0, .5);
  animation: stampIn .5s cubic-bezier(.2, 1.8, .4, 1);
}
@keyframes stampIn {
  from { transform: scale(2.2) rotate(6deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

.result-card {
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 800;
  line-height: 1.9;
  background: rgba(255, 255, 255, .95);
  color: #14418f;
  border: 3px solid #fff;
  border-radius: 18px;
  padding: 14px 30px;
  box-shadow: 0 6px 0 rgba(9, 48, 120, .22), 0 12px 26px rgba(0, 20, 60, .35);
}
.pt-gain { color: #e8871a; font-weight: 900; }

/* =========================================================
   ガチャ
========================================================= */
#gacha-result {
  position: relative;
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#gacha-result::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  background: radial-gradient(circle, rgba(255, 255, 255, .5) 0%, transparent 65%);
  pointer-events: none;
}
#gacha-capsule {
  position: relative;
  font-size: 88px;
  filter: drop-shadow(0 10px 18px rgba(0, 20, 60, .45));
  animation: capsuleBob 2s ease-in-out infinite;
}
@keyframes capsuleBob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}
#gacha-capsule.shaking {
  animation: capShake .12s linear infinite;
}
@keyframes capShake {
  0% { transform: rotate(-16deg) scale(1.05); }
  50% { transform: rotate(16deg) scale(1.12); }
  100% { transform: rotate(-16deg) scale(1.05); }
}
#gacha-msg {
  position: relative;
  min-height: 1.4em;
  font-size: 15px;
  font-weight: 900;
  color: #ffe082;
  text-shadow: 0 2px 6px rgba(0, 20, 60, .5);
}
#gacha-msg.error { color: #ffab91; }

.gacha-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  color: #1a1a2e;
  border-radius: 18px;
  padding: 16px 30px;
  animation: cardIn .5s cubic-bezier(.2, 1.7, .4, 1);
  border: 4px solid #9e9e9e;
  box-shadow: 0 10px 24px rgba(0, 20, 60, .4);
}
@keyframes cardIn {
  from { transform: scale(.15) rotate(-12deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
.gacha-card .rarity { font-size: 13px; font-weight: 900; letter-spacing: 2px; }
.gacha-card .sname  { font-size: 19px; font-weight: 900; }
.gacha-card .seffect { font-size: 13px; font-weight: 800; color: #555; }
.gacha-card.rar-N   { border-color: #b0bec5; }
.gacha-card.rar-R   { border-color: #29b6f6; box-shadow: 0 0 22px rgba(41, 182, 246, .8), 0 10px 24px rgba(0, 20, 60, .4); }
.gacha-card.rar-SR  { border-color: #ab47bc; box-shadow: 0 0 28px rgba(171, 71, 188, .9), 0 10px 24px rgba(0, 20, 60, .4); }
.gacha-card.rar-SSR {
  border-color: #ffb300;
  box-shadow: 0 0 36px rgba(255, 179, 0, 1), 0 10px 24px rgba(0, 20, 60, .4);
  animation: cardIn .5s cubic-bezier(.2, 1.7, .4, 1), ssrGlow 1.2s ease-in-out infinite .5s;
}
@keyframes ssrGlow {
  0%, 100% { box-shadow: 0 0 26px rgba(255, 179, 0, .8), 0 10px 24px rgba(0, 20, 60, .4); }
  50% { box-shadow: 0 0 48px rgba(255, 200, 40, 1), 0 10px 24px rgba(0, 20, 60, .4); }
}
.rar-N   .rarity { color: #757575; }
.rar-R   .rarity { color: #0288d1; }
.rar-SR  .rarity { color: #8e24aa; }
.rar-SSR .rarity { color: #ff8f00; }

#skin-list {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  width: min(92vw, 460px);
  max-height: 30vh;
  /* 縦が足りないときは一覧が縮んで中でスクロールするが、カード1段ぶんは残す */
  min-height: min(120px, 30vh);
  overflow-y: auto;
  padding: 6px;
}
.skin-card {
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  color: #1a1a2e;
  border-radius: 14px;
  padding: 9px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(9, 48, 120, .25);
  transition: transform .08s;
}
.skin-card:active { transform: translateY(2px); }
.skin-card .sname { font-size: 11px; font-weight: 900; line-height: 1.2; }
.skin-card .seffect { font-size: 10px; color: #555; font-weight: 800; }
.skin-card .rarity { font-size: 10px; font-weight: 900; letter-spacing: 1px; }
.skin-card.rar-N   .rarity { color: #757575; }
.skin-card.rar-R   .rarity { color: #0288d1; }
.skin-card.rar-SR  .rarity { color: #8e24aa; }
.skin-card.rar-SSR .rarity { color: #ff8f00; }
.skin-card.equipped {
  border-color: #ffb300;
  background: linear-gradient(180deg, #fff8e1, #ffecb3);
  box-shadow: 0 4px 0 #c07d00, 0 0 14px rgba(255, 179, 0, .7);
}
.skin-card.equipped::after {
  content: "Equipped";
  font-size: 10px;
  font-weight: 900;
  color: #e65100;
}
.skin-card.unowned {
  opacity: .5;
  cursor: default;
  filter: grayscale(.9);
}

/* =========================================================
   サウンドボタン
========================================================= */
#btn-sound {
  position: fixed;
  /* フッター固定バナー広告に隠れないよう持ち上げる（広告なしのときは 0px）。
     --ad-space はセーフエリア込みなので、セーフエリアとは大きいほうだけを使う */
  bottom: calc(14px + max(env(safe-area-inset-bottom, 0px), var(--ad-space, 0px)));
  right: 14px;
  z-index: 20;
  font-size: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #4aa8ff, #1f6fe0);
  box-shadow: 0 4px 0 rgba(9, 48, 120, .45), 0 8px 16px rgba(0, 20, 60, .35);
  cursor: pointer;
}
#btn-sound:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(9, 48, 120, .45); }

/* ==========================================================================
   フッター固定バナー広告（スマホ表示時のみ / 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; }
}
