/* ---- 色 ---- */
:root {
  --bg: #f6f5f1;
  --surface: #f6f5f1;
  --text: #1b1b1b;
  --sub: #77746c;
  --line: #e3e0d8;
  --accent: #1b1b1b;
  --accent-text: #ffffff;
  --late: #c2410c;
  --chip: #ebe8e0;
  --chip-text: #4a4740;
  --head: #77746c;
  --check: #1b1b1b;
  --sheet: #ffffff;
  --pulse: rgba(27, 27, 27, 0.18);
  --new: #fff6d6;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 400;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(190px + env(safe-area-inset-bottom));
}

/* ---- 見出し ---- */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 18px;
}

.title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.summary {
  margin: 0;
  font-size: 14px;
  color: var(--sub);
}

/* ---- からっぽ ---- */
.empty {
  margin-top: 18vh;
  text-align: center;
  color: var(--sub);
  line-height: 1.8;
}

.empty-main {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.empty-sub { margin: 0; font-size: 15px; }

.empty-example {
  margin: 6px 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
}

/* ---- リスト ---- */
.group { margin-bottom: 22px; }

.group-head {
  display: inline-block;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--head);
}

.group[data-group="late"] .group-head { color: var(--late); }
.items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 1.2s;
}

.item.is-new { background: var(--new); transition: none; }

.check {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  color: transparent;
}

.check { border-color: #c9c5bb; }
.check svg { width: 16px; height: 16px; stroke-width: 3; }

.item.done .check {
  border-color: var(--check);
  background: var(--check);
  color: var(--accent-text);
}

.item-body {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  text-align: left;
}

.item-text {
  display: block;
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.item.done .item-text {
  color: var(--sub);
  text-decoration: line-through;
}

.due {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  background: var(--chip);
  color: var(--chip-text);
}

.due.late {
  background: transparent;
  padding-left: 0;
  color: var(--late);
}

/* ---- 終わったもの ---- */
.done-area { margin-top: 8px; }

.done-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.done-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--sub);
}

.done-toggle svg { width: 18px; height: 18px; transition: transform 0.2s; }
.done-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.text-btn {
  padding: 8px 4px;
  border: 0;
  background: none;
  font-size: 14px;
  color: var(--sub);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- 下のマイク ---- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 26%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.heard {
  width: 100%;
  max-width: 520px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--sheet);
  border: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.heard .interim { color: var(--sub); }

.dock-row {
  display: flex;
  align-items: center;
  gap: 28px;
}

.mic {
  position: relative;
  width: 84px;
  height: 84px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  transition: transform 0.15s;
}

.mic:active { transform: scale(0.95); }
.mic svg { width: 36px; height: 36px; stroke-width: 2; }

.mic::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pulse);
  z-index: -1;
  opacity: 0;
}

.listening .mic::before { animation: pulse 1.4s ease-out infinite; }

@keyframes pulse {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.7); opacity: 0; }
}

.side-btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--sheet);
  color: var(--sub);
  display: grid;
  place-items: center;
}

.side-btn svg { width: 22px; height: 22px; }
.side-btn.ghost { visibility: hidden; }
.side-btn[aria-pressed="true"] { color: var(--text); border-color: var(--text); }

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--sub);
}

.type-form {
  width: 100%;
  max-width: 520px;
  display: flex;
  gap: 8px;
}

.type-form input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
  font-size: 16px;
}

.type-form button,
.main-btn {
  height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* ---- お知らせ ---- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #1b1b1b;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.toast-btn {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- 編集 ---- */
.sheet {
  width: min(520px, calc(100% - 24px));
  margin: auto auto 12px;
  padding: 20px;
  border: 0;
  border-radius: 18px;
  background: var(--sheet);
  color: var(--text);
}

.sheet::backdrop { background: rgba(0, 0, 0, 0.35); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
}

.field input {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 16px;
  color: var(--text);
  min-width: 0;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 10px;
}

.field-row .field { margin-bottom: 4px; }
.text-btn.small { font-size: 13px; padding: 4px 0; }

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.spacer { flex: 1; }

.plain-btn,
.danger-btn {
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-weight: 500;
}

.plain-btn { color: var(--sub); }
.danger-btn { color: var(--late); }
