/* ============================================================
   base.css — 土台
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* 見出しは太字を最小限に。本文では強調しない */
h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
}
h1 { font-size: var(--fs-lg); }
h2 { font-size: var(--fs-md); }

p { margin: 0 0 var(--sp-3); }

a { color: var(--accent); text-decoration: none; }

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* ---- アプリ全体の骨組み ---------------------------------- */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* 共通ヘッダー */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header__title {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.header__action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  height: var(--tap);
  color: var(--text-sub);
}
.header__action svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
}

/* 画面の中身 */
.view {
  flex: 1;
  padding: var(--sp-5) var(--gutter);
  /* 下タブ + 端末のホームバーぶんだけ空ける */
  padding-bottom: calc(var(--tabbar-h) + var(--sp-7) + env(safe-area-inset-bottom));
}

/* 下タブ */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--tabbar-h);
  color: var(--text-weak);
  font-size: var(--fs-xs);
}
.tabbar__item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar__item.is-active { color: var(--accent); }

/* ＋ ボタン(クイック記録。中身は STEP 5 で作る) */
.fab {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--tabbar-h) + var(--sp-4) + env(safe-area-inset-bottom));
  z-index: 15;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(58, 54, 50, 0.18);
}

/* 画面遷移: 右→左のスライド(200ms) */
@media (prefers-reduced-motion: no-preference) {
  .view { animation: slide-in 200ms ease-out; }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
