/* ============================================================
   丁半 - Cho-Han
   畳と木の盆をイメージした和風のテーブル
   ============================================================ */

:root {
  --tatami-1: #4a5e3a;
  --tatami-2: #33452a;
  --wood-1: #6b4527;
  --wood-2: #4a2d18;
  --wood-3: #2a180d;
  --sumi: #14100c;
  --gold: #e9c46a;
  --gold-hi: #f8e3a8;
  --shu: #c0392b;
  --ai: #2e5f8a;
  --panel-bg: #1b120b;
  --ui-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --brush-font: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "MS PMincho", serif;
  --sgc-dw: 46px;
}

* { 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(--sumi);
  color: #f2ece2;
  -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 に残し、スクリーンリーダーにだけ見せる。
   position: absolute でレイアウトから外れるので、チップバー以下が共通ヘッダーの直下から始まる */
#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-family: var(--brush-font);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #fff;
  white-space: nowrap;
}

#logo::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--shu);
  vertical-align: 2px;
}

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

.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: 6px;
  padding: 8px 10px 4px;
  overflow: hidden;
  /* 畳 */
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.07) 0 1px, transparent 1px 5px),
    radial-gradient(ellipse 96% 80% at 50% 26%, var(--tatami-1) 0%, var(--tatami-2) 62%, #1e2b18 100%);
}

#bon {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: calc(var(--sgc-dw) * 2.5);
  padding: 10px 12px 8px;
  border-radius: 16px;
  /* 木の盆 */
  background:
    repeating-linear-gradient(96deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 62%, var(--wood-3) 100%);
  box-shadow: inset 0 0 0 2px rgba(233, 196, 106, 0.22), inset 0 3px 10px rgba(0, 0, 0, 0.4), 0 6px 16px rgba(0, 0, 0, 0.45);
}

/* 壺（伏せてあるあいだサイコロを覆う）。
   サイコロの行（#dice）にちょうど重なる位置・大きさにして、
   下の掛け声（#call）にはかぶせない */
#tsubo {
  position: absolute;
  left: 50%;
  top: 6px;
  width: calc(var(--sgc-dw) * 2.7);
  height: calc(var(--sgc-dw) * 1.2);
  margin-left: calc(var(--sgc-dw) * -1.35);
  opacity: 0;
  transform: translateY(-16px) scale(0.94);
  transition: opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
  z-index: 3;
}

#tsubo.closed { opacity: 1; transform: none; }
#tsubo.shaking { opacity: 1; transform: none; animation: tsubo-shake 0.16s linear infinite; }

#tsubo-body {
  position: absolute;
  inset: 0;
  border-radius: 46% 46% 16% 16% / 30% 30% 12% 12%;
  background: linear-gradient(165deg, #3b332c 0%, #1d1713 55%, #0e0b09 100%);
  box-shadow: inset 0 3px 6px rgba(255, 255, 255, 0.14), inset 0 -6px 12px rgba(0, 0, 0, 0.6), 0 6px 14px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(233, 196, 106, 0.25);
}

#tsubo-mark {
  position: absolute;
  left: 0;
  right: 0;
  top: 42%;
  text-align: center;
  font-family: var(--brush-font);
  font-size: calc(var(--sgc-dw) * 0.46);
  font-weight: 800;
  color: rgba(233, 196, 106, 0.5);
  letter-spacing: 0.1em;
}

@keyframes tsubo-shake {
  0% { transform: translate(-4px, 0) rotate(-2deg); }
  25% { transform: translate(4px, -3px) rotate(2deg); }
  50% { transform: translate(-3px, 2px) rotate(-1.4deg); }
  75% { transform: translate(4px, 1px) rotate(1.6deg); }
  100% { transform: translate(-4px, 0) rotate(-2deg); }
}

#dice { display: flex; gap: 12px; min-height: var(--sgc-dw); }

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

@keyframes die-drop {
  from { opacity: 0; transform: translateY(-20px) rotate(-16deg) scale(1.12); }
  to { opacity: 1; transform: none; }
}

@keyframes die-tumble {
  from { transform: rotate(-10deg) scale(0.93); }
  to { transform: rotate(8deg) scale(1); }
}

#call {
  font-family: var(--brush-font);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(255, 245, 230, 0.86);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  min-height: 1.3em;
  text-align: center;
}

#call.hot { color: var(--gold-hi); }
#call.cho { color: #a9d0ff; }
#call.han { color: #ffb0a3; }

#history-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.mini-label, #history-stats {
  font-size: 9px;
  color: rgba(255, 245, 230, 0.45);
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

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

.hist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-family: var(--brush-font);
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex: none;
}

.hist-c { background: var(--ai); }
.hist-h { background: var(--shu); }

#msg {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 245, 230, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  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: 4px; }

.note {
  margin: 1px 0 2px;
  font-size: 9px;
  line-height: 1.5;
  color: rgba(255, 245, 230, 0.5);
  text-align: center;
}

.sec {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
  font-family: var(--brush-font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(255, 245, 230, 0.55);
}

.sec small { font-size: 9px; font-weight: 700; color: var(--gold); font-family: var(--ui-font); }

.row { display: grid; gap: 4px; }
.row-main { grid-template-columns: 1fr 1fr; }
.row-one { grid-template-columns: 1fr; }
.grid6 { grid-template-columns: repeat(6, 1fr); }
.grid-total { grid-template-columns: repeat(6, 1fr); }

.spot {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 40px;
  padding: 4px 2px;
  border: 1px solid rgba(233, 196, 106, 0.26);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
  color: #f2ece2;
  font-family: var(--ui-font);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

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

.spot-cho, .spot-han { min-height: 76px; border-width: 2px; }
.spot-cho { border-color: rgba(46, 95, 138, 0.85); background: rgba(46, 95, 138, 0.24); }
.spot-han { border-color: rgba(192, 57, 43, 0.85); background: rgba(192, 57, 43, 0.24); }
.spot-any { min-height: 44px; border-color: rgba(233, 196, 106, 0.6); background: rgba(233, 196, 106, 0.12); }

.s-kanji {
  font-family: var(--brush-font);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.s-name { font-size: 14px; font-weight: 800; line-height: 1.2; }
.spot-total .s-name { font-size: 15px; font-variant-numeric: tabular-nums; }
.s-sub { font-size: 9px; color: rgba(255, 245, 230, 0.62); line-height: 1.2; }
.s-odds { font-size: 9px; color: var(--gold); line-height: 1.2; font-variant-numeric: tabular-nums; }

.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-dice { display: flex; gap: 2px; pointer-events: none; }

.sgc-die.mini {
  width: 15px;
  height: 15px;
  border-radius: 25%;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.4);
}

.sgc-die.mini .sgc-die-pip { box-shadow: none; }

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

.spot.winner { animation: spot-win 0.9s ease infinite alternate; }

@keyframes spot-win {
  from { box-shadow: 0 0 0 2px var(--gold) inset, 0 0 8px rgba(233, 196, 106, 0.4); }
  to { box-shadow: 0 0 0 3px var(--gold-hi) inset, 0 0 20px rgba(233, 196, 106, 0.85); }
}

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

#controls {
  flex: none;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 0 rgba(233, 196, 106, 0.2);
}

#bet-panel, #result-panel { display: flex; flex-direction: column; gap: 8px; align-items: center; }

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

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

#bet-total {
  font-size: 20px;
  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: 12px; font-size: 15px; letter-spacing: 0.1em; }

#chip-rack { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

#result-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  line-height: 1.5;
}

.r-head { font-size: 13px; font-weight: 700; color: rgba(255, 245, 230, 0.92); }
.r-amount { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

#result-text.win .r-amount { color: #7dffb0; }
#result-text.lose .r-amount { color: #ff9c90; }
#result-text.push .r-amount { color: rgba(255, 245, 230, 0.85); }

.r-detail { font-size: 11px; color: rgba(255, 245, 230, 0.62); }

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

@media (min-width: 480px) {
  :root { --sgc-dw: 54px; }
  .spot { min-height: 46px; }
  .sgc-die.mini { width: 18px; height: 18px; }
}

@media (min-width: 700px) {
  :root { --sgc-dw: 66px; }
  #logo { font-size: 22px; }
  #call { font-size: 18px; }
  #msg { font-size: 14px; }
  .sec { font-size: 13px; }
  .s-kanji { font-size: 44px; }
  .s-odds, .s-sub { font-size: 11px; }
  .s-chips { font-size: 12px; }
  .sgc-die.mini { width: 21px; height: 21px; }
  .hist { width: 19px; height: 19px; font-size: 11px; }
}

@media (max-height: 660px) {
  :root { --sgc-dw: 38px; }
  #bon { padding: 6px 8px 5px; }
  .sgc-chip { width: 40px; height: 40px; font-size: 11px; }
  .spot-cho, .spot-han { min-height: 60px; }
  .s-kanji { font-size: 28px; }
  #bet-total { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  #tsubo, #dice .sgc-die, .spot.winner { 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);
}

#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 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;
}

.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; }
}
