/* 早晨清單：配色、字體、卡片沿用旅行網頁 */
:root {
  --bg: #F5F0E6;
  --card: #FFFFFF;
  --card-line: #EFE6D6;
  --inner: #FCFAF6;
  --inner-line: #F0E8DA;
  --chip-line: #E3D8C6;
  --ink: #2C2520;
  --body: #3A3330;
  --label: #5A5350;
  --muted: #7A7571;
  --faint: #B9AE9F;
  --accent: #C8956B;
  --tab: #ECE4D5;
  --tab-on: #DCCFB9;
  --wd: #E5AF65;      /* 平日 */
  --wd-tint: #FBF1E2;
  --we: #7AAFA8;      /* 假日 */
  --we-tint: #E8F2F0;
  --serif: 'Source Sans 3', 'Noto Serif TC', 'Songti TC', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* 關掉點兩下放大（保留兩指縮放）：iOS 要每個元素都設才確實生效 */
*, *::before, *::after { touch-action: manipulation; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: 'Noto Sans TC', 'Source Sans 3', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
button { font-family: inherit; color: inherit; }

/* iOS 27 主畫面 App 頂部霧面：放一條有底色的 fixed 細條 */
.remove-blur {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: 11px;
  pointer-events: none; z-index: 2147483647;
  background-color: #F5F0E6; background-clip: text; -webkit-background-clip: text;
}
@media (display-mode: standalone) { .remove-blur { display: block; } }
:root[data-standalone] .remove-blur { display: block; }

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 16px calc(56px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 20px;
  min-width: 0;
}
.wrap > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ── 標題區 ── */
.hero-head { display: flex; flex-direction: column; gap: 6px; }
.head-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.eyebrow { font-size: 12px; letter-spacing: .18em; color: var(--muted); font-weight: 500; }
.hero-head h1 { margin: 0; font-family: 'Fredoka', 'Noto Sans TC', sans-serif; font-size: 32px; line-height: 1.25; font-weight: 600; }
.head-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--card); border: 1px solid var(--card-line); color: var(--label);
}
.pill.count { background: var(--ink); border-color: var(--ink); color: #FFF; font-weight: 700; }
.pill.wd { background: var(--wd-tint); border-color: #F1DDBC; color: #9A6420; font-weight: 700; }
.pill.we { background: var(--we-tint); border-color: #CFE3DF; color: #3F7A72; font-weight: 700; }

/* ── 分頁切換：色塊在三個分頁間滑動；往下捲時貼頂 ── */
.tabs-bar { position: sticky; top: 0; z-index: 20; margin: -6px -16px; padding: 8px 16px; background: var(--bg); }
.tabs { position: relative; display: flex; gap: 2px; background: var(--tab); border-radius: 16px; padding: 3px; }
.tab-pill {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: 0; border-radius: 13px; background: var(--card);
  box-shadow: 0 1px 3px rgba(44, 37, 32, .08);
  transition: transform .35s cubic-bezier(.3, .8, .3, 1), width .35s cubic-bezier(.3, .8, .3, 1);
}
.tab-pill.still { transition: none; }
.tab {
  position: relative; z-index: 1; flex: 1; height: 40px; border: none; background: transparent; border-radius: 13px;
  font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; transition: color .25s;
}
.tab.on { color: var(--ink); font-weight: 700; }

/* ── 卡片 ── */
.card {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 22px;
  padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.card-title svg { flex-shrink: 0; }
.card-title .progress { margin-left: auto; }
.note { font-size: 13px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.divider { border-top: 1px solid var(--inner-line); }
.progress { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── 今日完成 ── */
.done-hero {
  border-radius: 24px; padding: 20px; display: flex; align-items: center; gap: 14px;
  background: var(--accent); color: #FFF;
}
.done-hero .badge {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .25);
  display: flex; align-items: center; justify-content: center;
}
.done-hero h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 700; }
.done-hero .sub { font-size: 13px; opacity: .9; margin-top: 2px; }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.done-hero.pop { animation: pop .35s cubic-bezier(.3, .8, .3, 1); }

/* ── 勾選列 ── */
.check-list { display: flex; flex-direction: column; }
.check {
  display: flex; align-items: center; gap: 12px; min-height: 56px;
  border-bottom: 1px solid var(--inner-line); cursor: pointer;
}
.check:last-child { border-bottom: none; }
.check .tick {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--chip-line); background: var(--card);
  display: flex; align-items: center; justify-content: center; color: #FFF; padding: 0; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.check.done .tick { background: var(--accent); border-color: var(--accent); }
.check .label { flex: 1; min-width: 0; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; padding: 12px 0; }
.check.done .label { color: var(--faint); text-decoration: line-through; }

.mode-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--chip-line); background: var(--card); color: var(--ink);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--ink); border-color: var(--ink); color: #FFF; font-weight: 700; min-height: 48px; font-size: 15px; }

/* ── 紀錄：連續天數＋月曆 ── */
.streak { display: flex; align-items: baseline; gap: 6px; }
.streak b { font-family: 'Fredoka', sans-serif; font-size: 40px; font-weight: 600; line-height: 1; }
.streak span { font-size: 14px; color: var(--muted); }
.month-head { display: flex; align-items: center; justify-content: space-between; }
.month-head .title { font-size: 16px; font-weight: 700; }
.nav-btn {
  width: 36px; height: 36px; border-radius: 12px; border: none; background: var(--inner); color: var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.nav-btn:disabled { opacity: .35; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wk { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.cal .day {
  aspect-ratio: 1; border: none; border-radius: 12px; background: transparent; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 14px; font-weight: 600; color: var(--ink); min-width: 0;
}
.cal .day .n { font-size: 9px; font-weight: 500; color: var(--muted); }
.cal .day.none { color: var(--faint); font-weight: 500; }
.cal .day.part { background: var(--inner); border: 1px solid var(--inner-line); }
.cal .day.full { background: var(--accent); color: #FFF; }
.cal .day.full .n { color: rgba(255, 255, 255, .85); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal .day.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal .day.future, .cal .day.blank { cursor: default; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.miss-list { display: flex; flex-direction: column; }
.miss { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--inner-line); font-size: 14px; }
.miss:last-child { border-bottom: none; }
.miss .mk {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #FFF;
}
.miss.no .mk { background: var(--card); border: 1.5px dashed var(--chip-line); }
.miss.no .t { color: var(--muted); }

/* ── 設定 ── */
.edit-list { display: flex; flex-direction: column; }
.edit-row { display: flex; align-items: center; gap: 4px; min-height: 48px; border-bottom: 1px solid var(--inner-line); }
.edit-row:last-child { border-bottom: none; }
.edit-row .label { flex: 1; min-width: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; padding: 10px 4px 10px 0; cursor: text; }
.edit-row input {
  flex: 1; min-width: 0; height: 40px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--inner); font-size: 16px; font-family: inherit; color: var(--ink);
}
.icon-btn {
  flex-shrink: 0; width: 34px; height: 34px; border: none; background: none; color: var(--faint);
  border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.del { font-size: 20px; }
.add { display: flex; gap: 8px; margin-top: 4px; }
.add input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--chip-line); background: var(--inner); font-size: 16px; font-family: inherit; color: var(--ink);
}
.add button {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 14px; border: none;
  background: var(--ink); color: #FFF; font-size: 22px; cursor: pointer;
}
.kind-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── 登入 ── */
.login { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login .card { width: 100%; max-width: 360px; gap: 14px; padding: 24px; }
.login h1 { margin: 0; font-family: var(--serif); font-size: 24px; }
.login input {
  height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--chip-line);
  background: var(--inner); font-size: 16px; font-family: inherit; color: var(--ink); width: 100%;
}
.err { font-size: 13px; color: #B5523F; min-height: 18px; }
.foot { display: flex; justify-content: center; }
.link-btn { border: none; background: none; font-size: 12px; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: #FFF; font-size: 13px; padding: 10px 16px; border-radius: 999px; z-index: 50;
  opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

@media (max-width: 360px) {
  .hero-head h1 { font-size: 26px; }
}
