/* ============================================================
   マンカラ - style.css
   縦画面: 縦型ボード（2列×6段＋上下ゴール）
   広い画面: 横型ボード（2行×6列＋左右ゴール）
   ============================================================ */

:root {
  --bg: #f7f3ec;
  --bg-deco: #efe8dc;
  --ink: #3d3833;
  --ink-soft: #8a817a;
  --card: #ffffff;
  --line: #e6ddd1;
  --wood: #a06c3f;
  --wood-dark: #83552e;
  --wood-edge: #6f4523;
  --pit: #7c4f2b;
  --pit-dark: #643e20;
  --accent: #f0a532;
  --danger: #e05a5a;
  --stone-red: #e85d75;
  --stone-blue: #4fa3e0;
  --stone-green: #66bb6a;
  --stone-yellow: #f2b134;
  --stone-purple: #9575cd;
  --shadow: 0 4px 14px rgba(90, 70, 40, .12);
  --shadow-soft: 0 2px 6px rgba(90, 70, 40, .08);
  --radius: 18px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(var(--bg-deco) 9%, transparent 10%),
    radial-gradient(var(--bg-deco) 9%, transparent 10%);
  background-size: 42px 42px;
  background-position: 0 0, 21px 21px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app {
  min-height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  /* 上のセーフエリアは共通ヘッダー（body の padding-top = --sgh-top）が確保済みなので足さない */
  padding: 14px calc(14px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  animation: screen-in .3s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.hidden { display: none !important; }

/* ---------- ボタン共通 ---------- */

.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:active { transform: scale(.96); }

.btn:disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}

.btn-big {
  width: 100%;
  font-size: 18px;
  padding: 16px 24px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 5px 0 #cf861b, var(--shadow-soft);
}

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #cf861b, var(--shadow-soft);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  font-size: 19px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: transform .12s ease;
}

.icon-btn:active { transform: scale(.92); }

/* ---------- タイトル画面 ---------- */

.title-inner {
  flex: 1;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 0;
}

.title-logo {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: bob 3s ease-in-out infinite;
  background: #f2e2c8;
}

.title-logo svg { width: 100%; height: 100%; display: block; }

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}

.title-jp {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .06em;
}

.title-desc {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 8px;
}

.menu-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-mode-icon { font-size: 24px; }

/* 設定パネル */

.config-group {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 16px;
}

.config-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.config-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-top: 10px;
}

.seg {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border-radius: 999px;
  padding: 5px;
}

.seg-btn {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 9px 4px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}

.seg-btn.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

#game-config.pvp .cpu-only { display: none; }

/* ---------- ゲーム画面 ---------- */

#game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

#game-mode-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  flex: 1;
  text-align: center;
}

.header-right {
  display: flex;
  gap: 8px;
}

/* スコアボード */

#scoreboard {
  width: 100%;
  max-width: 440px;
  display: grid;
  grid-template-columns: 1fr .9fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.score-card {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 8px 6px 7px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: border-color .2s ease, transform .2s ease;
}

.score-card.is-turn {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.score-chip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18);
}

.chip-p1 { background: radial-gradient(circle at 35% 30%, #f7889b, var(--stone-red) 70%); }
.chip-p2 { background: radial-gradient(circle at 35% 30%, #7fc0ec, var(--stone-blue) 70%); }

.score-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.score-value {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.score-value.bump { animation: value-bump .35s cubic-bezier(.2, 1.5, .4, 1); }

@keyframes value-bump {
  0% { scale: 1; }
  40% { scale: 1.35; }
  100% { scale: 1; }
}

.score-cap {
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1;
}

.score-card-record { justify-content: center; }

.score-wins {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ステータス */

#status {
  font-size: 16px;
  font-weight: 800;
  min-height: 26px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#status.thinking::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 3px solid var(--line);
  border-top-color: var(--ink-soft);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 盤面 ---------- */

#board-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

#board {
  --pit-h: clamp(46px, 8.6dvh, 76px);
  --store-h: clamp(44px, 7dvh, 60px);
  --stone-size: clamp(14px, 2.3dvh, 19px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: var(--store-h) repeat(6, var(--pit-h)) var(--store-h);
  gap: 7px;
  width: min(92vw, 330px);
  background: linear-gradient(160deg, var(--wood) 0%, var(--wood-dark) 100%);
  border: 4px solid var(--wood-edge);
  border-radius: 26px;
  padding: 10px;
  box-shadow: 0 8px 22px rgba(90, 55, 20, .35), inset 0 2px 3px rgba(255, 235, 200, .35);
}

/* 縦型レイアウトの位置（あなた: 右列を上→下、ゴールは下） */
.pos-13 { grid-area: 1 / 1 / 2 / 3; }
.pos-12 { grid-area: 2 / 1 / 3 / 2; }
.pos-11 { grid-area: 3 / 1 / 4 / 2; }
.pos-10 { grid-area: 4 / 1 / 5 / 2; }
.pos-9  { grid-area: 5 / 1 / 6 / 2; }
.pos-8  { grid-area: 6 / 1 / 7 / 2; }
.pos-7  { grid-area: 7 / 1 / 8 / 2; }
.pos-0  { grid-area: 2 / 2 / 3 / 3; }
.pos-1  { grid-area: 3 / 2 / 4 / 3; }
.pos-2  { grid-area: 4 / 2 / 5 / 3; }
.pos-3  { grid-area: 5 / 2 / 6 / 3; }
.pos-4  { grid-area: 6 / 2 / 7 / 3; }
.pos-5  { grid-area: 7 / 2 / 8 / 3; }
.pos-6  { grid-area: 8 / 1 / 9 / 3; }

/* 横型レイアウト（広い画面） */
@media (min-width: 600px) {
  #board {
    --pit-h: clamp(64px, 10vw, 86px);
    --stone-size: clamp(16px, 2.6vw, 21px);
    grid-template-columns: clamp(56px, 9vw, 76px) repeat(6, 1fr) clamp(56px, 9vw, 76px);
    grid-template-rows: repeat(2, var(--pit-h)) ;
    width: min(94vw, 680px);
    gap: 9px;
    padding: 14px;
  }
  .pos-13 { grid-area: 1 / 1 / 3 / 2; }
  .pos-12 { grid-area: 1 / 2 / 2 / 3; }
  .pos-11 { grid-area: 1 / 3 / 2 / 4; }
  .pos-10 { grid-area: 1 / 4 / 2 / 5; }
  .pos-9  { grid-area: 1 / 5 / 2 / 6; }
  .pos-8  { grid-area: 1 / 6 / 2 / 7; }
  .pos-7  { grid-area: 1 / 7 / 2 / 8; }
  .pos-0  { grid-area: 2 / 2 / 3 / 3; }
  .pos-1  { grid-area: 2 / 3 / 3 / 4; }
  .pos-2  { grid-area: 2 / 4 / 3 / 5; }
  .pos-3  { grid-area: 2 / 5 / 3 / 6; }
  .pos-4  { grid-area: 2 / 6 / 3 / 7; }
  .pos-5  { grid-area: 2 / 7 / 3 / 8; }
  .pos-6  { grid-area: 1 / 8 / 3 / 9; }
}

/* ポケット・ゴール共通 */

.pit, .store {
  position: relative;
  border: none;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 38%, var(--pit-dark) 0%, var(--pit) 78%);
  box-shadow:
    inset 0 4px 8px rgba(30, 15, 0, .55),
    inset 0 -2px 3px rgba(255, 220, 170, .25);
  padding: 0;
  font-family: inherit;
}

.pit {
  cursor: default;
  transition: box-shadow .2s ease, filter .2s ease;
}

/* 打てるポケット */
.pit.can-play {
  cursor: pointer;
  box-shadow:
    inset 0 4px 8px rgba(30, 15, 0, .55),
    inset 0 -2px 3px rgba(255, 220, 170, .25),
    0 0 0 3px var(--accent);
  animation: can-play-pulse 1.8s ease-in-out infinite;
}

@keyframes can-play-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.22); }
}

@media (hover: hover) {
  .pit.can-play:hover { filter: brightness(1.3); animation: none; }
}

.pit:focus-visible, .store:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

#board.locked .pit { pointer-events: none; }

/* まいた石が入った瞬間のハイライト */
.pit.drop-flash, .store.drop-flash {
  animation: drop-flash .3s ease;
}

@keyframes drop-flash {
  0% { filter: brightness(1.65); }
  100% { filter: brightness(1); }
}

/* カラハのゲット演出 */
.pit.capture-flash {
  animation: capture-flash .55s ease;
}

@keyframes capture-flash {
  0%, 60% { box-shadow: inset 0 4px 8px rgba(30, 15, 0, .55), 0 0 0 3px var(--danger), 0 0 16px var(--danger); }
  100% { box-shadow: inset 0 4px 8px rgba(30, 15, 0, .55); }
}

/* 最後に石が落ちたマーカー */
.pit.last-drop::after, .store.last-drop::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  pointer-events: none;
}

/* 石 */

.stone {
  position: absolute;
  width: var(--stone-size, 20px);
  height: var(--stone-size, 20px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 3px rgba(20, 8, 0, .45), inset 0 -2px 3px rgba(0, 0, 0, .25), inset 0 2px 2px rgba(255, 255, 255, .5);
  pointer-events: none;
}

.stone.c0 { background: radial-gradient(circle at 35% 30%, #f7a8b5, var(--stone-red) 75%); }
.stone.c1 { background: radial-gradient(circle at 35% 30%, #a8d4f2, var(--stone-blue) 75%); }
.stone.c2 { background: radial-gradient(circle at 35% 30%, #b0e0b3, var(--stone-green) 75%); }
.stone.c3 { background: radial-gradient(circle at 35% 30%, #f8d58a, var(--stone-yellow) 75%); }
.stone.c4 { background: radial-gradient(circle at 35% 30%, #c8b5e8, var(--stone-purple) 75%); }

.stone.pop { animation: stone-pop .28s cubic-bezier(.2, 1.5, .4, 1) both; }

@keyframes stone-pop {
  0% { scale: .2; opacity: 0; }
  100% { scale: 1; opacity: 1; }
}

.stone.vanish { animation: stone-vanish .4s ease both; }

@keyframes stone-vanish {
  to { scale: .2; opacity: 0; }
}

/* ハンドから落ちてくる石 */
.stone.drop { animation: stone-drop .32s cubic-bezier(.3, 0, .4, 1.3) both; }

@keyframes stone-drop {
  0%   { translate: 0 -30px; scale: 1.2; opacity: 0; }
  55%  { translate: 0 2px; opacity: 1; }
  100% { translate: 0 0; scale: 1; opacity: 1; }
}

/* 手に取られてハンドへ吸い込まれる石 */
.stone.picked { animation: stone-picked .24s ease-in both; }

@keyframes stone-picked {
  to { translate: 0 -26px; scale: .5; opacity: 0; }
}

/* ポケット間を飛ぶ石（横取り・終局回収） */
.fly-stone {
  position: absolute;
  z-index: 7;
  transition-property: left, top;
  transition-timing-function: cubic-bezier(.45, -.25, .55, 1.1);
}

/* 手持ちの石を示すハンド（残り個数つき） */
.hand {
  position: absolute;
  z-index: 8;
  transform: translate(-50%, -122%);
  transition: left .17s ease, top .17s ease;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(30, 12, 0, .4));
}

.hand-stone {
  position: absolute;
  width: calc(var(--stone-size, 20px) * .95);
  height: calc(var(--stone-size, 20px) * .95);
  border-radius: 50%;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .25), inset 0 2px 2px rgba(255, 255, 255, .5);
}

.hand-stone.hs1 { background: radial-gradient(circle at 35% 30%, #f7a8b5, var(--stone-red) 75%); left: -14px; top: -6px; }
.hand-stone.hs2 { background: radial-gradient(circle at 35% 30%, #f8d58a, var(--stone-yellow) 75%); left: -2px; top: -12px; }
.hand-stone.hs3 { background: radial-gradient(circle at 35% 30%, #a8d4f2, var(--stone-blue) 75%); left: -8px; top: 2px; }

/* 持ち数に合わせてクラスターの石を減らす（バッジの数字が実数） */
.hand[data-n="0"] .hand-stone,
.hand[data-n="1"] .hs2,
.hand[data-n="1"] .hs3,
.hand[data-n="2"] .hs3 { display: none; }

/* 少ないときは中央寄せに配置し直す */
.hand[data-n="1"] .hs1 { left: -9px; top: -8px; }
.hand[data-n="2"] .hs1 { left: -15px; top: -9px; }
.hand[data-n="2"] .hs2 { left: -3px; top: -7px; }

.hand-count {
  position: absolute;
  left: 12px;
  top: -10px;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

/* 石の数バッジ */

.count {
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff8ee;
  border: 1px solid #d9c3a5;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(60, 30, 0, .25);
}

.store .count {
  background: var(--accent);
  border-color: #cf861b;
  color: #fff;
}

.store.store-p2 .count { bottom: auto; top: -7px; }

@media (min-width: 600px) {
  .store .count, .store.store-p2 .count { top: auto; bottom: -8px; }
}

/* トースト（もういっかい！ / ゲット！） */

#event-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(38, 34, 31, .88);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  padding: 14px 26px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 5;
  animation: toast-pop .3s cubic-bezier(.2, 1.4, .4, 1) both;
  pointer-events: none;
}

#event-toast.toast-accent { background: rgba(224, 90, 90, .92); }

@keyframes toast-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#game-buttons {
  margin-top: 16px;
  display: flex;
  gap: 16px;
}

/* ---------- 結果オーバーレイ ---------- */

#result-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 56, 51, .45);
  animation: fade-in .25s ease both;
  padding: 24px;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

#result-panel {
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(40, 30, 15, .3);
  padding: 28px 24px 24px;
  text-align: center;
  animation: panel-pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}

@keyframes panel-pop {
  from { opacity: 0; transform: scale(.8) translateY(16px); }
  to   { opacity: 1; transform: none; }
}

#result-count {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .02em;
  margin-bottom: 8px;
}

#result-text {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

#result-sub {
  font-size: 13px;
  color: var(--ink-soft);
  min-height: 18px;
  margin-bottom: 18px;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- 遊び方モーダル ---------- */

#help-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 56, 51, .45);
  animation: fade-in .25s ease both;
  padding: 24px;
}

#help-panel {
  width: 100%;
  max-width: 380px;
  max-height: min(82dvh, 600px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(40, 30, 15, .3);
  padding: 24px 22px 22px;
  animation: panel-pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}

#help-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 14px;
}

.help-sub {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
  padding-left: 2px;
  color: var(--wood-dark);
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.help-list li {
  font-size: 14px;
  line-height: 1.75;
  padding-left: 20px;
  position: relative;
}

.help-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--wood);
}

/* ---------- 紙吹雪 ---------- */

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

.confetti {
  position: absolute;
  top: -14px;
  width: 10px;
  height: 14px;
  opacity: .95;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: .7;
  }
}

/* ---------- フッター ---------- */

.footer {
  margin-top: auto;
  padding-top: 22px;
  text-align: center;
  font-size: 11px;
  line-height: 1.9;
  color: var(--ink-soft);
}

.footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-game { padding-top: 18px; }

/* ---------- 小さい画面調整 ---------- */

@media (max-height: 700px) {
  .title-logo { width: 76px; height: 76px; }
  .title-jp { font-size: 28px; }
  #scoreboard { margin-bottom: 6px; }
  #status { margin-bottom: 6px; }
  #game-buttons { margin-top: 10px; }
}

/* アニメーションを減らす設定への配慮 */
@media (prefers-reduced-motion: reduce) {
  .title-logo { animation: none; }
  .pit.can-play { animation: none; }
  .stone.pop { animation: none; }
  .stone.drop { animation: none; }
  .stone.picked { animation: none; }
  .confetti { animation-duration: .01s !important; }
}

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