/* Seion 集中アプリ — v7 UI を Web 再現
   配色・ジオメトリの正本は tools/pomodoro/pomodoro_frames.py / brand-guide.md */
:root {
  --cream:      #FAF3E7;
  --card:       rgba(250, 240, 222, 0.78);
  --card-solid: #FAF0DE;
  --text-dark:  #37302A;
  --text-sub:   #5F5248;
  --peach:      #C88C6C;   /* Focus アクセント */
  --sage:       #8CA880;   /* Break アクセント */
  --shadow:     rgba(40, 30, 22, 0.45);
  --accent:     var(--peach);   /* JS がフェーズで切替 */
  --line:        rgba(40, 30, 22, 0.18);
  --line-soft:   rgba(40, 30, 22, 0.12);
  --surface:        rgba(255, 255, 255, 0.50);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --serif: "Noto Serif JP", "YuMincho", "Hiragino Mincho ProN", serif;
  --sans:  "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ===== ダークモード ===== */
body.app[data-theme="dark"] {
  --cream:      #211e1b;
  --card-solid: #2b2723;
  --text-dark:  #ece4d8;
  --text-sub:   #a99e90;
  --shadow:     rgba(0, 0, 0, 0.55);
  --line:        rgba(255, 255, 255, 0.16);
  --line-soft:   rgba(255, 255, 255, 0.10);
  --surface:        rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.13);
}
@media (prefers-color-scheme: dark) {
  body.app[data-theme="auto"] {
    --cream:      #211e1b;
    --card-solid: #2b2723;
    --text-dark:  #ece4d8;
    --text-sub:   #a99e90;
    --shadow:     rgba(0, 0, 0, 0.55);
    --line:        rgba(255, 255, 255, 0.16);
    --line-soft:   rgba(255, 255, 255, 0.10);
    --surface:        rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.13);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body.app {
  font-family: var(--sans);
  color: var(--text-dark);
  background: var(--cream);
  min-height: 100vh;
  min-height: 100dvh;
  /* 縦に収まらない端末では縦スクロール可（横は固定） */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}
body.app[data-phase="break"] { --accent: var(--sage); }
body.app[data-mode="sleep"] { --accent: #8C93B8; }   /* 睡眠モードは落ち着いた夜色 */

/* ===== 背景：クリーム地＋テーマ色を薄く（画像・動画なし） ===== */
.backdrop {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--theme-tint, transparent) 0%, transparent 55%),
    var(--cream);
  opacity: 1;
  transition: background .6s ease;
}

/* ===== メインカード（中央寄せのクリーンな1カラム・箱なし） ===== */
.card {
  position: relative; z-index: 1;
  width: min(440px, 100vw);
  margin: 0 auto;            /* 横中央。body は block 扱いで縦スクロール可 */
  min-height: 100vh; min-height: 100dvh;
  padding: clamp(24px, 4vh, 44px) clamp(22px, 6vw, 40px);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: clamp(12px, 1.8vh, 20px);
  background: transparent;
}
.card__brand {
  position: fixed; z-index: 2;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  margin: 0; display: flex; align-items: center; gap: 7px;
  font-weight: 400; font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--text-sub); white-space: nowrap;
}
.card__logo { width: 22px; height: 22px; border-radius: 7px; box-shadow: 0 1px 3px rgba(40,30,22,0.18); }
.menu-list__btn--yt { text-decoration: none; }
.menu-list__btn--yt i { color: #ff0033; }
.hamburger {
  position: fixed; z-index: 4;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: var(--text-sub);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer;
}
.hamburger:hover { background: var(--surface-strong); }

/* メニューリスト */
.menu-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.menu-list__btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  font-family: var(--sans); font-size: 1rem; color: var(--text-dark);
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 15px 16px; cursor: pointer; transition: all .18s ease;
}
.menu-list__btn:hover { background: var(--surface-strong); }
.menu-list__btn i { width: 22px; text-align: center; color: var(--text-sub); }
.card__state {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(1.5rem, 4.4vw, 2rem);
  color: var(--accent);
  text-shadow: 0 2px 6px var(--shadow);
  transition: color .5s ease;
}

/* ===== モード切替（セグメント） ===== */
.modes {
  display: flex; gap: 3px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 999px;
}
.modes__btn {
  font-family: var(--sans); font-size: 0.8rem; color: var(--text-sub);
  background: transparent; border: none; border-radius: 999px;
  padding: 7px 16px; cursor: pointer; transition: all .18s ease;
}
.modes__btn.is-active { background: var(--accent); color: #fff; }
.mode-config { display: flex; flex-direction: column; gap: 14px; }

/* ===== 集中/休憩で画面を最適化 ===== */
/* セッション中はモード切替を隠して気を散らさない（idle/done のみ表示） */
body.app:not([data-phase="idle"]):not([data-phase="done"]) .modes { display: none; }
/* 休憩中はタスク選択を隠し、休憩に集中させる */
body.app[data-phase="break"] .taskbar,
body.app[data-phase="break"] .quickadd { display: none; }

/* 休憩のヒント（ストレッチ等） */
.rest-tip {
  display: none; align-items: center; gap: 11px;
  width: 100%; max-width: 360px;
  background: rgba(140, 168, 128, 0.14); border: 1px solid rgba(140, 168, 128, 0.4);
  border-radius: 14px; padding: 13px 16px;
}
body.app[data-phase="break"] .rest-tip { display: flex; }
.rest-tip i { color: var(--sage); font-size: 1.25rem; flex: 0 0 auto; }
.rest-tip__text { font-size: 0.95rem; color: var(--text-dark); line-height: 1.5; }

/* ===== セット完了の祝福ポップアップ ===== */
.celebrate {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40, 30, 22, 0.30); backdrop-filter: blur(2px);
  animation: celebFade 0.3s ease;
}
.celebrate[hidden] { display: none; }
.celebrate__card {
  background: var(--card-solid); border-radius: 22px; padding: 30px 34px; text-align: center;
  box-shadow: 0 18px 50px rgba(40, 30, 22, 0.32); max-width: 300px;
  animation: celebPop 0.42s cubic-bezier(0.2, 0.85, 0.3, 1.25);
}
.celebrate__icon { font-size: 2.7rem; color: var(--peach); margin-bottom: 10px; }
.celebrate__title { font-family: var(--serif); font-size: 1.35rem; color: var(--text-dark); margin: 0.1em 0 0.25em; }
.celebrate__sub { color: var(--text-sub); font-size: 0.95rem; margin: 0; }
@keyframes celebPop { from { transform: scale(0.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes celebFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .celebrate, .celebrate__card { animation: none; } }

/* ===== ダイヤル（リング＋タイマー）===== */
.dial { position: relative; width: min(320px, 70vw, 38vh); aspect-ratio: 1; }
.dial__ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial__track    { fill: none; stroke: var(--line-soft); stroke-width: 10; }
.dial__progress {
  fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 942.48; stroke-dashoffset: 0;
  transition: stroke-dashoffset .95s linear, stroke .5s ease;
}
.dial__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dial__time {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(3.4rem, 16vw, 5rem); line-height: 1;
  color: var(--text-dark);
  text-shadow: 0 3px 7px var(--shadow);
  font-variant-numeric: tabular-nums;
}
.dial__intro {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.6rem, 7vw, 2.2rem); color: var(--text-dark);
  text-shadow: 0 3px 7px var(--shadow);
}

.card__period {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  color: var(--text-sub);
}

/* ===== サイクル ===== */
.cycle { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cycle__text { font-family: var(--serif); font-size: 0.95rem; color: var(--text-sub); }
.cycle__dots { display: flex; gap: 10px; }
.cycle__dots .dot {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--text-sub);
}
.cycle__dots .dot--done    { background: var(--text-dark); border-color: var(--text-dark); }
.cycle__dots .dot--current { background: var(--accent); border-color: var(--accent); }

/* ===== タスク入力 ===== */
.task { width: 100%; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.task__label { font-size: 0.72rem; color: var(--text-sub); letter-spacing: 0.04em; }
.task__input {
  width: 100%; max-width: 320px; text-align: center;
  font-family: var(--sans); font-size: 0.95rem; color: var(--text-dark);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px;
}
.task__input:focus { outline: none; border-color: var(--accent); }

/* ===== 操作 ===== */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.controls__btn {
  font-family: var(--sans); font-size: 0.92rem; color: var(--text-sub);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; cursor: pointer; transition: all .2s ease;
}
.controls__btn:hover { background: var(--surface-strong); }
.controls__btn--main {
  color: #fff; font-weight: 500; font-size: 1rem;
  background: var(--accent); border-color: transparent;
  padding: 12px 36px; box-shadow: 0 4px 14px var(--line);
}
.controls__btn--main:hover { filter: brightness(1.05); background: var(--accent); }

/* ===== ツールバー ===== */
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.toolbar__btn {
  font-family: var(--sans); font-size: 0.82rem; color: var(--text-sub);
  background: transparent; border: none; cursor: pointer;
  padding: 8px 10px; border-radius: 10px; transition: background .2s ease;
}
.toolbar__btn:hover { background: var(--surface); }

/* ===== シート（パネル）===== */
.sheet {
  position: fixed; z-index: 5; right: 0; top: 0; bottom: 0;
  width: min(380px, 92vw);
  background: var(--card-solid);
  box-shadow: -8px 0 40px rgba(40,30,22,0.22);
  padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
  animation: slideIn .25s ease;
}
.sheet--wide { width: min(440px, 94vw); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; }
.sheet__title { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; color: var(--text-dark); }
.sheet__close {
  font-size: 1.6rem; line-height: 1; color: var(--text-sub);
  background: none; border: none; cursor: pointer; padding: 0 6px;
}
.sheet__note { font-size: 0.76rem; color: var(--text-sub); line-height: 1.5; }

/* ===== テーマリスト ===== */
.theme-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.theme-list__item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-soft);
  background: var(--surface); transition: all .18s ease;
}
.theme-list__item:hover { background: var(--surface-strong); }
.theme-list__item.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(200,140,108,0.25); }
.theme-list__emoji { font-size: 1.15rem; color: var(--accent); width: 24px; text-align: center; }
.theme-list__body { display: flex; flex-direction: column; }
.theme-list__name { font-family: var(--serif); font-size: 1.02rem; color: var(--text-dark); }
.theme-list__sound { font-size: 0.76rem; color: var(--text-sub); }
.theme-list__band {
  margin-left: auto; font-size: 0.7rem; color: var(--text-sub);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}

/* ===== フィールド ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field--row { flex-direction: row; align-items: center; gap: 10px; }
.field--inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field__label { font-size: 0.86rem; color: var(--text-sub); }
.field__range { width: 100%; accent-color: var(--peach); }
.field__num {
  width: 84px; text-align: center; font-size: 0.95rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px;
}
.field__check { width: 18px; height: 18px; accent-color: var(--peach); }

.presets { display: flex; gap: 8px; }
.presets__btn {
  flex: 1; font-family: var(--serif); font-size: 1rem; color: var(--text-sub);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 0; cursor: pointer; transition: all .18s ease;
}
.presets__btn.is-active { background: var(--peach); color: #fff; border-color: transparent; }
.custom { display: flex; flex-direction: column; gap: 10px; }

/* ===== 1日の目標リング ===== */
.goal { display: flex; align-items: center; gap: 16px; }
.goal__dial { position: relative; width: 92px; height: 92px; flex: 0 0 auto; }
.goal__ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal__track { fill: none; stroke: var(--line-soft); stroke-width: 8; }
.goal__fill {
  fill: none; stroke: var(--peach); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 263.89; stroke-dashoffset: 263.89;
  transition: stroke-dashoffset .6s ease;
}
.goal__center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.goal__center b { font-family: var(--serif); font-size: 1.2rem; color: var(--text-dark); }
.goal__meta { display: flex; flex-direction: column; gap: 8px; }
.goal__nums { font-size: 0.95rem; color: var(--text-sub); }
.goal__nums b { font-family: var(--serif); font-size: 1.3rem; color: var(--text-dark); }
.goal__set { font-size: 0.8rem; color: var(--text-sub); display: flex; align-items: center; gap: 8px; }
.goal__set .field__num { width: 76px; }

/* ===== 統計 ===== */
.stats__summary { display: flex; gap: 14px; flex-wrap: wrap; }
.stats__summary .stat {
  flex: 1; min-width: 110px; text-align: center;
  background: var(--surface); border-radius: 14px; padding: 14px 8px;
}
.stats__summary .stat__num { font-family: var(--serif); font-size: 1.7rem; color: var(--text-dark); }
.stats__summary .stat__label { font-size: 0.74rem; color: var(--text-sub); }
.stats__chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding: 8px 2px; }
.stats__chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.stats__chart .bar__fill { width: 100%; max-width: 26px; background: var(--peach); border-radius: 6px 6px 0 0; min-height: 2px; }
.stats__chart .bar__label { font-size: 0.66rem; color: var(--text-sub); }
.stats__clear { font-size: 0.78rem; color: var(--text-sub); background: none; border: none; cursor: pointer; text-decoration: underline; align-self: flex-start; }

.gcal { border-top: 1px solid var(--line-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.gcal__btn {
  font-family: var(--sans); font-size: 0.92rem; color: var(--text-dark);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px; cursor: pointer;
}
.gcal__btn:hover { background: var(--surface-strong); }
.gcal__status { font-size: 0.74rem; color: var(--text-sub); }
.gcal__setup { font-size: 0.82rem; }
.gcal__setup summary { cursor: pointer; color: var(--text-sub); padding: 4px 0; }
.gcal__setup summary i { margin-right: 6px; }
.gcal__help { font-size: 0.74rem; color: var(--text-sub); line-height: 1.6; margin: 6px 0; }
.gcal__help code { background: var(--line-soft); padding: 1px 5px; border-radius: 5px; }
.field__text {
  width: 100%; font-size: 0.85rem; color: var(--text-dark);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
.field__text:focus { outline: none; border-color: var(--accent); }
.gcal__setup-actions { display: flex; gap: 8px; margin-top: 8px; }
.gcal__save, .gcal__clearid {
  font-family: var(--sans); font-size: 0.82rem; cursor: pointer;
  border-radius: 999px; padding: 7px 16px; border: 1px solid var(--line);
}
.gcal__save { background: var(--peach); color: #fff; border-color: transparent; }
.gcal__clearid { background: var(--surface); color: var(--text-sub); }
.gcal__guide { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.8rem; color: #b06a45; text-decoration: none; }
.gcal__guide:hover { text-decoration: underline; }
/* 無料カレンダー追加（直近セッションのチップ） */
.cal-recent { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.cal-recent__chip {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  font-family: var(--sans); font-size: 0.84rem; color: var(--text-dark);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 12px;
}
.cal-recent__chip:hover { background: var(--surface-strong); }
.cal-recent__chip i { color: var(--peach); }
.cal-recent__empty { font-size: 0.78rem; color: var(--text-sub); }
.gcal__adv { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.gcal__adv summary { cursor: pointer; color: var(--text-sub); font-size: 0.8rem; }
.gcal__adv summary i { margin-right: 6px; }
.gcal__adv > .gcal__btn { margin-top: 10px; }

/* ===== アプリ内カレンダー ===== */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-nav__btn { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; color: var(--text-sub); cursor: pointer; }
.cal-nav__btn:hover { background: var(--surface-strong); }
.cal-nav__label { font-family: var(--serif); font-size: 1.05rem; color: var(--text-dark); }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-wd span { text-align: center; font-size: 0.7rem; color: var(--text-sub); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  padding: 5px 6px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--surface); cursor: pointer;
}
.cal-cell--empty { border: none; background: transparent; cursor: default; }
.cal-cell__d { font-size: 0.78rem; color: var(--text-dark); }
.cal-cell__m { font-size: 0.6rem; color: var(--text-sub); align-self: flex-end; }
.cal-cell.l1 { background: #f2e0cd; }
.cal-cell.l2 { background: #e8c6a3; }
.cal-cell.l3 { background: #d9a87f; }
.cal-cell.l4 { background: #c88c6c; }
.cal-cell.l3 .cal-cell__d, .cal-cell.l4 .cal-cell__d, .cal-cell.l3 .cal-cell__m, .cal-cell.l4 .cal-cell__m { color: #3b2c20; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.is-sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-today { align-self: flex-start; margin-top: 8px; font-size: 0.8rem; color: var(--text-sub); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 15px; cursor: pointer; }
.cal-detail { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cal-detail__head { font-family: var(--serif); font-size: 0.95rem; color: var(--text-dark); }
.cal-detail__row { display: flex; align-items: center; gap: 9px; font-size: 0.84rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 11px; }
.cal-detail__row i { color: var(--peach); }
.cal-detail__time { color: var(--text-sub); font-variant-numeric: tabular-nums; }
.cal-detail__title { flex: 1; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-detail__min { color: var(--text-sub); }
.cal-detail__empty { font-size: 0.8rem; color: var(--text-sub); }

/* ===== 設定（設定シート） ===== */
.set { display: flex; flex-direction: column; gap: 10px; }
.set__title { font-family: var(--serif); font-size: 0.95rem; color: var(--text-dark); }
.seg {
  display: flex; gap: 4px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px;
}
.seg__btn {
  flex: 1; font-family: var(--sans); font-size: 0.86rem; color: var(--text-sub);
  background: transparent; border: none; border-radius: 9px;
  padding: 9px 0; cursor: pointer; transition: all .18s ease;
}
.seg__btn.is-active { background: var(--accent); color: #fff; }

/* ===== カスタムチェックボックス（設定など） ===== */
.field__check {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; flex: 0 0 auto; cursor: pointer;
  border: 2px solid var(--line); border-radius: 6px; background: var(--surface);
  display: inline-grid; place-content: center; transition: all .15s ease;
}
.field__check::before { content: "\f00c"; font: 900 0.62rem "Font Awesome 6 Free"; color: #fff; opacity: 0; }
.field__check:checked { background: var(--sage); border-color: var(--sage); }
.field__check:checked::before { opacity: 1; }

/* ===== タスクチップ＋クイック追加（メイン） ===== */
.taskbar { width: 100%; max-width: 360px; display: flex; gap: 8px; }
.taskchip {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-size: 0.95rem; color: var(--text-dark);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 11px 14px; cursor: pointer; transition: all .18s ease;
}
.taskchip:hover { background: var(--surface-strong); }
.taskchip__icon { font-size: 1rem; color: var(--accent); width: 18px; text-align: center; }
.taskchip__text { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.taskchip__arrow { color: var(--text-sub); font-size: 0.8rem; }
.taskquick {
  flex: 0 0 auto; width: 44px; border-radius: 14px; cursor: pointer;
  background: var(--accent); color: #fff; border: none; font-size: 1rem;
}
.quickadd { width: 100%; max-width: 360px; }
.quickadd__input {
  width: 100%; font-family: var(--sans); font-size: 0.95rem; color: var(--text-dark); text-align: center;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; padding: 11px 14px;
}
.quickadd__input:focus { outline: none; }

/* ===== タスクリスト ===== */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.task-list__item {
  display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 12px;
  border: 1px solid var(--line-soft); background: var(--surface);
}
.task-list__item.is-current { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(200,140,108,0.22); }
.task-list__check {
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--line);
  background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.66rem; padding: 0;
}
.task-list__check i { opacity: 0; }
.task-list__check.is-done { background: var(--sage); border-color: var(--sage); }
.task-list__check.is-done i { opacity: 1; }
.task-list__cat { flex: 0 0 auto; width: 20px; text-align: center; font-size: 0.95rem; }
.task-list__body { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; }
.task-list__title { font-size: 0.92rem; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-list__title.is-done { text-decoration: line-through; color: var(--text-sub); }
.task-list__meta { font-size: 0.7rem; color: var(--text-sub); }
.task-list__acts { display: flex; flex: 0 0 auto; gap: 1px; }
.task-list__acts button { background: none; border: none; color: var(--text-sub); cursor: pointer; font-size: 0.82rem; padding: 5px 4px; border-radius: 6px; }
.task-list__acts button:hover { background: var(--surface-strong); color: var(--text-dark); }

/* ===== よく使う例（テンプレ） ===== */
.task-tpl { display: flex; flex-direction: column; gap: 8px; }
.task-tpl__head { font-size: 0.78rem; color: var(--text-sub); }
.task-tpl__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.task-tpl__chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 0.82rem; color: var(--text-dark);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; cursor: pointer; transition: all .15s ease;
}
.task-tpl__chip:hover { background: var(--surface-strong); }

/* ===== 追加／編集フォーム ===== */
.task-add { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.task-add__row { display: flex; gap: 8px; align-items: center; }
.field__select {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: 0.9rem; color: var(--text-dark);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
.task-add__btn { font-family: var(--sans); font-size: 0.9rem; color: #fff; background: var(--accent); border: none; border-radius: 10px; padding: 9px 18px; cursor: pointer; white-space: nowrap; }
.task-add__cancel { font-family: var(--sans); font-size: 0.85rem; color: var(--text-sub); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; }

/* ===== カテゴリ管理 ===== */
.catman { font-size: 0.85rem; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.catman summary { cursor: pointer; color: var(--text-sub); padding: 4px 0; }
.catman summary i { margin-right: 6px; }
.catman__list { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.catman__chip { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--text-dark); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; padding: 5px 6px 5px 11px; }
.catman__chip .del { background: none; border: none; color: var(--text-sub); cursor: pointer; font-size: 0.78rem; padding: 2px 4px; }
.catman__chip.is-builtin { opacity: 0.85; }
.catman__add { display: flex; flex-direction: column; gap: 9px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick__btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface); color: var(--text-sub); display: grid; place-content: center; font-size: 0.85rem;
}
.pick__btn.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(200,140,108,0.22); color: var(--text-dark); }
.pick--color .pick__btn { border-radius: 50%; }
.pick--color .pick__btn.is-active { box-shadow: 0 0 0 2px var(--card-solid), 0 0 0 4px var(--accent); }

/* ===== ストリーク ===== */
.streak { display: flex; align-items: baseline; gap: 12px; justify-content: center; padding: 4px 0; }
.streak__main { display: flex; align-items: baseline; gap: 6px; }
.streak__fire { font-size: 1.4rem; color: #e0883c; }
.streak__num { font-family: var(--serif); font-size: 2.2rem; color: var(--text-dark); }
.streak__unit { font-size: 0.9rem; color: var(--text-sub); }
.streak__sub { font-size: 0.78rem; color: var(--text-sub); }

/* ===== 統計セクション見出し・カテゴリ・ヒートマップ・バッジ ===== */
.stats__h { font-family: var(--serif); font-size: 1rem; color: var(--text-dark); margin-top: 6px; }
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; }
.cat-row__name { width: 36%; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-row__bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.cat-row__fill { display: block; height: 100%; background: var(--peach); border-radius: 999px; }
.cat-row__min { width: 70px; text-align: right; color: var(--text-sub); }
.hm-wrap { overflow-x: auto; padding-bottom: 4px; }
.hm { position: relative; }   /* width/height はインラインで明示 */
.hm__cell { position: absolute; width: 12px; height: 12px; border-radius: 3px; background: var(--line-soft); }
.hm__cell.l1 { background: #eccdb6; }
.hm__cell.l2 { background: #dcab83; }
.hm__cell.l3 { background: #c88c6c; }
.hm__cell.l4 { background: #a96847; }
.hm__cell.future { background: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 72px; padding: 10px 4px;
  border-radius: 12px; border: 1px solid var(--line-soft); background: var(--surface); opacity: 0.45;
}
.badge.is-earned { opacity: 1; border-color: var(--accent); }
.badge__emoji { font-size: 1.3rem; color: var(--text-sub); }
.badge.is-earned .badge__emoji { color: var(--accent); }
.badge.is-earned .badge__emoji .fa-fire { color: #e0883c; }
.badge.is-earned .badge__emoji .fa-circle-check { color: var(--sage); }
.badge__label { font-size: 0.66rem; color: var(--text-sub); text-align: center; line-height: 1.3; }

/* ===== トースト ===== */
.toast {
  position: fixed; z-index: 9; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: rgba(55,48,42,0.94); color: #f5efe4;
  font-size: 0.88rem; padding: 11px 20px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* FA アイコンの余白（ボタン内テキストと揃える） */
.controls__btn i, .toolbar__btn i, .gcal__btn i { margin-right: 5px; }

[hidden] { display: none !important; }

/* ===== レスポンシブ（スマホ最優先） ===== */
@media (max-width: 560px) {
  .sheet, .sheet--wide {
    width: 100vw; left: 0; right: 0;
    padding: calc(18px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-right));
  }
  /* 上のハンバーガー/ブランドを避けつつ、画面内に収める */
  .card {
    justify-content: center;
    gap: clamp(8px, 1.3vh, 14px);
    padding: calc(54px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom));
  }
  .controls__btn { padding: 11px 18px; }       /* タップしやすく */
}
/* 縦が短い端末ではダイヤルと余白をさらに圧縮 */
@media (max-width: 560px) and (max-height: 720px) {
  .dial { width: min(280px, 62vw, 32vh); }
  .card { gap: clamp(6px, 1vh, 11px); }
  .card__state { font-size: clamp(1.3rem, 4.2vw, 1.7rem); }
}
