/* =========================================================
   まいにち. — a koto app by UT.  (mobile-first, single column)
   Canonical koto palette. Orange ≤5%. Noto Sans JP only.
   Orange は限定使用：チェック✓・％の数字・グラフ線＋今日●・
   追加欄フォーカスのみ。面塗りはグレー/極淡tint（面積を増やさない）。
   ========================================================= */
:root {
  --base:   #FFFFFF;
  --paper:  #FAF9F7;
  --soft:   #F2EFEA;
  --ink:    #1B1B1B;
  --sub:    #6B6259;
  --faint:  #A9A59E;
  --line:   #ECEAE6;
  --orange: #FF5C1A;
  --deep:   #E84E0F;
  --tint:   #FFF1EA;
  --r:      16px;
  --r-pill: 999px;
  --ease:   cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic UI",system-ui,sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.02em;
  font-feature-settings: "palt" 1;
}
::selection { background: var(--orange); color: #fff; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

.app {
  min-height: 100dvh; max-width: 480px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 22px) 20px calc(env(safe-area-inset-bottom) + 28px);
  display: flex; flex-direction: column; gap: 16px;
}

/* header */
.topbar { display: flex; align-items: baseline; gap: 10px; }
.wordmark { font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
/* the dot motif — a true round orange circle (not the font period) */
.wordmark .dot, .js-brand .dot {
  color: transparent; position: relative; margin-left: -0.04em;
}
.wordmark .dot::before, .js-brand .dot::before {
  content: ""; position: absolute; left: 0.02em; bottom: 0.08em;
  width: 0.2em; height: 0.2em; border-radius: 50%; background: var(--orange);
}
.appname { font-size: 11px; color: var(--faint); letter-spacing: 0.18em; }

/* ① today */
.today { font-size: 14px; color: var(--sub); letter-spacing: 0.04em; margin: 2px 2px -2px; }

/* cards */
.card {
  background: var(--base); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 18px;
}

/* ② checklist */
.tasklist { list-style: none; }
.task {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: none; }
.task .box {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid #D6D2CC; background: var(--base);
  display: grid; place-items: center; cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.task .box svg { width: 13px; height: 13px; opacity: 0; transform: scale(0.6);
  transition: opacity 0.18s var(--ease), transform 0.22s var(--ease); }
.task .box svg path { stroke: var(--orange); }
.task input { position: absolute; opacity: 0; width: 0; height: 0; }
.task input:checked + .box { border-color: var(--orange); background: var(--tint); }
.task input:checked + .box svg { opacity: 1; transform: scale(1); }
.task input:focus-visible + .box { outline: 2px solid var(--orange); outline-offset: 2px; }
.task .title {
  flex: 1; font-size: 16px; line-height: 1.5; cursor: pointer;
  transition: color 0.16s var(--ease);
}
.task input:checked ~ .title { color: var(--sub); }
.task .del {
  flex: none; width: 32px; height: 32px; border: none; background: none;
  color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer;
  border-radius: 8px; opacity: 0.55; transition: opacity 0.16s, color 0.16s, background 0.16s;
}
.task .del:hover { opacity: 1; color: var(--deep); background: var(--soft); }

.empty { text-align: center; color: var(--faint); font-size: 14px; line-height: 1.9; padding: 14px 0 10px; }

.addrow { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding-top: 10px;
  border-top: 1px solid var(--line); }
.addrow .plus { width: 22px; text-align: center; color: var(--faint); font-size: 18px;
  transition: color 0.16s var(--ease); }
.addinput {
  flex: 1; border: none; background: none; outline: none; min-height: 38px;
  font-family: inherit; font-size: 16px; color: var(--ink);
}
.addinput::placeholder { color: var(--faint); }
.addrow:focus-within .plus { color: var(--orange); }

/* ③ percent + chart */
.chart-card { padding-bottom: 10px; }
.pct-row { display: flex; align-items: baseline; gap: 12px; }
.pct {
  font-size: 56px; font-weight: 600; line-height: 1; letter-spacing: -0.02em;
  color: var(--orange);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.pct.muted { color: #D6D2CC; }
.pct-sub { font-size: 12px; color: var(--faint); letter-spacing: 0.08em; }
.chart { width: 100%; height: 120px; margin-top: 6px; display: block; overflow: visible; }

/* ④ diary */
.diary { padding: 8px 14px; }
.diary-list { display: flex; flex-direction: column; }
.drow {
  display: grid; grid-template-columns: 64px 1fr; align-items: start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.drow:last-child { border-bottom: none; }
.drow .dlabel { font-size: 12px; color: var(--faint); padding-top: 9px; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums; }
.drow textarea {
  width: 100%; border: none; background: none; outline: none; resize: none;
  font-family: inherit; font-size: 15px; line-height: 1.7; color: var(--ink);
  min-height: 38px; padding: 6px 0; overflow: hidden;
}
.drow textarea::placeholder { color: #CFCBC4; }
/* 今日を強調 */
.drow.is-today { background: var(--soft); border-radius: 12px; padding: 12px 12px;
  margin: 4px -6px; border-bottom: none; }
.drow.is-today .dlabel { color: var(--ink); font-weight: 600; padding-top: 9px; }
.drow.is-today .dlabel .mark { color: var(--orange); margin-right: 3px; }
.drow.is-today + .drow { border-top: 1px solid var(--line); }

/* footer */
.credit {
  margin-top: auto; padding-top: 22px; font-size: 12px; color: #B6B3AD;
  display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.credit a { color: var(--sub); text-decoration: none; transition: color 0.16s var(--ease); }
.credit a:hover { color: var(--orange); }
.credit .sep { color: var(--line); }

/* toast */
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px);
  transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: var(--r-pill); padding: 11px 20px; font-size: 13px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
