/* ── 日记页 ── */
.diary-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px 8px; border-bottom:1px solid var(--separator-soft); flex-shrink:0; }
.diary-date-label { font-size:15px; font-weight:700; color:var(--text); }
.diary-page {
  --diary-time-col: 64px;
  --diary-axis-col: 18px;
  --diary-axis-half: 9px;
  --diary-col-gap: 14px;
  /* Horizontal centerline of the rail (matches grid column 2 center). */
  --diary-axis-track-x: calc(var(--diary-time-col) + var(--diary-col-gap) + var(--diary-axis-half));
  --diary-axis-x: calc(14px + var(--diary-axis-track-x));
  --diary-left-hit-w: 118px;
  /* Today-only rail: past vs future (reference: line hue shifts at “now”) */
  --diary-rail-past: color-mix(in srgb, var(--accent) 36%, var(--separator));
  --diary-rail-future: color-mix(in srgb, var(--text3) 32%, var(--separator-soft));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  background-image: none;
}
.diary-header {
  position: relative;
  z-index: 2;
}
.diary-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
}
.diary-axis {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 100%;
  overflow-y: auto;
  padding: 16px 14px 0;
  -webkit-overflow-scrolling: touch;
}
.diary-axis-track {
  position: relative;
  min-height: 100%;
  padding-bottom: 86px;
}
.diary-axis-track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--diary-axis-track-x) - 1px);
  width: 1.5px;
  border-radius: 999px;
  background: var(--separator);
  pointer-events: none;
  z-index: 0;
}

/* “当前时刻”：轴线在 now 处分段变色 + 中枢大圆点（仅查看今天） */
.diary-axis.is-diary-today .diary-axis-track::before {
  background: linear-gradient(
    to bottom,
    var(--diary-rail-past) 0,
    var(--diary-rail-past) var(--diary-now-y, 45%),
    var(--diary-rail-future) var(--diary-now-y, 45%),
    var(--diary-rail-future) 100%
  );
}

.diary-axis-now {
  position: absolute;
  z-index: 2;
  left: var(--diary-axis-track-x);
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-light) 76%, transparent);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .diary-axis-now {
    box-shadow: 0 0 0 3px var(--accent-light);
  }
}

/* 今天：已过时间点用小节点，未到时间用弱色节点（当前时刻由 .diary-axis-now 强调） */
.diary-axis.is-diary-today .diary-axis-node.diary-node-past .diary-axis-dot {
  width: 10px;
  height: 10px;
  margin-top: 30px;
}

.diary-axis.is-diary-today .diary-axis-node.diary-node-future .diary-axis-dot {
  width: 10px;
  height: 10px;
  margin-top: 30px;
  border-color: color-mix(in srgb, var(--text3) 55%, var(--border));
  box-shadow: none;
  opacity: 0.92;
}
.diary-empty,
.diary-axis-node {
  display: grid;
  grid-template-columns: var(--diary-time-col) var(--diary-axis-col) minmax(0, 1fr);
  column-gap: var(--diary-col-gap);
  position: relative;
  z-index: 1;
}
.diary-empty {
  min-height: calc(100% - 4px);
  margin: 0;
  padding: 8px 0 0;
  color: var(--text3);
  font-size: 14px;
  line-height: 1.6;
  align-content: start;
}
.diary-empty-rail {
  grid-column: 2;
  position: relative;
  min-height: 62px;
}
.diary-empty-rail span {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 5px var(--accent-light);
}
.diary-empty-card {
  grid-column: 3;
  min-width: 0;
}
.diary-empty-add {
  min-height: 38px;
  padding: 0 12px;
  margin: 0 0 10px;
  width: auto;
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-light) 66%, var(--material-raised));
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  touch-action: manipulation;
}
.diary-empty > .diary-memory-card,
.diary-empty > .diary-memory-draft {
  grid-column: auto;
}
.diary-axis-node {
  min-height: 76px;
  align-items: start;
}
.diary-axis-time {
  display: block;
  width: 100%;
  grid-column: 1;
  grid-row: 1;
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 28px;
  text-align: right;
  color: var(--text3);
  z-index: 2;
}
.diary-axis-time strong {
  display: block;
  color: inherit;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.1;
  letter-spacing: -.01em;
}
.diary-axis-dot {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin: 30px auto 0;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-light) 62%, transparent);
}
.diary-axis-node [data-drag-axis-time] {
  cursor: ns-resize;
  touch-action: none;
}
.diary-axis-node.dragging .diary-axis-dot {
  transform: scale(1.25);
}
.diary-axis-content {
  position: relative;
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  margin: 13px 0 16px;
  padding: 12px 34px 12px 18px;
  border: 1px solid var(--separator-soft);
  border-radius: 6px var(--radius) var(--radius) 6px;
  background: var(--material-raised);
  box-shadow: var(--shadow-card);
  cursor: text;
}
.diary-axis-content::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 6px 999px 999px 6px;
  background: var(--accent);
  pointer-events: none;
}
.diary-axis-title {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -.01em;
}
.diary-axis-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.diary-axis-title-row + .diary-axis-title-row {
  margin-top: 5px;
}
.diary-axis-title-row span {
  flex: 1;
  min-width: 0;
}
.diary-axis-delete {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin-top: -2px;
  border-radius: 50%;
  color: var(--text3);
  background: transparent;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr), color var(--tr);
}
.diary-axis-title-row:hover .diary-axis-delete,
.diary-axis-title-row:focus-within .diary-axis-delete,
.diary-axis-title-row:active .diary-axis-delete,
.diary-axis-title-row.diary-action-visible .diary-axis-delete {
  opacity: .65;
  pointer-events: auto;
}
.diary-memory-card,
.diary-memory-draft {
  position: relative;
  padding: 10px 30px 2px 0;
  border: 0;
  border-top: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.diary-memory-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.diary-memory-card + .diary-memory-card,
.diary-memory-draft + .diary-memory-card,
.diary-memory-card + .diary-memory-draft {
  margin-top: 14px;
}
.diary-memory-text,
.diary-memory-draft-text {
  width: 100%;
  min-height: 28px;
  height: auto;
  overflow: hidden;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 0;
}
.diary-memory-text {
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.diary-memory-draft-text {
  min-height: 34px;
  color: var(--text2);
}
.diary-memory-text::placeholder,
.diary-memory-draft-text::placeholder {
  color: var(--text3);
}
.diary-memory-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.diary-memory-images:has(.diary-media-item:only-child) {
  grid-template-columns: 1fr;
}
.diary-memory-images:has(.diary-media-item:only-child) .diary-media-item {
  aspect-ratio: 1.45;
}
.diary-memory-images:has(.diary-media-item:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.diary-draft-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}
.diary-memory-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}
.diary-image-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-light) 62%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.diary-memory-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  border-radius: 50%;
  color: var(--text3);
  background: transparent;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr), color var(--tr);
}
.diary-memory-card:hover .diary-memory-delete,
.diary-memory-card:focus-within .diary-memory-delete,
.diary-memory-card:active .diary-memory-delete,
.diary-memory-card.diary-action-visible .diary-memory-delete {
  opacity: .65;
  pointer-events: auto;
}
.diary-footer {
  display: none;
  padding: 0;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + 4px);
  z-index: 22;
  pointer-events: none;
}
.diary-footer .btn-primary { display: none; }
.diary-footer .btn-outline { flex: 1; }
.diary-file-input {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.diary-axis-composer {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 42px;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-radius: 22px;
  background: var(--material-base);
  border: 1px solid var(--separator);
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
  pointer-events: auto;
}
.diary-axis-composer input {
  min-width: 0;
  height: 38px;
  border: none;
  outline: none;
  border-radius: 14px;
  background: var(--material-field);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 0 9px;
}
.diary-axis-composer input[type="text"] {
  font-size: 14px;
}
.diary-axis-composer button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.time-point-panel {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: flex-end;
  padding: 0 14px calc(var(--nav-h) + var(--safe-bottom) + 14px);
  background: rgba(0,0,0,.18);
}
.time-point-box {
  width: 100%;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 58px;
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
  background: var(--material-base);
  border: 1px solid var(--separator);
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
}
.time-point-box input {
  min-width: 0;
  height: 40px;
  border: none;
  outline: none;
  border-radius: 14px;
  background: var(--material-field);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 10px;
}
.time-point-box button {
  height: 40px;
  min-height: 40px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 760;
}
.diary-media-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.diary-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.diary-media-item button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,.52);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}
.diary-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 18px) 16px calc(var(--safe-bottom) + 18px);
  background: rgba(0,0,0,.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.diary-image-viewer.show {
  opacity: 1;
  pointer-events: auto;
}
.diary-image-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.34);
}
.diary-image-viewer-close {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  right: 14px;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

/* ── Mobile viewport: large viewport height stays stable when OS keyboard opens (unlike dvh). ── */
@supports (height: 100lvh) {
  :root { --app-height: 100lvh; }
}

@media (max-width: 430px) {
  .diary-page {
    --diary-axis-col: 28px;
    --diary-axis-half: 14px;
    --diary-left-hit-w: 104px;
    --diary-axis-track-x: calc(60px + 12px + 14px);
    --diary-axis-x: calc(12px + var(--diary-axis-track-x));
  }

  .diary-axis {
    padding-left: 12px;
    padding-right: 12px;
  }

  .diary-empty,
  .diary-axis-node {
    grid-template-columns: 60px var(--diary-axis-col) minmax(0, 1fr);
    column-gap: 12px;
  }

  .diary-axis-title {
    min-width: 0;
  }

  .diary-axis-content {
    border-radius: 4px 16px 16px 4px;
  }

  .diary-memory-card,
  .diary-memory-draft {
    border-radius: 0;
  }

  .icon-btn,
  .todo-date-arrow,
  .cal-arrow,
  .nav-item,
  .type-btn,
  .cal-view-tab,
  .btn-primary,
  .btn-outline,
  .setting-action,
  .link-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .cal-view-tab {
    min-width: 0;
  }

  .header-right .icon-btn {
    min-width: 34px;
    min-height: 34px;
  }

  .modal-sheet {
    max-height: min(92dvh, 760px);
  }

  .settings-drawer {
    width: min(94vw, 430px);
    height: var(--app-height);
    max-height: none;
    border-radius: 24px 0 0 24px;
  }

  .settings-drawer-header {
    min-height: 108px;
    padding: calc(var(--safe-top) + 16px) 16px 14px;
  }

  .settings-drawer-body {
    height: calc(var(--app-height) - 108px);
    box-sizing: border-box;
    padding: 14px 12px calc(var(--safe-bottom) + 64px);
    scroll-padding-bottom: calc(var(--safe-bottom) + 64px);
  }

  .settings-row {
    padding: 13px 14px;
  }

  .settings-select {
    min-width: 126px;
  }

  .ai-sheet {
    max-height: min(88dvh, 720px);
  }

  .search-sheet {
    max-height: var(--app-height);
    padding-top: var(--safe-top);
  }

  .tl-block.draggable,
  .week-day-col .tl-block.draggable {
    touch-action: none;
  }

  .tl-resize-handle {
    min-height: 24px;
  }

  .task-wheel-overlay {
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
  }

  .wheel-confirm-bar {
    bottom: calc(var(--safe-bottom) + 16px);
  }
}

@media (max-width: 360px) {
  .todo-tabs { padding: 0 12px; }
  .tab-panel { padding: 12px; }
  .month-grid { gap: 2px; }
  .month-cell { min-height: 54px; }
  .ai-result-actions { gap: 6px; }
}

/* ── Mobile polish for long-press wheels ── */
#app,
.modal-overlay,
.task-wheel-overlay,
.task-item,
.tl-block,
button {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

/* 细则见 components.css：未 .show 时必须 pointer-events:none，避免透明层挡住底部弹窗 */

.wheel-backdrop {
  background:
    radial-gradient(circle at 50% 42%, rgba(124,111,224,.22), transparent 34%),
    rgba(10, 12, 20, .42);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.wheel-task-card {
  left: max(92px, env(safe-area-inset-left, 0px) + 92px);
  right: max(78px, env(safe-area-inset-right, 0px) + 78px);
  min-height: 62px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.28);
  border-left: 0;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(238,245,255,.86));
  box-shadow:
    0 18px 44px rgba(0,0,0,.22),
    inset 0 1px 0 rgba(255,255,255,.75);
}

body:not(.light) .wheel-task-card {
  background:
    linear-gradient(180deg, rgba(44,44,62,.92), rgba(30,30,43,.86));
  border-color: rgba(255,255,255,.12);
}

.wheel-task-name {
  color: #182033;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

body:not(.light) .wheel-task-name {
  color: var(--text);
}

.side-wheel {
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.18));
}

.wheel-side-left {
  left: -116px;
  width: 116px;
  height: 204px;
  border: 1px solid rgba(255,255,255,.18);
  border-left: 0;
  border-radius: 0 32px 32px 0;
  background: rgba(124,111,224,.18);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.18);
}

.wheel-side-right {
  right: -64px;
  width: 64px;
  height: 136px;
  border: 1px solid rgba(255,255,255,.18);
  border-right: 0;
  border-radius: 28px 0 0 28px;
  background: rgba(124,111,224,.18);
  box-shadow: inset 1px 0 0 rgba(255,255,255,.18);
}

.side-track {
  padding: 80px 0;
}

.side-item {
  height: 42px;
  color: rgba(210,214,255,.38);
  font-size: 11px;
  font-weight: 650;
}

.side-item.active {
  color: #f4f5ff;
  font-size: 13px;
  font-weight: 850;
  text-shadow: 0 1px 8px rgba(124,111,224,.5);
}

.side-pointer {
  width: 2px;
  margin: 22% 0;
  background: rgba(255,255,255,.46);
  box-shadow: 0 0 12px rgba(124,111,224,.46);
}

.side-right-done,
.side-right-del {
  padding-right: 0;
}

.side-right-done svg,
.side-right-del svg {
  width: 22px;
  height: 22px;
}

.side-right-done svg {
  stroke: #bfb8ff;
}

.side-right-del svg {
  stroke: #ff7676;
}

.side-right-divider {
  margin: 0 12px;
  background: rgba(255,255,255,.16);
}

.wheel-confirm-bar {
  bottom: calc(18px + var(--safe-bottom));
  gap: 10px;
  padding: 7px 7px 7px 16px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(244,248,255,.9);
  box-shadow:
    0 18px 44px rgba(0,0,0,.24),
    inset 0 1px 0 rgba(255,255,255,.75);
}

body:not(.light) .wheel-confirm-bar {
  background: rgba(28,28,40,.9);
  border-color: rgba(255,255,255,.12);
}

.wheel-confirm-bar span {
  color: #20243a;
  font-size: 13px;
  font-weight: 800;
}

body:not(.light) .wheel-confirm-bar span {
  color: var(--text);
}

.wheel-confirm-btn {
  min-height: 38px;
  padding: 8px 17px;
  box-shadow: 0 8px 18px var(--accent-glow);
}

.task-action-sheet {
  position: absolute;
  left: max(14px, env(safe-area-inset-left, 0px) + 14px);
  right: max(14px, env(safe-area-inset-right, 0px) + 14px);
  bottom: calc(12px + var(--safe-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 28px;
  background: rgba(28, 28, 40, .86);
  box-shadow:
    0 22px 56px rgba(0,0,0,.34),
    inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
  transform: translateY(calc(100% + 24px));
  transition: transform var(--duration-slide) var(--ease-slide);
}
.task-wheel-overlay.show .task-action-sheet {
  transform: translateY(0);
}
body.light .task-action-sheet {
  background: rgba(248,250,255,.9);
  border-color: rgba(255,255,255,.72);
  box-shadow:
    0 22px 54px rgba(42,50,80,.2),
    inset 0 1px 0 rgba(255,255,255,.82);
}
.task-action-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.task-action-title {
  font-size: 16px;
  font-weight: 850;
  color: var(--text);
}
.task-action-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text3);
}
.task-action-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: var(--text2);
  font-size: 22px;
  line-height: 1;
}
body.light .task-action-close {
  background: rgba(20,30,60,.06);
}
.wheel-action-btn {
  min-height: 42px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.1);
}
body.light .wheel-action-btn {
  background: rgba(20,30,60,.055);
  border-color: rgba(20,30,60,.06);
}
.wheel-action-btn:active,
.task-action-close:active {
  opacity: .78;
  transform: scale(.98);
}
.wheel-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.wheel-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  min-height: 74px;
  padding: 10px 6px;
  text-align: center;
  line-height: 1.15;
}
.wheel-action-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wheel-action-done {
  color: color-mix(in srgb, var(--accent) 76%, white);
}
.wheel-action-delete {
  color: #ff7676;
}
.wheel-action-edit {
  color: var(--text);
}

body.light {
  background: #f4f4f8;
}

body.light .app-header,
body.light .todo-date-nav,
body.light .todo-tabs,
body.light .tl-day-header {
  background: var(--bg);
}

body.light .bottom-nav {
  filter: drop-shadow(0 -8px 24px rgba(20, 25, 55, 0.07));
}

body.light .bottom-nav::before {
  background: linear-gradient(180deg, #ffffff, #fdfdff);
}

body.light .diary-page {
  --diary-rail-past: color-mix(in srgb, var(--accent) 34%, var(--separator));
  --diary-rail-future: color-mix(in srgb, var(--text3) 36%, var(--separator-soft));
}

body.light .task-item {
  box-shadow: var(--shadow-card);
}

/* ── Mobile layout tightening (narrow viewport only; wide screens use layout.css shell) ── */
@media (max-width: 430px) {
  .app-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(var(--safe-top) + 8px) 18px 0;
    background: transparent;
    border-bottom: none;
    pointer-events: none;
  }

  .header-inner {
    justify-content: flex-end;
    height: 44px;
    padding-bottom: 0;
  }

  .header-right {
    pointer-events: auto;
    gap: 8px;
  }

  .header-right .icon-btn {
    width: 34px;
    height: 34px;
    background: transparent;
    color: var(--text2);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.light .header-right .icon-btn {
    background: transparent;
  }

  body.light .app-header {
    background: transparent;
  }

  .page {
    top: calc(var(--safe-top) + 52px);
  }

  .todo-date-label,
  .cal-title,
  .diary-date-label {
    font-size: 16px;
    font-weight: 760;
    letter-spacing: -.015em;
    line-height: 1.25;
  }

  .todo-date-nav,
  .cal-header,
  .diary-header {
    min-height: 48px;
  }

  .todo-date-arrow,
  .cal-arrow {
    width: 44px;
    height: 44px;
  }

  .scroll-area,
  .tl-scroll {
    padding-bottom: 18px;
  }

  .cal-bottom-bar {
    padding: 10px 16px 14px;
  }

  .diary-footer {
    padding: 12px 16px 14px;
  }

  .week-scroll,
  .tl-scroll,
  .month-grid,
  .diary-body,
  .scroll-area {
    min-height: 0;
  }
}

@media (max-height: 720px) and (max-width: 430px) {
  .page {
    top: calc(var(--safe-top) + 44px);
  }

  .todo-date-nav,
  .cal-header,
  .diary-header {
    min-height: 42px;
    padding-top: 2px;
    padding-bottom: 4px;
  }

  .cal-subheader {
    padding-bottom: 4px;
  }
}

/* ── Unified top date headers across Todo / Calendar / Diary ── */
:root {
  --page-x: clamp(12px, 4vw, 20px);
  --page-header-h: clamp(44px, 12vw, 52px);
  --page-header-action: clamp(42px, 11vw, 48px);
  --page-title-size: clamp(15px, 4.1vw, 17px);
}

.todo-date-nav,
.cal-header,
.diary-header {
  height: var(--page-header-h);
  min-height: var(--page-header-h);
  padding: 0 var(--page-x);
  border-bottom: 0;
  background: transparent;
  flex-shrink: 0;
  align-items: center;
}

.todo-date-nav,
.cal-nav,
.diary-header {
  display: grid;
  grid-template-columns: var(--page-header-action) minmax(0, 1fr) var(--page-header-action);
  column-gap: 0;
  width: 100%;
}

.cal-header {
  display: flex;
}

.cal-nav {
  flex: 1;
  align-items: center;
}

.todo-date-arrow,
.cal-arrow {
  width: var(--page-header-action);
  height: var(--page-header-action);
  min-width: var(--page-header-action);
  min-height: var(--page-header-action);
  margin: 0;
  justify-self: center;
  align-self: center;
}

.todo-date-arrow svg,
.cal-arrow svg {
  width: 17px;
  height: 17px;
}

.todo-date-label-btn,
.cal-title,
.diary-date-label {
  min-width: 0;
  width: 100%;
  height: var(--page-header-action);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  justify-self: stretch;
  align-self: center;
  font-family: inherit;
  font-size: var(--page-title-size);
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: -.015em;
  white-space: nowrap;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.todo-date-label-btn {
  position: relative;
  flex-direction: row;
}

.todo-date-label,
.cal-title,
.diary-date-label {
  font-size: var(--page-title-size);
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: -.015em;
}

.date-title-part,
.date-title-sep {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: 1em;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}

.date-title-sep {
  margin: 0 .38em;
  color: var(--text3);
  font-weight: 520;
}

.todo-date-label {
  flex: 0 0 auto;
  width: auto;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}

.today-dot {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  margin-top: 0;
}
