:root {
  color-scheme: dark;
  --surface-1: #121214;
  --surface-2: #1c1c1f;
  --surface-3: #2b2b2f;
  --text-primary: #f2f2f4;
  --text-secondary: #b5b5ba;
  --text-muted: #85858c;
  --text-accent: #ff5a7a;
  --bg-accent: #3a2129;
  --border: #333338;

  /* 横スクロールサムネイル(好きリスト履歴・お気に入りリスト)共通の幅。
     main(max-width:480px, 左右padding16px)配下でN=4個が完全に見え、5個目が
     ちょうど20%だけ見切れるよう、64px(padding32px+gap8px×4個分)を引いた
     残り幅を4.2で割って算出する。固定pxではなく画面幅に対する比率で
     決まるため、デバイス幅が変わっても常に約0.2個分の見切れが保たれる。 */
  --shelf-thumb-width: calc((min(100vw, 480px) - 64px) / 4.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--surface-1);
  color: var(--text-primary);
  padding-bottom: 72px; /* app-footer分の余白(フッター自体の底上げ分10pxを含む) */
}
body.theme-black { background: #000; }
body.no-footer { padding-bottom: 0; }

a { color: inherit; }
button { font-family: inherit; }

/* ロゴ: 太字ピンク、ピリオドのみ白 */
.logo { font-weight: 800; letter-spacing: -0.2px; color: var(--text-accent); text-decoration: none; }
.logo .logo-dot { color: #fff; }

/* 共通ヘッダー */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 10px;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.app-header .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}
.app-header.dark .icon-btn { background: rgba(255, 255, 255, 0.12); color: #fff; }
.app-header .back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
}

/* 共通フッターナビ。iPhoneの画面下端スワイプ操作(ホームインジケーター)の
   邪魔にならないよう、画面最下部から少し浮かせて配置する */
.app-footer {
  position: fixed;
  left: 50%; bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 20;
  display: flex;
  height: 62px;
  background: #111;
  border-top: 0.5px solid rgba(255, 255, 255, 0.1);
}
.app-footer.light { background: var(--surface-1); border-top: 0.5px solid var(--border); }
.app-footer .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}
.app-footer.light .tab-item { color: var(--text-muted); }
.app-footer .tab-item.active { color: #fff; }
.app-footer.light .tab-item.active { color: var(--text-accent); }
.app-footer .tab-item span { font-size: 9px; }
.app-footer .tab-item svg { width: 20px; height: 20px; }

/* ボタン */
.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}
.btn-accent { background: var(--text-accent); color: #fff; }
.btn-accent:hover { opacity: 0.9; }
.btn-surface { background: var(--surface-2); color: var(--text-primary); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 0.5px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* モーダル共通(年齢確認・ログイン等)。疑似フルスクリーンの動画エリア(z-index:200)より
   常に前面に出す必要があるため、それより高い値にしておく */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.with-blur { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(14px); }
.modal-overlay.dim { background: rgba(0, 0, 0, 0.45); }
.modal-box {
  background: var(--surface-1);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  position: relative;
}
.modal-box .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.modal-box h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-box p {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.modal-box input[type="email"] {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 16px; /* iOS Safariのフォーカス時自動拡大を防止するため16px以上にする */
  margin-bottom: 14px;
}
.modal-box .btn {
  width: 100%;
  height: 42px;
  font-size: 14px;
  margin-bottom: 10px;
}
.modal-status {
  font-size: 11px;
  min-height: 1.4em;
  color: var(--text-muted);
  margin-bottom: 10px !important;
  line-height: 1.6;
}

/* トースト */
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 0.5px solid var(--text-accent);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 90;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.toast a { color: var(--text-accent); font-weight: 600; margin-left: 8px; }
.toast[hidden] { display: none; }
