:root {
  --accent: #6d28d9;
  --accent-dark: #5b21b6;
  --bg: #f5f3ff;
  --card: #ffffff;
  --text: #1e1b4b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--accent); color: #fff;
  padding: env(safe-area-inset-top) 0 0;
}
.app-header h1 { margin: 0; font-size: 1.25rem; }
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.help-btn {
  width: 32px; height: 32px; border-radius: 999px; flex: none;
  border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.15);
  color: #fff; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.help-panel {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.help-panel[hidden] { display: none; }
.help-card { background: var(--card); border-radius: 14px; padding: 20px; max-width: 420px; max-height: 80vh; overflow-y: auto; color: var(--text); }
.help-card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.help-card ul { margin: 0 0 16px; padding-left: 18px; }
.help-card li { margin-bottom: 8px; font-size: 0.9rem; line-height: 1.5; }
.btn { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 0.9rem; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff; border: none; font-weight: 700; }
.header-actions { display: flex; gap: 8px; flex: none; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; }
.account-menu-panel {
  position: absolute; right: 16px; top: 52px; z-index: 20;
  background: var(--card); color: var(--text); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); padding: 10px; min-width: 200px;
  display: flex; flex-direction: column; gap: 4px;
}
.account-menu-email { margin: 0 0 4px; padding: 0 8px; font-size: 0.8rem; color: var(--muted); }
.account-menu-link {
  display: block; padding: 8px; border-radius: 8px; border: none; background: none;
  color: var(--text); text-align: left; font-size: 0.9rem; text-decoration: none; cursor: pointer;
}
.account-menu-link:hover { background: var(--bg); }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.card {
  background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(30, 27, 75, 0.06);
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
textarea {
  width: 100%; padding: 12px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 10px; font-family: inherit; color: var(--text);
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.15); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.log-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 8px; border: none; border-radius: 14px;
  background: var(--bg); color: var(--accent-dark); cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}
.log-btn span { font-size: 0.95rem; font-weight: 700; }
.log-btn:active { transform: scale(0.97); background: #ede9fe; }
.log-btn:disabled { opacity: 0.6; }
.message { margin: 12px 0 0; font-size: 0.9rem; min-height: 1.2em; }
.message.ok { color: var(--ok); }
.message.error { color: var(--danger); }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.recent-list li:last-child { border-bottom: none; }
.recent-meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
/* 記録1件の行: 本文＋右端に削除ボタン（誤タップの取り消し） */
#recent li { display: flex; align-items: flex-start; gap: 8px; }
.recent-main { flex: 1; min-width: 0; }
.recent-delete {
  flex: none; width: 32px; height: 32px; border: none; border-radius: 8px;
  background: none; color: var(--muted); font-size: 0.9rem; cursor: pointer; opacity: 0.55;
}
.recent-delete:hover { opacity: 1; background: rgba(0, 0, 0, 0.05); }
.empty { color: var(--muted); font-size: 0.9rem; }

/* --- log-series UI/UX標準（共通適用） --------------------------------------- */
/* hidden属性がdisplay指定に負けて非表示が壊れる事故の防止（標準§2 実装ノートA） */
[hidden] { display: none !important; }
/* キーボード操作のフォーカスを常に見えるように（a11y） */
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent2, var(--accent, #7c3aed));
  outline-offset: 2px;
}
/* 全画面フッター（プライバシー/規約は中央 auth.log-series.jp に集約。標準§10） */
.app-footer {
  text-align: center; padding: 20px 12px calc(16px + env(safe-area-inset-bottom));
  color: var(--muted, #71717a); font-size: 0.85rem;
}
.app-footer a { color: var(--muted, #71717a); text-decoration: underline; }

/* --- フォーム部品標準: ネイティブ部品をブラウザ標準のままにせずアプリ色に --------- */
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
input[type="file"] {
  width: 100%; padding: 10px; box-sizing: border-box;
  border: 1px dashed var(--border); border-radius: 10px;
  background: var(--bg); color: var(--muted); font-size: 0.88rem; cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 9px 14px;
  border: 1px solid var(--accent); border-radius: 999px;
  background: var(--card, #fff); color: var(--accent);
  font-weight: 700; font-size: 0.88rem; cursor: pointer; font-family: inherit;
}
input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--accent) 8%, #fff);
}

/* --- タップ領域標準（§11: 44px以上）------------------------------------- */
/* ヘッダーの丸ボタン（？・人）とタブは指で確実に押せるサイズにする */
.help-btn, .btn-help, .header-icon-btn, .account-btn, .icon-btn {
  min-width: 44px; min-height: 44px;
}
.help-btn, .btn-help, .header-icon-btn, .account-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tab { min-height: 44px; }
.coach-controls button, #coach-next, #coach-back, #coach-skip { min-height: 44px; min-width: 44px; }

/* --- 共通チュートリアル（tour.js が使う。全アプリ同一の見た目）------------- */
#ls-tour-highlight {
  position: fixed; z-index: 10001; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
  pointer-events: none;
}
#ls-tour-tooltip {
  position: fixed; z-index: 10002; width: 280px; max-width: calc(100vw - 24px);
  background: #fff; color: #1f2937; border-radius: 14px; padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
#ls-tour-tooltip[hidden], #ls-tour-highlight[hidden] { display: none !important; }
.ls-tour-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
#ls-tour-step { font-size: .72rem; font-weight: 700; color: #6b7280; letter-spacing: .02em; }
#ls-tour-skip {
  background: none; border: none; color: #6b7280; font-size: .95rem; line-height: 1;
  cursor: pointer; min-width: 44px; min-height: 44px;
}
#ls-tour-tooltip p { margin: 0 0 12px; font-size: .93rem; line-height: 1.6; color: #1f2937; }
.ls-tour-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
#ls-tour-back, #ls-tour-next {
  min-height: 44px; padding: 10px 18px; border-radius: 10px; font-size: .9rem;
  font-weight: 700; cursor: pointer; font-family: inherit;
}
#ls-tour-back { background: #fff; border: 1px solid #e5e7eb; color: #4b5563; }
#ls-tour-back:disabled { visibility: hidden; }
#ls-tour-next { border: none; background: var(--accent, #7c3aed); color: #fff; }

/* ボタン（カテゴリ）編集 */
.category-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 16px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--accent); font-size: 0.9rem; font-weight: 700; cursor: pointer;
}
.chip:hover { background: var(--bg); }
.category-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.category-row .cat-icon { width: 62px; flex: none; text-align: center; font-size: 1.2rem; padding: 10px 6px; border: 1px solid var(--border); border-radius: 10px; }
.category-row .cat-label { flex: 1; padding: 10px 12px; font-size: 1rem; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; }
.category-row .cat-remove {
  flex: none; min-width: 44px; min-height: 44px; border: none; border-radius: 10px;
  background: none; color: var(--muted); font-size: 0.95rem; cursor: pointer;
}
.category-row .cat-remove:hover { background: rgba(0,0,0,.05); }

/* ヘッダーのサービスシンボル。色ベタのヘッダーに白の透過SVGを重ねる。
   高さは見出しの文字に追従させる（em指定）ので、文字サイズを変えても崩れない。 */
.app-logo {
  height: 1.05em; width: auto; flex: none;
  vertical-align: -0.15em; margin-right: .4em;
}

/* ふりかえり: 何をどれだけ残せたか */
.review-more { margin: 14px 0 0; font-size: 0.95rem; color: #475569; }
.review-total { margin: 0 0 12px; font-size: 0.95rem; font-weight: 700; }
.review-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.review-row { display: grid; grid-template-columns: minmax(0, 8.5em) 1fr auto; gap: 10px; align-items: center; }
.review-name { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-bar { height: 10px; border-radius: 999px; background: #eef2f1; overflow: hidden; }
.review-bar i { display: block; height: 100%; background: #0f766e; }
.review-num { font-size: 0.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- 今週の一手 ---------------------------------------------------------
   ワンタップ記録より上に置くが、視覚的に重くしない。
   ここが主張しすぎると、記録の2秒体験の邪魔になる。 */
.action-card { border-left: 4px solid #6d28d9; }
.action-hold {
  margin: 0 0 6px; font-size: 0.95rem; color: #6d28d9; font-weight: 700;
}
.action-title { margin: 0 0 12px; font-size: 1.15rem; line-height: 1.5; }
.action-hint { margin: 0 0 14px; font-size: 0.95rem; color: #475569; }
.action-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.action-count {
  font-size: 0.95rem; font-weight: 700; color: #334155;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.action-bar {
  flex: 1; height: 8px; border-radius: 999px; background: #ede9fe; overflow: hidden;
}
.action-bar i { display: block; height: 100%; background: #6d28d9; transition: width .25s ease; }
.action-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-done {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px;
  background: #6d28d9; color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn-done:disabled { opacity: .55; cursor: default; }
.btn-done.is-full { background: #15803d; }  /* 目標に届いた週は色で分かるように */
.action-card .field { margin-bottom: 12px; }
.action-card select, .action-card input[type="text"] {
  width: 100%; min-height: 44px; padding: 0 12px;
  border: 1px solid #cbd5e1; border-radius: 10px; font-size: 1rem; background: #fff;
}

/* ---- AIが出した3案 ------------------------------------------------------
   選ぶこと自体が「その人らしさ」のデータになるので、押しやすさを優先する。 */
.suggest-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.suggest-pick {
  width: 100%; text-align: left; display: grid; gap: 4px;
  min-height: 44px; padding: 12px 14px; cursor: pointer;
  border: 1px solid #ddd6fe; border-radius: 12px; background: #faf5ff;
}
.suggest-pick:hover, .suggest-pick:focus-visible { border-color: #6d28d9; background: #f3e8ff; }
.suggest-title { font-size: 1rem; font-weight: 700; line-height: 1.5; color: #1e293b; }
.suggest-why { font-size: 0.9rem; color: #6d28d9; }
.suggest-meta { font-size: 0.85rem; color: #64748b; }

/* ---- 今日の予定 ---------------------------------------------------------
   読み取り専用なので、編集できそうな見た目にはしない。
   選べること（＝記録に紐づくこと）だけが分かればよい。 */
.cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cal-item {
  display: grid; grid-template-columns: 4.5em 1fr; gap: 10px; align-items: center;
  min-height: 44px; padding: 8px 12px; cursor: pointer;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
}
.cal-item:hover, .cal-item:focus-visible { border-color: #6d28d9; background: #faf5ff; }
.cal-item.is-picked { border-color: #6d28d9; background: #ede9fe; }
.cal-time { font-size: 0.9rem; color: #64748b; font-variant-numeric: tabular-nums; }
.cal-title { font-size: 0.95rem; line-height: 1.4; }

/* 選んだ予定を、書く欄のすぐ上に出す（何に紐づくかを見失わないように） */
.note-subject {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: 0.9rem; font-weight: 700; color: #6d28d9;
}
.note-subject-clear {
  min-width: 28px; min-height: 28px; border: 0; border-radius: 50%;
  background: #ede9fe; color: #6d28d9; font-size: 1rem; cursor: pointer;
}
