/* ================================================================
   うららん FEAT01/03 共通スタイル
   - 全画面共通: ベースレイアウト / トップバー / フッターナビ /
                  CTAボタン / ローディング / エラートースト /
                  提供割合モーダル / 設定モーダル
   - 個別画面CSSはこれを継承する
   - 既存 home.css 系の --c-* トークンを使う部分（フッタナビ等）と、
     index.html プロト由来の --pu / --gold 系トークンを併用
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  /* index.html 由来（演出シーンの世界観） */
  --gold: #D4A574;
  --gold-l: #F5DEB3;
  --gold-b: #FFD700;
  --pu: #7B61FF;
  --pu-d: #4A2FBD;
  --pu-l: #F0EDFF;
  --pk: #FF6B9D;
  --bd: #F0EDE8;
  --bgw: #FDFCFA;
  --ts: #777;
  --tt: #bbb;
  --tx: #1A1A1A;
  --red: #E53935;
  --green: #43A047;
  --amber: #F9A825;

  /* home.css 系（既存ページとの整合用、フッタナビ等で使う） */
  --c-surface: #FFFFFF;
  --c-border: #ECECEC;
  --c-text: #2C2C2A;
  --c-text-muted: #7A7770;
  --c-text-hint: #9A968C;
  --c-purple: #7B5BC4;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #fff;
  color: var(--tx);
  font-family: 'Noto Sans JP', system-ui, -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ----------------------------------------------------------------
   アプリ枠（max-width 430px、フルハイト、縦flex）
   ---------------------------------------------------------------- */
.app {
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ----------------------------------------------------------------
   トップバー（ポイント残高 + 購入ボタン）
   ※ 旧 .g-top / .g-bar / .tb は後方互換のため残置。新規実装は
      下方の .app-header / .topbar を使うこと（home.css と統一形式）。
   ---------------------------------------------------------------- */
.g-top {
  height: env(safe-area-inset-top, 0);
  flex-shrink: 0;
}
.g-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  height: 36px;
  gap: 6px;
  flex-shrink: 0;
  background: #fff;
}
.g-pt {
  font-size: 12px;
  color: var(--ts);
}
.g-buy {
  font-size: 11px;
  color: var(--pu);
  border: 1px solid var(--pu);
  border-radius: 4px;
  padding: 3px 10px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}

/* ----------------------------------------------------------------
   トップバー（新統一形式：home.css と揃える）
   全画面で「[戻る] ... [—pt] [購入]」の1段構成
   ---------------------------------------------------------------- */
.app-header {
  flex: 0 0 auto;
  background: #fff;
  border-bottom: 0.5px solid var(--bd, #ECECEC);
  padding-top: env(safe-area-inset-top, 0);
}
.topbar {
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-height: 24px;
}
.topbar-back {
  margin-right: auto;
  color: var(--tx, #1A1A1A);
  background: transparent;
  border: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}
.topbar-point {
  font-size: 14px;
  color: #5A5A60;
  font-weight: 500;
}
.topbar-buy {
  font-size: 13px;
  color: var(--pu, #7B5BC4);
  border: 1px solid var(--pu-l, #B5A0DC);
  border-radius: 6px;
  padding: 5px 16px;
  background: #fff;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}
.topbar-buy:hover { background: #F8F5FA; }

/* ----------------------------------------------------------------
   トップタイトルバー（戻る + 中央タイトル）
   ※ 後方互換のためのみ残置。中央タイトルは全画面撤去方針。
   ---------------------------------------------------------------- */
.tb {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}
.tb .bk {
  font-size: 28px;
  cursor: pointer;
  width: 36px;
  font-weight: 300;
  color: var(--pu);
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  text-decoration: none;
  display: inline-block;
  text-align: left;
}
.tb .tt {
  font-size: 15px;
  font-weight: 500;
  flex: 1;
  text-align: center;
}
.tb .rt { width: 36px; }

/* ----------------------------------------------------------------
   スクロール本体
   ---------------------------------------------------------------- */
.scb {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scb::-webkit-scrollbar { display: none; }

/* ----------------------------------------------------------------
   CTAボタン
   ---------------------------------------------------------------- */
.cta {
  display: block;
  max-width: 300px;
  margin: 0 auto 10px;
  padding: 14px;
  border: none;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: transform .15s;
  text-decoration: none;
  color: inherit;
}
.cta:active { transform: scale(.98); }
.cta-pu {
  background: linear-gradient(135deg, #7B61FF, #9B7BFF, #B591FF);
  color: #fff;
  box-shadow: 0 4px 16px rgba(123, 97, 255, .2);
}
.cta-out {
  background: none;
  color: var(--pu);
  border: 1.5px solid var(--pu);
}
.cta-sub {
  font-size: 10px;
  opacity: .7;
  display: block;
  margin-top: 2px;
}

/* ----------------------------------------------------------------
   フッターナビ（SVGアイコン、既存 .tabbar/.tab 流儀を継承）
   ※ home.css / search-common.css と同じ position: fixed 方式に統一。
      従来の position: absolute では .app 内の z-index 干渉
      （動画レイヤー z:95、モーダル z:100 等）でクリックを奪われる
      ケースがあったため変更。
   ---------------------------------------------------------------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(72px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  align-items: stretch;
  z-index: 100;
  background: var(--c-surface);
  border-top: 0.5px solid var(--c-border);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  cursor: pointer;
  color: var(--c-text-hint);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.tab svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}
.tab span { line-height: 1; }
.tab.is-active { color: var(--c-purple); }

/* ----------------------------------------------------------------
   提供割合モーダル
   ---------------------------------------------------------------- */
.prob-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.prob-modal.on { display: flex; }
.prob-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 320px;
  max-height: 80vh;
  overflow-y: auto;
}
.prob-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin-bottom: 16px;
}
.prob-sec { margin-bottom: 14px; }
.prob-sec-t {
  font-size: 11px;
  font-weight: 700;
  color: var(--pu);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.prob-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.prob-tbl th {
  text-align: left;
  color: var(--ts);
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}
.prob-tbl td {
  padding: 4px 0;
  color: #333;
  border-bottom: 1px solid #f5f5f5;
}
.prob-tbl td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--pu);
}
.prob-close {
  display: block;
  margin: 12px auto 0;
  padding: 10px 32px;
  border: none;
  border-radius: 20px;
  background: var(--pu);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

/* ----------------------------------------------------------------
   設定モーダル（プロト用デバッグ機能）
   ---------------------------------------------------------------- */
.cog-btn {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  cursor: pointer;
  font-size: 14px;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.cog-btn.light {
  background: rgba(123, 97, 255, .08);
  border: 1px solid rgba(123, 97, 255, .2);
  color: var(--pu);
}

.set-modal {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.set-modal.on { display: flex; }
.set-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px 18px;
  width: 100%;
  max-width: 330px;
  max-height: 88vh;
  overflow-y: auto;
}
.set-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin-bottom: 14px;
}
.set-tab-bar {
  display: flex;
  gap: 4px;
  background: #f5f4f2;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 14px;
}
.set-tab {
  flex: 1;
  padding: 6px;
  border: none;
  background: transparent;
  font-size: 11px;
  color: #888;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
}
.set-tab.on {
  background: #fff;
  color: var(--pu);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.set-pane { display: none; }
.set-pane.on { display: block; }
.set-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--pu);
  margin: 10px 0 4px;
}
.set-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  background: #fafafa;
}
.set-input:focus { border-color: var(--pu); background: #fff; }
.set-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  background: #fafafa;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
}
.set-textarea:focus { border-color: var(--pu); background: #fff; }
.set-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  cursor: pointer;
  font-size: 12px;
  color: #333;
}
.set-check input { width: 16px; height: 16px; cursor: pointer; }
.set-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.set-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.set-btn-cancel { background: #f0f0f0; color: #666; }
.set-btn-save { background: var(--pu); color: #fff; }
.set-note {
  font-size: 10px;
  color: var(--ts);
  line-height: 1.5;
  margin-top: 4px;
}
.set-btn-link {
  background: none;
  border: none;
  color: var(--pu);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  padding: 0;
}

/* ----------------------------------------------------------------
   ローディングオーバーレイ
   ---------------------------------------------------------------- */
.loading-ov {
  position: absolute;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  gap: 14px;
}
.loading-ov.on { display: flex; }
.loading-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
}
.loading-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, .6);
}

/* ----------------------------------------------------------------
   エラートースト
   ---------------------------------------------------------------- */
.err-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  display: none;
  max-width: 90vw;
}
.err-toast.on {
  display: block;
  animation: errIn .3s;
}
@keyframes errIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ----------------------------------------------------------------
   情報ボタン（ガチャ画面のℹ️用、画面別で位置調整）
   ---------------------------------------------------------------- */
.info-btn {
  position: absolute;
  z-index: 12;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  color: rgba(255, 255, 255, .7);
}
.info-btn.light {
  background: rgba(123, 97, 255, .08);
  border: 1px solid rgba(123, 97, 255, .2);
  color: var(--pu);
}
