/* Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V4
 * Hallmark · macrostructure: app-dashboard (非LP・hero/nav/footerアーキタイプ非適用) · tone: utilitarian · anchor hue: gold #eab308
 * 目標ロードマップ管理アプリ。全色・フォントは tokens.css のトークンを参照。 */

@import url("./tokens.css");

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.75;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

h1, h2, h3 {
  line-height: 1.35;
  letter-spacing: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
  min-width: 0;
  font-feature-settings: "palt" 1, "kern" 1;
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); font-weight: 600; }
h3 { font-size: var(--text-h3); font-weight: 600; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); text-decoration: underline; }

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: var(--text-sm); }
.caption { font-size: var(--text-caption); color: var(--text-3); letter-spacing: 0.05em; }
.nowrap { white-space: nowrap; }

/* ============================================================ layout */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-m);
  padding: env(safe-area-inset-top) var(--space-l) 0; /* ノッチ/ステータスバー回避 */
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand .mark { color: var(--gold); }
.brand .sub { font-size: var(--text-caption); color: var(--text-3); letter-spacing: 0.08em; }

.app-nav {
  display: flex;
  gap: var(--space-xs);
  margin-left: var(--space-m);
}
.nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-2);
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius-button);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: background var(--dur) var(--ease-standard), color var(--dur) var(--ease-standard);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-btn:active { transform: translateY(1px); }
.nav-btn.is-active { background: var(--surface-2); color: var(--gold); }

.header-spacer { flex: 1; }

main { display: block; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-l);
}

.view-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-m);
  margin-bottom: var(--space-l);
}
.view-head h1 { font-size: var(--text-display); }
.view-head .grow { flex: 1; }

/* ============================================================ buttons
 * 注: 本アプリはPC利用も主体のため、操作対象（ボタン・タブ・クリック可能カード・
 * ナビ・マインドマップノード）には意図的にデスクトップ用 :hover を付与している。
 * いずれも :active（タッチ）と :focus-visible を併設し、hover 単独依存にはしていない。
 * 静的・装飾目的の hover は付けない（プロジェクト規約）。 */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-s);
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease-standard), transform var(--dur) var(--ease-standard),
    border-color var(--dur) var(--ease-standard), opacity var(--dur) var(--ease-standard);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--gold); color: var(--text-on-gold); }
.btn-primary:hover { background: var(--gold-light); }

.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.05); }

.btn-ghost { background: transparent; color: var(--gold); padding-left: var(--space-s); padding-right: var(--space-s); }
.btn-ghost:hover { color: var(--gold-light); text-decoration: underline; }

.btn-danger { background: transparent; color: var(--danger); border-color: rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.12); }

.btn-sm { min-height: 36px; padding: 7px 14px; font-size: var(--text-sm); }
.btn-block { width: 100%; }
.btn-icon {
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border-soft);
}
.btn-icon:hover { color: var(--text); border-color: var(--border); }

/* ============================================================ form */
.field { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-m); }
.field label { font-size: var(--text-sm); font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.field .hint { font-size: var(--text-caption); color: var(--text-3); }

.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-body);
  padding: 12px 14px;
  min-height: 48px;
  transition: border-color var(--dur) var(--ease-standard);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }

.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-m); }

/* ============================================================ cards / grid */
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--space-m);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--space-l);
  box-shadow: var(--inner-edge);
}

.goal-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  text-align: left;
  width: 100%;
  border: none;
  cursor: pointer;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--space-l);
  box-shadow: var(--inner-edge);
  transition: background var(--dur) var(--ease-standard), transform var(--dur) var(--ease-standard);
}
.goal-card:hover { background: var(--surface-2); }
.goal-card:active { transform: translateY(1px); }

.goal-card .gc-top { display: flex; align-items: flex-start; gap: var(--space-s); }
.goal-card .gc-title { font-size: var(--text-h3); font-weight: 700; color: var(--text); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.goal-card .gc-dot { width: 10px; height: 10px; border-radius: var(--radius-pill); margin-top: 6px; flex: none; }

.goal-card .gc-meta { display: flex; flex-wrap: wrap; gap: var(--space-s); align-items: center; }
.goal-card .gc-values { font-size: var(--text-sm); color: var(--text-2); }
.goal-card .gc-values b { color: var(--text); font-weight: 700; }
.goal-card .gc-spark { height: 36px; }

/* ============================================================ progress bar */
.pbar { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.pbar > span { display: block; height: 100%; background: var(--gold); border-radius: var(--radius-pill); }
.pbar.is-done > span { background: var(--success); }
.pbar-label { display: flex; justify-content: space-between; font-size: var(--text-caption); color: var(--text-3); margin-bottom: var(--space-xs); }
.pbar-label b { color: var(--gold); font-size: var(--text-sm); }

/* ============================================================ chips / badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
}
.chip.cat { background: rgba(234, 179, 8, 0.12); color: var(--gold-light); }

.badge { display: inline-flex; align-items: center; font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.05em; padding: 3px 10px; border-radius: var(--radius-pill); }
.badge.active { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.badge.paused { background: rgba(148, 163, 184, 0.15); color: var(--text-3); }
.badge.done { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge.dropped { background: rgba(148, 163, 184, 0.12); color: var(--text-3); }
.badge.testing { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge.validated { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge.invalidated { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* ============================================================ tabs */
.tabs { display: flex; gap: var(--space-xs); border-bottom: 1px solid var(--border-soft); margin-bottom: var(--space-l); overflow-x: auto; }
.tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-m);
  min-height: 44px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--dur) var(--ease-standard);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ============================================================ section blocks */
.section { margin-bottom: var(--space-2xl); }
.section-head { display: flex; align-items: center; gap: var(--space-m); margin-bottom: var(--space-m); }
.section-head h2 { flex: 1; min-width: 0; }

.stat-row { display: flex; flex-wrap: wrap; gap: var(--space-xl); margin-bottom: var(--space-l); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: var(--text-h1); font-weight: 700; color: var(--text); }
.stat .v.gold { color: var(--gold); }
.stat .k { font-size: var(--text-caption); color: var(--text-3); letter-spacing: 0.05em; }

/* ============================================================ roadmap timeline */
.timeline { display: flex; flex-direction: column; gap: var(--space-s); }
.ms {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: var(--space-m);
  align-items: start;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--space-m) var(--space-l);
  box-shadow: var(--inner-edge);
}
.ms .ms-marker { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.ms .ms-dot { width: 14px; height: 14px; border-radius: var(--radius-pill); border: 2px solid var(--border); background: var(--surface-2); }
.ms.todo .ms-dot { border-color: var(--border); }
.ms.doing .ms-dot { border-color: var(--gold); background: var(--gold); }
.ms.done .ms-dot { border-color: var(--success); background: var(--success); }
.ms .ms-body { min-width: 0; }
.ms .ms-title { font-weight: 700; overflow-wrap: anywhere; }
.ms.done .ms-title { color: var(--text-3); text-decoration: line-through; }
.ms .ms-sub { font-size: var(--text-sm); color: var(--text-3); margin-top: 2px; }
.ms .ms-detail { font-size: var(--text-sm); color: var(--text-2); margin-top: var(--space-xs); white-space: pre-wrap; }
.ms .ms-actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }

/* ============================================================ chart */
.chart-wrap { background: var(--surface); border-radius: var(--radius-card); padding: var(--space-l); box-shadow: var(--inner-edge); overflow-x: auto; }
.chart-legend { display: flex; gap: var(--space-l); flex-wrap: wrap; margin-top: var(--space-m); font-size: var(--text-caption); color: var(--text-3); }
.chart-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-legend i.actual { background: var(--gold); }
.chart-legend i.ideal { background: var(--gray-500); }
.chart-empty { color: var(--text-3); text-align: center; padding: var(--space-2xl) 0; }

/* SVGチャートの色はトークン参照（属性に生hexを書かない） */
.chart-grid { stroke: var(--border-soft); stroke-width: 1; }
.chart-axis-label { fill: var(--text-3); font-size: 11px; }
.chart-ideal { stroke: var(--gray-500); }
.chart-ideal-dot { fill: var(--gray-500); }
.chart-actual { stroke: var(--gold); }
.chart-actual-dot { fill: var(--gold); }
.spark-line { stroke: var(--gold); }

/* progress entries list */
.entry-list { display: flex; flex-direction: column; gap: var(--space-xs); margin-top: var(--space-m); }
.entry {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: var(--space-m);
  align-items: center;
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius-button);
  background: var(--surface-2);
  font-size: var(--text-sm);
}
.entry .e-date { color: var(--text-3); font-variant-numeric: tabular-nums; }
.entry .e-val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.entry .e-note { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }

/* ============================================================ hypotheses */
.hyp { background: var(--surface); border-radius: var(--radius-card); padding: var(--space-l); box-shadow: var(--inner-edge); margin-bottom: var(--space-m); }
.hyp-top { display: flex; align-items: flex-start; gap: var(--space-m); }
.hyp-statement { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.hyp-rules { margin-top: var(--space-m); font-size: var(--text-sm); color: var(--text-2); white-space: pre-wrap; background: var(--bg); border-radius: var(--radius-button); padding: var(--space-m); }
.hyp-rules .lbl { display: block; font-size: var(--text-caption); color: var(--text-3); letter-spacing: 0.05em; margin-bottom: var(--space-xs); }
.adherence { display: flex; align-items: center; gap: var(--space-m); margin-top: var(--space-m); }
.adherence .meter { flex: 1; height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; min-width: 80px; }
.adherence .meter > span { display: block; height: 100%; background: var(--success); }
.adherence .meter.low > span { background: var(--danger); }
.adherence .meter.mid > span { background: var(--warning); }
.adherence .ratio { font-size: var(--text-sm); font-weight: 700; color: var(--text); white-space: nowrap; }
.checkin-list { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-m); }
.ci-pill { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--text-caption); padding: 3px 8px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); }
.ci-pill.ok { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.ci-pill.ng { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }

/* ============================================================ mindmap */
.mindmap-wrap { position: relative; height: min(72vh, 720px); background: var(--bg-deep); border-radius: var(--radius-card); box-shadow: var(--inner-edge); overflow: hidden; touch-action: none; }
.mindmap-wrap svg { display: block; width: 100%; height: 100%; }
.mm-toolbar { position: absolute; top: var(--space-m); left: var(--space-m); right: var(--space-m); display: flex; gap: var(--space-s); flex-wrap: wrap; z-index: 2; pointer-events: none; }
.mm-toolbar > * { pointer-events: auto; }
.mm-hint { font-size: var(--text-caption); color: var(--text-3); background: rgba(15,23,42,0.7); padding: 4px 10px; border-radius: var(--radius-pill); }
.mm-edge { stroke: var(--border); stroke-width: 2; }
.mm-edge.depends { stroke: var(--info); }
.mm-edge.contributes { stroke: var(--success); }
.mm-edge.blocks { stroke: var(--danger); stroke-dasharray: 6 5; }
.mm-edge-label { fill: var(--text-3); font-size: 11px; }
.mm-node-rect { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; cursor: grab; }
.mm-node-rect:hover { fill: var(--surface-2); }
.mm-node-rect.dragging { cursor: grabbing; }
.mm-node-rect.selected { stroke: var(--gold); stroke-width: 3; }
.mm-node-accent { }
.mm-node-title { fill: var(--text); font-size: 13px; font-weight: 700; pointer-events: none; }
.mm-node-sub { fill: var(--text-3); font-size: 11px; pointer-events: none; }
.mm-node-bar-bg { fill: var(--surface-2); }
.mm-node-bar { fill: var(--gold); }

/* ============================================================ modal */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-l);
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), var(--inner-edge);
  width: 100%;
  max-width: 560px;
  margin: var(--space-2xl) 0;
  padding: var(--space-xl);
}
.modal-head { display: flex; align-items: center; gap: var(--space-m); margin-bottom: var(--space-l); }
.modal-head h2 { flex: 1; min-width: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-s); margin-top: var(--space-l); flex-wrap: wrap; }
.modal-actions .grow { flex: 1; }

/* ============================================================ login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-l); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius-card); padding: var(--space-2xl); box-shadow: var(--inner-edge); }
.login-card .brand { justify-content: center; margin-bottom: var(--space-xl); font-size: var(--text-h2); }
.login-error { color: var(--danger); font-size: var(--text-sm); margin-top: var(--space-s); min-height: 1.2em; }

/* ============================================================ toast */
.toast-host { position: fixed; bottom: var(--space-l); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: var(--space-s); align-items: center; width: calc(100% - 32px); max-width: 420px; }
.toast { display: flex; align-items: center; gap: var(--space-s); background: var(--surface-2); color: var(--text); border-radius: var(--radius-button); padding: var(--space-m) var(--space-l); box-shadow: 0 8px 24px rgba(0,0,0,0.4); font-size: var(--text-sm); width: 100%; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-pill); flex: none; background: var(--text-3); }
.toast.ok::before { background: var(--success); }
.toast.err::before { background: var(--danger); }

/* ============================================================ empty / skeleton */
.empty-state { text-align: center; padding: var(--space-3xl) var(--space-l); color: var(--text-3); }
.empty-state h2 { color: var(--text-2); margin-bottom: var(--space-s); }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-card); }
.skel-card { height: 150px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ============================================================ 詳細ページ補助（個別スタイルはクラスで管理） */
.goal-desc { margin-bottom: var(--space-l); white-space: pre-wrap; }
.entries-h3 { margin-bottom: var(--space-m); }
.hyp-intro { margin-bottom: var(--space-m); }
.hyp-note { margin-top: var(--space-m); white-space: pre-wrap; }
.hyp-actions { margin-top: var(--space-m); }
.confirm-msg { margin-bottom: var(--space-m); }

/* ============================================================ 毎朝の書き出し */
.morning-lead { color: var(--text-2); margin-bottom: var(--space-l); max-width: 640px; }
.morning-why { background: rgba(234, 179, 8, 0.10); border-radius: var(--radius-card); margin-bottom: var(--space-m); }
.morning-why > summary { cursor: pointer; list-style: none; padding: var(--space-m) var(--space-l); font-weight: 700; color: var(--gold-light); min-height: 52px; display: flex; align-items: center; gap: var(--space-s); }
.morning-why > summary::-webkit-details-marker { display: none; }
.morning-why > summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--dur) var(--ease-standard); }
.morning-why[open] > summary::after { transform: rotate(-135deg); }
.morning-why > summary:active { transform: translateY(1px); }
.morning-why > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: var(--radius-card); }
.why-body { padding: var(--space-s) var(--space-l) var(--space-l); display: flex; flex-direction: column; gap: var(--space-m); color: var(--text-2); line-height: 1.9; max-width: 680px; }
.why-body p { margin: 0; }
.morning-card { display: flex; flex-direction: column; gap: var(--space-m); }
.morning-date { display: flex; flex-direction: column; gap: 2px; }
.morning-date .md-date { font-size: var(--text-h3); font-weight: 700; color: var(--text); }
.morning-list { display: flex; flex-direction: column; gap: var(--space-s); }
.morning-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-s); align-items: center; }
.morning-num { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.morning-actions { display: flex; align-items: center; gap: var(--space-m); flex-wrap: wrap; margin-top: var(--space-s); }

/* 連続日数バナー */
.streak-banner { display: flex; align-items: center; gap: var(--space-l); background: var(--surface); border-radius: var(--radius-card); padding: var(--space-l); box-shadow: var(--inner-edge); margin-bottom: var(--space-m); }
.streak-main { display: flex; align-items: baseline; gap: var(--space-xs); flex: none; }
.streak-num { font-size: 2.5rem; font-weight: 700; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; }
.streak-unit { font-size: var(--text-sm); color: var(--text-2); }
.streak-side { display: flex; flex-direction: column; gap: var(--space-s); min-width: 0; }
.streak-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.streak-dot { width: 14px; height: 14px; border-radius: 3px; background: var(--surface-2); flex: none; }
.streak-dot.on { background: var(--gold); }
.streak-dot.today { outline: 2px solid var(--gold-light); outline-offset: 1px; }

/* 履歴 */
.hist-note { margin-bottom: var(--space-m); }
.hist-list { display: flex; flex-direction: column; gap: var(--space-xs); max-height: 50vh; overflow-y: auto; }
.hist-item { appearance: none; text-align: left; border: none; background: var(--surface-2); color: var(--text); border-radius: var(--radius-button); padding: var(--space-m); min-height: 44px; cursor: pointer; font-size: var(--text-sm); transition: background var(--dur) var(--ease-standard); }
.hist-item:hover, .hist-item:active { background: var(--border); }
.hist-item:active { transform: translateY(1px); }
.hist-items { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: var(--space-s); line-height: 1.7; }

/* ============================================================ responsive */
@media (max-width: 640px) {
  .container { padding: var(--space-m); }
  .app-header { padding: env(safe-area-inset-top) var(--space-m) 0; gap: var(--space-s); }
  .brand .sub { display: none; }
  /* ナビはモバイルでは画面下部の固定タブバーにする */
  .app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 40;
    display: flex; gap: 4px; padding: 4px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
    background: rgba(15, 23, 42, 0.96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-soft);
  }
  .nav-btn { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 48px; font-size: var(--text-caption); }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); } /* 下部タブバー＋安全領域 */
  .view-head h1 { font-size: var(--text-h1); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .stat-row { gap: var(--space-l); }
  .ms { grid-template-columns: 24px minmax(0, 1fr); }
  .ms .ms-actions { grid-column: 1 / -1; }
  .entry { grid-template-columns: auto auto minmax(0, 1fr); }
  .entry .btn-icon { grid-column: 1 / -1; justify-self: end; }
  .streak-banner { flex-direction: column; align-items: flex-start; gap: var(--space-m); }
  .modal { padding: var(--space-l); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
