/* ── Welcome (leer, kein Buch) ──────────────────────────────── */

.journal-welcome {
  max-width: 420px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), var(--sp-5)) var(--sp-5) var(--sp-6);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.settings-icon-top-right {
  position: absolute;
  top: max(env(safe-area-inset-top), var(--sp-4));
  right: var(--sp-4);
}

.welcome-mascot {
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-5);
}

.welcome-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 0 0 var(--sp-3);
}

.welcome-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0 0 var(--sp-6);
}

.welcome-form { margin-top: auto; padding-bottom: env(safe-area-inset-bottom); }

/* ── Books list ─────────────────────────────────────────────── */

.books-screen {
  max-width: 640px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), var(--sp-4)) var(--sp-4) var(--sp-6);
  min-height: 100vh;
}

.books-header {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.export-form {
  display: flex;
  flex-direction: column;
}
.export-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: var(--sp-2) 0 var(--sp-4);
  line-height: 1.45;
}

.screen-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 var(--sp-5);
}

.books-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.book-card {
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-card);
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-card:active { transform: scale(0.98); }

.book-card--cream { background: var(--book-cream); }
.book-card--pink  { background: var(--book-pink); }
.book-card--blue  { background: var(--book-blue); }
.book-card--green { background: var(--book-green); color: #F0EBE3; }
.book-card--black { background: var(--book-black); color: #F0EBE3; }

.book-card--new {
  border: 2px dashed var(--text-muted);
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  gap: var(--sp-2);
}
.book-card__plus { font-size: 28px; line-height: 1; }
.book-card__name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.book-card__count {
  font-size: 13px;
  font-family: var(--font-mono);
  color: inherit;
  opacity: 0.7;
  margin-top: var(--sp-1);
}

/* ── Page-List Sheet (T4.2) ─────────────────────────────────── */

.page-list-sheet { max-height: 85vh; }
.page-list-sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-4);
}
.page-list-sheet__count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.page-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-4);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}
.page-list li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.page-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  text-decoration: none;
  color: var(--text);
}
.page-list__item:hover { background: rgba(0, 0, 0, 0.02); }
.page-list__item.is-current {
  background: rgba(197, 184, 222, 0.18);
  border-left: 3px solid var(--text);
  padding-left: var(--sp-3);
  margin-left: calc(-1 * var(--sp-3));
}
.page-list__date {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.page-list__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.page-list__title {
  font-size: 13px;
  color: var(--text-secondary);
}
.page-list__empty {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.page-list__count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.page-list-sheet__new,
.page-list-sheet__free {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-3);
}
.page-list-sheet__new input[type="date"],
.page-list-sheet__free input[type="text"] {
  flex: 1;
  font-size: 14px;
}
.page-list-sheet__new button,
.page-list-sheet__free button { white-space: nowrap; }
.page-list__section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: var(--sp-4) 0 var(--sp-2);
}
.page-list__date--free {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 18px;
  width: 12px;
  text-align: center;
}
.page-date--free {
  font-style: italic;
  color: var(--text-muted);
}
.page-list__hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: var(--sp-3) 0 0;
}
.page-list__empty-state {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  padding: var(--sp-4);
}

/* ── Bottom-Sheet ───────────────────────────────────────────── */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  z-index: 100;
  animation: fadeIn 0.2s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom));
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-sheet);
}

.sheet__grip {
  width: 36px; height: 4px;
  background: var(--text-muted);
  border-radius: var(--r-pill);
  margin: 0 auto var(--sp-4);
  opacity: 0.4;
}

.sheet__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 var(--sp-5);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
.sheet-backdrop--closing { animation: fadeOut 0.2s ease forwards; }
.sheet-backdrop--closing .sheet { animation: slideDown 0.2s ease forwards; }
@keyframes slideDown { to { transform: translateY(100%); } }

/* ── Color picker ───────────────────────────────────────────── */

.color-picker {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.color-swatch {
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  display: block;
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.color-swatch input { opacity: 0; position: absolute; inset: 0; cursor: pointer; }
.color-swatch:has(input:checked) { border-color: var(--text); }

.color-swatch--cream { background: var(--book-cream); }
.color-swatch--pink  { background: var(--book-pink); }
.color-swatch--blue  { background: var(--book-blue); }
.color-swatch--green { background: var(--book-green); }
.color-swatch--black { background: var(--book-black); }

/* ── Toggle row ─────────────────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  margin-bottom: var(--sp-3);
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px; height: 26px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--r-pill);
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  margin: 0;
}
.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle-row input[type="checkbox"]:checked {
  background: var(--accent-primary);
}
.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

/* ── Page-Screen ────────────────────────────────────────────── */

.page-screen {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: 96px; /* room for bottom-bar */
  min-height: 100vh;
}

.page-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  padding-top: calc(var(--sp-3) + env(safe-area-inset-top));
}

.streak-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.streak-num { font-family: var(--font-mono); }
.streak-flame { filter: grayscale(1); opacity: 0.45; transition: filter 0.2s ease, opacity 0.2s ease; }
.streak-flame.is-active { filter: none; opacity: 1; }

.page-content {
  padding: 0 var(--sp-4);
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: var(--sp-3) 0 var(--sp-1);
  outline: none;
}
.page-title--editable:focus { outline: none; }
.page-title--placeholder:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  font-weight: 700;
}

.page-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 var(--sp-5);
  letter-spacing: 0.3px;
}

.blocks {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.empty-page-hint {
  padding: var(--sp-5) var(--sp-4);
  border: 2px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--r-md);
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.empty-page-hint:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
}

/* ── Day View (T4.8) ────────────────────────────────────────── */

.day-screen {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: var(--sp-6);
  min-height: 100vh;
}
.day-content { padding: 0 var(--sp-4); }
.day-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 var(--sp-1);
}
.day-subtitle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 var(--sp-5);
}
.day-pages {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.day-pages__row {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.day-pages__item {
  flex: 1;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}
.day-pages__item:hover { transform: translateX(2px); }
.day-pages__bullet {
  font-size: 22px;
  line-height: 1;
}
.day-pages__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.day-pages__count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.3px;
  white-space: nowrap;
  padding-left: var(--sp-2);
}
.day-pages__delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  width: 32px; height: 32px;
  border-radius: 50%;
}
.day-pages__delete:hover {
  background: rgba(194, 74, 74, 0.08);
  color: var(--accent-danger);
}
.day-pages__empty {
  color: var(--text-muted);
  font-size: 14px;
  margin: var(--sp-3) 0;
  text-align: center;
}
.day-actions {
  margin-top: var(--sp-4);
}

/* ── Page-List Grouping (T4.8) ──────────────────────────────── */

.page-list-sheet__search {
  position: relative;
  margin-bottom: var(--sp-4);
}
.page-list-sheet__search input {
  width: 100%;
  font-size: 14px;
}
.page-list-sheet__clear {
  position: absolute;
  right: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
}
.page-list-sheet__clear:hover { background: rgba(0, 0, 0, 0.12); color: var(--text); }

.day-group {
  margin: var(--sp-4) 0 var(--sp-2);
  border-radius: var(--r-md);
}
.day-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3);
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--text);
  margin-bottom: var(--sp-1);
  transition: background 0.15s ease;
}
.day-group__header:hover {
  background: rgba(0, 0, 0, 0.06);
}
.day-group__date {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.day-group__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.page-list--nested {
  padding-left: var(--sp-4);
  border-left: 2px solid rgba(0, 0, 0, 0.04);
  margin-left: var(--sp-2);
}
.page-list__bullet {
  width: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Page-List Delete + Jump (T4.7) ─────────────────────────── */

.page-list__row {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.page-list__row .page-list__item { flex: 1; }
.page-list__delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.page-list__delete:hover {
  background: rgba(194, 74, 74, 0.08);
  color: var(--accent-danger);
  opacity: 1;
}
.page-list-sheet__jump {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.page-list-sheet__jump input[type="date"] { font-size: 14px; }
.btn-secondary {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  border: none;
  font-size: 14px;
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  font-weight: 500;
}
.btn-secondary:hover { background: rgba(0, 0, 0, 0.1); }

/* ── Bottom-Bar ─────────────────────────────────────────────── */

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-sheet);
  transition: padding 0.15s ease;
}
.bottom-bar[data-mode="action"] {
  justify-content: space-around;
}
.bb-action {
  flex-shrink: 0;
}
.bb-shake {
  animation: bb-shake 0.36s ease;
}
@keyframes bb-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.bb-position {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  background: transparent;
  border: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-pill);
  cursor: pointer;
}
.bb-position:hover { background: rgba(0, 0, 0, 0.04); color: var(--text); }

.bb-icon {
  width: 44px; height: 44px;
  border: none; background: transparent;
  border-radius: var(--r-pill);
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bb-icon:hover { background: rgba(0, 0, 0, 0.04); }

.bb-emi-dot {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Generic block container ────────────────────────────────── */

.block { padding: var(--sp-2) 0; }
.block__editor {
  outline: none;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  min-height: 1.55em;
}
.block__editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
}

.block--heading-1 .block__editor { font-size: 28px; font-weight: 700; line-height: 1.2; }
.block--heading-2 .block__editor { font-size: 22px; font-weight: 700; line-height: 1.25; }
.block--heading-3 .block__editor { font-size: 18px; font-weight: 600; line-height: 1.3; }

/* ── Note (T2.3) ────────────────────────────────────────────── */

.block--note {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(248, 233, 169, 0.25);
  border-radius: var(--r-md);
  border-left: 3px solid #E8C45A;
  align-items: flex-start;
}
.note-icon {
  font-size: 18px;
  line-height: 1.5;
  user-select: none;
}
.note__editor {
  font-size: 15px;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
}

/* ── Quote (T2.6) ───────────────────────────────────────────── */

.block--quote {
  border-left: 3px solid var(--text);
  padding-left: var(--sp-4);
  margin: var(--sp-3) 0;
}
.block--quote .quote__editor {
  font-style: italic;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}
.quote__author {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--sp-2);
}

/* ── Divider (T2.6) ─────────────────────────────────────────── */

.block--divider {
  padding: 0;
}
.block--divider hr {
  border: none;
  border-top: 1px solid var(--text-muted);
  opacity: 0.3;
  margin: var(--sp-5) 0;
}

/* ── Mood (T2.1) ─────────────────────────────────────────────── */

.block--mood {
  padding: var(--sp-3) 0;
}

.mood-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.15s ease;
}
.mood-inline:hover { background: rgba(0, 0, 0, 0.06); }
.mood-inline__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mood-inline__text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.mood-inline__note {
  font-size: 13px;
  color: var(--text);
}

.mood-picker {
  padding: var(--sp-4);
  background: var(--bg-card);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.mood-picker__question {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
  text-align: center;
}
.mood-picker__options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.mood-option {
  flex: 1;
  background: transparent;
  border: none;
  padding: var(--sp-3) var(--sp-1);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  transition: background 0.15s ease;
}
.mood-option:hover { background: rgba(0, 0, 0, 0.04); }
.mood-option.is-active { background: rgba(0, 0, 0, 0.08); }
.mood-option__label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.mood-picker__note {
  margin-top: var(--sp-2);
}

/* ── Todo (T2.2) ─────────────────────────────────────────────── */

.block--todo {
  padding: var(--sp-2) 0;
}
.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.todo-item {
  display: grid;
  grid-template-columns: 28px 1fr auto 24px;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) 0;
}
.todo-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.todo-check:hover { border-color: var(--text); }
.todo-item.is-done .todo-check {
  background: var(--text);
  border-color: var(--text);
}
.todo-item.is-done .todo-check::after {
  content: '✓';
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
}
.todo-check--ghost {
  border-style: dashed;
  opacity: 0.4;
  cursor: default;
}

.todo-text {
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  outline: none;
  width: 100%;
  font-family: inherit;
  padding: 4px 0;
}
.todo-item.is-done .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-reminder {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background 0.15s ease;
}
.todo-reminder:hover { background: rgba(0, 0, 0, 0.04); }
.todo-reminder.is-empty { opacity: 0.4; }
.todo-item.is-done .todo-reminder {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-delete {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
}
.todo-delete:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent-danger);
}

.todo-item--new .todo-text {
  color: var(--text-muted);
}

/* ── Streak (T2.4) ───────────────────────────────────────────── */

.block--streak {
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-2) 0;
}
.streak-block-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 var(--sp-3);
  letter-spacing: -0.3px;
}
.streak-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.streak-row {
  display: grid;
  grid-template-columns: 1fr auto 32px;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.streak-row:last-child { border-bottom: none; }
.streak-name { font-size: 15px; }
.streak-days {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.streak-row.is-checked .streak-days { color: var(--text); }
.streak-check {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.check-box {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--text-muted);
  border-radius: var(--r-sm);
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check-box.is-checked {
  background: var(--text);
  border-color: var(--text);
}
.check-box.is-checked::after {
  content: '✓';
  color: #FFFFFF;
  font-size: 12px;
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
.streak-row--add input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--text-muted);
  outline: none;
  font-family: inherit;
  padding: 4px 0;
}
.streak-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: var(--sp-3) 0;
  text-align: center;
}

/* ── Image (T2.5) ────────────────────────────────────────────── */

.block--image {
  padding: var(--sp-2) 0;
}
.image-placeholder {
  height: 200px;
  background: repeating-linear-gradient(
    45deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.04) 10px,
    transparent 10px, transparent 20px
  );
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.image-placeholder:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}
.image-placeholder__icon { font-size: 32px; }
.image-placeholder__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
}
.image-figure {
  margin: 0;
}
.image-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
  display: block;
}
.image-caption {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--sp-2);
  outline: none;
  min-height: 1.3em;
}
.image-caption:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
}

/* ── Breath (T2.9) ───────────────────────────────────────────── */

.block--breath {
  text-align: center;
  padding: var(--sp-5) var(--sp-4);
  background: rgba(197, 184, 222, 0.12);
  border-radius: var(--r-md);
  margin: var(--sp-3) 0;
}
.breath-mascot {
  margin: 0 auto var(--sp-3);
  transition: transform 1s ease;
  transform-origin: center;
  display: inline-block;
}
.breath-mascot.is-breathing { transition-timing-function: cubic-bezier(0.4, 0, 0.4, 1); }
.breath-mascot.is-breathing[data-phase="inhale"]     { transform: scale(1.3); transition-duration: 4s; }
.breath-mascot.is-breathing[data-phase="hold"]       { transform: scale(1.3); transition-duration: 0.1s; }
.breath-mascot.is-breathing[data-phase="exhale"]     { transform: scale(1.0); transition-duration: 8s; }
.breath-mascot.is-breathing[data-phase="hold-after"] { transform: scale(1.0); transition-duration: 0.1s; }

.breath-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
}
.breath-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  letter-spacing: 0.5px;
}
.breath-start {
  min-width: 120px;
}

/* ── Block-Menu Sheet (T2.7) ─────────────────────────────────── */

.sheet--scroll {
  max-height: 85vh;
  overflow-y: auto;
}

.block-menu {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.block-menu__group {
  display: flex;
  flex-direction: column;
}
.block-menu__group-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}
.block-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: var(--sp-3) 0;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-family: inherit;
}
.block-menu button:hover { background: rgba(0, 0, 0, 0.025); }
.block-menu button:active { background: rgba(0, 0, 0, 0.05); }
.block-menu__group:last-child button:last-child { border-bottom: none; }

/* ── Emi-Chat Sheet (T3.2) ──────────────────────────────────── */

.sheet--full {
  height: 92vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  padding-top: var(--sp-2);
}

.emi-chat-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
}

.emi-chat-header {
  display: grid;
  grid-template-columns: 48px 1fr 32px;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.emi-chat-header__avatar {
  display: inline-flex;
  width: 40px; height: 40px;
}
.emi-chat-header__meta {
  display: flex;
  flex-direction: column;
}
.emi-chat-header__name {
  font-size: 16px;
  font-weight: 700;
}
.emi-chat-header__state {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.emi-chat-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 50%;
}
.emi-chat-close:hover { background: rgba(0, 0, 0, 0.04); }

.emi-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 80%;
}
.chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-msg__label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: var(--sp-1);
}
.chat-msg__bubble {
  display: inline-block;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-msg--emi .chat-msg__bubble {
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text);
  border-bottom-left-radius: var(--r-sm);
}
.chat-msg--user .chat-msg__bubble {
  background: var(--text);
  color: #FFFFFF;
  border-bottom-right-radius: var(--r-sm);
}

.emi-chat-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + env(safe-area-inset-bottom));
}
.emi-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}
.emi-disclaimer a { color: inherit; text-decoration: underline; }
.emi-disclaimer--bottom { margin-top: var(--sp-2); }

.emi-chat-input {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-3) 0 var(--sp-2);
  background: var(--bg);
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
}
.emi-chat-input input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.emi-send-btn {
  width: 36px; height: 36px;
  border: none; border-radius: 50%;
  background: var(--text);
  color: #FFFFFF;
  cursor: pointer;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.crisis-link {
  display: inline-block;
  align-self: center;
  background: var(--accent-danger);
  color: #FFFFFF;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-pill);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.emi-paused-content {
  text-align: center;
  padding: var(--sp-3) var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}
.emi-paused-content h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.emi-paused-content p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 var(--sp-3);
}

/* ── Emi-Reflection (T3.3) ──────────────────────────────────── */

.block--emi-reflection {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  align-items: flex-start;
  border-left: 3px solid #c5b8de;
  background: rgba(197, 184, 222, 0.06);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.block--emi-reflection[data-companion="kiara"] {
  border-left-color: #c47054;
  background: rgba(196, 112, 84, 0.05);
}
.emi-reflection__avatar {
  padding-top: 2px;
}
.emi-reflection__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.emi-reflection__label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}
.block--emi-reflection[data-companion="kiara"] .emi-reflection__label {
  color: #c47054;
}
.block--emi-reflection[data-companion="emi"] .emi-reflection__label {
  color: #A99CC2;
}
.emi-reflection__text {
  margin: 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.55;
}
.block--emi-reflection-loading .emi-reflection__loading {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-top: 4px;
}
.emi-reflection__loading-text {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}
.emi-loading-bar {
  height: 2px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--r-pill);
  overflow: hidden;
  width: 100%;
  max-width: 240px;
}
.emi-loading-bar span {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--text);
  animation: emi-loading-slide 1.5s ease-in-out infinite;
}
@keyframes emi-loading-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ── Block-Options Sheet (T2.8) ──────────────────────────────── */

.sheet--compact {
  padding: var(--sp-3) var(--sp-3) calc(var(--sp-3) + env(safe-area-inset-bottom));
}
.block-options {
  list-style: none;
  padding: 0;
  margin: 0;
}
.block-options button {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-sm);
  font-family: inherit;
}
.block-options button:hover  { background: rgba(0, 0, 0, 0.04); }
.block-options button:active { background: rgba(0, 0, 0, 0.08); }
.block-options button.danger { color: var(--accent-danger); }
.block-options__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  font-family: var(--font-mono);
  font-size: 16px;
}

/* ── Format-Bar (T1.8) ──────────────────────────────────────── */

.format-bar {
  position: absolute;
  z-index: 60;
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-2);
  background: var(--accent-primary);
  color: #FFFFFF;
  border-radius: var(--r-pill);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.format-bar button {
  background: transparent;
  border: none;
  color: inherit;
  width: 32px; height: 32px;
  font-family: var(--font-mono);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.format-bar button:hover { background: rgba(255, 255, 255, 0.15); }

/* ── R2.5 Connectivity / Outbox / Toast ──────────────────────────── */

.conn-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 13px;
  padding: 8px 14px 8px 12px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  animation: connBannerIn 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  max-width: calc(100vw - 32px);
}
.conn-banner__dot {
  width: 8px; height: 8px;
  background: #F2A65A;
  border-radius: 50%;
  animation: connDotPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.conn-banner--leaving { animation: connBannerOut 0.25s ease forwards; }
@keyframes connBannerIn  { from { transform: translate(-50%, -120%); opacity: 0; } }
@keyframes connBannerOut {   to { transform: translate(-50%, -120%); opacity: 0; } }
@keyframes connDotPulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.outbox-indicator {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  z-index: 180;
  letter-spacing: 0.3px;
}

.toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: 14px;
  z-index: 250;
  max-width: calc(100vw - 32px);
  text-align: center;
  animation: toastIn 0.22s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.toast--error { background: #C24A4A; }
.toast--leaving { animation: toastOut 0.28s ease forwards; }
@keyframes toastIn  { from { transform: translate(-50%, 120%); opacity: 0; } }
@keyframes toastOut {   to { transform: translate(-50%, 120%); opacity: 0; } }

/* ── R2.4 Voice-Block ─────────────────────────────────────────────── */

.block--voice {
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0;
}
.voice-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
}
.voice-play {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.voice-play:active { transform: scale(0.96); }
.voice-play__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.voice-play__icon[data-state="paused"]::before  { content: "▶"; }
.voice-play__icon[data-state="playing"]::before { content: "⏸"; }
.voice-waveform {
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.voice-wf-bar {
  flex: 1 1 0;
  min-width: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  opacity: 0.55;
}
.voice-wf-fallback {
  width: 100%;
  height: 2px;
  background: var(--text-muted);
  opacity: 0.4;
}
.voice-progress {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0;
  background: rgba(0, 0, 0, 0.07);
  pointer-events: none;
  transition: width 0.1s linear;
}
.voice-duration {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}
.voice-privacy-note {
  margin-top: var(--sp-2);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

/* Recording overlay */
.voice-rec-ui {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  z-index: 260;
  min-width: 240px;
  animation: toastIn 0.25s ease;
}
.voice-rec-pulse {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #E54B4B;
  box-shadow: 0 0 0 0 rgba(229, 75, 75, 0.6);
  animation: voiceRecPulse 1.2s ease-out infinite;
}
@keyframes voiceRecPulse {
  0%   { box-shadow: 0 0 0 0 rgba(229, 75, 75, 0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(229, 75, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 75, 75, 0); }
}
.voice-rec-time {
  font-family: var(--font-mono);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.voice-rec-actions {
  display: flex;
  gap: var(--sp-3);
}
.voice-rec-actions .btn-primary,
.voice-rec-actions .btn-secondary {
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 13px;
  border: none;
  cursor: pointer;
}
.voice-rec-actions .btn-primary {
  background: #fff;
  color: var(--text);
  font-weight: 600;
}
.voice-rec-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
