/* 神経衰弱 - Memory */

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

:root {
  --bg1: #0d1026;
  --bg2: #1a1f45;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #eef0ff;
  --text-dim: #9aa0c8;
  --accent: #6c7bff;
  --accent2: #b56cff;
  --gold: #ffd76c;
  --good: #7dffb8;
  /* SGRanking 共通モジュール用 */
  --accent3: #ffe14d;
  --bg-mid: #171c40;
  --hit: #ff7d8a;
  --line: rgba(255, 255, 255, 0.12);
  --font-jp: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  /* 盤面（js/game.js が実寸を入れる） */
  --cols: 4;
  --card-w: 60px;
  --card-h: 80px;
  --gap: 8px;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-jp);
  background: radial-gradient(120% 100% at 50% 0%, var(--bg2) 0%, var(--bg1) 65%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

#app {
  height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
  min-height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  /* 上のセーフエリアは共通ヘッダー（--sgh-top）が確保済みなので足さない */
  padding: 6px
           calc(env(safe-area-inset-right) + 12px)
           calc(env(safe-area-inset-bottom) + 6px)
           calc(env(safe-area-inset-left) + 12px);
}

/* 広告があるときは --ad-space が下のセーフエリアを含むので、二重に空けない */
html.has-ad-banner #app { padding-bottom: 6px; }

/* ---------- ヘッダー ---------- */

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0 8px;
  flex: none;
}

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

#logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #8ea2ff, #d78bff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

#diff-badge {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-dim);
  font-family: var(--font-jp);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text);
}

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

/* ---------- ステータスバー ---------- */

.status-bar {
  display: flex;
  gap: 8px;
  flex: none;
}

.status-box {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.status-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}

.status-value {
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* 対戦モードのスコア表示 */

.player-box {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.player-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dim);
}

.player-score {
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.player-box.turn {
  border-color: var(--accent);
  background: rgba(108, 123, 255, 0.2);
  box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(108, 123, 255, 0.35);
}

.player-box.turn .player-name { color: var(--text); }

#pbox-com.turn {
  border-color: #ff9f6c;
  background: rgba(255, 159, 108, 0.18);
  box-shadow: 0 0 0 1px #ff9f6c, 0 0 16px rgba(255, 159, 108, 0.3);
}

.vs-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  line-height: 1.15;
}

.vs-mid span {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.vs-mid small {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
}

/* ---------- ステージ ---------- */

#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0 2px;
}

#message {
  flex: none;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  min-height: 1.5em;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}

.msg-good { color: var(--good); }
.msg-bad  { color: var(--hit); }
.msg-turn { color: var(--gold); }

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

/* 盤面はこの箱の中で絶対配置にして、カードの大きさがレイアウトに
   跳ね返らない（＝サイズ計算が発振しない）ようにしている */
#board-area {
  position: relative;
  flex: 1;
  min-height: 0;
}

#board {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(var(--cols), var(--card-w));
  grid-auto-rows: var(--card-h);
  gap: var(--gap);
}

.card {
  width: var(--card-w);
  height: var(--card-h);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  perspective: 700px;
  -webkit-tap-highlight-color: transparent;
}

.card:disabled { cursor: default; }

.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.32s cubic-bezier(0.3, 0.9, 0.4, 1);
}

.card.flipped .card-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 12%/9%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* 裏面（カードの背） */
.face-front {
  background:
    repeating-linear-gradient(45deg,
      rgba(255, 255, 255, 0.07) 0 6px,
      rgba(255, 255, 255, 0) 6px 12px),
    linear-gradient(160deg, #5866e6 0%, #3d3fae 55%, #2b2d80 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35),
    0 3px 10px rgba(0, 0, 0, 0.45);
}

.face-front::after {
  content: "";
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.08) 60%, rgba(255, 255, 255, 0) 70%);
  border: 2px solid rgba(255, 255, 255, 0.28);
}

/* 表面（絵柄） */
.face-back {
  transform: rotateY(180deg);
  font-size: calc(var(--card-w) * 0.55);
  line-height: 1;
  background: linear-gradient(165deg, #fdfdff 0%, #e6e9fb 60%, #cfd4ef 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.9),
    0 3px 10px rgba(0, 0, 0, 0.45);
}

.card:not(:disabled):active .card-inner { transform: scale(0.94); }
.card.flipped:not(:disabled):active .card-inner { transform: rotateY(180deg) scale(0.94); }

.card:focus-visible {
  outline: none;
}

.card:focus-visible .face {
  box-shadow: 0 0 0 3px var(--gold), 0 3px 10px rgba(0, 0, 0, 0.45);
}

/* ペア成立 */
.card.matched { cursor: default; }

.card.matched .face-back {
  background: linear-gradient(165deg, #d9ffe9 0%, #a8f0cd 60%, #7fdcb4 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 16px rgba(125, 255, 184, 0.45);
}

.card.pop .card-inner { animation: pop 0.42s ease; }

@keyframes pop {
  0%   { transform: rotateY(180deg) scale(1); }
  40%  { transform: rotateY(180deg) scale(1.14); }
  100% { transform: rotateY(180deg) scale(1); }
}

.card.miss .card-inner { animation: shake 0.36s ease; }

@keyframes shake {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  25% { transform: rotateY(180deg) translateX(5px); }
  50% { transform: rotateY(180deg) translateX(-5px); }
  75% { transform: rotateY(180deg) translateX(3px); }
}

/* 取ったカードは静かに沈める（残りが見やすくなる） */
.card.gone .face-back { opacity: 0.52; }
.card.gone .card-inner { transform: rotateY(180deg) scale(0.9); }

.card.gone.by-you .face-back {
  background: linear-gradient(165deg, #dfe4ff 0%, #b7c0ff 60%, #8e9bff 100%);
}

.card.gone.by-com .face-back {
  background: linear-gradient(165deg, #ffe6d5 0%, #ffc7a3 60%, #ff9f6c 100%);
}

@media (prefers-reduced-motion: reduce) {
  .card-inner { transition: none; }
  .card.pop .card-inner, .card.miss .card-inner { animation: none; }
}

/* ---------- スタート画面 ---------- */

/* 選択肢が多いので画面いっぱいに出す（小さい画面でスタートボタンが
   隠れないように）。中央寄せは #start-box の margin: auto で行う
   （flex の align-items: center だと、はみ出したときに上端が切れる） */
#start-overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--sgh-top, 0px);
  bottom: var(--ad-space, 0px);
  display: flex;
  padding: 10px calc(env(safe-area-inset-left) + 12px) 10px calc(env(safe-area-inset-right) + 12px);
  background: rgba(9, 12, 34, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 15;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#start-overlay.hidden { display: none; }

#start-box {
  width: 100%;
  max-width: 340px;
  margin: auto;
  padding: 12px;
  text-align: center;
}

#start-lead {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 12px;
}

.opt-caption {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
  text-align: left;
  margin-bottom: 6px;
}

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

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

.mode-btn,
.diff-btn,
.cpu-btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-jp);
  border-radius: 12px;
  padding: 9px 6px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.mode-btn small,
.diff-btn small {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
}

.mode-btn.selected,
.diff-btn.selected,
.cpu-btn.selected {
  border-color: var(--accent);
  background: rgba(108, 123, 255, 0.18);
  box-shadow: 0 0 0 1px var(--accent);
}

.mode-btn.selected small,
.diff-btn.selected small { color: #aab4ff; }

/* ---------- 汎用ボタン ---------- */

.btn {
  border: none;
  border-radius: 12px;
  font-family: var(--font-jp);
  font-size: 15px;
  font-weight: 800;
  padding: 12px 18px;
  cursor: pointer;
  color: #fff;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 16px rgba(108, 123, 255, 0.4);
  width: 100%;
}

.btn-sub {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
}

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

#result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 20, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 20;
  padding: 16px;
  padding-bottom: calc(16px + var(--ad-space, 0px));
}

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

#result-box {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, #232a5c, #171c40);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#result-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 6px;
}

#result-sub {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}

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

#result-main {
  font-size: 18px;
  font-weight: 800;
  margin: 10px 0 14px;
}

#result-main span {
  font-size: 28px;
  color: #8ea2ff;
  font-variant-numeric: tabular-nums;
}

#result-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.rstat {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rstat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
}

.rstat span:last-child {
  font-size: 14px;
  font-weight: 800;
}

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

/* ---------- メニューモーダル ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 20, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 30;
  padding: 16px;
  padding-bottom: calc(16px + var(--ad-space, 0px));
}

.modal.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 400px;
  /* 画面の中央に置くので、上端が共通ヘッダーの下に潜らない高さに抑える
     （360x640 や横向きのスマホで「メニュー」の見出しが隠れていた） */
  max-height: min(86dvh, 640px, calc(100dvh - var(--ad-space, 0px) - 2 * var(--sgh-top, 0px) - 8px));
  overflow-y: auto;
  background: linear-gradient(180deg, #232a5c, #171c40);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px 18px;
  -webkit-overflow-scrolling: touch;
}

.modal-title {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 14px;
}

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

.menu-caption {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.menu-note {
  font-size: 11px;
  color: var(--text-dim);
  margin: -6px 0 16px;
}

#best-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.best-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

.best-row span:last-child {
  color: #8ea2ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.howto {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #c9cdea;
}

.howto li {
  padding-left: 16px;
  position: relative;
}

.howto li::before {
  content: "●";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 8px;
  line-height: 2.4;
  color: var(--accent);
}

.howto b { color: var(--text); }

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

.menu-buttons .btn-sub { width: 100%; }

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

#footer {
  flex: none;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  padding-top: 8px;
}

#footer a {
  color: #8ea2ff;
  text-decoration: none;
}

#footer a:hover { text-decoration: underline; }

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

@media (max-height: 640px) {
  #logo { font-size: 17px; }
  #message { font-size: 13px; min-height: 1.3em; }
  .status-value { font-size: 17px; }
  #footer { font-size: 10px; }
}
/* ---------- 全国ランキング（SGRanking 共通モジュール） ---------- */

.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 + env(safe-area-inset-bottom, 0px));
  background: rgba(9, 12, 34, 0.72);
  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, #1c2158 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.5), 0 0 30px rgba(62, 201, 255, 0.12);
}

.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-size: 13px;
  font-weight: bold;
  background: rgba(154, 163, 208, 0.16);
  color: var(--text);
  cursor: pointer;
}

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

.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(154, 163, 208, 0.45);
  border-radius: 8px;
  background: rgba(13, 16, 48, 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, #8fe0ff 0%, var(--accent) 60%, #1fa8e6 100%);
  color: #06122a;
  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(154, 163, 208, 0.1); }

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

.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(154, 163, 208, 0.4);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  font-family: var(--font-jp);
  background: rgba(154, 163, 208, 0.16);
  color: var(--text);
  cursor: pointer;
}

.sgr-close:hover { background: rgba(154, 163, 208, 0.28); }

.sgr-cta {
  margin: 0;
  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(255, 225, 77, 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, #fff0a0 0%, var(--accent3) 55%, #ffc93e 100%);
  color: #3a2c00;
  cursor: pointer;
  box-shadow: 0 4px 0 #b8892a, 0 8px 22px rgba(255, 225, 77, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.sgr-cta-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 0 #b8892a, 0 4px 12px rgba(255, 225, 77, 0.35);
}

.sgr-cta-link {
  border: none;
  background: none;
  padding: 6px;
  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; }
}
