/* =========================================================
   base.css — リセット／日本語組版／アプリの骨格
   骨格＝上帯（固定）＋ 解説ボタンの行 ＋ 横スワイプの甲板 ＋ 下タブ（固定）
   ========================================================= */

*, *::before, *::after{ box-sizing: border-box; }

html{
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;   /* タブ連打での拡大を止める */
}

body{
  margin: 0;
  font-family: var(--ff-ja);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: .01em;
  color: var(--ink);
  background: var(--nm-bg);
  /* 日本語の改行事故を止める（430px幅は特に起きやすい）
     ★overflow-wrap:anywhere は入れない。line-break:strict の禁則を打ち消し、
       行頭に「。」「）」が来る */
  word-break: auto-phrase;
  line-break: strict;
  /* アプリらしく、body 自体は動かさない */
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

h1, h2, h3, p, ul, ol, figure, table{ margin: 0; }
ul, ol{ padding: 0; list-style: none; }
img{ max-width: 100%; height: auto; display: block; }
button, input, select, textarea{ font: inherit; color: inherit; }
a{ color: var(--accent-deep); }

/* 数字は等幅で桁を揃える（21-2） */
.num{
  font-family: var(--ff-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.01em;
}

/* ── アプリの外枠 ─────────────────────────────── */
.app{
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin-inline: auto;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: var(--nm-bg);
}

/* PC で見たときに余白を放置しない（MOBILE_FIRST_DESIGN §1-2） */
@media (min-width: 768px){
  body{ background: #E5E1D9; }
  .app{ box-shadow: 16px 16px 40px #D0CCC4, -16px -16px 40px #FFFFFF; }
}

/* ── 上帯 ─────────────────────────────────────── */
.topbar{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gut) 12px;
  background: var(--nm-bg);
}
.topbar .who{ min-width: 0; }
.topbar .who b{
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  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;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 上帯のポイントは「沈んだ溝」に置く。押せる物ではないので塗らない */
.topbar .mini-pt{
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 7px 13px;
  border-radius: var(--r-chip);
  background: var(--nm-bg);
  box-shadow: var(--nm-in-sm);
  color: var(--accent-deep);
}
.topbar .mini-pt b{ font-size: 15px; font-weight: 600; }
.topbar .mini-pt span{ font-size: 12px; }

.avatar{
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--nm-bg);
  box-shadow: var(--nm-up-sm);
  color: var(--accent-deep);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600;
  flex: 0 0 auto;
}

/* ── 甲板（横スワイプ）─────────────────────────────
   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;
  scroll-snap-stop: always;   /* 勢いよくスワイプしても1枚ずつ止める */
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px var(--gut) 32px;
}

/* ── 下タブ ───────────────────────────────────── */
.tabbar{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--nm-bg);
}
.tabbar a{
  min-height: var(--tap);
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px 2px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.25;
  background: var(--nm-bg);
  transition: color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tabbar a svg{ width: 21px; height: 21px; }
/* 現在地は「押し込まれている」＝色と沈みの2つで示す（片方だけに頼らない）*/
.tabbar a[aria-current="page"]{
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: var(--nm-in-sm);
}
.tabbar a:active{ box-shadow: var(--nm-in-sm); }
.tabbar a:focus-visible{ outline: 3px solid var(--accent-deep); outline-offset: -3px; }

/* 動きを抑える設定を尊重する */
@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;
}
