:root {
  color-scheme: light;
  --bg: #f8f5ee;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --ink: #2c2924;
  --soft: #5c554b;
  --muted: #8a8174;
  --line: #e7dfd2;
  --coral: #e96f5c;
  --coral-soft: #fff0eb;
  --coral-deep: #ab3f31;
  --sage: #6fa981;
  --sage-soft: #edf8ef;
  --sage-deep: #356b45;
  --sky: #6c9fd5;
  --sky-soft: #eef6ff;
  --sky-deep: #315f93;
  --gold: #d9a72f;
  --shadow: 0 18px 44px rgba(77, 63, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  max-width: 460px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: rgba(248, 245, 238, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 9px;
  align-items: center;
}

.brand-mark {
  font-size: 22px;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

/* #49 ホーム画面式ページャ：4ビューを横に並べ、ネイティブの横スクロール＋スナップで移動 */
.main {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.main::-webkit-scrollbar {
  display: none;
}

.app-view {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always; /* 1スワイプ1ページ（#25の教訓） */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 112px;
  scrollbar-width: none;
}

.app-view::-webkit-scrollbar {
  display: none;
}

.child-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain; /* チップ端でページャに連鎖させない */
  scrollbar-width: none;
}

.child-switcher::-webkit-scrollbar {
  display: none;
}

.child-chip,
.add-child-button {
  min-height: 46px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  padding: 7px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.child-chip.is-active {
  background: var(--coral-soft);
  border-color: var(--coral);
  box-shadow: inset 0 0 0 1px var(--coral);
}

.child-chip .name {
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.child-chip .meta {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.add-child-button {
  border-style: dashed;
  color: var(--muted);
  font-weight: 800;
}

.date-card,
.age-card,
.section-block,
.entry-panel,
.calendar-card,
.output-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(77, 63, 42, 0.05);
}

.date-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  margin-bottom: 12px;
}

.date-nav,
.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

.date-nav:active,
.icon-button:active {
  background: var(--line);
}

.date-label {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-weight: 800;
  line-height: 1.25;
}

.date-label small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.age-card {
  margin-bottom: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.age-card .title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.age-card .stage {
  margin-top: 2px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.age-card select,
.settings-row input,
.settings-row select {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
  font-weight: 800;
}

.section-block,
.entry-panel,
.calendar-card {
  margin-bottom: 14px;
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.category-grid {
  display: flex;
  gap: 8px;
  margin: 0 -14px;
  padding: 0 14px 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain; /* チップ端でページャに連鎖させない */
  scrollbar-width: none;
}

.category-grid::-webkit-scrollbar {
  display: none;
}

.category-button {
  position: relative;
  min-width: 84px;
  min-height: 58px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--ink);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.category-button.is-active {
  background: var(--sky-soft);
  border-color: var(--sky);
  box-shadow: inset 0 0 0 1px var(--sky);
}

.category-button .emoji {
  display: inline;
  font-size: 18px;
}

.category-button .label {
  display: inline;
  margin-top: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.count-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--coral);
  color: white;
  font-size: 11px;
  font-weight: 900;
  line-height: 20px;
}

.entry-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.entry-title-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.entry-title .emoji {
  font-size: 24px;
}

.entry-title strong {
  font-size: 16px;
}

.entry-nav {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.entry-nav button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--soft);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.button-cloud,
.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-button-cloud {
  gap: 10px;
}

.custom-button-item {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.custom-button-item .tag-button {
  padding-right: 58px;
}

.custom-actions {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  gap: 3px;
  transform: translateY(-50%);
}

.custom-action-button {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--soft);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.custom-action-button.danger {
  color: var(--coral-deep);
}

.button-group {
  margin-top: 12px;
}

.button-group:first-of-type {
  margin-top: 0;
}

.meal-time-picker {
  margin: 2px 0 12px;
}

.segmented-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.segment-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.segment-button.is-active {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}

.tag-button,
.selected-chip,
.pill,
.secondary-button,
.text-button,
.primary-button {
  border-radius: 999px;
}

.tag-button {
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
}

.tag-button.is-selected {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}

.free-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.temperature-add,
.sleep-add,
.medicine-add,
.first-food-add {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border-radius: 14px;
  background: var(--coral-soft);
  padding: 10px;
}

.medicine-add {
  background: var(--sky-soft);
}

.temperature-add {
  grid-template-columns: 1fr 1fr;
}

.sleep-add {
  grid-template-columns: 1fr 1fr;
  background: var(--sage-soft);
}

.sleep-add label:nth-of-type(3) {
  grid-column: 1 / -1;
}

.temperature-add .primary-button,
.sleep-add .primary-button {
  grid-column: 1 / -1;
}

.temperature-add label,
.sleep-add label,
.medicine-add label,
.first-food-add label {
  display: grid;
  gap: 6px;
  color: var(--coral-deep);
  font-size: 12px;
  font-weight: 900;
}

.sleep-add label {
  color: var(--sage-deep);
}

.medicine-add label {
  color: var(--sky-deep);
}

.temperature-add input,
.temperature-add select,
.sleep-add input,
.medicine-add input,
.first-food-add input,
.free-add input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-strong);
  padding: 11px 12px;
  outline: none;
}

.primary-button {
  border: 0;
  background: var(--ink);
  color: white;
  padding: 11px 16px;
  font-weight: 900;
}

.primary-button.compact {
  padding: 8px 14px;
  font-size: 13px;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 800;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 800;
}

.selected-groups {
  display: grid;
  gap: 10px;
}

/* チップのひとこと入力（#36） */
.note-edit {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 6px;
}

.note-edit input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-strong);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}

.selected-group {
  border-radius: 14px;
  background: var(--bg);
  padding: 11px;
}

.selected-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap; /* 量・✎・×が収まらない幅では中で折り返す（#45・画面外に切れるのを防ぐ） */
  max-width: 100%;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
  padding: 7px 8px 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.selected-chip > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
/* #73 デッドクリック対策：チップの文字本体を押せる（食事=量5択／他=ひとこと） */
.chip-label {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip-label:active {
  opacity: 0.6;
}

/* リセット確認ダイアログ（残課題②） */
.reset-body {
  display: grid;
  gap: 12px;
  padding: 18px 16px;
}

.reset-body h2 {
  margin: 0;
  font-size: 17px;
}

.reset-body p {
  margin: 0;
  font-size: 13px;
  color: var(--soft);
}

.reset-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 13.5px;
  font-weight: 800;
}

.reset-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--coral);
}

/* 思い出ページ：写真の下に「今日のひとこと」（#47・親の声をページの主役に） */
.day-detail .memory-hitokoto {
  margin: 2px 0 4px;
  background: var(--coral-soft);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--coral-deep);
}

.day-detail .memory-hitokoto small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 10px;
  margin-bottom: 3px;
}

/* チップのひとことボタン（#36/#45）。✎ひと文字のために量ボタンの幅（min-width:68px）を借りない */
.age-card-info {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.note-button {
  max-width: 110px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--soft);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-chip .remove-chip {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-weight: 900;
}

.amount-button {
  min-width: 68px;
  height: 32px;
  border: 1px solid var(--sage);
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}
.amount-button.is-open {
  background: var(--sage);
  color: white;
}

/* 「ぜんぶ完食」一括バー（食事グループの見出し直下） */
.bulk-amount-button {
  align-self: flex-start;
  margin: 2px 0 8px;
  height: 32px;
  border: 1px solid var(--sage);
  border-radius: 999px;
  background: var(--sage);
  color: white;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 900;
}

/* チップ直下に開く量5択（チップクラウド内で1行ぶん使う＝note-editと同じ折返し） */
.amount-edit {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 2px;
}
.amount-edit .segment-button {
  min-height: 38px;
  font-size: 12px;
  border-radius: 12px;
}

.pill {
  background: var(--sky-soft);
  color: var(--sky-deep);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.text-input,
.output-text {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-strong);
  color: var(--ink);
  padding: 12px;
  outline: none;
  font-size: 15px;
  line-height: 1.65;
}

.output-stack {
  display: grid;
  gap: 12px;
}

.copy-panel {
  display: grid;
  gap: 9px;
}

/* 貼り付けタブ：欄コピーの下に共有メモカード（#54） */
.copy-panel + .output-card {
  margin-top: 14px;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.copy-row:active {
  opacity: 0.6;
}

.copy-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.copy-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.copy-row p {
  margin: 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line; /* 共有メモの改行（Issue #22）を貼り付け用の表示でも保つ */
}

.output-card {
  padding: 13px;
}

.output-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
}

.badge.sage {
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.badge.coral {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.edited-label {
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 18px;
}

.week-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.week-row span {
  padding: 5px 0;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.calendar-day.is-today {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.calendar-day.has-record::after {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  bottom: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
}

.trend-list {
  display: grid;
  gap: 9px;
}

.trend-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-radius: 14px;
  background: var(--bg);
  padding: 10px 12px;
}

.trend-item strong {
  font-size: 13px;
}

.trend-item span {
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.trend-item.is-medical {
  display: grid;
  background: var(--sky-soft);
}

.trend-item.is-medical span {
  text-align: left;
  line-height: 1.5;
}

.temp-line-chart {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.temp-line-chart svg {
  width: 100%;
  height: 66px;
  overflow: visible;
}

.temp-line-chart polyline,
.temp-line-chart circle {
  fill: none;
  stroke: var(--coral);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.temp-line-chart polyline {
  stroke-width: 4;
}

.temp-line-chart circle {
  fill: #fff7f2;
  stroke-width: 3;
}

.temp-line-chart text {
  fill: var(--coral-deep);
  font-size: 9px;
  font-weight: 900;
  text-anchor: middle;
}

.temp-guide {
  fill: none;
  stroke: rgba(47, 40, 35, 0.12);
  stroke-dasharray: 4 5;
  stroke-linecap: round;
}

.temp-line-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.temp-line-labels span {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
}

.temp-line-labels small,
.temp-line-labels em {
  font-size: 9px;
  font-style: normal;
  line-height: 1.1;
}

.trend-summary {
  display: block;
  margin-top: 6px;
  color: var(--sky-deep);
  font-size: 11px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  padding: 13px;
  text-align: left;
}

.history-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 900;
}

.history-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.notice,
.empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 22px 14px;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: min(420px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.94);
  padding: 7px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.bottom-nav-button {
  min-width: 0;
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
}

.bottom-nav-button span {
  font-size: 20px;
  line-height: 1;
}

/* カレンダータブのアイコン＝開いている日の日にち（#38） */
.bottom-nav-button .nav-cal {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 21px;
  border: 1.5px solid currentColor;
  border-top-width: 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.bottom-nav-button strong {
  font-size: 11px;
  line-height: 1;
}

.bottom-nav-button.is-active {
  background: var(--paper-strong);
  color: var(--coral-deep);
  box-shadow: inset 0 0 0 2px #e6bd52;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  background: rgba(37, 31, 25, 0.28);
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(440px, 100%);
  max-height: min(86vh, 760px);
  overflow: hidden;
  border-radius: 22px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.modal-panel.large {
  max-height: 90vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.modal-body {
  max-height: calc(90vh - 72px);
  overflow-y: auto;
  padding: 14px 16px 18px;
}

/* 初回起動：なまえ＋誕生日を聞くウェルカム画面 */
.welcome-body {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 26px 22px 22px;
}

.welcome-mark {
  font-size: 40px;
  line-height: 1;
}

.welcome-body h2 {
  margin: 0;
  font-size: 19px;
}

.welcome-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.welcome-form {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 260px;
  margin-top: 4px;
}

.welcome-form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 11px 12px;
  font-size: 15px;
  text-align: center;
  width: 100%;
}

.welcome-age-echo {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  padding: 12px;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-row input {
  min-width: 0;
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 40;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  transition: 0.2s ease;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 360px) {
  .app-view {
    padding-inline: 12px;
  }

  .category-grid {
    gap: 7px;
  }

  .category-button {
    min-height: 78px;
  }
}

/* ===== 写真カルーセル（横スワイプ）===== */
.photo-strip{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 10px;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;}
.photo-strip::-webkit-scrollbar{height:0;}
.photo-item{position:relative;flex:0 0 auto;scroll-snap-align:start;}
.photo-item img{display:block;width:158px;height:198px;object-fit:cover;border-radius:18px;background:#efe9df;box-shadow:0 8px 22px -14px rgba(60,52,40,.45);}
.photo-item.photo-missing img{visibility:hidden;}
.photo-item.photo-missing{width:158px;height:198px;border-radius:18px;background:#efe9df;display:flex;align-items:center;justify-content:center;}
.photo-item.photo-missing::after{content:"写真が見つかりません";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:0 14px;color:var(--muted,#8c8378);font-size:12px;line-height:1.5;pointer-events:none;}
.photo-item.photo-missing .photo-del{z-index:2;}
.photo-del{position:absolute;top:7px;right:7px;width:26px;height:26px;border:none;border-radius:50%;background:rgba(40,34,28,.6);color:#fff;font-size:16px;line-height:24px;text-align:center;cursor:pointer;padding:0;}
.photo-add{flex:0 0 auto;width:158px;height:198px;border:2px dashed var(--line,#e6dfd3);border-radius:18px;background:transparent;color:var(--muted,#8c8378);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;cursor:pointer;font-size:13px;scroll-snap-align:start;}
.photo-add:hover{border-color:var(--clay,#b49a7c);color:var(--clay-deep,#9c8062);}
.photo-add-plus{font-size:28px;line-height:1;}
/* カレンダー思い出ページ */
.day-detail .photo-strip{margin:2px 0 14px;}
/* #74① 前後日ナビ（‹ ›） */
.day-nav-group{display:flex;align-items:center;gap:6px;min-width:0;}
.day-nav{flex:0 0 auto;width:30px;height:30px;border:1px solid var(--line,#e6dfd3);border-radius:999px;background:var(--bg,#f8f5ee);color:var(--ink,#2e2a24);font-size:18px;line-height:1;cursor:pointer;-webkit-tap-highlight-color:transparent;}
.day-nav:disabled{opacity:.3;cursor:default;}
/* #5 タグ・ひとことをタップでその日を編集（押せる手掛かり） */
.day-detail .memory-hitokoto,.day-tags{cursor:pointer;-webkit-tap-highlight-color:transparent;}
.day-detail .memory-hitokoto:active,.day-tags:active{opacity:.65;}
.day-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:10px 0;}
.day-tags-label{font-size:11px;color:var(--muted,#8c8378);margin-right:2px;letter-spacing:.04em;}
.day-tag{font-size:11.5px;padding:3px 10px;border-radius:999px;background:var(--surface2,#f6f0e8);color:var(--muted,#857c71);border:1px solid var(--line,#ece4da);}
.nursery-fold{margin:6px 0 2px;}
.nursery-fold summary{cursor:pointer;font-size:13px;color:var(--clay-deep,#9c8062);padding:6px 2px;list-style:none;}
.nursery-fold summary::-webkit-details-marker{display:none;}
.nursery-fold summary::before{content:"▸ ";}
.nursery-fold[open] summary::before{content:"▾ ";}

/* タップで拡大（スワイプ式ライトボックス・自然なサイズ）*/
.photo-item img,.day-detail img[data-photo-id]{cursor:pointer;}
.photo-lightbox{position:fixed;inset:0;z-index:200;background:rgba(247,243,236,.45);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);transition:opacity .16s ease;}
.lightbox-track{position:absolute;inset:0;display:flex;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;}
.lightbox-track::-webkit-scrollbar{display:none;}
.lightbox-slide{flex:0 0 100%;scroll-snap-align:center;scroll-snap-stop:always;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;}
.lightbox-slide img{max-width:75vw;max-height:66vh;object-fit:contain;border-radius:14px;box-shadow:0 18px 48px -16px rgba(60,52,40,.5);cursor:default;}
.lightbox-close{position:absolute;top:16px;right:16px;z-index:3;width:40px;height:40px;border:none;border-radius:50%;background:rgba(46,42,36,.14);color:#3b362e;font-size:22px;line-height:38px;text-align:center;cursor:pointer;padding:0;}

/* アプリ化（ホーム画面に追加）ガイド */
.install-card{background:#fbf8f2;border:1px solid #ece4d6;}
.install-lead{color:#7a7264;font-size:13.5px;margin:6px 0 10px;}
.install-note{background:#fff5ea;border:1px solid #f0e0c8;border-radius:12px;padding:10px 12px;font-size:12.5px;color:#8a6a3a;line-height:1.6;margin:0 0 12px;}
.install-os{border-top:1px solid #ece4d6;padding:10px 0 2px;}
.install-os summary{cursor:pointer;font-weight:700;font-size:14px;color:#3b362e;list-style:none;padding:4px 0;}
.install-os summary::-webkit-details-marker{display:none;}
.install-os summary::before{content:"▸ ";color:#b49a7c;}
.install-os[open] summary::before{content:"▾ ";}
.install-steps{margin:8px 0 4px;padding-left:20px;}
.install-steps li{font-size:13.5px;color:#4a443b;line-height:1.7;margin-bottom:4px;}
.install-steps strong{color:#2e2a24;}
.install-done{color:#5e7152;font-weight:700;font-size:15px;margin-top:6px;}
.install-inapp{background:#fdeeee;border:1px solid #f3d2d2;border-radius:12px;padding:12px 14px;margin:0 0 12px;}
.install-inapp-title{font-weight:700;color:#b4453c;font-size:13.5px;margin-bottom:4px;}
.install-inapp p{font-size:12.5px;color:#7a4a44;line-height:1.6;}
.install-inapp .install-steps li{color:#6a4540;}

/* 誕生日入力・月齢ヒント */
.birthday-input{font-family:inherit;font-size:14px;border:1px solid var(--line,#e6dfd3);border-radius:12px;padding:8px 12px;background:#fff;color:inherit;}
.child-age-hint{font-size:12px;color:#8c8378;margin:6px 2px 0;}
.custom-toggle{margin-top:8px;color:#8a8174;font-size:12px;font-weight:700;background:none;border:none;padding:4px 2px;}
.history-actions{display:flex;gap:8px;flex:none;}
.backup-nudge{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;background:var(--paper);border:1px dashed var(--line);border-radius:14px;padding:10px 14px;margin:0 0 14px;font-size:12.5px;color:var(--soft);}
.backup-nudge-actions{display:flex;align-items:center;gap:6px;flex:none;}
.backup-nudge .secondary-button{min-height:34px;padding:4px 14px;font-size:12px;}

/* ===== 0歳の記録ボタン＋高速ドック ===== */
.baby-entry{width:100%;border:none;border-radius:16px;padding:14px;background:var(--ink);color:#fff;font-weight:800;font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;margin:0 0 14px}
.baby-entry:active{transform:scale(.98)}
.baby-entry small{font-weight:700;font-size:10.5px;opacity:.75}
.bsheet{position:fixed;inset:0;max-width:460px;margin:0 auto;background:var(--bg,#f8f5ee);transform:translateY(100%);transition:transform .32s cubic-bezier(.32,.72,0,1);display:flex;flex-direction:column;z-index:300}
.bsheet.open{transform:translateY(0)}
.bs-top{padding:10px 16px 2px;text-align:center;flex:none}
.bs-top .grab2{width:42px;height:5px;background:var(--line,#e6dfd3);border-radius:3px;margin:2px auto 8px}
.bs-close{background:#fff;border:1px solid var(--line,#e6dfd3);border-radius:999px;padding:7px 18px;font-size:13px;font-weight:800;color:var(--ink,#2e2a24);cursor:pointer}
.pulse{display:flex;gap:8px;padding:8px 16px 6px;flex:none}
.pcard{flex:1;background:#fff;border:1px solid var(--line,#e6dfd3);border-radius:16px;padding:10px 12px;cursor:pointer}
.pcard .pl{font-size:10px;color:var(--muted,#8c8378);font-weight:700}
.pcard .pv{font-size:21px;font-weight:800;line-height:1.25;margin-top:1px;color:var(--ink,#2e2a24)}
.pcard .ps{font-size:10.5px;color:var(--muted,#8c8378);margin-top:1px}
.pcard.asleep{background:#e7efe1;border-color:#cfe0c4}.pcard.asleep .pv{color:#41553a}
.bs-feed{flex:1;overflow-y:auto;padding:2px 16px 8px}
.bs-feed .ttl2{font-size:10px;color:var(--muted,#8c8378);font-weight:700;margin:4px 0}
.brow{display:flex;align-items:center;gap:10px;padding:7px 2px;border-top:1px dashed var(--line,#e6dfd3);font-size:13px;color:var(--ink,#2e2a24);cursor:pointer}
.brow:first-of-type{border-top:none}.brow .t{font-weight:800;width:44px}.brow .erev{margin-left:auto;color:#bcae9c;font-size:14px}
.bempty{color:var(--muted,#8c8378);font-size:12px;text-align:center;padding:14px}
.bdock{background:#fff;border-top:1px solid var(--line,#e6dfd3);border-radius:22px 22px 0 0;box-shadow:0 -10px 30px -18px rgba(60,52,40,.4);padding:8px 14px 16px;flex:none}
.btabs{display:flex;gap:5px;margin-bottom:10px}
.btab{flex:1;border:1px solid var(--line,#e6dfd3);background:var(--bg,#f8f5ee);border-radius:11px;padding:9px 0;text-align:center;font-size:11.5px;font-weight:800;cursor:pointer;white-space:nowrap;color:var(--ink,#2e2a24)}
.btab.on{background:var(--ink,#2e2a24);color:#fff;border-color:var(--ink,#2e2a24)}
.bpanes{height:188px}.bpane{display:flex;flex-direction:column;height:100%}
.when{display:flex;gap:6px;margin-bottom:8px}
.wchip{border:1px solid var(--line,#e6dfd3);background:var(--bg,#f8f5ee);border-radius:999px;padding:5px 13px;font-size:12px;font-weight:800;cursor:pointer;color:var(--ink,#2e2a24)}
.wchip.on{background:#7f9472;border-color:#7f9472;color:#fff}
.amounts{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;flex:1}
.amt{border:1px solid var(--line,#e6dfd3);background:var(--bg,#f8f5ee);border-radius:14px;text-align:center;cursor:pointer;transition:.1s;display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;color:var(--ink,#2e2a24)}
.amt b{font-size:19px;font-weight:800}.amt span{font-size:9px;color:var(--muted,#8c8378)}
.amt:active{transform:scale(.93);background:#7f9472;border-color:#7f9472;color:#fff}
.amt.prev{border-color:#b49a7c;background:#f6efe5}
.amt.prev::after{content:"前回";position:absolute;top:4px;right:6px;font-size:8px;color:#927657;font-weight:800}
.big2{display:flex;gap:8px;flex:1}
.bb{flex:1;border:1px solid var(--line,#e6dfd3);background:var(--bg,#f8f5ee);border-radius:16px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-weight:800;font-size:17px;cursor:pointer;gap:3px;color:var(--ink,#2e2a24)}
.bb small{font-size:9.5px;color:var(--muted,#8c8378);font-weight:800}.bb:active{transform:scale(.96)}
.bb.next{border-color:#b49a7c;background:#f6efe5}.bb.live{background:#e7efe1;border-color:#cfe0c4}
.btoast{position:absolute;left:50%;bottom:235px;transform:translateX(-50%) translateY(8px);background:var(--ink,#2e2a24);color:#fff;border-radius:14px;padding:10px 10px 10px 16px;font-size:13px;opacity:0;transition:.2s;pointer-events:none;z-index:30;display:flex;align-items:center;gap:10px;max-width:88%}
.btoast.show{opacity:1;transform:translateX(-50%);pointer-events:auto}
.btoast .undo{border:1px solid rgba(255,255,255,.45);background:none;color:#fff;border-radius:999px;padding:4px 12px;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap}
.edit-ov{position:absolute;inset:0;background:rgba(20,18,16,.42);display:none;align-items:flex-end;z-index:40}
.edit-ov.open{display:flex}
.edit-card{width:100%;background:#fff;border-radius:22px 22px 0 0;padding:14px 18px 20px}
.ec-head{display:flex;align-items:center;gap:8px;margin-bottom:14px}.ec-head b{font-size:16px;font-weight:800;color:var(--ink,#2e2a24)}
.ec-head .x{margin-left:auto;border:none;background:#f0ece2;border-radius:50%;width:30px;height:30px;font-size:15px;cursor:pointer;color:#5f574b}
.ec-row{margin-bottom:12px}.ec-row .l{font-size:10.5px;color:var(--muted,#8c8378);font-weight:800;margin-bottom:6px}
.ec-time{border:1px solid var(--line,#e6dfd3);background:var(--bg,#f8f5ee);border-radius:12px;padding:10px 12px;font-size:16px;font-weight:800;color:var(--ink,#2e2a24);width:100%;font-family:inherit}
.ec-chips{display:flex;flex-wrap:wrap;gap:6px}
.ec-chip{border:1px solid var(--line,#e6dfd3);background:var(--bg,#f8f5ee);border-radius:999px;padding:7px 13px;font-size:13px;font-weight:800;cursor:pointer;color:var(--ink,#2e2a24)}
.ec-chip.on{background:#7f9472;border-color:#7f9472;color:#fff}
.ec-foot{display:flex;align-items:center;margin-top:6px}
.ec-del{border:none;background:none;color:#b4453c;font-weight:800;font-size:13.5px;cursor:pointer;padding:8px 4px}
.ec-done{margin-left:auto;border:none;background:var(--ink,#2e2a24);color:#fff;border-radius:14px;padding:11px 26px;font-weight:800;font-size:14px;cursor:pointer}
.bsheet.nt{background:#1b1916}
.bsheet.nt .pcard,.bsheet.nt .bdock,.bsheet.nt .btab,.bsheet.nt .amt,.bsheet.nt .bb,.bsheet.nt .wchip,.bsheet.nt .bs-close,.bsheet.nt .edit-card,.bsheet.nt .ec-time,.bsheet.nt .ec-chip{background:#262320;border-color:#39342d;color:#ece6da}
.bsheet.nt .pcard .pv,.bsheet.nt .amt b,.bsheet.nt .ec-head b{color:#f3ede1}
.bsheet.nt .btab.on{background:#f3ede1;color:#1b1916}
.bsheet.nt .wchip.on{background:#7f9472;color:#fff;border-color:#7f9472}
.bsheet.nt .pcard.asleep,.bsheet.nt .bb.live{background:#23302150;border-color:#3a4a32}
.bsheet.nt .amt.prev,.bsheet.nt .bb.next{background:#2e2820;border-color:#5a4c38}
.bsheet.nt .brow{color:#ece6da;border-color:#39342d}.bsheet.nt .bempty,.bsheet.nt .bs-feed .ttl2{color:#8c8378}
.bsheet.nt .ec-done{background:#f3ede1;color:#1b1916}.bsheet.nt .ec-head .x{background:#39342d;color:#ece6da}

/* ===== 直近7日の傾向：日付ごとの行（スラッシュ詰め込みをやめる） ===== */
.trend-days {
  display: grid;
  gap: 4px;
}

.trend-day {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.trend-day .td-date {
  flex: 0 0 38px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
}

.trend-day .td-body {
  flex: 1;
  text-align: left;
}

/* ===== 傾向の折りたたみ（要約1行＋タップで日別） ===== */
.trend-item.is-foldable {
  cursor: pointer;
  grid-template-columns: 1fr;
}

.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.trend-caret {
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
}

.trend-detail {
  margin-top: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}

/* ===== 写真キャプション（任意のひとこと・今日タブで書く / Issue #24） ===== */
.photo-cap{width:158px;margin-top:4px;font-size:11px;line-height:1.5;color:var(--soft);font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.photo-cap-input{width:158px;margin-top:4px;border:none;border-bottom:1px dashed var(--line);background:transparent;color:var(--soft);padding:3px 2px;font-size:11px;font-weight:700;outline:none;}
.photo-cap-input::placeholder{color:#cfc4b2;}
.photo-cap-input:focus{border-bottom-color:var(--sage);color:var(--ink);}
.lightbox-slide{flex-direction:column;gap:12px;}
.lightbox-capview{max-width:75vw;color:#fff;font-size:14px;font-weight:700;text-align:center;text-shadow:0 1px 8px rgba(0,0,0,.45);}

/* ===== ドック：量の自由入力（Issue #23）とトーストのようすチップ（Issue #20） ===== */
.ml-free{display:flex;gap:6px;margin-top:8px;}
.ml-free input{flex:1;border:1px solid var(--line);background:var(--bg,#f8f5ee);border-radius:12px;padding:8px 12px;font-size:14px;font-weight:800;color:var(--ink);outline:none;}
.ml-free input::placeholder{color:#bcae9c;font-weight:700;font-size:12px;}
.ml-free-go{flex:0 0 auto;border:none;border-radius:12px;background:#7f9472;color:#fff;font-weight:800;font-size:13px;padding:0 18px;}
.ec-mlfree{width:64px;border:1px solid var(--line);background:var(--bg,#f8f5ee);border-radius:999px;padding:7px 10px;font-size:13px;font-weight:800;color:var(--ink);outline:none;}
.toast-notes{display:inline-flex;gap:5px;}
.btoast .note-chip{border:1px solid rgba(255,255,255,.45);background:none;color:#fff;border-radius:999px;padding:4px 10px;font-size:12px;font-weight:800;cursor:pointer;white-space:nowrap;}
.bsheet.nt .ml-free input,.bsheet.nt .ec-mlfree{background:#262320;border-color:#39342d;color:#ece6da;}
/* ===== ぜんいんモード：単児専用セクションを隠す（#32） ===== */
.is-all-mode .single-child-only { display: none; }
