/* ============================================================
   ルーレット - Roulette
   ============================================================ */

:root {
  --felt-1: #1a7a52;
  --felt-2: #0f5137;
  --felt-3: #08301f;
  --gold: #e9c46a;
  --gold-hi: #f8e3a8;
  --num-red: #c0392b;
  --num-black: #1c1c22;
  --cell: 30px;             /* 数字マス1つぶんの大きさ */
  --side: 40px;             /* 右端のカラムベットの幅 */
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}

* { 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.04em;
  color: #fff;
  white-space: nowrap;
}

#logo::before { content: "◉"; color: var(--gold); margin-right: 5px; }

#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;
  align-items: center;
  gap: 6px;
  padding: 8px 0 6px;
  overflow: hidden;
  background: radial-gradient(ellipse 92% 78% at 50% 34%, var(--felt-1) 0%, var(--felt-2) 60%, var(--felt-3) 100%);
}

/* ============ ホイール ============ */

#wheel-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 0 10px;
}

#wheel-wrap {
  position: relative;
  flex: none;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
}

/* 上部の三角ポインタ（ここに来た数字が出目） */
#wheel-pointer {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 15px solid var(--gold-hi);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

#wheel-result {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 2em;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

#wheel-result:empty { display: none; }
#wheel-result.red { background: rgba(192, 57, 43, 0.94); }
#wheel-result.black { background: rgba(20, 20, 26, 0.94); }
#wheel-result.zero { background: rgba(26, 122, 82, 0.94); }
#wheel-result { animation: result-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); box-shadow: 0 0 0 2px var(--gold), 0 6px 16px rgba(0, 0, 0, 0.6); }

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

/* --- 出目の履歴 --- */

#history-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  flex: 0 1 auto;
  min-width: 0;
  max-height: 100%;
}

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

#history {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  min-height: 0;
}

.hist {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 20px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  flex: none;
}

.hist-red { background: var(--num-red); }
.hist-black { background: var(--num-black); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.hist-zero { background: #1a7a52; }
.hist-empty { font-size: 9px; color: rgba(255, 255, 255, 0.3); }

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

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

#layout-scroll {
  flex: none;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 8px 4px;
  scrollbar-width: thin;
}

#layout {
  display: grid;
  grid-template-columns: var(--cell) calc(var(--cell) * 12) var(--side);
  grid-template-rows: calc(var(--cell) * 3) var(--cell) var(--cell);
  gap: 2px;
  width: max-content;
  margin: 0 auto;
}

#numbers {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  grid-column: 2;
  grid-row: 1;
}

#col-bets { grid-column: 3; grid-row: 1; display: grid; grid-template-rows: repeat(3, 1fr); gap: 1px; }
#dozen-bets { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; }
#outside-bets { grid-column: 2; grid-row: 3; display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; }

/* --- ベットスポット共通 --- */

.spot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-family: var(--ui-font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: filter 0.12s ease;
}

.spot:hover { filter: brightness(1.35); }
.spot:active { filter: brightness(0.85); }

.spot-num.num-red { background: var(--num-red); }
.spot-num.num-black { background: var(--num-black); }

.spot-zero {
  grid-column: 1;
  grid-row: 1;
  background: #1a7a52;
  font-size: 13px;
}

.spot-col { font-size: 10px; }
.spot-wide { font-size: 10px; }

.spot-red, .spot-black { background: rgba(0, 0, 0, 0.22); }

.diamond {
  display: block;
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  border-radius: 2px;
}

.spot-red .diamond { background: var(--num-red); }
.spot-black .diamond { background: var(--num-black); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.75); }

/* --- 置いたチップ --- */

.spot-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-hi) 0%, #d4a93f 100%);
  box-shadow: 0 0 0 1.5px #7a5c14, 0 2px 4px rgba(0, 0, 0, 0.5);
  color: #3b2a06;
  font-size: 9px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
  z-index: 3;
}

.spot.has-bet .spot-chip { display: flex; }

.spot.winner {
  box-shadow: 0 0 0 2px var(--gold-hi), 0 0 12px rgba(233, 196, 106, 0.85);
  z-index: 4;
}

/* --- 境目のベット（スプリット・ストリート・コーナー・ライン） --- */

.edge-layer, .zero-edge-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.edge {
  position: absolute;
  border: none;
  border-radius: 3px;
  background: transparent;
  pointer-events: auto;
}

.edge:hover { background: rgba(233, 196, 106, 0.45); filter: none; }
.edge:active { background: rgba(233, 196, 106, 0.7); }

/* 縦の境目（左右のスプリット） */
.edge-v { width: 13px; height: 68%; transform: translate(-50%, -50%); }
/* 横の境目（上下のスプリット） */
.edge-h { width: 68%; height: 12px; transform: translate(-50%, -50%); }
/* 4つ角（コーナー） */
.edge-c { width: 15px; height: 15px; transform: translate(-50%, -50%); border-radius: 50%; }
/* 下端の中央（ストリート） */
.edge-s { width: 58%; height: 12px; transform: translate(-50%, -50%); }
/* 下端の列境（シックスライン） */
.edge-l { width: 15px; height: 13px; transform: translate(-50%, -50%); }

/* コーナー・ラインはスプリットより上に置く（角では角が優先） */
.edge-c, .edge-l { z-index: 2; }
.edge-v, .edge-h, .edge-s { z-index: 1; }

.edge.has-bet { background: rgba(233, 196, 106, 0.25); }

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

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

#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, 255, 255, 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: 12px; }
.sgc-btn.wide { width: min(300px, 100%); padding: 12px; font-size: 15px; }

#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, 255, 255, 0.9); }
.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, 255, 255, 0.85); }

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

.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:last-child { white-space: nowrap; }

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

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

/* ============ レスポンシブ ============ */

@media (min-width: 560px) {
  :root { --cell: 36px; --side: 46px; }
  .spot { font-size: 13px; }
  .spot-col, .spot-wide { font-size: 11px; }
  .spot-chip { min-width: 23px; height: 23px; font-size: 10px; }
  .hist { width: 28px; height: 24px; font-size: 12px; }
}

@media (min-width: 700px) {
  #logo { font-size: 20px; }
  #msg { font-size: 14px; }
  #wheel-result { font-size: 28px; }
  .mini-label { font-size: 11px; }
}

@media (max-height: 700px) {
  :root { --cell: 26px; --side: 36px; }
  .spot { font-size: 10px; }
  .spot-chip { min-width: 17px; height: 17px; font-size: 8px; }
  .sgc-chip { width: 40px; height: 40px; font-size: 11px; }
  #bet-total { font-size: 17px; }
  .hist { width: 22px; height: 17px; font-size: 10px; }
}

/* さらに低い画面（小さいスマホ・横向き・背の低いウィンドウ）: 1画面に収めようとするとホイールの高さが 0 になり、
   ベット表の下の段も見切れて押せなかった。ホイールの大きさを確保し、収まらない分はページごとスクロールさせる */
@media (max-height: 600px) {
  #app {
    height: auto;
    min-height: calc(100vh - var(--sgh-top, 0px) - var(--ad-space, 0px));
    min-height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
  }
  #table { flex: 1 0 auto; }
  #wheel-area {
    flex: none;
    height: clamp(120px, min(calc(100vw - 110px), calc(100vh - var(--sgh-top, 0px) - var(--ad-space, 0px) - 260px)), 240px);
    height: clamp(120px, min(calc(100vw - 110px), calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px) - 260px)), 240px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #wheel-result { animation: none !important; }
}

/* ============ モーダル ============ */

.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: #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); }

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

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

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

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

/* ============ カードサイズ ============ */

:root { --sgc-cw: 54px; --sgc-ch: 76px; }

@media (min-width: 420px) {
  :root { --sgc-cw: 62px; --sgc-ch: 87px; }
}

@media (min-width: 700px) {
  :root { --sgc-cw: 74px; --sgc-ch: 104px; }
  #logo { font-size: 20px; }
  #msg { font-size: 15px; }
  .seat-head { font-size: 12px; }
  .hand-bet { font-size: 11px; }
  #result-text { font-size: 18px; }
}

/* 画面が低いときはカードを小さくしてスクロールを避ける */
@media (max-height: 620px) {
  :root { --sgc-cw: 46px; --sgc-ch: 65px; }
  #table { padding: 6px 8px 4px; }
  .sgc-chip { width: 40px; height: 40px; font-size: 11px; }
  #bet-amount { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .dealt, .result-badge { animation: none !important; }
}

/* ==========================================================================
   全国ランキング（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: #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; }
}
