/* やる事リスト：色の名前は design.md（brand-core.md のトークン）。ここだけ HEX を書く */
:root {
  --text: #333333;
  --brand-gray: #595656;
  --brand-red: #E60012;
  --red-dark: #C4000F;
  --gray-30: #CDCCCC;
  --gray-20: #DEDDDD;
  --gray-05: #F7F7F7;
  --cream-20: #FEF7E8;
  --white: #FFFFFF;
  --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--white); color: var(--text);
  font: 17px/1.5 -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
}
#app {
  max-width: 720px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 20px; }
h3 { font-size: 14px; color: var(--brand-gray); margin: 0 0 8px; font-weight: 600; }

/* 上の帯 */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-bottom: 8px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; width: 100%; padding: 0 16px; border-radius: var(--r);
  background: var(--white); color: var(--text); border: 1px solid var(--gray-30);
  font: inherit; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--brand-red); border-color: var(--brand-red); color: var(--white); font-weight: 700; }
.btn.small { width: auto; min-height: 44px; font-size: 15px; }
.btn.danger { color: var(--brand-red); border-color: var(--gray-30); }
.btn.link { justify-content: flex-start; background: var(--cream-20); border-color: var(--gray-20); font-weight: 600; }
@media (hover: hover) {
  .btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
  .btn:not(.primary):hover { background: var(--gray-05); }
}
.linkish { background: none; border: 0; color: var(--brand-gray); font: inherit; font-size: 14px; text-decoration: underline; padding: 8px; cursor: pointer; }

.banner { background: var(--cream-20); border: 1px solid var(--gray-20); border-radius: var(--r); padding: 8px 12px; font-size: 14px; color: var(--brand-gray); margin: 0 0 12px; }
.empty { color: var(--brand-gray); text-align: center; padding: 32px 0; }
.error { color: var(--brand-red); font-weight: 700; min-height: 1.5em; }
.hint { font-size: 14px; color: var(--brand-gray); margin: 0 0 8px; }

/* リスト */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--gray-20); }
.row {
  display: flex; align-items: stretch; gap: 4px; background: var(--white);
  border-bottom: 1px solid var(--gray-20); position: relative;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.row.dragging { z-index: 10; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); border-radius: var(--r); background: var(--white); }
.check {
  flex: 0 0 48px; min-height: 56px; background: none; border: 0; cursor: pointer; position: relative;
}
.check::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 24px; height: 24px; margin-top: -12px;
  border: 2px solid var(--gray-30); border-radius: 50%;
}
.check:active::before { background: var(--brand-red); border-color: var(--brand-red); }
.row-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 10px 0; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.row-body.static { cursor: default; padding-left: 4px; }
.row-title { overflow-wrap: anywhere; }
.row-next { font-size: 14px; color: var(--brand-gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-count, .row-date { font-size: 13px; color: var(--brand-gray); }
.handle {
  flex: 0 0 48px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--brand-gray); cursor: grab;
  touch-action: none; /* ≡ の上ではスクロールしない（並べ替えの取り違えを防ぐ） */
}
.list.done .row { align-items: center; padding-right: 4px; }

.foot { display: grid; gap: 12px; margin-top: 16px; }

/* 詳細 */
.detail-title { margin: 8px 0 16px; overflow-wrap: anywhere; }
.sec { margin: 0 0 20px; }
.next { margin: 0; padding: 12px; background: var(--gray-05); border-radius: var(--r); overflow-wrap: anywhere; }
.next.none { color: var(--brand-gray); }
.links { display: grid; gap: 8px; }
.copy { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--gray-20); border-radius: var(--r); margin-bottom: 8px; }
.copy-label { grid-column: 1 / -1; font-size: 13px; color: var(--brand-gray); }
.copy-value { margin: 0; font: 15px/1.4 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }

/* 入力 */
.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field > span { font-size: 14px; color: var(--brand-gray); font-weight: 600; }
.input { width: 100%; font: inherit; color: var(--text); padding: 12px; border: 1px solid var(--gray-30); border-radius: var(--r); background: var(--white); }
textarea.input { resize: vertical; }
.items { display: grid; gap: 12px; margin-bottom: 12px; }
.item-edit { display: grid; gap: 8px; padding: 12px; background: var(--gray-05); border-radius: var(--r); }
.item-head { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.badge { font-size: 13px; font-weight: 700; color: var(--brand-gray); }

/* 合言葉 */
.gate { display: grid; gap: 16px; padding-top: 40px; }

/* お知らせ */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%);
  background: var(--brand-gray); color: var(--white); padding: 10px 18px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.offscreen { position: fixed; left: -9999px; top: 0; }
