/* Kaname 画面下・固定タブバー（全ページ共通の迷子解消ナビ）。
   目的：ユーザーが「今どこにいて、どこへ行けるか」を常に分かるよう、
   スマホアプリ標準の固定タブバーを全ページの画面下に常時表示する。
   5タブ：☀️今日 / 🐾相棒 / 🔎診断 / 🧰整える / 📚学ぶ。
   方針：上質ポップ・白地＋青(#2B6CF6)・角丸・M PLUS Rounded・390px最優先・アクセシブル。
   トークンは kaname.css の --kt-* を再利用（kaname.css / kaname_pop.css は編集しない）。
   スコープ：.kt-tabbar のみ。 */

/* タブバーに隠れない余白（全ページ共通）。
   safe-area（iPhone のホームバー領域）も加味して下げる。 */
:root {
  --kt-tabbar-h: 64px;
}
body {
  /* タブバー実高＋安全余白に十分被らない下余白（被り防止の保険込み）。 */
  padding-bottom: calc(var(--kt-tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  /* 保険：万一どこかで横幅が溢れても“幽霊横スクロール”と固定要素の押し出しを断つ。
     clip は scroll を生まないので位置固定の下部タブバーに影響しない。 */
  overflow-x: clip;
}

.kt-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;      /* paddingを幅に含め、5分割合計が横幅を超えない＝横はみ出し防止 */
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--kt-card, #fff);
  border-top: 1.5px solid var(--kt-line, #E4E9F2);
  box-shadow: 0 -6px 22px rgba(43, 108, 246, 0.08);
  font-family: var(--kt-sans, sans-serif);
  /* iOS で要素が下に流れたときも操作できるよう本体は触れる */
  -webkit-tap-highlight-color: transparent;
}

.kt-tabbar-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  min-height: 52px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--kt-ink-soft, #5B6478);
  transition: background .15s ease, color .15s ease, transform .08s ease;
}
.kt-tabbar-item:hover { background: var(--kt-accent-bg, #E7EFFF); }
.kt-tabbar-item:active { transform: scale(.95); }
.kt-tabbar-item:focus-visible {
  outline: 3px solid var(--kt-accent, #2B6CF6);
  outline-offset: 2px;
}

.kt-tabbar-icon {
  font-size: 22px;
  line-height: 1;
}
.kt-tabbar-label {
  font-family: var(--kt-display, sans-serif);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
}

/* 現在地のタブ＝落ち着いた濃紺でハイライト（2026-07-03 配色案2・固定UIの青の減量）。
   CTAの明るい青（--kt-accent）は押せる操作専用に残し、常時表示のタブは --kt-nav-active に分離。 */
.kt-tabbar-item[aria-current="page"] {
  color: var(--kt-nav-active, var(--kt-link, #2850A6));
  background: var(--kt-accent-bg, #E7EFFF);
}
.kt-tabbar-item[aria-current="page"] .kt-tabbar-label {
  color: var(--kt-nav-active, var(--kt-link, #2850A6));
}

@media (prefers-reduced-motion: reduce) {
  .kt-tabbar-item { transition: none; }
  .kt-tabbar-item:active { transform: none; }
}

/* ================================================================== */
/* デスクトップ表示（2026-07-05・PC最適化）。                          */
/*   これまでPC幅でも本バーがビューポート全幅に広がり、中央寄せの本文列 */
/*   （.kt-inner）とズレて見えていた（オーナー指摘「センターがずれている」）。 */
/*   kaname.css が定義する --kt-app-w に合わせて中央へ収め、本文列と    */
/*   同じ中心軸に揃える。モバイル(≤767px)側の値は一切変更しない。       */
/* ------------------------------------------------------------------ */
@media (min-width: 768px) {
  .kt-tabbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(var(--kt-app-w, 600px), calc(100vw - var(--kt-app-gutter-x, 40px)));
    max-width: var(--kt-app-w, 600px);
    border-radius: 20px 20px 0 0;
  }
  /* 「つぎの一歩」バンド（.kt-wayfind）が直上にある画面では、継ぎ目を
     四角にして1枚の浮島カードに見えるようにする（バンド側が上端を丸める）。 */
  body:has(.kt-wayfind) .kt-tabbar {
    border-radius: 0;
  }
}
