/* ============================================================
   クラップス - Craps
   ============================================================ */

:root {
  --felt-1: #1a7a52;
  --felt-2: #0f5137;
  --felt-3: #08301f;
  --gold: #e9c46a;
  --gold-hi: #f8e3a8;
  --red: #c0392b;
  --blue: #3a7bd5;
  --panel-bg: #0a2418;
  --ui-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --sgc-dw: 38px;
}

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

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

body {
  font-family: var(--ui-font);
  background: var(--felt-3);
  color: #f3f7f2;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.hidden { display: none !important; }

/* ============ ヘッダー ============ */

/* ボタンは共通ヘッダーのメニューに集約したので、残るのはタイトルだけ。
   タイトルだけの帯は縦幅を圧迫するので画面からは隠す（スクリーンリーダー向けには残す）。
   h1 と、共通ヘッダーが click() で押す元ボタンは DOM に残す */
#topbar {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

#logo {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  white-space: nowrap;
}

#logo::before { content: "🎯"; margin-right: 5px; font-size: 0.9em; }

/* ボタン（32px）がロゴ（26px）より高いぶんを打ち消し、共通ヘッダーが
   ボタンを隠したときにバーの高さが変わらない（レイアウトシフトしない）ようにする */
#topbar-buttons { display: flex; gap: 6px; flex: none; margin: -3px 0; }

/* チップバーは /js/casino.js があとから中身を入れるので、先に高さを取っておく */
#casino-bar { min-height: 38px; }

.icon-btn {
  width: 34px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s ease;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.22); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.off { opacity: 0.45; }

/* ============ テーブル ============ */

#table {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 10px 4px;
  overflow: hidden;
  background: radial-gradient(ellipse 94% 76% at 50% 24%, var(--felt-1) 0%, var(--felt-2) 58%, var(--felt-3) 100%);
}

#table::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0, transparent 3px, rgba(0, 0, 0, 0.025) 3px, rgba(0, 0, 0, 0.025) 4px);
  pointer-events: none;
}

#top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  min-height: calc(var(--sgc-dw) + 8px);
}

/* ポイントを示すパック */
#puck {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.25s ease, color 0.25s ease;
}

#puck.off {
  background: radial-gradient(circle at 34% 30%, #4a4f57 0%, #1b1f26 78%);
  color: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.25), 0 3px 8px rgba(0, 0, 0, 0.5);
}

#puck.on {
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #dfe3e6 78%);
  color: #17202a;
  font-size: 19px;
  box-shadow: inset 0 0 0 3px var(--gold), 0 0 14px rgba(233, 196, 106, 0.6), 0 3px 8px rgba(0, 0, 0, 0.5);
}

#dice { display: flex; gap: 8px; flex: 1; justify-content: center; min-height: var(--sgc-dw); }

#dice .sgc-die.settled { animation: die-drop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
#dice .sgc-die.tumbling { animation: die-tumble 0.14s linear; }

@keyframes die-drop {
  from { opacity: 0; transform: translateY(-18px) rotate(-14deg) scale(1.1); }
  to { opacity: 1; transform: none; }
}

@keyframes die-tumble {
  from { transform: rotate(-9deg) scale(0.94); }
  to { transform: rotate(7deg) scale(1); }
}

#history-wrap { display: flex; align-items: center; gap: 4px; flex: none; }

.mini-label { font-size: 9px; color: rgba(255, 255, 255, 0.42); flex: none; }

#history { display: flex; gap: 2px; overflow: hidden; }

.hist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  font-size: 9px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.hist-seven { background: var(--red); color: #fff; }
.hist-craps { background: #6c3483; color: #fff; }
.hist-yo { background: var(--blue); color: #fff; }

#msg {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  min-height: 1.2em;
  flex: none;
}

/* ============ ベットレイアウト ============ */

#layout-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

#layout { display: flex; flex-direction: column; gap: 3px; }

.sec {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}

.sec small { font-size: 9px; font-weight: 600; color: rgba(233, 196, 106, 0.85); }

.row { display: grid; gap: 3px; }
.row-1 { grid-template-columns: 1fr; }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: repeat(3, 1fr); }
.row-4 { grid-template-columns: repeat(4, 1fr); }
.row-6 { grid-template-columns: repeat(6, 1fr); }

.spot {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 42px;
  padding: 4px 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  color: #f3f7f2;
  font-family: var(--ui-font);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}

.spot:hover:not(.off) { background: rgba(255, 255, 255, 0.1); }
.spot:active:not(.off) { transform: scale(0.96); }

/* いま置けないベットは暗くする（すでに置いてあるチップは見える） */
.spot.off { opacity: 0.4; }
.spot.off.has-bet { opacity: 0.72; }

.spot-line { border-color: rgba(233, 196, 106, 0.55); background: rgba(233, 196, 106, 0.1); min-height: 48px; }
.spot-odds { border-color: rgba(125, 255, 176, 0.45); background: rgba(125, 255, 176, 0.08); }
.spot-come { border-color: rgba(58, 123, 213, 0.6); background: rgba(58, 123, 213, 0.12); }
.spot-field { border-color: rgba(255, 255, 255, 0.35); min-height: 40px; }
.spot-hard { border-color: rgba(192, 57, 43, 0.55); background: rgba(192, 57, 43, 0.1); }
.spot-prop { border-color: rgba(108, 52, 131, 0.6); background: rgba(108, 52, 131, 0.14); min-height: 38px; }

.spot-num { min-height: 52px; border-color: rgba(255, 255, 255, 0.3); }
.spot-num.is-point { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 10px rgba(233, 196, 106, 0.35); }

.s-name { font-size: 11px; font-weight: 800; line-height: 1.25; text-align: center; }
.spot-line .s-name { font-size: 13px; }
.spot-prop .s-name { font-size: 9.5px; }

.s-num { font-size: 18px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.spot-num.is-point .s-num { color: var(--gold-hi); }

.s-odds { font-size: 8px; color: rgba(233, 196, 106, 0.9); line-height: 1.2; font-variant-numeric: tabular-nums; text-align: center; }

.s-chips {
  min-height: 12px;
  font-size: 10px;
  font-weight: 800;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;

  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.s-marks { display: flex; gap: 2px; min-height: 11px; flex-wrap: wrap; justify-content: center; max-width: 100%; overflow: hidden; }

.mark {
  padding: 0 3px;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.mark-come { background: var(--blue); color: #fff; }
.mark-dont { background: #7a4fa3; color: #fff; }

.spot.has-bet { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

/* ============ 操作エリア ============ */

#controls {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  /* 下のセーフエリアは最下部の #footer が受け持つ */
  padding: 7px 10px;
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 0 rgba(233, 196, 106, 0.18);
}

.bet-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.bet-label { font-size: 11px; color: rgba(255, 255, 255, 0.65); }

#bet-total {
  font-size: 19px;
  font-weight: 800;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  min-width: 2.5em;
  text-align: right;
}

.sgc-btn.small { padding: 6px 9px; font-size: 11px; }
.sgc-btn.wide { width: min(300px, 100%); padding: 11px; font-size: 15px; }

/* チップは game.js があとから作るので、先に高さを取っておく（チップ 46px） */
#chip-rack { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 46px; }

#roll-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
  line-height: 1.4;
  min-height: 1.2em;
}

#roll-result:empty { min-height: 0; }

.rr-head { font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.9); }
.rr-amount { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }

#roll-result.win .rr-amount { color: #7dffb0; }
#roll-result.lose .rr-amount { color: #ff9c90; }
#roll-result.push .rr-amount { color: rgba(255, 255, 255, 0.85); }

.rr-detail { font-size: 10px; color: rgba(255, 255, 255, 0.6); }

/* ============ 画面サイズ対応 ============ */

@media (min-width: 480px) {
  :root { --sgc-dw: 46px; }
  .s-name { font-size: 12px; }
  .s-odds { font-size: 9px; }
}

@media (min-width: 700px) {
  :root { --sgc-dw: 56px; }
  #casino-bar { min-height: 42px; }
  #logo { font-size: 20px; }
  #msg { font-size: 13px; }
  #layout { max-width: 760px; width: 100%; margin: 0 auto; }
  .sec { font-size: 12px; }
  .sec small { font-size: 11px; }
  .spot { min-height: 50px; }
  .spot-line { min-height: 58px; }
  .spot-num { min-height: 62px; }
  .s-name { font-size: 13px; }
  .spot-line .s-name { font-size: 15px; }
  .spot-prop .s-name { font-size: 11px; }
  .s-num { font-size: 24px; }
  .s-odds { font-size: 10px; }
  .s-chips { font-size: 12px; }
  .mark { font-size: 9px; }
  .hist { width: 20px; height: 20px; font-size: 10px; }
  #puck { width: 48px; height: 48px; }
  #puck.on { font-size: 22px; }
}

@media (max-height: 700px) {
  :root { --sgc-dw: 30px; }
  #puck { width: 34px; height: 34px; font-size: 12px; }
  #puck.on { font-size: 16px; }
  .sgc-chip { width: 40px; height: 40px; font-size: 11px; }
  #chip-rack { min-height: 40px; }
  .spot { min-height: 38px; }
  .spot-num { min-height: 46px; }
  #bet-total { font-size: 17px; }
}

/* スマホ横向きなど高さが極端に低い画面では、固定の部分だけで高さが埋まって
   ベット面（#layout-scroll）が 0 になるので、ページ全体をスクロールさせる */
@media (max-height: 500px) {
  #app {
    height: auto;
    min-height: calc(100dvh - var(--sgh-top, 0px));
    padding-bottom: var(--ad-space, 0px);
  }
  #table { flex: 1 0 auto; overflow: visible; }
  #layout-scroll { flex: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  #dice .sgc-die { animation: none !important; }
}

/* ==========================================================================
   フッター
   ========================================================================== */

#footer {
  flex: none;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 10px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.42);
  background: rgba(0, 0, 0, 0.32);
}

/* 広告があるときは広告枠（--ad-space）が下のセーフエリアを受け持つ */
html.has-ad-banner #footer { padding-bottom: 7px; }

#footer a { color: rgba(255, 255, 255, 0.6); text-decoration: none; }
#footer a:hover { text-decoration: underline; }

/* ==========================================================================
   モーダル（遊び方・設定）
   ========================================================================== */

.modal {
  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));
  background: rgba(4, 20, 14, 0.78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.modal-box {
  width: min(460px, 100%);
  max-height: min(84vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px;
  border: 1px solid rgba(233, 196, 106, 0.3);
  border-radius: 14px;
  background: var(--panel-bg, #0a2418);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6);
  -webkit-user-select: text;
  user-select: text;
}

/* 開いたときにフォーカスを移すだけなので枠は出さない */
.modal-box:focus { outline: none; }

.modal-box h2 {
  margin-bottom: 12px;
  font-size: 19px;
  text-align: center;
  color: var(--gold-hi);
}

.modal-box h3 {
  margin: 14px 0 5px;
  font-size: 14px;
  color: var(--gold);
}

.modal-box section:first-of-type h3 { margin-top: 0; }

.modal-box p,
.modal-box li {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
}

.modal-box ul, .modal-box ol { padding-left: 1.3em; margin: 4px 0; }
.modal-box li { margin-bottom: 3px; }
.modal-box strong { color: var(--gold-hi); }

.rule-table {
  width: 100%;
  margin: 6px 0;
  border-collapse: collapse;
  font-size: 12px;
}

.rule-table th,
.rule-table td {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
}

.rule-table th { background: rgba(233, 196, 106, 0.14); color: var(--gold-hi); }
.rule-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

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

.rule-name { font-size: 13px; font-weight: 700; }

.settings-sub { margin-top: 18px !important; }

.seg { display: flex; gap: 4px; }

.seg button {
  padding: 6px 11px;
  border: 1px solid rgba(233, 196, 106, 0.3);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #f3f7f2;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.seg button.on {
  background: linear-gradient(180deg, var(--gold-hi), #d4a93f);
  border-color: transparent;
  color: #3b2a06;
}

#stats-list { list-style: none; padding: 0; margin-top: 6px; }

#stats-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

#stats-list strong { font-variant-numeric: tabular-nums; color: #fff; }
#stats-list strong.plus { color: #7dffb0; }
#stats-list strong.minus { color: #ff9c90; }

/* ==========================================================================
   全国ランキング（SGRanking 共通モジュール）
   ========================================================================== */

.sgr-hidden { display: none !important; }

.sgr-overlay {
  position: fixed;
  inset: 0;
  /* フッター固定バナー広告（2147482000）より上に出す */
  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(4, 20, 14, 0.8);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sgr-panel {
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel-bg, #0a2418);
  color: #f3f7f2;
  border: 1px solid rgba(233, 196, 106, 0.32);
  border-radius: 14px;
  padding: 20px 18px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6);
}

.sgr-title {
  margin: 0;
  font-size: 20px;
  text-align: center;
  color: var(--gold-hi);
}

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

.sgr-tab {
  border: 1px solid rgba(233, 196, 106, 0.32);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  font-family: var(--ui-font);
  background: rgba(255, 255, 255, 0.06);
  color: #f3f7f2;
  cursor: pointer;
}

.sgr-tab-active {
  background: linear-gradient(180deg, var(--gold-hi), #d4a93f);
  border-color: transparent;
  color: #3b2a06;
}

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

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

.sgr-name {
  flex: 1;
  min-width: 0;
  font-size: 16px; /* iOSズーム防止のため16px以上 */
  font-family: var(--ui-font);
  padding: 8px 10px;
  border: 2px solid rgba(233, 196, 106, 0.32);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: #f3f7f2;
  -webkit-user-select: text;
  user-select: text;
}

.sgr-name::placeholder { color: rgba(255, 255, 255, 0.45); }

.sgr-name:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(233, 196, 106, 0.3);
}

.sgr-submit {
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: bold;
  font-family: var(--ui-font);
  background: linear-gradient(180deg, var(--gold-hi), #d4a93f);
  color: #3b2a06;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.sgr-submit:hover { filter: brightness(1.1); }
.sgr-submit:active { transform: scale(0.96); }
.sgr-submit:disabled { opacity: 0.5; cursor: default; }

.sgr-error { margin: 6px 0 0; font-size: 12px; text-align: center; color: #ff9c90; }
.sgr-status { margin: 0; font-size: 13px; text-align: center; color: rgba(255, 255, 255, 0.55); }

.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(255, 255, 255, 0.05); }

.sgr-row-me {
  background: rgba(233, 196, 106, 0.18) !important;
  box-shadow: inset 0 0 0 1px rgba(233, 196, 106, 0.5);
}

.sgr-rank {
  width: 2em;
  text-align: center;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  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-weight: 700; color: var(--gold-hi); flex: none; }

.sgr-close {
  border: 1px solid rgba(233, 196, 106, 0.32);
  border-radius: 999px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: bold;
  font-family: var(--ui-font);
  background: rgba(255, 255, 255, 0.06);
  color: #f3f7f2;
  cursor: pointer;
}

.sgr-close:hover { background: rgba(255, 255, 255, 0.12); }

/* 結果画面に差し込まれる登録CTA */
.sgr-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.sgr-cta-msg {
  margin: 0;
  font-size: 13px;
  font-weight: bold;
  color: var(--gold-hi);
}

.sgr-cta-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--ui-font);
  background: linear-gradient(180deg, var(--gold-hi), #d4a93f);
  color: #3b2a06;
  cursor: pointer;
}

/* クラップスでは CTA をベット面（#layout-scroll）の先頭に出す。高さを取りすぎないよう横に並べる */
#layout-scroll > .sgr-cta {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin: 2px 0 4px;
}

#layout-scroll > .sgr-cta .sgr-cta-btn { padding: 7px 14px; font-size: 13px; }

.sgr-cta-link {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-family: var(--ui-font);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

/* ==========================================================================
   フッター固定バナー広告（スマホ表示時のみ / 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 {
  box-sizing: content-box;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  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);
  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; }
}
