/* ====================================
   コンポーネント — ステータスバー・ヘッダー・
   ミッションカード・結社・ランキング・ポイント交換
   ==================================== */

/* T22 (#22) Native 環境ではストア審査ブロッカー UI を強制 hide する。
   Web (S3 配布) では引き続き表示する。
   html.capacitor-native は index.html L12 で付与される。 */
html.capacitor-native [data-store-build="hidden"] {
  display: none !important;
}

/* (Issue #75) Native アプリでは PWA インストール導線・Web Push 案内モーダルを非表示。
   - #installModal:      📱 アプリをインストール (PWA ホーム画面追加モーダル) — アプリは既にインストール済
   - #notificationModal: 📢 プッシュ通知を登録 (Web Push 案内モーダル) — Native は OS 権限ダイアログを使う
   #settingsNotifSec (設定画面の通知セクション) は Issue #77 / #78 で Native 用トグルに
   拡張したため非表示にしない (settings.html 側で Capacitor.isNativePlatform() を見て分岐する)。 */
html.capacitor-native #installModal,
html.capacitor-native #notificationModal {
  display: none !important;
}

/* ==== ステータスバー ==== */
.status-bar {
  display: none !important;
}
.status-bar .time {
  color: white;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-h);
}
.status-bar .icons {
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==== ヘッダー ==== */
.app-header {
  background: var(--navy);
  padding: 0 16px 10px;
  color: white;
  position: sticky;
  top: 0;
  z-index: 49;
  overflow: visible;
}
/* iOS PWA safe area: components.css はlayout.cssより後ロードのためここで上書き */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 480px) {
    .app-header {
      padding-top: env(safe-area-inset-top);
    }
  }
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 8px;
  position: relative;
  z-index: 1;
  overflow: visible;
}
.header-title-img {
  height: 56px;
  width: 56px;
  object-fit: contain;
  position: absolute;
  /* safe-area-inset-right を尊重 (#71 Android Capacitor 見切れ対策) */
  right: max(10.6%, env(safe-area-inset-right, 0px));
  top: 66.1%;
  z-index: 2;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-h);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  position: relative;
  width: 110px;   /* Jpn logo @ 80px height = 120px幅をカバー (overflow:visible で多少はみ出しOK) */
  flex-shrink: 0;
  overflow: visible;
}
.logo-mark {
  width: 32px; height: 32px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
/* ロゴ画像: absolute でヘッダー高さに影響させない */
.logo-img {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 80px;   /* 旧1:1→100px、新3:2→80pxで横幅120pxに収める */
  width: auto;
  display: block;
  z-index: 5;
}
/* header/header-top は overflow:visible でロゴのはみ出しを許可 */

/* ヘッダーボス */
.header-boss-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.header-boss {
  position: absolute;
  left: 132px;
  top: -13px;
  height: 298px;
  width: auto;
  /* (Issue #71 fix) 実機幅 < 390px で右端から数十px はみ出して見切れていたため
     画面より広くならないよう max-width で制限 (height: auto で縦横比保持) */
  max-width: calc(100% - 132px);
  pointer-events: none;
  opacity: 0.1;
}
.header-agent {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.agent-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--lavender);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border: 2px solid rgba(255,255,255,0.25);
}
.header-title-pill {
  font-size: 10px;
  font-weight: 800;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  color: rgba(255,255,255,0.95);
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: visible;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.15);
  line-height: 1.6;
  transition: background 0.4s ease;
}
.agent-info {
  text-align: right;
  min-width: 0;
  max-width: clamp(130px, 46vw, 215px); /* モバイル〜PCで安全な幅 (≈13文字@390px) */
  overflow: hidden;
}
.agent-name {
  font-family: var(--font-h);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-id {
  font-size: 13px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
}

/* ポイントボックス */
.points-box {
  background: rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 16px;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.points-left { flex: 1; }
.points-label { font-size: 12px; opacity: 0.7; margin-bottom: 3px; white-space: nowrap; }
.points-num {
  font-family: var(--font-h);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.points-unit { font-size: 13px; opacity: 0.8; margin-left: 2px; }
/* GP メイン: ゴールドカラー */
.points-gp-num { color: #FFD166; }
.points-gp-num .points-unit { color: #FFD166; opacity: 0.85; }
/* PT サブバッジ（控えめ、右側） */
.points-pt-badge {
  background: rgba(255,255,255,0.12);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  text-align: center;
  font-family: var(--font-h);
  flex-shrink: 0;
}
.points-pt-badge-label { font-size: 10px; opacity: 0.55; white-space: nowrap; margin-bottom: 2px; }
.points-pt-badge-num { font-size: 13px; font-weight: 700; display: block; line-height: 1.2; white-space: nowrap; opacity: 0.7; }

/* ==== エージェント LVバッジ + XPストリップ ==== */

/* LVバッジ: header-xp-label の頭に小さくインライン */
.header-lv-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #f0b429;
  background: rgba(240,180,41,0.22);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 0;
  vertical-align: middle;
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
/* XPセクション: 次のレベルまで テキスト + レベラー */
.header-xp-section {
  padding: 2px 0 4px;
}
.header-xp-label {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-wrap: nowrap;
  padding-right: 62px;
}
#headerXpNext {
  color: rgba(240,180,41,0.8);
  font-weight: 700;
}
.header-xp-strip {
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  overflow: hidden;
}
.header-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #f0b429 0%, #ff6b35 100%);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ==== 結社タブ ==== */
.society-tabs {
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  flex-shrink: 0;
  position: sticky;
  top: 205px;
  z-index: 48;
}
.society-tabs::-webkit-scrollbar { display: none; }
.stab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  white-space: nowrap;
  font-family: var(--font-h);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.stab.active { color: var(--navy); border-bottom-color: var(--navy); }
.stab-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.stab-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
}

/* ==== ミッションカード ==== */
.mcard {
  background: white;
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid var(--border);
  position: relative;
  overflow: visible;
  margin-bottom: 12px;
}
.mcard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 5px;
}
.mcard.quiz  { background: #F0F4FF; border-color: #C7D6F5; }
.mcard.sns   { background: #FFF5F7; border-color: #FFD6E0; }
.mcard.study { background: #F5F3FF; border-color: #DDD6FE; }
.mcard.quiz::before  { background: var(--navy); }
.mcard.sns::before   { background: var(--red); }
.mcard.study::before { background: #7C3AED; }

.mcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.mtype {
  font-family: var(--font-h);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}
.mcard.quiz  .mtype { color: var(--navy); }
.mcard.sns   .mtype { color: var(--red); }
.mcard.study .mtype { color: #7C3AED; }

.mpts {
  font-family: var(--font-h);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
}
.mcard.quiz  .mpts { background: var(--lavender); color: var(--navy); }
.mcard.sns   .mpts { background: #FEE2E9; color: var(--red); }
.mcard.study .mpts { background: #EDE9FE; color: #7C3AED; }

.mpts-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mxps { font-size: 10px; font-weight: 700; color: #64748b; background: rgba(100,116,139,0.1); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }

.msociety {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mq {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  margin-bottom: 0;
}

/* クイズ選択肢 */
.choices { display: flex; flex-direction: column; gap: 7px; }
.choice {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.18s;
}
.choice:active { transform: scale(0.98); }
.choice.correct { background: #D1FAE5; border-color: #6EE7B7; }
.clabel {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-h);
  flex-shrink: 0;
}
.choice.correct .clabel { background: #065F46; color: white; border-color: #065F46; }

/* SNS型 */
.sns-body {
  background: #FFF5F7;
  border: 1px solid #FFD6E0;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #5A1C30;
  margin-bottom: 12px;
}
.sns-tags { color: var(--red); font-weight: 500; }

.btn-share {
  width: 100%;
  background: var(--red);
  color: white;
  font-family: var(--font-h);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--r-pill);
  padding: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.18s;
}
.btn-share:active { opacity: 0.82; }

/* 学習型 */
.study-body {
  background: #F5F3FF;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #3D1F70;
  margin-bottom: 12px;
}
.study-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  font-family: var(--font-b);
  color: var(--text);
  resize: none;
  outline: none;
  display: block;
}
.study-input:focus { border-color: #7C3AED; }

.btn-post {
  width: 100%;
  margin-top: 8px;
  background: #7C3AED;
  color: white;
  font-family: var(--font-h);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--r-pill);
  padding: 12px;
  cursor: pointer;
  transition: opacity 0.18s;
}
.btn-post:active { opacity: 0.82; }

/* ==== スタディ選択画面 ==== */
.study-select { padding: 4px 0; }
.ss-label {
  font-size: 12px; color: var(--muted); text-align: center;
  margin-bottom: 14px; font-weight: 500;
}
.ss-card {
  background: white; border-radius: 14px; padding: 16px;
  border: 1.5px solid var(--border); cursor: pointer;
  transition: all 0.18s; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
}
.ss-card:active { transform: scale(0.97); }
.ss-card.ss-study          { border-color: #DDD6FE; background: #F5F3FF; }
.ss-card.ss-mistake        { border-color: #FED7AA; background: #FFF7ED; }
.ss-card.ss-campaign-study { border-color: #FCD34D; background: #FFFBEB; }
.ss-icon { font-size: 30px; flex-shrink: 0; }
.ss-info { flex: 1; }
.ss-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.ss-desc  { font-size: 12px; color: var(--muted); line-height: 1.5; }
.ss-pts   { font-size: 11px; font-weight: 700; margin-top: 4px; }
.ss-study          .ss-pts { color: #7C3AED; }
.ss-mistake        .ss-pts { color: #C2410C; }
.ss-campaign-study .ss-pts,
.ss-pts.gp,
.mpts.gp { color: #B45309; background: #FEF3C7; border-radius: 6px; padding: 1px 6px; display: inline-block; }
.mcard.campaign-study { background: #FFFBEB; border-color: #FCD34D; }
.ss-arrow { font-size: 16px; color: var(--muted); flex-shrink: 0; }

/* ==== ミッションミステイクカード ==== */
.mcard.mistake { background: #FFF7ED; border-color: #FED7AA; }
.mcard.mistake::before { background: #F97316; }
.mcard.mistake .mtype { color: #C2410C; }
.mcard.mistake .mpts  { background: #FFEDD5; color: #C2410C; }
.mpts.pending { background: #FEF3C7 !important; color: #92400E !important; }

.mistake-intro {
  font-size: 13px; color: #7C2D12; line-height: 1.6;
  margin-bottom: 12px; padding: 10px 12px;
  background: #FEF3C7; border-radius: 8px;
  border-left: 3px solid #F59E0B;
}
.mistake-ref {
  background: white; border: 1px solid #FED7AA;
  border-radius: 10px; padding: 12px; margin-bottom: 12px;
}
.mistake-ref-label {
  font-size: 10px; font-weight: 700; color: #92400E;
  letter-spacing: 0.5px; margin-bottom: 6px; text-transform: uppercase;
}
.mistake-ref-q { font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 4px; }
.mistake-ref-a { font-size: 12px; color: var(--muted); }
.mistake-field-sel {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 9px 13px; font-size: 13px; font-family: var(--font-b);
  color: var(--text); outline: none; margin-bottom: 8px; cursor: pointer;
}
.mistake-field-sel:focus { border-color: #F97316; }
.mistake-input {
  width: 100%; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font-size: 13px; font-family: var(--font-b);
  color: var(--text); resize: none; outline: none; display: block;
}
.mistake-input:focus { border-color: #F97316; }
.btn-mistake-post {
  width: 100%; margin-top: 8px; background: #F97316; color: white;
  font-family: var(--font-h); font-size: 14px; font-weight: 700;
  border: none; border-radius: var(--r-pill); padding: 12px;
  cursor: pointer; transition: opacity 0.18s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-mistake-post:active { opacity: 0.82; }
.btn-mistake-post:disabled { background: #9CA3AF; cursor: default; }
.mistake-note {
  font-size: 11px; color: var(--muted);
  text-align: center; margin-top: 8px; line-height: 1.5;
}

/* ==== 結社カード ==== */
.soc-card {
  background: white;
  border-radius: var(--r);
  padding: 14px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.soc-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.soc-info { flex: 1; min-width: 0; }
.soc-name {
  font-family: var(--font-h);
  font-size: 14px;
  font-weight: 700;
}
.soc-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.soc-right { text-align: right; flex-shrink: 0; }
.soc-rank {
  font-family: var(--font-h);
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.soc-rlabel { font-size: 10px; color: var(--muted); }

/* ==== バッジ ==== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-h);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-pill);
}
.b-navy   { background: var(--navy); color: white; }
.b-red    { background: var(--red); color: white; }
.b-spy    { background: #FEF3C7; color: #92400E; }
.b-member { background: var(--lavender); color: var(--navy); }
.b-ok     { background: #D1FAE5; color: #065F46; }

/* ==== ランキング ==== */
.rank-item {
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.rnum {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-h);
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}
.rnum.g1 { background: #FEF3C7; color: #7A5C00; }
.rnum.g2 { background: #F1F5F9; color: #475569; }
.rnum.g3 { background: #FEF0E8; color: #7C3D15; }
.rnum.gn { background: var(--bg); color: var(--muted); }
.rname { font-family: var(--font-h); font-size: 13px; font-weight: 700; flex: 1; }
.rpts { font-family: var(--font-h); font-size: 13px; font-weight: 800; color: var(--navy); }

/* ==== ポイント交換バナー ==== */
.exchange-card {
  background: var(--navy);
  border-radius: var(--r);
  padding: 16px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ex-label { font-size: 11px; opacity: 0.7; margin-bottom: 4px; }
.ex-num {
  font-family: var(--font-h);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.ex-options {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ex-opt {
  background: rgba(255,255,255,0.15);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  font-family: var(--font-h);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ex-opt.active { background: rgba(232,0,61,0.6); }
.ex-btn {
  background: white;
  color: var(--navy);
  font-family: var(--font-h);
  font-size: 13px;
  font-weight: 800;
  border: none;
  border-radius: var(--r-pill);
  padding: 10px 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.18s;
}
.ex-btn:active { opacity: 0.8; }

/* ==== 登録画面 ==== */
.register-screen {
  padding: 40px 20px 30px;
  text-align: center;
}
.reg-logo {
  font-size: 48px;
  margin-bottom: 12px;
}
.reg-title {
  font-family: var(--font-h);
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
}
.reg-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
}
.reg-form { text-align: left; }
.reg-label {
  font-family: var(--font-h);
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  display: block;
  margin-bottom: 6px;
}
.reg-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font-b);
  color: var(--text);
  outline: none;
  margin-bottom: 18px;
  box-sizing: border-box;
}
.reg-input:focus { border-color: var(--navy); }
.reg-society-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.reg-soc {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.reg-soc:active { transform: scale(0.97); }
.reg-soc.selected {
  border-color: var(--navy);
  background: var(--lavender);
}
.reg-soc-icon { font-size: 24px; margin-bottom: 4px; }
.reg-soc-name {
  font-family: var(--font-h);
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
}
.reg-soc-type {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.reg-btn {
  width: 100%;
  background: var(--navy);
  color: white;
  font-family: var(--font-h);
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--r-pill);
  padding: 14px;
  cursor: pointer;
  transition: opacity 0.18s;
}
.reg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.reg-btn:not(:disabled):active { opacity: 0.8; }
.reg-error {
  color: var(--red);
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

/* ==== 結社選択モーダル ==== */
.reg-modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reg-modal {
  background: white;
  border-radius: var(--r);
  padding: 30px 20px;
  width: 90%;
  max-width: 360px;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: none;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.reg-modal::-webkit-scrollbar { display: none; }

/* ==== ログイン/新規登録画面 ==== */
.auth-modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--navy);
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-modal {
  text-align: center;
  width: 85%;
  max-width: 340px;
}
.auth-logo { font-size: 56px; margin-bottom: 8px; }
.auth-title {
  font-family: var(--font-h);
  font-size: 22px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.auth-subtitle {
  font-family: var(--font-h);
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 28px;
}
.auth-form { width: 100%; }
.auth-input {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-family: var(--font-b);
  color: var(--text);
  background: rgba(255,255,255,0.9);
  margin-bottom: 10px;
  box-sizing: border-box;
  outline: none;
}
.auth-input:focus { background: white; box-shadow: 0 0 0 2px var(--red); }
.auth-input::placeholder { color: #999; }
.auth-divider {
  text-align: center;
  margin: 14px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: rgba(255,255,255,0.2);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-divider span {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-h);
}
.auth-back-link {
  text-align: center;
  font-size: 12px;
  color: var(--navy);
  cursor: pointer;
  margin-top: 14px;
  font-family: var(--font-h);
  font-weight: 700;
}
.auth-back-link:hover { text-decoration: underline; }
.auth-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: var(--r-pill);
  font-family: var(--font-h);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  margin-bottom: 12px;
  transition: opacity 0.2s;
}
.auth-btn:active { opacity: 0.8; }
.auth-btn-login {
  background: white;
  color: var(--navy);
}
.auth-btn-register {
  background: var(--red);
  color: white;
}
.auth-note {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-top: 20px;
}

/* ==== プレースホルダー画面 ==== */
.screen-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}
.ph-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.ph-title {
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.ph-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ====================================
   エージェントルーム（B案）
   ==================================== */
.room-wrapper { position: relative; width: 100%; height: 100%; min-height: 698px; }
.app-scroll:has(.room-wrapper) { overflow: hidden; display: flex; flex-direction: column; }
.app-body:has(.room-wrapper) { padding: 0; flex: 1; min-height: 0; overflow: hidden; }
.app-scroll:has(.mission-room) { overflow: hidden; display: flex; flex-direction: column; }
.app-body:has(.mission-room) { padding: 0 !important; flex: 1; min-height: 0; overflow: hidden; }
/* モバイル: スクロール型ルーム — 画像の自然な高さで全体を表示
   PC は固定型（100%高さ + object-fit:cover）を維持                */
@media (max-width: 480px) {
  /* ① app-scroll を通常スクロールに戻す（固定型の flex/hidden を解除） */
  .app-scroll:has(.room-wrapper),
  .app-scroll:has(.mission-room) {
    overflow-y: auto !important;
    display: block !important;
  }
  /* ② app-body: flex拘束 / overflow:hidden を解除 */
  .app-body:has(.room-wrapper),
  .app-body:has(.mission-room) {
    flex: none !important;
    overflow: visible !important;
    min-height: 0 !important;
  }
  /* ③ room-wrapper: 高さを画像に委ねる */
  .room-wrapper { height: auto !important; min-height: 0 !important; }
  /* ④ room-bg: position:absolute → relative に切替（room-wrapperに高さを与える） */
  .room-bg { position: relative !important; inset: auto !important; }
  .room-bg img {
    height: auto !important;
    object-fit: unset !important;
    object-position: unset !important;
  }
  /* ⑤ mission-room: 同様 */
  .mission-room {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  /* ⑥ mission-room-bg: インフロー化 */
  .mission-room-bg {
    position: relative !important;
    height: auto !important;
    object-fit: unset !important;
    object-position: unset !important;
    top: auto !important;
    left: auto !important;
  }
  /* points-box は引き続き非表示（ヘッダーをコンパクトに保つ） */
  .app-scroll:has(.mission-room) .points-box,
  .app-scroll:has(.room-wrapper) .points-box { display: none; }
  .mission-room .mission-pt-display,
  .room-wrapper .mission-pt-display { display: flex; }
}
.room-bg { position: absolute; inset: 0; z-index: 0; }
.room-bg img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.room-vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, transparent 18%, transparent 75%, rgba(0,0,0,0.3) 100%),
              radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.35) 100%);
}
.room-agent-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(27,43,114,0.85) 0%, rgba(27,43,114,0) 100%);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.room-agent-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.7); cursor: pointer;
  object-fit: cover; transition: transform 0.2s;
}
.room-agent-icon:hover { transform: scale(1.1); }
.room-agent-info { flex: 1; }
.room-agent-name { font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.room-agent-sub { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 1px; }
.room-toggle-btn {
  background: rgba(255,255,255,0.15); backdrop-filter: blur(6px);
  border: none; border-radius: 20px; color: white; font-size: 11px;
  font-weight: 700; padding: 7px 12px; cursor: pointer;
  transition: background 0.2s; white-space: nowrap; flex-shrink: 0;
}
.room-toggle-btn:hover { background: rgba(255,255,255,0.3); }

/* キャラクター（全体シルエット — 背景ごとに位置変更） */
.room-character {
  position: absolute; z-index: 3;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  pointer-events: none; transition: all 0.4s ease;
}
.room-character.pos-western { left: 41.6%; top: 68.1%; bottom: auto; width: 31.63%; }
.room-character.pos-japanese { left: 23%; bottom: 48%; width: 35%; }
.room-character img { width: 100%; height: auto; display: block; }

/* ホットスポット */
.hotspot {
  position: absolute; z-index: 6; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: transform 0.3s;
}
.hs-inner {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(27,43,114,0.55); border: 2px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; position: relative; transition: all 0.3s;
}
.hs-inner::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(232,0,61,0.4);
  animation: hs-pulse 2.5s ease-in-out infinite;
}
.hotspot:hover .hs-inner {
  background: rgba(232,0,61,0.6); border-color: rgba(255,255,255,0.7);
  transform: scale(1.1); box-shadow: 0 0 20px rgba(232,0,61,0.5);
}
.hotspot:hover .hs-inner::before { animation: hs-pulse-active 1.2s ease-in-out infinite; border-color: rgba(232,0,61,0.7); }
.hs-label {
  position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8); opacity: 0; transition: opacity 0.3s;
}
.hotspot:hover .hs-label { opacity: 1; }

@keyframes hs-pulse { 0%,100%{transform:scale(1);opacity:0.6;} 50%{transform:scale(1.35);opacity:0;} }
@keyframes hs-pulse-active { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.5);opacity:0;} }
@keyframes hs-float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-8px);} }

/* ホットスポット位置 */
.hs-map { top: 18%; left: 18%; }
.hs-cork { top: 15%; right: 16%; }
.hs-monitor { top: 45%; right: 14%; }
.hs-safe { bottom: 18%; right: 18%; }

/* BEGIN_NATIVE_EXCLUDE T22#22 Phase3 wallet hotspot CSS */
/* ウォレットコネクト浮遊オブジェクト */
.hs-wallet {
  bottom: 22%; left: 14%;
  animation: hs-float 3s ease-in-out infinite;
}
.hs-wallet .hs-inner {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, rgba(100,60,200,0.65), rgba(40,180,220,0.55));
  border: 2px solid rgba(140,100,255,0.7);
  box-shadow: 0 0 18px rgba(120,80,255,0.4);
}
.hs-wallet .hs-inner::before { border-color: rgba(140,100,255,0.6); }
.hs-wallet .hs-inner img { width: 34px; height: 34px; object-fit: contain; }
.hs-wallet .hs-label {
  opacity: 1; bottom: -24px;
  font-size: 10px; font-weight: 800;
  color: #c8aaff; letter-spacing: 0.3px;
  text-shadow: 0 0 8px rgba(140,100,255,0.8), 0 1px 4px rgba(0,0,0,0.9);
}
.hs-wallet:hover .hs-inner {
  background: linear-gradient(135deg, rgba(140,80,255,0.85), rgba(40,200,240,0.75));
  border-color: rgba(180,140,255,0.9);
  box-shadow: 0 0 28px rgba(140,100,255,0.7);
}
/* END_NATIVE_EXCLUDE T22#22 Phase3 wallet hotspot CSS */

/* パネル背景 */
.room-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 50;
  opacity: 0; visibility: hidden; transition: opacity 0.35s, visibility 0.35s;
}
.room-backdrop.active { opacity: 1; visibility: visible; }

/* スライドアップパネル（空と雲テーマ） */
.room-panel {
  position: fixed; bottom: 76px; left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 20px));
  visibility: hidden;
  width: var(--app-w, 390px); max-width: 100vw; max-height: calc(100vh - 76px - 60px); z-index: 100;
  background: linear-gradient(180deg, #93c5fd 0%, #bfdbfe 18%, #e0f2fe 38%, #f8fbff 62%, #fff 85%);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 28px rgba(147,197,253,0.35), 0 -2px 10px rgba(0,0,0,0.06);
  transition: transform 0.4s cubic-bezier(0.32,0.72,0,1), visibility 0s 0.4s; overflow: hidden;
}
.room-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 90px;
  background:
    radial-gradient(ellipse 130px 48px at 18% 55%, rgba(255,255,255,0.82) 0%, transparent 72%),
    radial-gradient(ellipse 110px 42px at 72% 40%, rgba(255,255,255,0.78) 0%, transparent 72%),
    radial-gradient(ellipse 80px 32px at 48% 70%, rgba(255,255,255,0.55) 0%, transparent 68%);
  pointer-events: none; border-radius: 20px 20px 0 0;
}
.room-panel.active {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  transition: transform 0.4s cubic-bezier(0.32,0.72,0,1), visibility 0s 0s;
}
.rp-handle { width: 40px; height: 4px; background: rgba(255,255,255,0.7); border-radius: 2px; margin: 12px auto 0; position: relative; z-index: 1; }
.rp-header { padding: 16px 20px 8px; font-size: 16px; font-weight: 800; color: #1e3a5f; font-family: 'M PLUS Rounded 1c', sans-serif; position: relative; z-index: 1; text-shadow: 0 1px 3px rgba(255,255,255,0.6); }
.rp-body { padding: 0 20px 24px; color: #3d2b1f; font-size: 13px; line-height: 1.8; overflow-y: auto; max-height: calc(100vh - 76px - 60px - 80px); scrollbar-width: none; -ms-overflow-style: none; }
.rp-body::-webkit-scrollbar { display: none; }

/* バッジ */
.rp-badge-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 8px; }
.rp-badge { background: #f5f3ff; border: 1px solid rgba(196,181,253,0.3); border-radius: 10px; padding: 10px 8px; text-align: center; font-size: 24px; line-height: 1.5; }
.rp-badge small { font-size: 11px; display: block; color: #7c6f9f; }
.rp-badge.locked { opacity: 0.4; }

/* 統計 */
.rp-stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(196,181,253,0.2); font-size: 12px; color: #3d2b1f; }
.rp-stat strong { color: #3d2b1f; }
.rp-bar { width: 100%; height: 6px; background: rgba(196,181,253,0.15); border-radius: 3px; margin: 4px 0 8px; overflow: hidden; }
.rp-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #f9a8d4, #c4b5fd); }

/* 活動 */
.rp-activity { padding: 10px 0; border-bottom: 1px solid rgba(196,181,253,0.2); font-size: 12px; color: #3d2b1f; }
.rp-activity b { color: #7c3aed; }
.rp-activity span { float: right; font-size: 10px; color: #94a3b8; }

/* ポイント */
.rp-points-big { font-size: 36px; font-weight: 800; color: #3d2b1f; text-align: center; margin: 16px 0 4px; }
.rp-points-big small { font-size: 16px; font-weight: 500; color: #94a3b8; }
.rp-points-btns { display: flex; gap: 8px; }
.rp-points-btns button { flex: 1; padding: 10px 8px; border: 1px solid rgba(196,181,253,0.3); border-radius: 10px; background: #f5f3ff; color: #3d2b1f; font-family: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }

/* ポイント内訳ブロック */
.rp-pts-breakdown {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 14px;
  padding: 4px 0;
  backdrop-filter: blur(4px);
}
.rp-pts-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.rp-pts-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.rp-pts-info { flex: 1; min-width: 0; }
.rp-pts-label { font-size: 13px; font-weight: 700; color: #3d2b1f; }
.rp-pts-sub   { font-size: 10px; color: #94a3b8; margin-top: 1px; }
.rp-pts-val   { font-size: 15px; font-weight: 800; color: #3d2b1f; white-space: nowrap; }
.rp-pts-val span { font-size: 11px; font-weight: 500; color: #94a3b8; margin-left: 2px; }
.rp-pts-divider {
  height: 1px; background: rgba(148,163,184,0.2); margin: 0 16px;
}

/* プロフィール編集 */
.rp-label { font-size: 12px; font-weight: 700; color: #7c6f9f; display: block; margin: 12px 0 8px; }
.rp-avatar-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; max-height: 180px; overflow-y: auto; }
.rp-avatar-thumb { width: 100%; aspect-ratio: 1; border-radius: 50%; background: #f5f3ff; border: 2px solid transparent; cursor: pointer; overflow: hidden; transition: border-color 0.2s; }
.rp-avatar-thumb.selected { border-color: #c4b5fd; }
.rp-avatar-thumb img { width: 100%; height: 100%; object-fit: cover; }

.rp-char-select { display: flex; gap: 8px; margin-bottom: 8px; }
.rp-char-thumb { width: 60px; text-align: center; cursor: pointer; border: 2px solid transparent; border-radius: 10px; padding: 4px; background: #f5f3ff; transition: border-color 0.2s; }
.rp-char-thumb.selected { border-color: #c4b5fd; }
.rp-char-thumb img { width: 100%; height: auto; }
.rp-char-thumb small { font-size: 10px; color: #7c6f9f; display: block; margin-top: 2px; }

.rp-bg-select { display: flex; gap: 8px; }
.rp-bg-thumb { width: 80px; height: 60px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; transition: border-color 0.2s; }
.rp-bg-thumb.selected { border-color: var(--red); }
.rp-bg-thumb img { width: 100%; height: 100%; object-fit: cover; }

.rp-comment { width: 100%; padding: 10px 12px; border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; background: #232342; color: #fff; font-family: inherit; font-size: 13px; resize: none; outline: none; }
.rp-comment:focus { border-color: var(--red); }

/* ==== ミッションルーム（全画面背景型） ==== */
.mission-room {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 585px;
  overflow: hidden;
}
.mission-room-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  position: absolute;
  top: 0; left: 0;
}
.mission-avatar {
  position: absolute;
  z-index: 10;
  pointer-events: none;
}
.mission-avatar img {
  width: 100%;
  height: auto;
  display: block;
  position: absolute;
  bottom: 0; left: 0;
}
.mission-avatar .avatar-open { opacity: 1; position: relative; }
.mission-avatar .avatar-closed { opacity: 0; }

.mission-bg-toggle {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 20;
  background: rgba(27,43,114,0.7);
  backdrop-filter: blur(6px);
  border: none; border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 16px;
  cursor: pointer;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* オブジェクトタップ領域 */
.mission-obj {
  position: absolute;
  z-index: 15;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}
.mission-obj:hover,
.mission-obj:active {
  background: rgba(255,255,255,0.15);
}
.mission-obj.has-mission {
  /* 枠の点滅なし — Missionタグのみ点滅 */
}
.mission-obj-label {
  position: absolute;
  bottom: -20px; left: 50%;
  transform: translateX(-50%);
  background: rgba(27,43,114,0.85);
  color: white;
  font-size: 10px;
  font-family: var(--font-h);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
}

/* Missionタグ（点滅） */
.mission-obj-tag {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: white;
  font-size: 9px;
  font-family: var(--font-h);
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.05em;
  animation: missionBlink 2.5s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(232,0,61,0.4);
}
@keyframes missionBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
/* 達成済み */
.mission-obj-tag.completed {
  background: #059669;
  animation: none;
  box-shadow: 0 2px 8px rgba(5,150,105,0.4);
}
/* studyタグ位置オフセット */
.mission-obj-study .mission-obj-tag {
  top: 9px;
  left: 73%;
}

/* ロゴアイコン（Missionタグの上） */
.mission-obj-icon {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: auto;
  pointer-events: none;
  animation: missionBlink 2.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
/* studyのアイコン位置調整 */
.mission-obj-study .mission-obj-icon {
  top: -18px;
  left: 73%;
}

/* 写真ミッション（photo）スタイル — JS の objPos で % 位置指定 */
.mission-obj-photo {
  /* top/left/width/height は app.js objPos.photo で % 指定 */
}
.mission-obj-photo .mission-obj-icon {
  top: -50px;
  left: 43px;
}
.mission-obj-photo .mission-obj-tag {
  position: absolute;
  top: -8px;
  left: 68px;
  background: #FF1493;
  box-shadow: 0 2px 8px rgba(255, 20, 147, 0.4);
}
.mission-obj-photo .mission-obj-tag.completed {
  background: #059669;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
}

/* SNS リンクバッジ（右端・吹き出し付き） */
.sns-link-badge {
  position: absolute;
  width: 54px;
  cursor: pointer;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}
.sns-link-badge img {
  width: 100%; height: auto;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.30));
  transition: transform 0.2s ease;
}
.sns-link-badge:hover img,
.sns-link-badge:active img { transform: scale(1.14); }
.sns-link-bubble {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.97);
  color: #2a2a40;
  font-family: var(--font-h);
  font-size: 11px; font-weight: 700;
  padding: 7px 14px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(0,0,0,0.18);
  border: 1px solid rgba(167,139,250,0.30);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.sns-link-bubble::after {
  content: '';
  position: absolute;
  left: 100%; top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: rgba(255,255,255,0.97);
}
.sns-link-badge:hover .sns-link-bubble { opacity: 1; }

/* ポイント吸収アニメーション */
.pt-fly {
  position: absolute;
  z-index: 50;
  font-family: var(--font-h);
  font-size: 20px;
  font-weight: 800;
  color: #34D399;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  animation: ptFlyUp 1.0s ease-in forwards;
}
@keyframes ptFlyUp {
  0%   { opacity: 1; transform: translateY(0) scale(1.2); }
  40%  { opacity: 1; transform: translateY(-80px) scale(1.4); }
  100% { opacity: 0; transform: translateY(-200px) scale(0.6); }
}
/* GC吸収演出（金色） */
.gc-fly {
  color: #F59E0B;
}
/* ヘッダー吸収完了pulse */
.absorb-pulse {
  animation: absorbPulse 0.5s ease forwards;
}
@keyframes absorbPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); color: #fff; }
  100% { transform: scale(1); }
}
/* ポイント表示の数値変化演出 */
.mission-pt-num.pulse {
  animation: ptPulse 0.4s ease;
}
@keyframes ptPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); color: #34D399; }
  100% { transform: scale(1); }
}

/* ポイント表示（ルーム左上） */
.mission-pt-display {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 20;
  display: none;
  align-items: baseline;
  gap: 4px;
  background: rgba(27,43,114,0.8);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: 6px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.mission-pt-num {
  font-family: var(--font-h);
  font-size: 20px;
  font-weight: 800;
  color: white;
}
.mission-pt-label {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-h);
  font-weight: 700;
}
.mission-pt-today {
  font-size: 10px;
  color: #34D399;
  font-family: var(--font-h);
  font-weight: 800;
  margin-left: 4px;
}

/* ミニステータス帯 */
.mission-stats {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 16;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 10px 16px;
  background: linear-gradient(transparent, rgba(27,43,114,0.85));
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  font-family: var(--font-h);
  font-weight: 700;
}

/* パネルオーバーレイ — 常時表示 */
.mission-panel-overlay {
  display: flex;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.mission-panel-overlay.hide {
  opacity: 0;
  pointer-events: none;
}
/* 回答後: バックドロップをクリックスルーにして他ミッションを即タップ可能に */
.mission-panel-overlay.answered-done {
  pointer-events: none;
}
.mission-panel-overlay.answered-done .mission-panel {
  pointer-events: auto;
}

.mission-panel {
  background: white;
  border: 3px solid #d4a5d9;
  border-radius: 16px;
  width: 88%;
  max-width: 360px;
  max-height: 75vh;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#missionPanelContent {
  position: relative;
  z-index: 2;
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
  scrollbar-width: none;
}

.mission-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    /* 大サイズ（18-20%） */
    radial-gradient(circle at 15% 25%, rgba(255, 179, 214, 0.65) 0%, transparent 20%),
    radial-gradient(circle at 85% 65%, rgba(216, 191, 216, 0.60) 0%, transparent 20%),
    radial-gradient(circle at 50% 85%, rgba(200, 230, 201, 0.55) 0%, transparent 18%),
    /* 中サイズ（12-15%） */
    radial-gradient(circle at 30% 60%, rgba(255, 205, 210, 0.68) 0%, transparent 15%),
    radial-gradient(circle at 70% 30%, rgba(221, 192, 229, 0.62) 0%, transparent 12%),
    radial-gradient(circle at 75% 75%, rgba(255, 240, 180, 0.60) 0%, transparent 14%),
    radial-gradient(circle at 65% 50%, rgba(200, 220, 255, 0.62) 0%, transparent 13%),
    /* 小サイズ（6-9%） */
    radial-gradient(circle at 25% 45%, rgba(179, 229, 252, 0.70) 0%, transparent 9%),
    radial-gradient(circle at 40% 15%, rgba(228, 190, 219, 0.70) 0%, transparent 8%),
    radial-gradient(circle at 55% 40%, rgba(255, 150, 190, 0.70) 0%, transparent 7%);
  pointer-events: none;
  animation: bubble-float 6s ease-in-out infinite;
  z-index: 0;
}

@keyframes bubble-float {
  0%, 100% {
    transform: translateY(0px);
    opacity: 1;
  }
  50% {
    transform: translateY(-12px);
    opacity: 0.5;
  }
}

.mission-panel::-webkit-scrollbar { display: none; }

.mp-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--muted);
  z-index: 10;
}

/* ピルボタンスタイル */
.pill-btn {
  padding: 16px 48px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 48px;
  background: linear-gradient(135deg, #ff9cc5 0%, #c279d9 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(192, 121, 217, 0.4);
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 12px;
}

.pill-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(192, 121, 217, 0.6);
}

.pill-btn:active {
  transform: scale(0.98);
}

.pill-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ポイント吸収アニメーション */
@keyframes absorb-point {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.2);
  }
}

.absorbing-point {
  animation: absorb-point 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: fixed;
  font-weight: bold;
  color: #ffd700;
  z-index: 10000;
  font-size: 24px;
  pointer-events: none;
}

/* ==== フロント画面（新デザイン） ==== */
.front-overlay {
  position: fixed;       /* ビジュアルビューポート直接追従 — iOS URL バー開閉に左右されない */
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('../img/front/back.webp') center top / cover no-repeat;
  z-index: 210;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
/* PC: front-overlay はラッパー内に収める（fixed だと全画面になるため absolute に戻す） */
@media (min-width: 481px) {
  .front-overlay { position: absolute; }
}
/* iOS PWA: コンテンツをステータスバー下に押し込む（背景画像は全面のまま） */
@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 480px) {
    .front-overlay {
      padding-top: env(safe-area-inset-top);
    }
  }
}
/* ロゴ + BOSSラッパー */
.fp-logo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  z-index: 1;
  width: 100%;
  overflow: visible;
  margin-top: 26px;
  padding-bottom: 16px;
}
/* ロゴ（前面） */
.fp-logo {
  width: 374px;
  aspect-ratio: 691 / 186; /* 画像未ロード時も高さを確保してレイアウトシフト防止 */
  position: relative;
  z-index: 2;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 2px 10px rgba(120,60,200,0.2));
}
/* BOSSシルエット（ロゴ背面） */
.fp-boss {
  position: absolute;
  width: 232px;
  top: 50%;
  left: 50%;
  transform: translate(-46%, -32%);
  z-index: 0;
  opacity: 0.3;
  filter:
    grayscale(1)
    brightness(1.8)
    drop-shadow(0 0 6px rgba(140,80,220,0.9))
    drop-shadow(0 0 14px rgba(180,120,255,0.7))
    drop-shadow(0 3px 8px rgba(80,20,160,0.6));
}
/* タグライン */
.fp-tagline {
  font-family: var(--font-h);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 6px rgba(80,30,140,0.7), 0 0 12px rgba(200,160,255,0.4);
  margin: 5px 0 0;
  flex-shrink: 0;
  z-index: 1;
}
/* 地球エリア */
.fp-world {
  position: relative;
  width: 100%;
  height: 380px;
  margin-top: 4px;
  flex-shrink: 1;
  min-height: 200px;
  z-index: 1;
  overflow: visible;
}
/* 地球 — ふわふわ浮遊のみ・自転なし */
.fp-earth {
  position: absolute;
  width: 356px;
  aspect-ratio: 720 / 632; /* 画像未ロード時も高さを確保 → translate(-50%,-50%) が正確に中央に来る */
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  animation: fpFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 8px 26px rgba(100,200,255,0.45));
}
@keyframes fpFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
  50%       { transform: translate(-50%, -50%) translateY(-10px); }
}

/* 軌道ベース — 地球中心から外側へ周回 */
.fp-orbit {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
}
/* キャラ画像 — 軌道から offset、地球にしがみつく向き（90°固定） */
.fp-kabe {
  position: absolute;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.2));
  transform-origin: center center;
  transform: rotate(90deg);
}

/* 軌道アニメ：rotate → 円周移動（逆回転なし = 地球表面にしがみつく） */
@keyframes fpOrbit {
  from { transform: rotate(0deg)   translateX(var(--r)); }
  to   { transform: rotate(360deg) translateX(var(--r)); }
}
/* kabe1 ウサギ — 半径170px、0deg開始 */
.fp-orbit1 {
  --r: 170px;
  animation: fpOrbit 14s linear infinite;
  animation-delay: 0s;
}
.fp-orbit1 .fp-kabe { width: 112px; margin-left: -56px; margin-top: -56px; }

/* kabe2 犬+たぬき — 半径175px、120deg遅延 */
.fp-orbit2 {
  --r: 175px;
  animation: fpOrbit 14s linear infinite;
  animation-delay: -4.67s;
}
.fp-orbit2 .fp-kabe { width: 122px; margin-left: -61px; margin-top: -61px; }

/* kabe3 猫 — 半径168px、240deg遅延 */
.fp-orbit3 {
  --r: 168px;
  animation: fpOrbit 14s linear infinite;
  animation-delay: -9.33s;
}
.fp-orbit3 .fp-kabe { width: 112px; margin-left: -56px; margin-top: -56px; }
/* メインキャラ */
.fp-charas {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-top: auto;
  flex-shrink: 0;
  z-index: 2;
}
.fp-chara {
  width: 108px;
  aspect-ratio: 1024 / 1536; /* 2:3 — 画像未ロード時も高さを確保してレイアウトシフト防止 */
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.22));
}
.fp-chara-l { margin-right: -8px; }
.fp-chara-r { margin-left: -8px; }

/* モバイル: フロント画面をコンパクトに */
@media (max-width: 430px) and (max-height: 800px) {
  .fp-logo-wrap { margin-top: 10px; padding-bottom: 4px; }
  .fp-logo { width: 340px; }
  .fp-boss { width: 150px; opacity: 0.15; }
  .fp-tagline { font-size: 12px; margin-top: 2px; }
  .fp-world { height: 270px; min-height: 160px; }
  .fp-earth { width: 300px; }
  .fp-orbit1 { --r: 148px; }
  .fp-orbit2 { --r: 152px; }
  .fp-orbit3 { --r: 146px; }
  .fp-orbit1 .fp-kabe { width: 90px; margin-left: -45px; margin-top: -45px; }
  .fp-orbit2 .fp-kabe { width: 98px; margin-left: -49px; margin-top: -49px; }
  .fp-orbit3 .fp-kabe { width: 90px; margin-left: -45px; margin-top: -45px; }
  .fp-chara { width: 90px; }
  .fp-charas { margin-top: auto; }
  .fp-btns { padding-bottom: 16px; }
}

/* ボタンエリア */
.fp-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  padding-bottom: 38px;
  z-index: 2;
}
/* ボタン共通 */
.front-btn {
  display: block;
  border-radius: var(--r-pill);
  font-family: var(--font-h);
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: opacity 0.18s, transform 0.14s;
}
.front-btn:active { opacity: 0.82; transform: scale(0.97); }
/* はじめる — ピンクグロー */
.fp-btn-start {
  width: 238px;
  padding: 16px 10px;
  font-size: 20px;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ff8ec0 0%, #ff4a9d 100%);
  color: #fff;
  text-shadow: 0 1px 4px rgba(160,20,80,0.35);
  box-shadow: 0 4px 24px rgba(255,70,160,0.55), inset 0 1px 0 rgba(255,255,255,0.35);
  animation: fp-pulse 2.6s ease-in-out infinite;
}
@keyframes fp-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(255,70,160,0.55), inset 0 1px 0 rgba(255,255,255,0.35); }
  50%       { box-shadow: 0 6px 36px rgba(255,70,160,0.85), inset 0 1px 0 rgba(255,255,255,0.35); }
}
/* つづける — 白ガラス */
.fp-btn-continue {
  width: 200px;
  padding: 11px 10px;
  font-size: 15px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.55) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ==== バー演出・ログイン共通オーバーレイ ==== */
.bar-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0c0e1a;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bar-inner {
  width: 90%;
  max-width: 360px;
  max-height: 90%;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 8px 0;
}
.bar-inner::-webkit-scrollbar { display: none; }
.bar-inner-login { max-width: 340px; }

/* ステップ */
.bar-step {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.bar-scene-label {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-family: var(--font-h);
  letter-spacing: 1px;
  margin-bottom: -8px;
}

/* マスター行 */
.bar-master-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.bar-avatar {
  font-size: 36px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.bar-speech {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0 14px 14px 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
  font-family: var(--font-b);
  flex: 1;
}
.bar-speech strong { color: #f0c040; }
.bar-speech-sm { font-size: 13px; }

/* アクションエリア */
.bar-action { display: flex; flex-direction: column; gap: 10px; }
.bar-action-row {
  flex-direction: row;
  gap: 10px;
}
.bar-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-family: var(--font-b);
  color: white;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.bar-input:focus { border-color: #f0c040; }
.bar-input::placeholder { color: rgba(255,255,255,0.3); }

.bar-btn {
  flex: 1;
  background: var(--red);
  color: white;
  font-family: var(--font-h);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--r-pill);
  padding: 14px 16px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.bar-btn:active { opacity: 0.8; transform: scale(0.98); }
.bar-btn-ghost {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
}
.bar-btn-back {
  margin-top: 4px;
  font-size: 13px;
}
.bar-hint {
  font-size: 12px;
  color: rgba(255,200,0,0.8);
  text-align: center;
  font-family: var(--font-b);
  line-height: 1.5;
}

/* メニューリスト */
.bar-menu-list { display: flex; flex-direction: column; gap: 8px; }
.bar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  font-family: var(--font-b);
  transition: all 0.15s;
}
.bar-menu-item:active, .bar-menu-item.selected {
  background: rgba(240,192,64,0.15);
  border-color: #f0c040;
  color: #f0c040;
}
.bar-menu-ico { font-size: 22px; flex-shrink: 0; }

/* ルーレット */
.bar-roulette-wrap { text-align: center; }
.bar-roulette-label {
  font-family: var(--font-h);
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 8px;
}
.bar-roulette {
  font-family: var(--font-h);
  font-size: 28px;
  font-weight: 800;
  color: #f0c040;
  letter-spacing: 2px;
  min-height: 44px;
  line-height: 1.3;
}
.bar-roulette-soc { font-size: 20px; }

/* ようこそ画面 */
.bar-welcome {
  text-align: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px 20px;
}
.bar-welcome-icon { font-size: 48px; margin-bottom: 8px; }
.bar-welcome-title {
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 800;
  color: white;
  line-height: 1.5;
  margin-bottom: 16px;
}
.bar-welcome-code {
  font-family: var(--font-h);
  font-size: 22px;
  font-weight: 800;
  color: #f0c040;
  letter-spacing: 1px;
}

/* ==== PWA インストール / 通知モーダル ==== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-content {
  background: #fff;
  border: 2px solid rgba(196,181,253,0.4);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: none;
  box-shadow: 0 8px 32px rgba(196,181,253,0.25), 0 2px 12px rgba(0,0,0,0.08);
}
.modal-content::-webkit-scrollbar { display: none; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 0;
  border-bottom: 1px solid rgba(196,181,253,0.2);
  padding-bottom: 14px;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: #3d2b1f;
  margin: 0;
  font-family: 'M PLUS Rounded 1c', sans-serif;
}
.modal-close {
  background: rgba(196,181,253,0.15);
  border: 1px solid rgba(196,181,253,0.35);
  border-radius: 50%;
  color: #7c6f9f;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(196,181,253,0.3); color: #5b4f8a; }
.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 18px 0;
}
.modal-tab {
  flex: 1;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(196,181,253,0.3);
  border-radius: 10px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'M PLUS Rounded 1c', sans-serif;
}
.modal-tab.active {
  background: rgba(196,181,253,0.15);
  border-color: #c4b5fd;
  color: #7c6f9f;
  font-weight: 700;
}
.modal-section {
  display: none;
  padding: 16px 18px 20px;
}
.modal-section.active { display: block; }
.modal-description {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 14px;
  line-height: 1.5;
}
.modal-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #3d2b1f;
  line-height: 1.4;
  background: #fafafa;
  border: 1px solid rgba(196,181,253,0.2);
  border-radius: 10px;
  padding: 8px 10px;
}
.step-num {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.2;
}
.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-buttons .btn {
  width: 100%;
  padding: 12px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: 'M PLUS Rounded 1c', sans-serif;
}
.modal-buttons .btn:active { opacity: 0.75; transform: scale(0.98); }
.modal-buttons .btn-primary {
  background: linear-gradient(135deg, #f9a8d4, #c4b5fd);
  color: #fff;
  box-shadow: 0 4px 14px rgba(196,181,253,0.45);
}
.modal-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #3d2b1f;
  background: rgba(196,181,253,0.1);
  border-left: 3px solid #c4b5fd;
}

/* ====================================
   AI君ウィジェット + モーダル
   ==================================== */

/* ── フロートアニメーション ── */
@keyframes akFloat {
  0%,100% { transform: translateY(0) rotate(-1.2deg); }
  50%      { transform: translateY(-9px) rotate(1.2deg); }
}
@keyframes akBubbleIn {
  from { opacity:0; transform:translateY(6px) scale(.92); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes akModalIn {
  from { opacity:0; transform:scale(.94) translateY(12px); }
  to   { opacity:1; transform:scale(1)   translateY(0); }
}

/* ── ウィジェット本体 ── */
/* position:absolute → #appWrapper(position:relative)基準で固定。
   ビューポート幅に依存しないためDevTools開閉で位置ズレしない。 */
#akWidget {
  position: absolute;
  bottom: 96px;   /* nav bar(~73px) + 余白 */
  right: 14px;
  width: 72px;
  z-index: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.55s ease;
}

/* キャラ画像ラッパー（float アニメ） */
#akCharWrap {
  animation: akFloat 3.2s ease-in-out infinite;
  transform-origin: center bottom;
}
#akCharImg {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
  transition: transform .12s ease;
}
#akWidget:active #akCharImg {
  transform: scale(.92);
}

/* ── 吹き出し ── */
#akBubble {
  position: absolute;
  bottom: 78px;
  right: 0;
  max-width: 180px;
  min-width: 80px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(147,197,253,0.7);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: #1e3a5f;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-all;
}
#akBubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 20px;
  width: 12px;
  height: 7px;
  background: rgba(255,255,255,0.96);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-bottom: none;
}

/* ── モーダルオーバーレイ ── */
#akModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9800;
  background: rgba(10,8,28,0.82);
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  backdrop-filter: blur(6px);
}
#akModal.ak-open {
  display: flex;
}
#akModalCard {
  position: relative;
  width: 100%;
  max-width: 360px;
  min-height: 520px;
  max-height: 88vh;
  overflow-y: auto;
  /* ハウス背景＋暗めのグラデオーバーレイ（上は明るく・下は読みやすく） */
  background:
    linear-gradient(180deg,
      rgba(10,8,28,0.30) 0%,
      rgba(10,8,28,0.38) 45%,
      rgba(10,8,28,0.72) 75%,
      rgba(10,8,28,0.85) 100%),
    url('../img/ai-kun/bg-modal.webp') center top / cover no-repeat;
  border: 1.5px solid rgba(147,197,253,0.35);
  border-radius: 22px;
  padding: 20px 18px 24px;
  box-shadow: 0 20px 70px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.1);
  animation: akModalIn .28s ease;
  scrollbar-width: none;
}
#akModalCard::-webkit-scrollbar { display: none; }

/* 閉じるボタン */
#akModalClose {
  position: absolute;
  top: 12px; right: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  width: 30px; height: 30px;
  color: #e2e8f0;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  z-index: 1;
}
#akModalClose:hover { background: rgba(0,0,0,0.55); color:#fff; }

/* キャラ名・ステージ（最上部） */
#akModalInfo {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 14px;
}
#akModalName {
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  letter-spacing: .05em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
#akModalStage {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 12px;
  background: rgba(147,197,253,0.18);
  border: 1px solid rgba(147,197,253,0.45);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* セリフ吹き出し（ウィジェットと同スタイル、キャラの上） */
#akModalSpeech {
  position: relative;
  background: rgba(255,255,255,0.96);
  border: 1.5px solid rgba(147,197,253,0.75);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  color: #1e3a5f;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  margin-bottom: 0;
  text-align: center;
  min-height: 36px;
}
/* 吹き出し三角（下向き → キャラを指す） */
#akModalSpeech::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 9px;
  background: rgba(255,255,255,0.96);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* キャラ画像（吹き出しの下） */
#akModalCharWrap {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  margin-bottom: 20px;
}
#akModalImg {
  width: 130px;
  height: 130px;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(147,197,253,0.5));
  animation: akFloat 3.2s ease-in-out infinite;
}

/* 達成率バー */
#akModalProgress {
  margin-bottom: 14px;
}
#akModalProgressLabel {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 6px;
}
#akModalProgressBg {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
}
#akModalProgressBar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 4px;
  transition: width .6s cubic-bezier(.22,1,.36,1);
}
#akModalMilestones {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
}
#akModalMilestones span {
  font-size: 9px;
  color: #64748b;
  text-align: center;
  line-height: 1.3;
}

/* 月次履歴 */
#akModalHistory {
  font-size: 11px;
  color: #64748b;
}
.ak-hist-label {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 5px;
  letter-spacing: .05em;
}
.ak-hist-item {
  display: block;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #64748b;
}

/* ネイティブアプリ: オンボーディングフォント強制（iOS Hiragino） */
html.capacitor-native #ob-card span,
html.capacitor-native #ob-card button,
html.capacitor-native [id^="ob-"] {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', sans-serif !important;
}
