/* ============================================================
   DUEFLOW モック スタイル
   モバイルファースト / 落ち着いたトーン / ライト・ダーク対応
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --text: #1d2330;
  --text-muted: #6b7280;
  --border: #e6e8ef;
  --primary: #4f8df5;
  --primary-weak: #e7f0ff;
  --danger: #ef5b62;
  --success: #2bb673;
  --warning: #f0a500;
  --shadow: 0 6px 20px rgba(30, 40, 80, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --appbar-h: 56px;
  --maxw: 560px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

[data-theme='dark'] {
  --bg: #11141c;
  --surface: #1a1f2b;
  --surface-2: #232a39;
  --text: #eef1f7;
  --text-muted: #9aa3b2;
  --border: #2a3140;
  --primary: #6ea1ff;
  --primary-weak: #1f2c45;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans',
    'Noto Sans JP', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---- レイアウト ----
   アプリ全体を 100dvh の縦フレックスにし、本文だけ内側スクロール。
   上部バーとボトムナビは flex 子要素として常に表示（fixed をやめ、
   iOS Safari のツールバーに隠れないようにする）。 */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100vh;       /* フォールバック */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.appbar {
  flex: none;
  z-index: 20;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg);
}
/* ロゴ｜DUEFLOW｜区切り｜画面名 を1行に */
.appbar__brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.appbar__logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  flex: none;
  box-shadow: 0 2px 6px rgba(79, 141, 245, 0.35);
}
.appbar__name {
  flex: none;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #4F8DF5, #7B5BF5);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme='dark'] .appbar__name {
  background: linear-gradient(90deg, #6ea1ff, #a78bff);
  -webkit-background-clip: text;
  background-clip: text;
}
.appbar__sep {
  flex: none;
  width: 1px; height: 16px;
  background: var(--border);
}
.appbar__view {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* 後方互換（旧クラス名） */
.appbar__title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.appbar__action {
  border: none;
  background: var(--surface);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center;
}
.appbar__action svg { width: 20px; height: 20px; display: block; }

.view {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 100px;
  outline: none;
}

/* ---- ボトムナビ ---- */
.bottomnav {
  flex: none;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 30;
}
.bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 0.66rem;
  padding-top: 6px;
}
.bottomnav__icon {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.bottomnav__icon svg { width: 23px; height: 23px; display: block; }
.bottomnav__item.active { color: var(--primary); font-weight: 700; }
.bottomnav__item.active .bottomnav__icon { transform: translateY(-1px); }

/* ---- FAB ---- */
.fab {
  position: absolute;
  right: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(79, 141, 245, 0.45);
  z-index: 25;
  transition: transform .12s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.fab svg { width: 26px; height: 26px; display: block; }
.fab:active { transform: scale(0.92); }
.fab[hidden] { display: none; }

/* ---- カード共通 ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  margin: 18px 2px 8px;
  letter-spacing: .02em;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 8px; }

/* ---- バッジ / チップ ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.chip--prio-high { background: rgba(239,91,98,.14); color: var(--danger); }
.chip--prio-mid  { background: rgba(240,165,0,.16); color: var(--warning); }
.chip--prio-low  { background: rgba(43,182,115,.14); color: var(--success); }
.chip--danger { background: rgba(239,91,98,.14); color: var(--danger); }
.chip--ok { background: rgba(43,182,115,.14); color: var(--success); }
.chip--goal { background: rgba(123,91,245,.16); color: #7B5BF5; }
[data-theme='dark'] .chip--goal { color: #a78bff; }
.chip--actual { background: var(--primary-weak); color: var(--primary); }
/* 目標 */
/* 最上部の目標ヒーロー（どうなりたいかを強調） */
.goal-hero {
  background: linear-gradient(135deg, #4F8DF5, #7B5BF5);
  color: #fff;
  border: none;
  cursor: pointer;
}
.goal-hero__label { font-size: .72rem; font-weight: 700; letter-spacing: .02em; opacity: .92; }
.goal-hero__vision { font-size: 1.18rem; font-weight: 800; line-height: 1.45; margin-top: 4px; }
.goal-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.goal-card__vision { font-weight: 800; font-size: 1.02rem; margin: 0 0 4px; }
.goal-card__criteria { color: var(--text-muted); font-size: .9rem; margin: 0 0 8px; }
.goal-card__addtask { margin-top: 10px; background: var(--primary-weak); color: var(--primary); border: none; }
.goal-card.achieved .goal-card__vision { text-decoration: line-through; color: var(--text-muted); }
.goal-why { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; }
.goal-why__label { font-size: .72rem; font-weight: 700; color: var(--text-muted); }
.field-hint { font-size: .78rem; color: var(--text-muted); margin: 4px 2px 0; }
.status--todo { background: var(--surface-2); color: var(--text-muted); }
.status--doing { background: rgba(79,141,245,.16); color: var(--primary); }
.status--done { background: rgba(43,182,115,.14); color: var(--success); }
/* サブタスク完了数チップ */
.chip--subcount { background: var(--primary-weak); color: var(--primary); }
/* サブタスクの段階インデント（孫まで） */
.item--sub { position: relative; }
.item--sub.depth-1 { padding-left: 14px; }
.item--sub.depth-2 { padding-left: 30px; }
.item--sub::before {
  content: '';
  position: absolute;
  left: 4px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}
.item--sub.depth-2::before { left: 20px; }
/* フォーム内サブタスク行 */
.subtask-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.subtask-row__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-row__title.done { text-decoration: line-through; color: var(--text-muted); }

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* 締切が迫っているタスク（迫ってる感の強調）
   静止画でも分かるよう、少し大きく＋常時リング(outline)を出し、
   さらに脈動アニメを重ねる。reduced-motion ではリングだけ残る。 */
.dot--urgent {
  width: 14px;
  height: 14px;
  outline: 3px solid rgba(239, 91, 98, 0.28);
  outline-offset: 2px;
  animation: dot-pulse 1.3s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 91, 98, 0.6); }
  70%  { box-shadow: 0 0 0 9px rgba(239, 91, 98, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 91, 98, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .dot--urgent { animation: none; }
}
.card--urgent { border: 1px solid rgba(239, 91, 98, 0.35); }

/* ---- 進捗バー ---- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress--mini { height: 4px; }
.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width .4s ease;
}

/* ---- ボタン ---- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); border-color: rgba(239,91,98,.4); }
.btn--block { width: 100%; }
/* アクションシート（再配置メニュー等）の縦並びボタン */
.sheet-btn { text-align: left; padding: 13px 14px; margin-bottom: 8px; font-weight: 600; }
.btn--withicon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-ic { display: inline-flex; }
.btn-ic svg { width: 18px; height: 18px; }
.btn--sm { padding: 6px 10px; font-size: 0.8rem; }
.btn:active { transform: translateY(1px); }

.iconbtn {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 1.05rem; padding: 6px; border-radius: 8px;
}
.iconbtn svg { width: 20px; height: 20px; display: block; }
/* インライン線画アイコン（予定ピン・固定ロックなど） */
.evt-pin { display: inline-flex; align-items: center; vertical-align: -3px; margin-right: 5px; }
.evt-pin svg { width: 15px; height: 15px; }
.icn-play { display: inline-flex; align-items: center; }
.icn-play svg { width: 18px; height: 18px; }
.icn-inline { display: inline-flex; align-items: center; vertical-align: -2px; margin-left: 5px; color: var(--text-muted); }
.icn-inline svg { width: 13px; height: 13px; }

/* ---- 統計 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat__num { font-size: 1.35rem; font-weight: 800; }
.stat__label { font-size: 0.7rem; color: var(--text-muted); }

/* ---- 締め切りカウント ---- */
.countdown { font-weight: 800; }
.countdown--danger { color: var(--danger); }
.countdown--warn { color: var(--warning); }

/* ---- リスト項目 ---- */
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.item:last-child { border-bottom: none; }
.item__main { flex: 1; min-width: 0; }
.item__title { font-weight: 600; }
.item__title.done { text-decoration: line-through; color: var(--text-muted); }
.item__sub { font-size: 0.76rem; color: var(--text-muted); }

/* チェックボックス */
.check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; background: transparent; color: #fff; font-size: .8rem;
  transition: all .15s ease;
}
.check.on { background: var(--success); border-color: var(--success); }

/* ---- カレンダー ---- */
.cal-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.cal-tabs .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- 過去タブの期間切替（サブセグメント） ---- */
.seg-sub { display: flex; gap: 8px; margin: -2px 0 12px; }
.seg-sub .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- 過去タブ: 月ナビ／折れ線グラフ ---- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-nav__label { font-weight: 800; font-size: 1.05rem; }
.month-nav .iconbtn { font-size: 1.4rem; line-height: 1; padding: 2px 12px; }
.month-nav .iconbtn.is-disabled { opacity: 0.3; pointer-events: none; }
.swipe-area { touch-action: pan-y; } /* 横スワイプを月切替に使う（縦スクロールは維持） */
.lc { display: block; width: 100%; height: auto; }

/* ============================================================
   月の満ち欠け（プレミアム機能）
   ============================================================ */
/* 設定: 機能トグル行 */
.feature-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.feature-row:last-of-type { margin-bottom: 0; }
.feature-row__text { min-width: 0; }
.chip--premium {
  background: linear-gradient(135deg, #C9962B, #F6E27A);
  color: #3a2a00; font-weight: 800; font-size: 0.62rem; letter-spacing: .04em;
}

/* 共通: 月アイコン・スーパームーンの発光 */
.moon-ico { vertical-align: -0.18em; }
.moon-super-glow { filter: drop-shadow(0 0 3px rgba(246, 226, 122, 0.95)); }

/* カレンダー: 日ビューのヘッダー月相ラベル */
.cal-moon { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; font-size: 0.82rem; font-weight: 400; color: var(--text-muted); white-space: nowrap; vertical-align: middle; }
.cal-moon__emoji { font-size: 1rem; line-height: 1; }
.cal-moon--super { color: #C9962B; font-weight: 800; }
.cal-moon--tap { cursor: pointer; }
.cal-moon--tap:active { opacity: 0.6; }

/* 隠し機能「今宵の月」モーダル */
.lore { padding-top: 28px; }
.lore-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 4px; }
.lore-moon { font-size: 3.4rem; line-height: 1; flex: none; }
.lore-head__text { min-width: 0; }
.lore-name { font-size: 1.3rem; font-weight: 800; }
/* セクションカード（季節の歌 / 今夜の星空 / すてきな出来事） */
.lore-card { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-top: 14px; }
.lore-cardhead { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 800; color: var(--text-muted); letter-spacing: .03em; margin-bottom: 10px; }
.lore-cardicon { font-size: 1.05rem; }
.lore-p { font-size: 0.92rem; line-height: 1.75; margin: 4px 0 0; }
.lore-tanka { font-size: 1.08rem; line-height: 1.95; font-weight: 600; margin: 0; }
.lore-tanka-author { font-size: 0.8rem; color: var(--text-muted); margin: 4px 0 8px; }
.lore-about { font-size: 0.84rem; line-height: 1.7; color: var(--text-muted); margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--border); }
.lore-about__label { font-weight: 800; color: var(--text); }
.lore-sky { width: 100%; max-width: 260px; display: block; margin: 0 auto 10px; }
.lore-constname { font-size: 0.92rem; font-weight: 700; margin: 0 0 2px; }
.lore-year { color: var(--text-muted); font-weight: 700; }
.moon-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.moon-super-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: linear-gradient(135deg, #C9962B, #F6E27A); color: #3a2a00;
  font-size: 0.66rem; font-weight: 800;
}
/* カレンダー: 週ビューの日付バッジ脇の月相 */
.wa-moon { font-size: 0.9rem; line-height: 1; margin-top: 1px; }

/* 過去ビュー: 折れ線グラフの凡例・月相ストリップ */
.moon-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 6px; font-size: 0.7rem; color: var(--text-muted); }
.moon-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.moon-legend .lg-line::before { content: ''; width: 16px; border-top: 2px solid var(--primary); }
.moon-legend .lg-moon::before { content: ''; width: 16px; border-top: 2px dashed #C9962B; }
/* 天気の背景帯の凡例（色スウォッチ） */
.wx-legend { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 6px; font-size: 0.7rem; color: var(--text-muted); }
.wx-legend .wx-sw { display: inline-flex; align-items: center; gap: 5px; }
.wx-legend .wx-sw::before { content: ''; width: 14px; height: 12px; border-radius: 3px; }
.wx-legend .wx-sw--sun::before { background: rgba(239, 91, 98, 0.20); }
.wx-legend .wx-sw--cloud::before { background: rgba(140, 150, 170, 0.24); }
.wx-legend .wx-sw--rain::before { background: rgba(79, 141, 245, 0.24); }

/* 天気アイコン（カレンダー日ヘッダ／週バッジ） */
.cal-wx { display: inline-flex; align-items: center; margin-left: 8px; }
.cal-wx__emoji { font-size: 1rem; line-height: 1; }
.wa-wx { font-size: 0.9rem; line-height: 1; margin-top: 1px; }
/* 周期表: 四大相だけを折れ線グラフと同じx位置に重ねる（relative基準＋絶対配置） */
.moon-strip { position: relative; height: 24px; margin-top: 4px; }
.moon-pt { position: absolute; top: 0; transform: translateX(-50%); font-size: 1.15rem; line-height: 1; }

.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.day-nav h3 { margin: 0; font-size: 1rem; flex: 1 1 auto; min-width: 0; text-align: center; }
/* 前/次の移動ボタン（線画SVGの丸ボタン。はっきり押せて見える） */
.cal-navbtn {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease;
}
.cal-navbtn svg { width: 22px; height: 22px; display: block; }
.cal-navbtn:active { transform: scale(0.92); }

.timeline {
  position: relative;
  max-height: 340px;            /* 約6時間分。残りは内側スクロール */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.tl-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  min-height: 44px;
  border-top: 1px solid var(--border);
}
.tl-row--now { background: var(--primary-weak); }
.tl-row--now .tl-hour { color: var(--primary); font-weight: 800; }
.tl-hour { font-size: 0.7rem; color: var(--text-muted); padding-top: 2px; }
.tl-cell { position: relative; padding: 2px 0; }
.tl-block {
  background: var(--primary-weak);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
}
.tl-block .t { font-weight: 700; }
.tl-block .s { font-size: 0.7rem; color: var(--text-muted); }
.tl-block { display: flex; align-items: center; gap: 8px; }
.tl-block__main { flex: 1; min-width: 0; }
.tl-lock {
  flex: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
}
.tl-lock svg { width: 18px; height: 18px; display: block; }
.tl-lock.on { background: rgba(0, 0, 0, 0.06); color: var(--text); }
[data-theme='dark'] .tl-lock.on { background: rgba(255, 255, 255, 0.1); }
.tl-block.locked { border-left-style: double; border-left-width: 6px; }
.tl-block--event { color: #fff; }
.tl-block--event .t { color: #fff; font-weight: 700; }
.tl-block--event .s { color: rgba(255, 255, 255, 0.88); }

/* 週表示：スマホで読みやすい縦並びアジェンダ */
.week-agenda { padding: 4px 6px; }
.wa-row {
  display: flex;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
}
.wa-row:last-child { border-bottom: none; }
.wa-row.today { background: var(--primary-weak); border-radius: 10px; }
.wa-left { flex: none; width: 52px; text-align: center; }
.wa-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.wa-wd { font-size: 0.66rem; color: var(--text-muted); font-weight: 700; }
.wa-day { font-size: 1.3rem; font-weight: 800; }
.wa-date.today .wa-wd, .wa-date.today .wa-day { color: var(--primary); }
.wa-date.weekend .wa-wd { color: var(--danger); }
.wa-total { display: block; font-size: 0.62rem; color: var(--text-muted); margin-top: 2px; }
.wa-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.wa-empty { font-size: 0.78rem; color: var(--text-muted); }
.wa-item { display: flex; align-items: center; gap: 7px; min-width: 0; }
.wa-bar { flex: none; width: 4px; height: 16px; border-radius: 2px; }
.wa-time { flex: none; font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; width: 38px; }
.wa-title { font-size: 0.84rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---- タイマー ---- */
.timer-display {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
  max-width: 92%;
  margin: 14px 0 6px;
}
.timer-ring {
  width: 220px; height: 220px; margin: 6px auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--surface) 79%, transparent 80% 100%),
    conic-gradient(var(--primary) var(--p, 0%), var(--surface-2) 0);
  box-shadow: var(--shadow);
}
.timer-task-pick { display: grid; gap: 8px; }

/* ---- フォーム / モーダル ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  height: 100vh;        /* フォールバック */
  height: 100dvh;       /* 動的ビューポート（iOS のツールバー分を除く） */
  background: rgba(15, 20, 35, .45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  padding: 0;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  width: 100%;
  max-width: var(--maxw);
  border-radius: 20px 20px 0 0;
  /* 上はアドレスバー/ノッチ分の余白を残し、下はツールバー/セーフエリア分の余白を確保 */
  padding: 20px 18px calc(20px + var(--safe-b));
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: sheet-up .22s ease;
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 14px; font-size: 1.1rem; padding-right: 36px; }
/* 閉じる（×）：スクロールしても常に右上に出す。直後の見出しに被せて余白を増やさない */
.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;       /* 右寄せ（固定幅ブロック） */
  margin-bottom: -34px;    /* 直後の見出しに被せて余白を増やさない */
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted);
  z-index: 5;
}
.modal-close:active { transform: scale(0.92); }
.modal-close svg { width: 20px; height: 20px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 0.95rem;
}
.field textarea { resize: vertical; min-height: 60px; }
.field-row { display: flex; gap: 24px; }
.field-row .field { flex: 1; min-width: 0; }

/* iOS Safari の date/time 入力は既定だと width:100% を無視して内在幅のまま
   （narrow に見えて隣とくっつく）。appearance を解除して他の入力・select と
   同じく横幅いっぱいに揃える。値が空のときも幅が変わらないようにする。 */
.field input[type="date"],
.field input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 44px;
}
.field input[type="date"]::-webkit-date-and-time-value,
.field input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
}

.color-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; }
.color-pick button.on { border-color: var(--text); transform: scale(1.12); }

.wd-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.wd {
  width: 38px; height: 36px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
}
.wd.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* ---- 空状態 ---- */
.empty { text-align: center; color: var(--text-muted); padding: 30px 10px; }
.empty .big { font-size: 2.2rem; }
/* リッチな空状態（線画アイコン＋見出し＋説明＋CTA） */
.empty--rich { padding: 48px 18px 30px; }
.empty__icon { width: 52px; height: 52px; margin: 0 auto 16px; color: var(--primary); }
.empty__icon svg { width: 100%; height: 100%; display: block; }
.empty__title { font-size: 1.05rem; font-weight: 800; color: var(--text); margin: 0 0 8px; }
.empty__lead { max-width: 30ch; margin: 0 auto 18px; font-size: .9rem; line-height: 1.7; }

/* 新規ユーザー向けウェルカム */
.welcome { text-align: center; padding: 18px 6px 8px; }
.welcome__logo { width: 60px; height: 60px; filter: drop-shadow(0 8px 18px rgba(99, 91, 255, .28)); }
.welcome__title { font-size: 1.3rem; font-weight: 800; margin-top: 6px; }
.welcome__lead { color: var(--text-muted); font-size: .92rem; line-height: 1.7; margin: 8px auto 20px; max-width: 320px; }
.welcome__steps {
  text-align: left; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 18px;
}
.welcome__steps-title { font-size: .78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; letter-spacing: .02em; }
.welcome__step { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: .92rem; }
.welcome__step-emoji {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-weak); font-size: 1.1rem;
}
.welcome .btn--block + .btn--block { margin-top: 10px; }
.welcome__sample {
  display: block; width: 100%; margin-top: 16px;
  background: none; border: none; color: var(--text-muted);
  font-size: .85rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.welcome__sample:active { color: var(--primary); }

/* ---- トースト ---- */
.toast-stack {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  /* スマホは画面下部で操作するため、通知は上部（アプリバーのすぐ下）に出す */
  top: calc(env(safe-area-inset-top, 0px) + var(--appbar-h) + 8px);
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(30, 40, 80, 0.18);
  animation: toast-in .22s ease;
}
[data-theme='dark'] .toast { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
.toast--alarm {
  background: var(--primary); color: #fff; border-color: transparent; font-weight: 700;
  box-shadow: 0 12px 32px rgba(79, 141, 245, 0.4);
}
.toast--action { display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: opacity .3s; }
.toast__undo {
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--primary);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}
@keyframes toast-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- 完了演出 ---- */
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.35)} 100%{transform:scale(1)} }
.check.celebrate { animation: pop .35s ease; }

.warn-banner {
  background: rgba(240,165,0,.12);
  border: 1px solid rgba(240,165,0,.35);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.warn-banner b { color: var(--warning); }

hr.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ---- 設定トップのロゴ ---- */
.settings-logo {
  display: flex;
  justify-content: center;
  padding: 6px 0 14px;
}
.settings-logo img {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 14px;
}

/* ---- 起動スプラッシュ ---- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(160deg, #4F8DF5, #635BFF 55%, #7B5BF5);
  color: #fff;
  transition: opacity .4s ease;
}
.splash--hide { opacity: 0; pointer-events: none; }
.splash__logo {
  width: 96px; height: 96px;
  border-radius: 22px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  animation: splash-pop .5s ease;
}
.splash__name {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-top: 6px;
}
.splash__tag { font-size: 0.82rem; opacity: 0.92; }
@keyframes splash-pop {
  0% { transform: scale(.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .splash__logo { animation: none; }
}

/* ---- ダッシュボード: 今日の達成リング ---- */
.hero { display: flex; align-items: center; gap: 16px; }
.hero--done { background: linear-gradient(135deg, rgba(43,182,115,.12), rgba(79,141,245,.12)); }
.hero-ring {
  flex: none;
  width: 92px; height: 92px;
  border-radius: 50%;
  display: grid; place-items: center;
  transition: background .5s ease;
}
.hero-ring__inner {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.05;
}
.hero-ring__pct { font-size: 1.25rem; font-weight: 800; }
.hero-ring__frac { font-size: 0.68rem; color: var(--text-muted); }
.hero__text { min-width: 0; }
.hero__msg { font-size: 1.05rem; font-weight: 800; margin-bottom: 2px; }

/* ---- ダッシュボード: 週バーチャート ---- */
.wc { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 110px; }
.wc-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.wc-barwrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.wc-bar {
  width: 60%;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--primary);
  transition: height .4s ease;
}
.wc-col.today .wc-bar { background: linear-gradient(180deg, #7B5BF5, #4F8DF5); }
.wc-min { font-size: 0.6rem; color: var(--text-muted); margin-top: 3px; height: 0.8em; }
.wc-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.wc-col.today .wc-label { color: var(--primary); font-weight: 800; }

/* ============================================================
   ログイン / 新規登録（全画面）
   ============================================================ */
.login {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  padding: 24px calc(24px + env(safe-area-inset-right, 0)) calc(24px + var(--safe-b)) calc(24px + env(safe-area-inset-left, 0));
}
.login[hidden] { display: none; }
.login__lang {
  position: absolute; top: calc(14px + env(safe-area-inset-top, 0)); right: 16px;
  display: flex; gap: 4px; padding: 3px; border-radius: 999px;
  background: var(--surface-2);
}
.login__lang-btn {
  border: none; background: transparent; color: var(--text-muted);
  font-size: .78rem; font-weight: 700; padding: 5px 11px; border-radius: 999px;
}
.login__lang-btn.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.login__inner { width: 100%; max-width: 360px; text-align: center; }
.login__logo { width: 76px; height: 76px; filter: drop-shadow(0 10px 24px rgba(99, 91, 255, .32)); }
.login__brand {
  font-size: 1.9rem; font-weight: 800; letter-spacing: .06em; margin-top: 4px;
  background: linear-gradient(90deg, #4F8DF5, #7B5BF5);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
[data-theme='dark'] .login__brand { background: linear-gradient(90deg, #6ea1ff, #a78bff); -webkit-background-clip: text; background-clip: text; }
.login__tag { color: var(--text-muted); font-size: .92rem; margin: 10px 0 28px; line-height: 1.6; }
.login__google { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; padding: 13px 14px; }
.login__g {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; color: #4285F4; font-weight: 800; font-size: .9rem; flex: none;
}
.login__sub { color: var(--text-muted); font-size: .8rem; margin-top: 12px; }
.login__err { color: var(--danger); font-size: .82rem; margin-top: 10px; }
.login__legal { color: var(--text-muted); font-size: .7rem; margin-top: 22px; line-height: 1.7; }

/* 設定: アカウント */
.acct-pic { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; }
.acct-pic--lg { width: 52px; height: 52px; font-size: 1.3rem; }
.acct-pic--ph {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-weight: 800; text-transform: uppercase;
}

/* appbar 右上：アバター＋テーマ切替 */
.appbar__right { display: flex; align-items: center; gap: 10px; }
.appbar__avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; padding: 0; overflow: hidden;
  border: none; background: var(--primary); color: #fff;
  font-weight: 800; font-size: .85rem; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.appbar__avatar img { width: 100%; height: 100%; object-fit: cover; }

/* アカウントメニュー（モーダル内） */
.account-menu__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
