:root {
  --sprout: #eef2dc;   /* 苗色: 地。屋外の強い光でも読める明るさ */
  --sheet: #f8faef;    /* 野帳の紙 */
  --ink: #1c2a1c;      /* 墨緑: 文字 */
  --ink-soft: #46553f; /* 補足の文字（紙と地の両方でコントラスト 4.5 以上） */
  --soil: #5e3716;     /* 土: 押す場所 */
  --leaf: #2f6b24;     /* 若葉: 完了・選択 */
  --warn: #8f2a1a;
  --line: #bcc9a4;
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 112.5%;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--sprout);
  color: var(--ink);
  line-height: 1.7;
}

main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 16px 3rem;
}

h1, h2, h3, p { margin: 0; }

.top { padding: 0.9rem 0 0.6rem; }
h1 { font-size: 1.05rem; font-weight: 700; color: var(--ink-soft); }

/* 入力欄は野帳の方眼。5mm 方眼に近い間隔で、書く場所だと一目で分かるようにする */
.page {
  padding: 0.9rem 0.9rem 1rem;
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 1.4rem 1.4rem;
  background-position: -1px -1px;
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.ask {
  display: block;
  width: fit-content;
  padding: 0 0.3rem;
  background: var(--sheet);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
}

textarea,
input[type="date"],
input[type="password"] {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}

textarea {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  resize: vertical;
}

::placeholder { color: var(--ink-soft); opacity: 1; }

.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0.4rem 1rem;
  font: inherit;
  font-weight: 700;
  color: var(--soil);
  background: #fff;
  border: 2px solid var(--soil);
  border-radius: 6px;
  cursor: pointer;
}

button:disabled {
  color: var(--ink-soft);
  border-color: var(--ink-soft);
  opacity: 0.55;
  cursor: default;
}

button.primary {
  width: 100%;
  min-height: 3.8rem;
  margin-top: 0.7rem;
  font-size: 1.25rem;
  color: #fff;
  background: var(--soil);
}

/* 半透明にすると下の方眼が透けるので、不透明な色で無効を示す */
button.primary:disabled {
  color: #fff;
  background: #77836c;
  border-color: #77836c;
  opacity: 1;
}

button[aria-pressed="true"] {
  color: #fff;
  background: var(--warn);
  border-color: var(--warn);
}

button.quiet {
  min-height: 2.75rem;
  padding: 0.2rem 0.8rem;
  font-size: 0.92rem;
}

:focus-visible,
.visually-hidden:focus-visible + * {
  outline: 3px solid var(--leaf);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.preview {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.6rem;
  padding: 0.4rem;
  background: var(--sheet);
}

.preview img {
  width: 6rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 4px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.row > label { padding: 0 0.3rem; background: var(--sheet); font-weight: 700; }
.settings .row > label { background: none; }

.hint {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.page .hint { margin-top: 0.4rem; padding: 0 0.3rem; background: var(--sheet); }

.status {
  min-height: 1.7em;
  margin: 0.7rem 0 0;
  font-weight: 700;
}

.status.error { color: var(--warn); }

section { margin-top: 1.6rem; }

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.4;
  outline: none;
}

.empty {
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.range { font-size: 0.9rem; color: var(--ink-soft); }
.plain { margin: 0.4rem 0 0; padding: 0; list-style: none; }
.plain li { padding: 0.45rem 0; border-top: 1px solid var(--line); }
.plain time { display: block; font-size: 0.86rem; color: var(--ink-soft); }

/* やることは、畑で手を止めずに押せる大きさの行にする */
.todos { margin: 0.4rem 0 0; padding: 0; list-style: none; }
.todos li { border-top: 1px solid var(--line); }

.todo {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0 0.6rem;
  align-items: start;
  min-height: 3rem;
  padding: 0.6rem 0;
  cursor: pointer;
}

.todo input {
  width: 1.7rem;
  height: 1.7rem;
  margin: 0.1rem 0 0;
  accent-color: var(--leaf);
}

.todo-main { font-weight: 700; }
.todo-when { margin-right: 0.45em; color: var(--leaf); }
.todo-why { display: block; margin-top: 0.1rem; font-size: 0.88rem; font-weight: 400; line-height: 1.55; color: var(--ink-soft); }
.todo.done .todo-main > span:last-child { text-decoration: line-through; }

.money {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.money caption { text-align: left; font-size: 0.9rem; font-weight: 700; }
.money th, .money td { padding: 0.35rem 0; border-top: 1px solid var(--line); font-weight: 400; }
.money th { text-align: left; }
.money td { text-align: right; white-space: nowrap; }

.note { padding: 0.8rem 0; border-top: 1px solid var(--line); }
.note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.6em; font-size: 0.88rem; color: var(--ink-soft); }
.note-head strong { color: var(--leaf); }
.note-tag { padding: 0 0.4em; color: #fff; background: var(--warn); border-radius: 3px; font-size: 0.78rem; font-weight: 700; }
.note-photo { display: block; width: 100%; max-width: 15rem; margin-top: 0.4rem; border-radius: 4px; }
.note-text { margin-top: 0.25rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-ai { margin-top: 0.4rem; padding-left: 0.7rem; border-left: 3px solid var(--leaf); font-size: 0.95rem; }
.note-ai ul { margin: 0.2rem 0 0; padding-left: 1.1em; }
.note-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.settings {
  margin-top: 2rem;
  padding: 0.5rem 0.9rem;
  background: var(--sheet);
  border: 2px solid var(--line);
  border-radius: 6px;
}

.settings summary { min-height: 2.75rem; padding: 0.5rem 0; font-weight: 700; cursor: pointer; }
.settings h3 { margin-top: 1rem; font-size: 1rem; font-weight: 700; }
.settings input[type="password"] { flex: 1; min-width: 0; }
.settings > label:not(.check, .button) { display: block; margin-top: 0.5rem; font-size: 0.92rem; font-weight: 700; }
.settings > .button { margin: 0.5rem 0; }
.settings .hint { margin-top: 0.35rem; }

.check { display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; }
.check input { width: 1.5rem; height: 1.5rem; accent-color: var(--leaf); }

.caution { margin-top: 1.2rem; font-size: 0.84rem; color: var(--ink-soft); }
