/* =========================================================
   base.css — リセット／日本語組版／アプリの骨格
   骨格＝上帯（固定）＋ 横スワイプの甲板 ＋ 下タブ（固定）
   ========================================================= */

*, *::before, *::after{ box-sizing: border-box; }

html{
  -webkit-text-size-adjust: 100%;
  /* iOS でタブを連打したときの拡大を止める */
  touch-action: manipulation;
}

body{
  margin: 0;
  font-family: var(--ff-ja);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper-2);
  /* 日本語の改行事故を止める（430px幅は特に起きやすい）
     ★overflow-wrap:anywhere は入れない。line-break:strict の禁則を打ち消し、
       行頭に「。」「）」が来る。長い英字の URL 等は個別に対処する */
  word-break: auto-phrase;
  line-break: strict;
  /* アプリらしく、body 自体は動かさない */
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

h1, h2, h3, p, ul, ol, figure{ margin: 0; }
ul, ol{ padding: 0; list-style: none; }
img{ max-width: 100%; height: auto; display: block; }
/* フォーム部品はブラウザ既定の書体（Windows Chrome は Arial）が残るので継がせる */
button, input, select, textarea{ font: inherit; color: inherit; }
a{ color: var(--accent-deep); }

/* 数字は等幅で桁を揃える */
.num{
  font-family: var(--ff-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.01em;
}

/* ── アプリの外枠（SP特化型の列を中央に置く） ───────────── */
.app{
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin-inline: auto;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  box-shadow: var(--lift-2);
}

/* PC で見たときに余白を放置しない（MOBILE_FIRST_DESIGN §1-2） */
@media (min-width: 768px){
  body{
    background:
      radial-gradient(1200px 600px at 50% -10%, #F1EAE1 0%, transparent 60%),
      var(--paper-2);
  }
}

/* ── 上帯 ─────────────────────────────────────── */
.topbar{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) var(--gut) 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar .who{ min-width: 0; }
.topbar .who b{
  display: block;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .who span{
  display: block;
  font-size: var(--fs-label);
  color: var(--ink-3);
  line-height: 1.4;
}
.topbar .mini-pt{
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--r-chip);
  background: var(--on-accent);
  color: var(--white);
  box-shadow: 0 2px 0 var(--edge-accent);
}
.topbar .mini-pt b{ font-size: 15px; font-weight: 800; }
.topbar .mini-pt span{ font-size: 11px; }

.avatar{
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(150deg, #8E6A50, var(--on-accent));
  color: var(--white);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  flex: 0 0 auto;
  box-shadow: 0 2px 0 var(--edge-accent);
}

/* ── 甲板（横スワイプ）─────────────────────────────
   scroll-snap で1画面ずつ止める。ライブラリは使わない。
   ★この中に横スクロールする部品を入れない（スワイプが二重になる）。 */
.deck{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.deck::-webkit-scrollbar{ display: none; }

.panel{
  scroll-snap-align: start;
  /* 勢いよくスワイプしても1枚ずつ止める */
  scroll-snap-stop: always;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px var(--gut) 24px;
}

/* ── 下タブ ───────────────────────────────────── */
.tabbar{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a{
  min-height: var(--tap);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 2px 6px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .01em;
  transition: color var(--dur) var(--ease);
}
.tabbar a svg{ width: 22px; height: 22px; }
.tabbar a[aria-current="page"]{ color: var(--accent-deep); font-weight: 700; }
.tabbar a[aria-current="page"] .dot{
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent-deep);
}
.tabbar .dot{ width: 4px; height: 4px; }

/* 動きを抑える設定を尊重する */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 読み上げ専用 */
.sr{
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
