/* タイムバケット共有版 — 見た目（今のアプリの配色・丸み・シンプルさを再現） */
:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #33302e;
  --ink-soft: #8a837e;
  --ink-done: #b8b0a8;
  --accent: #e86a4a;
  --accent-soft: #fdeee8;
  --accent-dark: #d95538;
  --line: #f0e6dc;
  --owner-me: #e86a4a;
  --owner-wife: #5b8dbf;
  --owner-both: #7a9e6d;
  --danger: #c0392b;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

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

/* ヘッダー */
.header { text-align: center; margin-bottom: 8px; }
.header h1 { font-size: 22px; margin: 6px 0 2px; letter-spacing: 0.06em; }
.header .subtitle { color: var(--ink-soft); font-size: 13px; margin: 0; }

.progress-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin: 18px 0 6px;
}
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring .ring-fg { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.ring .ring-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.2;
}
.ring .ring-count { font-size: 18px; font-weight: 700; }
.ring .ring-label { font-size: 11px; color: var(--ink-soft); }
.progress-note { font-size: 13px; color: var(--ink-soft); text-align: left; max-width: 180px; }

/* 追加ボタン（上部のみ） */
.add-top {
  display: block; width: 100%; margin: 16px 0 14px; padding: 13px;
  border: none; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.add-top:active { background: var(--accent-dark); }

/* フィルター */
.filter { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.filter button {
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-soft); font-size: 14px; cursor: pointer;
}
.filter button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 同期状態 */
.sync-status { text-align: center; font-size: 12px; color: var(--ink-soft); min-height: 18px; margin-bottom: 6px; }
.sync-status.error { color: var(--danger); }

/* ヒント */
.hint { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 0 0 12px; }

/* 年代セクション（記入がある年代だけ表示） */
.decade { margin-bottom: 20px; }
.decade-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 6px; }
.decade-head h2 { font-size: 17px; margin: 0; }
.decade-head .decade-count { font-size: 12px; color: var(--ink-soft); }
.decade-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 0 4px 10px; }
.decade-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s ease; }

.empty { text-align: center; color: var(--ink-soft); padding: 36px 0; font-size: 15px; }

/* 項目リスト — シンプルに */
.item-list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 12px; margin-bottom: 8px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.item.dragging {
  opacity: 0.92; box-shadow: 0 10px 24px rgba(0,0,0,0.16);
  transform: scale(1.01); touch-action: none; z-index: 5; position: relative;
}
.item.pending { opacity: 0.75; border-style: dashed; }
.item.failed { border-color: var(--danger); }

.check {
  flex: none; width: 26px; height: 26px; margin-top: 2px;
  border: 2px solid #d8cfc6; border-radius: 50%; background: #fff;
  color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.check.done { background: var(--accent); border-color: var(--accent); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 16px; font-weight: 600; word-break: break-word; }
.item.done .item-title { color: var(--ink-done); font-weight: 500; } /* 取り消し線なし。色だけ薄く */
.item-memo { font-size: 13px; color: var(--ink-soft); margin-top: 2px; word-break: break-word; }
.item.done .item-memo { color: var(--ink-done); }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.owner-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; color: #fff;
}
.owner-tag.owner-正裕 { background: var(--owner-me); }
.owner-tag.owner-奥さん { background: var(--owner-wife); }
.owner-tag.owner-ふたり { background: var(--owner-both); }
.achieved-date { font-size: 12px; color: var(--ink-soft); }
.item.failed .achieved-date { color: var(--danger); }

.edit-btn {
  flex: none; border: none; background: none; font-size: 19px; line-height: 1;
  padding: 6px 4px; cursor: pointer; color: var(--ink-soft);
}
.edit-btn:active { color: var(--accent); }

.save-failed { font-size: 13px; color: var(--danger); margin-top: 6px; }
.save-failed button {
  margin-right: 8px; margin-top: 4px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--danger); background: #fff; color: var(--danger); font-size: 13px; cursor: pointer;
}

/* シート（追加・編集のモーダル） */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: none; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 20px 20px 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet h2 { font-size: 18px; margin: 2px 0 14px; }
.sheet label { display: block; font-size: 13px; color: var(--ink-soft); margin: 12px 0 4px; }
.sheet input[type="text"], .sheet textarea, .sheet select, .sheet input[type="date"] {
  width: 100%; padding: 11px 12px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink);
}
.sheet textarea { min-height: 72px; resize: vertical; }
.sheet .row { display: flex; gap: 12px; }
.sheet .row > div { flex: 1; min-width: 0; }
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 16px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .primary {
  flex: 1; padding: 13px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}
.sheet-actions .secondary {
  padding: 13px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-soft); font-size: 15px; cursor: pointer;
}
.delete-btn {
  display: block; width: 100%; margin-top: 22px; padding: 12px;
  border: none; background: none; color: var(--danger); font-size: 15px; cursor: pointer;
}
.delete-btn.confirm { background: var(--danger); color: #fff; border-radius: 999px; font-weight: 700; }
.sheet-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
