:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #161d24;
  --ink-2: #46525d;
  --muted: #5a6773;
  --muted-2: #6f7d8a;
  --muted-3: #7b8894;
  --line: #dde3e9;
  --ai: #2d4a63;
  --ai-hover: #3c5f7d;
  --ai-bg: #e2e9f0;
  --ai-border: #a9bccd;
  --chip: #eaeef2;
  --bar-1: #2d4a63;
  --bar-2: #5b7f9e;
  --bar-3: #8aa8bf;
  --warn-border: #cbbfa4;
  --warn-ink: #8a7444;
  --warn-bg: #f6f1e5;
  --toast: #233039;
  --on-ai: #f2f6f9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}

/* viewport-fit=cover なので、上のインセットはこちらで空ける（下はナビが持つ）。 */
#app {
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  min-height: 0;
  padding: 24px 24px 8px;
  animation: riseIn 0.2s ease both;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.screen-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--muted-2);
  text-align: center;
}

.screen-placeholder .title {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
}

/* ---- bottom nav ---- */

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  background: rgba(243, 245, 247, 0.9);
  backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid rgba(22, 29, 36, 0.08);
}

.nav-item {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted-2);
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-item.is-active {
  color: var(--ink);
}

.nav-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c3ccd4;
}

.nav-item.is-active .dot {
  background: var(--ai);
}

.nav-capture {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--ai-border);
  background: var(--ai-bg);
  color: var(--ai);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-capture:active {
  transform: scale(0.93);
}

/* ---- buttons (shared component styles) ---- */

.btn {
  min-height: 56px;
  border: none;
  border-radius: 16px;
  background: var(--ai);
  color: var(--on-ai);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.97);
}

.btn.secondary {
  border: 1px solid #ccd5dd;
  background: #e7ebef;
  color: #2d3843;
  font-weight: 500;
}

.btn.text {
  min-height: 48px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn:disabled:active {
  transform: none;
}

.coming-soon {
  font-size: 10px;
  color: var(--muted-3);
  margin-left: 4px;
}

/* ---- now screen ---- */

/* 横は各ブロックが持つが、上下は .screen と揃える（0 にすると日付がステータスバーに食われる）。 */
.now-screen {
  padding: 24px 0 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- capacity bar (design/05, bias 1.0 固定。実測が貯まるまで表示だけ) ---- */

.capacity-bar {
  padding: 0 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capacity-bar-labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.capacity-bar-total {
  color: var(--ai);
  font-weight: 500;
}

.capacity-bar-track {
  position: relative;
  height: 16px;
}

.capacity-bar-track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--line);
}

.capacity-bar-segments {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 2px;
}

.capacity-bar-segment {
  height: 100%;
  box-sizing: border-box;
  border-radius: 8px;
}

/* net_capacity を超えた分のセグメント（設計05）。 */
.capacity-bar-segment.is-past {
  background: transparent;
  border: 1px dashed var(--ai-border);
}

.capacity-bar-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  border-radius: 1px;
  background: var(--ink);
}

.capacity-bar-chips {
  display: flex;
  gap: 4px;
}

.capacity-chip {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: none;
  border-radius: 10px;
  background: var(--chip);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
}

.capacity-chip:active {
  transform: scale(0.96);
}

.capacity-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.capacity-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.capacity-bar-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted-2);
  text-wrap: pretty;
}

.now-header {
  padding: 0 28px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
}

.now-header-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.now-date {
  font-size: 15px;
  color: var(--muted);
}

.now-next-event {
  font-size: 14px;
  color: var(--muted);
}

.now-settings-btn {
  min-height: 32px;
  min-width: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.now-settings-btn:active {
  transform: scale(0.93);
}

.now-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 28px;
  gap: 26px;
  min-height: 0;
}

.head-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip-minutes {
  font-size: 13px;
  color: var(--ai);
  border: 1px solid var(--ai-border);
  padding: 4px 10px;
  border-radius: 999px;
}

.head-project {
  font-size: 13px;
  color: var(--muted-2);
}

.head-next-action {
  font-size: 33px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: pretty;
}

.head-title {
  font-size: 14px;
  color: var(--muted-2);
}

/* z-index は付けない: 後続の body 直下のトーストが上に来てほしい（失敗トーストが隠れる）。 */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(243, 245, 247, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  animation: riseIn 0.2s ease both;
}

.flash-mark {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--ai);
  color: var(--on-ai);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
}

.flash-label {
  font-size: 20px;
  color: #2d3843;
}

/* ---- timer overlay (「10分だけやる」全画面。design/05) ---- */

.timer-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 96px 32px calc(48px + env(safe-area-inset-bottom));
  animation: riseIn 0.2s ease both;
}

.timer-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.timer-label {
  font-size: 13px;
  color: var(--muted-2);
}

.timer-task {
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.timer-clock {
  font-size: 86px;
  font-weight: 200;
  letter-spacing: -0.03em;
  color: var(--ai);
  font-variant-numeric: tabular-nums;
}

.timer-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.now-divider {
  height: 1px;
  background: var(--line);
}

.rest-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.rest-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #bcc7d1;
  flex: none;
}

.rest-next-action {
  font-size: 16px;
  color: var(--ink-2);
  text-wrap: pretty;
}

.rest-minutes {
  font-size: 12px;
  color: var(--muted-2);
  margin-left: auto;
  flex: none;
}

.now-actions {
  padding: 0 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.now-actions-row {
  display: flex;
  gap: 12px;
}

.now-actions-row .btn {
  flex: 1;
}

.now-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 40px;
  text-align: center;
}

.now-empty-title {
  font-size: 26px;
  font-weight: 400;
  color: #2d3843;
}

.now-empty-body {
  font-size: 15px;
  line-height: 1.9;
  color: var(--muted-2);
}

/* ---- inbox screen ---- */

.inbox-screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px 0 8px;
}

.inbox-header {
  padding: 0 24px 8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.inbox-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
}

.inbox-sub {
  font-size: 13px;
  color: var(--muted-2);
}

.inbox-list {
  flex: 1;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.inbox-card {
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(22, 29, 36, 0.05);
  padding: 10px 16px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px solid #e6ebef;
  animation: riseIn 0.22s ease both;
}

.inbox-card.unsure {
  border: 1px dashed var(--warn-border);
}

.inbox-text {
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: pretty;
}

.inbox-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted-2);
}

.inbox-kind {
  color: var(--ai);
}

.inbox-kind.unsure {
  color: var(--warn-ink);
}

.inbox-actions {
  display: flex;
  gap: 6px;
  padding: 4px 0 4px;
}

.inbox-btn {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--chip);
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.inbox-btn:active {
  transform: scale(0.96);
}

.inbox-btn:disabled {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  opacity: 0.45;
  cursor: default;
}

.inbox-btn:disabled:active {
  transform: none;
}

.inbox-btn:disabled .coming-soon {
  margin-left: 0;
}

.inbox-btn.is-suggested {
  background: #dce7f0;
  color: var(--ai);
}

.inbox-btn.ghost {
  background: transparent;
  color: var(--muted-2);
}

.inbox-btn.write {
  flex: 2.2;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.inbox-rest {
  text-align: center;
  font-size: 12px;
  color: var(--muted-3);
  padding: 3px 0 0;
}

.inbox-empty {
  text-align: center;
  font-size: 14px;
  color: var(--muted-2);
  padding: 40px 0;
}

/* ---- stuck screen (Inbox の見た目を流用) ---- */

/* 「手放す」の強調はプロトタイプどおり藍の淡地。--warn-* は「構造化不能カード」専用の
   合図なので流用しない（設計04 デザイントークン）。 */
.inbox-btn.release {
  flex: 1.15;
  border: 1px solid var(--ai-border);
  background: var(--ai-bg);
  color: var(--ai);
  font-weight: 500;
}

.stuck-lead {
  padding: 0 24px 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted-2);
}

/* ---- Review ---- */

.review-screen {
  padding: 24px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.review-count {
  padding: 0 28px;
  font-size: 33px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.review-bars {
  padding: 0 28px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 88px;
}

.review-bar {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.review-bar-fill {
  width: 100%;
  max-width: 28px;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: var(--bar-1);
}

.review-bar-label {
  font-size: 11px;
  color: var(--muted-2);
}

.review-done-list {
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-done-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--ink-2);
}

.review-done-check {
  flex: none;
  color: var(--ai);
}

.review-insight {
  margin: 0 28px;
  padding: 16px;
  border-radius: 16px;
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
}

.review-insight-title {
  font-size: 12px;
  color: var(--ai);
  margin-bottom: 6px;
}

/* ---- bottom sheet (confirm / write-more) ---- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(22, 29, 36, 0.34);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: flex-end;
  animation: riseIn 0.2s ease both;
}

.sheet-panel {
  width: 100%;
  background: rgba(252, 253, 254, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px 28px 44px 44px;
  padding: 14px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 -20px 60px -34px rgba(22, 29, 36, 0.6);
}

.sheet-handle {
  align-self: center;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: #c3ccd4;
  flex: none;
}

.sheet-title {
  font-size: 19px;
  color: var(--ink);
  line-height: 1.5;
}

.sheet-body {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn.accent {
  border: 1px solid var(--ai-border);
  background: var(--ai-bg);
  color: var(--ai);
  font-weight: 500;
}

.breakdown-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breakdown-step-num {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ai-bg);
  color: var(--ai);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breakdown-step-text {
  font-size: 15px;
  color: var(--ink);
  text-wrap: pretty;
}

.breakdown-step-minutes {
  font-size: 12px;
  color: var(--muted-2);
  margin-left: auto;
  flex: none;
}

.capture-tabs {
  display: flex;
  gap: 6px;
  background: var(--chip);
  border-radius: 12px;
  padding: 4px;
}

.capture-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.capture-tab.is-active {
  background: var(--card);
  color: var(--ink);
}

.capture-tab:disabled {
  opacity: 0.45;
  cursor: default;
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-input,
.sheet-textarea {
  width: 100%;
  border: 1px solid #ccd5dd;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
}

.sheet-textarea {
  min-height: 88px;
  resize: none;
}

.sheet-input:focus,
.sheet-textarea:focus {
  outline: none;
  border-color: var(--ai);
}

/* ---- card ---- */

.card {
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(22, 29, 36, 0.05);
  padding: 16px 18px;
}

/* ---- settings / token screen ---- */

.settings-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 24px 28px;
}

.settings-screen .lead {
  font-size: 18px;
  color: var(--ink);
}

.settings-screen .hint {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-2);
}

.settings-screen input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #ccd5dd;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
}

.settings-screen input:focus {
  outline: none;
  border-color: var(--ai);
}

.settings-push {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* ---- install banner ---- */

.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 16px;
  background: var(--ai-bg);
  border-bottom: 1px solid var(--ai-border);
  color: var(--ai);
  font-size: 12px;
  line-height: 1.5;
}

.install-banner-text {
  flex: 1;
}

/* × は片手・歩きながら押される。他のタップ対象と同じ 44px 以上を確保する。 */
.install-banner-close {
  flex: none;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--ai);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* ---- offline badge ---- */

.offline-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn-ink);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

/* ---- toast ---- */

.toast {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 96px;
  background: var(--toast);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 14px;
  color: #eef2f5;
  text-align: center;
  animation: riseIn 0.2s ease both;
  box-shadow: 0 20px 40px -24px rgba(22, 29, 36, 0.6);
}
