/* ===== ゴルフソリティア - Golf Solitaire ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --felt-1: #2a8c58;
  --felt-2: #0b3a24;
  --bar-1: #123a26;
  --bar-2: #0a2517;
  --gold: #f0d27a;
  --ink: #1e2430;
  --red: #c1272d;
  --card-face: #fdfdf6;
  --cw: 60px;
  --ch: 87px;

  /* 共通ランキングモジュール（js/ranking.js）が使う色 */
  --bg-mid: #0f2c1d;
  --text: #eef5f0;
  --text-dim: #97b3a4;
  --line: rgba(240, 210, 122, .35);
  --accent: #f0d27a;
  --accent3: #ffe9a8;
  --hit: #ff8b8b;
  --font-jp: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", sans-serif;
}

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

body {
  font-family: var(--font-jp);
  background: #082a1a;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

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

/* ===== ヘッダー ===== */
#topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(var(--bar-1), var(--bar-2));
  border-bottom: 1px solid rgba(240, 210, 122, .25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  z-index: 30;
}

#logo-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#logo {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  white-space: nowrap;
}

#mode-badge {
  font-size: 9px;
  font-weight: 700;
  color: #d5e8dd;
  background: rgba(255, 255, 255, .13);
  border-radius: 8px;
  padding: 2px 7px;
  letter-spacing: .04em;
  white-space: nowrap;
}

#topbar-buttons {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background .15s;
}

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

/* ===== ステータスバー ===== */
#statusbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, .28);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  z-index: 29;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
}

.stat-label {
  font-size: 9px;
  color: #94b2a2;
  letter-spacing: .1em;
}

.stat-value {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.stat-value.good { color: #8ee6a8; }
.stat-value.bad { color: #ffc7a0; }

/* ===== 盤面 ===== */
#board-wrap {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
}

#board {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% 0%, rgba(255, 255, 255, .10), transparent 55%),
    radial-gradient(ellipse 140% 120% at 50% 100%, rgba(0, 0, 0, .38), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .016) 0 2px, transparent 2px 6px),
    linear-gradient(var(--felt-1), var(--felt-2));
}

/* スロット（枠） */
.slot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  border: 1.5px dashed rgba(255, 255, 255, .22);
  border-radius: calc(var(--cw) * .1);
  background: rgba(0, 0, 0, .1);
}

.slot.stock-slot { border-color: rgba(255, 255, 255, .34); cursor: pointer; }
.slot.waste-slot { border-color: rgba(240, 210, 122, .42); }

.slot-cap {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  color: #d8ece1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
  text-align: center;
  pointer-events: none;
  z-index: 25;
  white-space: nowrap;
}

/* ===== カード ===== */
.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  will-change: transform;
  transition: transform .24s ease;
  perspective: 600px;
}

.card.no-anim { transition: none; }
.card.moving { z-index: 500 !important; }
.card.tab { cursor: pointer; }        /* 場札は列のどこをタップしても一番下のカードを出す */
.slot.stock-slot { cursor: pointer; }

.card .in {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .3s ease;
}

.card.down .in { transform: rotateY(180deg); }

.card .front,
.card .back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: calc(var(--cw) * .1);
}

.card .front {
  background: linear-gradient(160deg, #ffffff, var(--card-face) 60%, #f1f0e4);
  border: 1px solid #c9c9b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  color: var(--ink);
  overflow: hidden;
}

.card.red .front { color: var(--red); }

.card .back {
  transform: rotateY(180deg);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, .16), transparent 65%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .09) 0 3px, transparent 3px 7px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .10) 0 3px, transparent 3px 7px),
    linear-gradient(160deg, #2f6f96, #123a56);
  border: 1px solid #0d2c42;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.card .back::after {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1.5px solid rgba(255, 255, 255, .32);
  border-radius: calc(var(--cw) * .06);
}

/* 数字とスートは横並びにする。場札は重なって上端しか見えないため、
   インデックスの高さを重なりの最小オフセット（MIN_OFF）に収める必要がある */
.cnr {
  position: absolute;
  top: 2.5%;
  left: 7%;
  display: flex;
  align-items: baseline;
  gap: calc(var(--cw) * .04);
  line-height: 1;
  font-weight: 800;
}

.cnr b { font-size: calc(var(--cw) * .33); letter-spacing: -0.03em; }
.cnr i { font-style: normal; font-size: calc(var(--cw) * .27); }

.pip {
  position: absolute;
  right: 5%;
  bottom: 2%;
  font-size: calc(var(--cw) * .62);
  line-height: 1;
  opacity: .92;
}

.card.tiny .pip { font-size: calc(var(--cw) * .5); opacity: .8; }

/* 出せるカードの目印（設定でON/OFF）。白いカードにも緑のフェルトにも映える水色にする */
.card.playable.assist .front {
  box-shadow: 0 0 0 2.5px #4fd6ff, 0 0 15px 4px rgba(79, 214, 255, .55), 0 2px 8px rgba(0, 0, 0, .5);
}

.card.hint-glow .front,
.card.hint-glow .back {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px 3px rgba(240, 210, 122, .85);
  animation: hintPulse .6s ease-in-out 2;
}

.slot.hint-glow {
  border-color: var(--gold);
  box-shadow: 0 0 14px 3px rgba(240, 210, 122, .85);
  animation: hintPulse .6s ease-in-out 2;
}

@keyframes hintPulse {
  50% { filter: brightness(1.4); }
}

.card.shake { animation: shake .3s ease; }

@keyframes shake {
  25% { margin-left: -4px; }
  75% { margin-left: 4px; }
}

.card.pop .front { animation: pop .38s ease; }

@keyframes pop {
  40% { filter: brightness(1.5) saturate(1.3); }
}

/* ===== ツールバー ===== */
#toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 7px 10px;
  background: linear-gradient(var(--bar-2), var(--bar-1));
  border-top: 1px solid rgba(240, 210, 122, .25);
  z-index: 30;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #e6f2ea;
  font-family: var(--font-jp);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.tool-btn:active { background: rgba(255, 255, 255, .2); transform: scale(.96); }
.tool-btn:disabled { opacity: .4; cursor: default; }

.tool-icon { font-size: 17px; line-height: 1; }

/* ===== フッター ===== */
#footer {
  flex: 0 0 auto;
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
  color: #85a494;
  background: #071e13;
}

#footer a { color: #a7c7b6; }

/* ===== トースト ===== */
#toast {
  position: fixed;
  left: 50%;
  /* フッター固定バナー広告に隠れないよう持ち上げる（広告なしのときは 0px） */
  bottom: calc(120px + var(--ad-space, 0px));
  transform: translateX(-50%);
  background: rgba(6, 20, 13, .93);
  border: 1px solid rgba(240, 210, 122, .5);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  z-index: 60;
  white-space: nowrap;
  transition: opacity .3s;
  pointer-events: none;
}

#toast.hidden { opacity: 0; }

/* ===== モーダル ===== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 50;
  padding: 16px;
  padding-bottom: calc(16px + var(--ad-space, 0px));
}

.modal.hidden { display: none; }

/* 共通ヘッダーから結果画面の上にメニュー・確認を開くことがあるので、結果画面より手前に出す */
#modal-menu,
#modal-confirm { z-index: 51; }

.modal-box {
  width: 100%;
  max-width: 400px;
  max-height: calc((100vh - var(--sgh-top, 0px) - var(--ad-space, 0px)) - 48px);
  max-height: calc((100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px)) - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(#17493090, #0f2c1d), linear-gradient(#1a5236, #0f2c1d);
  border: 1px solid rgba(240, 210, 122, .4);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
}

.modal-box-small { max-width: 320px; }

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
  margin-bottom: 14px;
}

.start-lead {
  font-size: 12.5px;
  line-height: 1.75;
  color: #cfe0d6;
  text-align: center;
  margin-bottom: 14px;
}

.start-lead b { color: #fff; }

.menu-section {
  margin-bottom: 16px;
}

.menu-caption {
  font-size: 11px;
  font-weight: 700;
  color: #9dbcab;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.mode-buttons,
.rule-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-btn,
.rule-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 6px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  color: #dbe8e1;
  font-family: var(--font-jp);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.mode-btn small,
.rule-btn small {
  font-size: 9.5px;
  font-weight: 600;
  color: #9dbcab;
  line-height: 1.3;
  text-align: center;
}

.mode-btn.active,
.rule-btn.active {
  background: linear-gradient(#f3e0a4, #d8b45a);
  border-color: #f0d27a;
  color: #2b2107;
}

.mode-btn.active small,
.rule-btn.active small { color: #4a3c14; }

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.menu-label { font-size: 13px; font-weight: 700; color: #d9e8e0; }

.menu-note {
  font-size: 10px;
  color: #8ea89a;
  margin: -6px 0 0;
}

.seg {
  display: flex;
  background: rgba(0, 0, 0, .3);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  flex: 0 0 auto;
}

.seg-btn {
  border: none;
  background: transparent;
  color: #a4c0b1;
  font-family: var(--font-jp);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.seg-btn.active {
  background: var(--gold);
  color: #22300f;
}

.menu-subtitle {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
}

.stats-rule-label { font-size: 11px; color: #a4c0b1; font-weight: 700; margin-left: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sg-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, .25);
  border-radius: 10px;
  padding: 8px 3px;
}

.sg-value { font-size: 16px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.sg-label { font-size: 9px; color: #8ea89a; margin-top: 2px; text-align: center; }

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-jp);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .1s, filter .15s;
}

.btn:active { transform: scale(.97); filter: brightness(1.1); }
.btn.hidden { display: none; }

.btn-primary {
  background: linear-gradient(#f3e0a4, #d8b45a);
  color: #2b2107;
  box-shadow: 0 3px 10px rgba(216, 180, 90, .35);
}

.btn-sub {
  background: rgba(255, 255, 255, .1);
  color: #d9e8e0;
  border: 1px solid rgba(255, 255, 255, .18);
}

.rules-hint {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.howto {
  margin: 0;
  padding-left: 1.1em;
  font-size: 12px;
  line-height: 1.75;
  color: #bcd2c6;
}

.howto li { margin-bottom: 4px; }
.howto b { color: #fff; }

.confirm-text {
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: #d9e8e0;
  margin-bottom: 14px;
}

/* ===== 結果モーダル ===== */
.modal-box-result { max-width: 360px; text-align: center; }

#result-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  animation: winPop .45s ease;
}

@keyframes winPop {
  0% { transform: scale(.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

#result-sub {
  font-size: 13px;
  font-weight: 800;
  color: #ffe9a8;
  margin-top: 6px;
  animation: hintPulse .9s ease-in-out infinite;
}

#result-sub.hidden { display: none; }

#result-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 10px 0 4px;
}

#result-main-value {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

#result-main-value.good { color: #8ee6a8; }
#result-main-value.bad { color: #ffc7a0; }

.result-main-unit { font-size: 15px; font-weight: 700; color: #a4c0b1; }

#result-comment {
  font-size: 12.5px;
  line-height: 1.7;
  color: #c3d8cc;
  margin-bottom: 12px;
}

/* スコアカード（9ホール） */
#scorecard {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 3px;
  margin: 0 0 14px;
}

#scorecard.hidden { display: none; }

.sc-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 0;
  border-radius: 7px;
  background: rgba(0, 0, 0, .28);
}

.sc-cell.current { background: rgba(240, 210, 122, .28); }
.sc-cell.clear { background: rgba(80, 200, 130, .3); }

.sc-hole { font-size: 8.5px; color: #8ea89a; }
.sc-val { font-size: 13px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.sc-cell.pending .sc-val { color: #6d8a7c; }

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

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 55;
}

.hidden { display: none; }

/* ===== レスポンシブ ===== */
@media (max-width: 430px) {
  #logo { font-size: 13.5px; }
  #mode-badge { font-size: 8px; padding: 2px 5px; }
  .icon-btn { width: 33px; height: 33px; font-size: 15px; }
  #statusbar { gap: 10px; }
  .stat { min-width: 40px; }
  .stat-value { font-size: 14px; }
  #scorecard { gap: 2px; }
  .sc-val { font-size: 11.5px; }
}

@media (min-width: 700px) {
  #logo { font-size: 21px; }
  #mode-badge { font-size: 10px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 18px; }
  #statusbar { gap: 34px; }
  .tool-btn { min-width: 86px; font-size: 12px; }
  #footer { font-size: 11px; }
}

/* ==========================================================================
   全国ランキング（js/ranking.js が動的に生成する）
   ========================================================================== */
.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 + var(--ad-space, 0px));
  background: rgba(4, 18, 11, 0.74);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sgr-panel {
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #1a5236 0%, var(--bg-mid) 100%);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.sgr-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

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

.sgr-tab {
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: var(--font-jp);
  font-size: 13px;
  font-weight: bold;
  background: rgba(220, 240, 230, 0.14);
  color: var(--text);
  cursor: pointer;
}

.sgr-tab-active {
  background: var(--accent);
  color: #22300f;
}

.sgr-register-msg {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  color: var(--accent3);
}

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

.sgr-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-family: var(--font-jp);
  padding: 8px 10px;
  border: 2px solid rgba(220, 240, 230, 0.4);
  border-radius: 8px;
  background: rgba(6, 26, 16, 0.65);
  color: var(--text);
}

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

.sgr-name:focus {
  outline: none;
  border-color: var(--accent);
}

.sgr-submit {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: bold;
  font-family: var(--font-jp);
  background: linear-gradient(180deg, #f7e6b4 0%, var(--accent) 60%, #d0a63f 100%);
  color: #22300f;
  cursor: pointer;
}

.sgr-submit:hover { filter: brightness(1.08); }

.sgr-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.sgr-error {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--hit);
}

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

.sgr-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.sgr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.sgr-row:nth-child(even) { background: rgba(220, 240, 230, 0.09); }

.sgr-row.sgr-row-me {
  background: var(--accent);
  color: #22300f;
}

.sgr-rank {
  width: 2em;
  text-align: right;
  font-weight: bold;
  flex-shrink: 0;
}

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

.sgr-row-score {
  font-weight: bold;
  flex-shrink: 0;
}

.sgr-close {
  border: 1px solid rgba(220, 240, 230, 0.34);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  font-family: var(--font-jp);
  background: rgba(220, 240, 230, 0.14);
  color: var(--text);
  cursor: pointer;
}

.sgr-close:hover { background: rgba(220, 240, 230, 0.24); }

.sgr-cta {
  margin: 0 0 8px;
  text-align: center;
}

.sgr-cta-msg {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: bold;
  color: var(--accent3);
  text-shadow: 0 0 12px rgba(240, 210, 122, 0.4);
}

.sgr-cta-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-jp);
  background: linear-gradient(180deg, #ffe999 0%, #f0d27a 60%, #d0a63f 100%);
  color: #22300f;
  box-shadow: 0 3px 0 #a9821f, 0 6px 16px rgba(240, 210, 122, 0.3);
  cursor: pointer;
}

.sgr-cta-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 0 #a9821f, 0 4px 12px rgba(240, 210, 122, 0.35);
}

.sgr-cta-link {
  border: none;
  background: none;
  padding: 6px;
  font-family: var(--font-jp);
  font-size: 13px;
  color: var(--text-dim);
  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; }
}
