:root {
  --ink: #252525;
  --muted: #6f6b64;
  --line: #e1ddd4;
  --paper: #f3f2ef;
  --white: #ffffff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --forest: #0b493b;
  --moss: #5f9f45;
  --leaf: #98c955;
  --terracotta: #cc6b25;
  --marigold: #f5bb35;
  --blue: #4d7c59;
  --green: #5f9f45;
  --coral: #cc6b25;
  --gold: #d99a2a;
  --plum: #4d7c59;
  --cyan: #98c955;
  --surface-1: #f2f1ee;
  --surface-2: #ebe8df;
  --shadow: 0 18px 44px rgba(35, 35, 31, 0.09);
  --surface: #ffffff;
  --text: #252525;
}

[data-theme="dark"] {
  --ink: #f6f1e5;
  --muted: #c2bba9;
  --line: #285144;
  --paper: #092f28;
  --white: #103d33;
  --panel: rgba(16, 61, 51, 0.92);
  --panel-solid: #123f35;
  --surface-1: #072720;
  --surface-2: #0b493b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --surface: #123f35;
  --text: #f6f1e5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, var(--surface-1) 0%, var(--surface-2) 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

button, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.top-visual {
  height: clamp(118px, 18vw, 190px);
  overflow: hidden;
  background: var(--forest);
  border-bottom: 4px solid color-mix(in srgb, var(--leaf) 56%, var(--paper));
}

.top-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: pixelated;
}

.sidebar {
  padding: 18px 20px 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.lang-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.lang-btn {
  padding: 4px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 150ms;
}

.lang-btn.active {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest);
}

.language-toggle,
.theme-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.lang-btn,
.theme-btn {
  width: 34px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-solid);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.theme-btn {
  font-size: 15px;
}

.lang-btn.active,
.theme-btn.active {
  color: #ffffff;
  background: var(--forest);
  border-color: transparent;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.15;
}

h2 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.25;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: var(--panel-solid);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(35, 35, 31, 0.07);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #ffffff;
  background: var(--forest);
  font-weight: 800;
}

/* V2: icon-only nav tabs */
.nav-tab {
  justify-content: center;
}
.nav-tab .nav-text {
  display: none;
}

.sidebar-panel {
  display: none;
}

.main {
  padding: 38px;
}

/* V2: minimal hero */
.hero {
  padding: 16px 0 20px;
  display: flex;
  align-items: center;
  min-height: unset;
  margin-bottom: 0;
}
.hero > div:not(.date-chip) { display: none; }

.date-chip {
  min-width: 132px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  margin-bottom: 18px;
}

.pillar-grid,
.router-options {
  display: grid;
  gap: 10px;
}

.pillar-card,
.router-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  text-align: left;
}

.pillar-card.active,
.router-card.active {
  border-color: var(--forest);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(35, 35, 31, 0.10);
}

.focus-last {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--leaf) 8%, var(--surface));
  border-radius: 6px;
  border-left: 2px solid color-mix(in srgb, var(--leaf) 40%, transparent);
}
.focus-last em {
  color: var(--text);
  font-style: italic;
}

.today-focus {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--leaf) 18%, var(--panel-solid));
  border: 1px solid var(--line);
}

.today-focus p {
  margin-bottom: 6px;
  color: var(--muted);
}

.today-focus strong {
  display: block;
  line-height: 1.5;
}

.color-dot {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.card-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 850;
}

.card-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 750;
}

textarea,
.text-input {
  width: 100%;
  padding: 14px;
  color: var(--ink);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.65;
}

textarea {
  resize: vertical;
  min-height: 176px;
}

.text-input {
  min-height: 48px;
  margin-bottom: 14px;
}

textarea:focus,
.text-input:focus {
  outline: 3px solid color-mix(in srgb, var(--leaf) 32%, transparent);
  border-color: var(--forest);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.google-signin-btn {
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font: inherit;
  font-weight: 900;
  font-size: 20px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.google-signin-btn:hover {
  border-color: var(--forest);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.google-signin-btn[hidden],
.connected-account[hidden] {
  display: none;
}

.google-wordmark {
  min-width: 58px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 5%, var(--panel-solid));
  font-weight: 850;
  font-size: 12px;
}

.primary,
.secondary,
.danger,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-weight: 800;
}

.primary {
  color: #ffffff;
  background: var(--forest);
  border-color: var(--forest);
}

.primary:disabled {
  opacity: 0.72;
  cursor: progress;
}

.secondary {
  color: var(--ink);
  background: var(--panel-solid);
}

.danger {
  color: #ffffff;
  background: #9f3e3a;
  border-color: #9f3e3a;
}

.import-button {
  color: var(--ink);
  background: var(--panel-solid);
  cursor: pointer;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.helper {
  margin: 12px 0 0;
  color: var(--muted);
}

.progress-panel,
.flow-panel {
  margin-top: 18px;
}

.progress-panel.pulse {
  animation: savedPulse 520ms ease;
}

.helper.status-saved {
  color: var(--leaf);
  font-weight: 600;
}

@keyframes savedPulse {
  0% {
    box-shadow: var(--shadow);
  }
  45% {
    border-color: color-mix(in srgb, var(--leaf) 70%, var(--line));
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--leaf) 18%, transparent), var(--shadow);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

.week-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--leaf) 10%, var(--panel-solid));
}

#sync {
  max-width: 1040px;
}

.sync-status-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(22px, 4vw, 46px);
  align-items: center;
  min-height: 252px;
  padding: clamp(24px, 4vw, 42px);
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--leaf) 18%, var(--line));
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--leaf) 10%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--leaf) 5%, transparent), transparent 54%),
    var(--panel);
}

.sync-status-panel::after {
  content: "";
  position: absolute;
  right: clamp(20px, 4vw, 46px);
  bottom: clamp(18px, 4vw, 40px);
  width: clamp(72px, 10vw, 118px);
  height: clamp(72px, 10vw, 118px);
  border: 1px solid color-mix(in srgb, var(--leaf) 12%, transparent);
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}

.sync-status-panel .section-heading {
  margin-bottom: 22px;
}

.sync-state-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sync-state-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--muted) 10%, transparent);
  flex: 0 0 auto;
}

.sync-config-line {
  margin: 0;
  color: var(--ink);
  font-size: clamp(21px, 2.7vw, 28px);
  font-weight: 850;
  line-height: 1.25;
}

.sync-status-panel[data-sync-state="ok"] .sync-state-dot,
.sync-status-panel[data-sync-state="connecting"] .sync-state-dot {
  background: var(--leaf);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--leaf) 14%, transparent);
}

.sync-status-panel[data-sync-state="syncing"] .sync-state-dot {
  background: #c49a45;
  box-shadow: 0 0 0 5px color-mix(in srgb, #c49a45 16%, transparent);
}

.sync-status-panel[data-sync-state="error"] .sync-state-dot {
  background: #9f3e3a;
  box-shadow: 0 0 0 5px color-mix(in srgb, #9f3e3a 14%, transparent);
}

.sync-status-panel[data-sync-state="reconnect"] .sync-state-dot {
  background: #c15d42;
  box-shadow: 0 0 0 5px color-mix(in srgb, #c15d42 14%, transparent);
}

.sync-auth-line {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.sync-message {
  max-width: 620px;
  font-size: 17px;
  line-height: 1.55;
}

.sync-actions {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-solid) 86%, transparent);
  box-shadow: 0 16px 36px rgba(35, 35, 31, 0.06);
}

.connected-account {
  min-height: 52px;
  border: 1px solid color-mix(in srgb, var(--leaf) 36%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--leaf) 10%, var(--panel-solid));
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.sync-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sync-path span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sync-path span:not(:last-child)::after {
  content: "";
  width: 22px;
  height: 1px;
  background: color-mix(in srgb, var(--muted) 38%, transparent);
}

.connected-mark {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--leaf);
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 900;
}

.sync-actions .form-row {
  margin-top: 0;
  gap: 12px;
}

.sync-actions .primary {
  min-height: 52px;
  flex: 1 1 160px;
  font-size: 18px;
}

.sync-actions .secondary {
  min-height: 52px;
}

.sync-toolstrip {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 4px;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 8px;
  background: transparent;
}

.sync-toolstrip .secondary,
.sync-toolstrip .import-button,
.sync-toolstrip .danger {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.toolstrip-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.toolstrip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sync-toolstrip .helper {
  margin: 0 0 0 auto;
  line-height: 1.35;
}

.week-summary strong {
  display: block;
  margin-bottom: 2px;
  font-size: 24px;
  line-height: 1;
}

.week-summary span {
  color: var(--muted);
  line-height: 1.45;
}

.summary-dots {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.summary-dots span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--line);
}

.summary-dots span.filled {
  background: var(--dot);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 16%, transparent);
}

/* ── Garden ── */
.garden {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 0 4px;
}

.garden-plant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.plant-svg-wrap {
  position: relative;
  width: 80px;
  height: 100px;
  transition: transform 280ms ease;
}

.plant-svg-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.garden-plant.today .plant-svg-wrap::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid var(--plant-color);
  opacity: 0.55;
  pointer-events: none;
}

.plant-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.plant-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.plant-stage {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  letter-spacing: 0.2px;
}

.plant-progress {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.2px;
  opacity: 0.8;
  margin-top: 1px;
}

.plant-progress.bloom {
  color: var(--moss);
  opacity: 1;
}

.garden-empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  opacity: 0.7;
  padding: 16px 0 8px;
  letter-spacing: 0.2px;
}

@keyframes plantEntrance {
  from { opacity: 0; transform: translateY(14px) scale(0.88); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.garden.fresh-load .garden-plant {
  animation: plantEntrance 420ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.garden.fresh-load .garden-plant:nth-child(1) { animation-delay: 0ms; }
.garden.fresh-load .garden-plant:nth-child(2) { animation-delay: 80ms; }
.garden.fresh-load .garden-plant:nth-child(3) { animation-delay: 160ms; }
.garden.fresh-load .garden-plant:nth-child(4) { animation-delay: 240ms; }
.garden.fresh-load .garden-plant:nth-child(5) { animation-delay: 320ms; }

@keyframes plantGrow {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.14) translateY(-5px); }
  65%  { transform: scale(0.97) translateY(0); }
  100% { transform: scale(1); }
}

.garden-plant.just-grew .plant-svg-wrap {
  animation: plantGrow 650ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Week summary adjustments ── */
.ws-left { flex: 1; }

.ws-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.streak-badge {
  display: flex;
  align-items: baseline;
  gap: 3px;
  padding: 6px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, #f59e0b 10%, var(--panel-solid));
  border: 1px solid color-mix(in srgb, #f59e0b 28%, var(--line));
}

.streak-fire { font-size: 16px; line-height: 1; }

.streak-badge strong {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  color: #d97706;
}

.streak-badge small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Trace cards ── */
.trace-cards-section { margin-top: 18px; }

.trace-cards-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.trace-card {
  flex: 0 0 172px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease;
  scroll-snap-align: start;
  cursor: default;
}

.trace-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(35,35,31,0.13);
}

.trace-card.new {
  animation: cardDrop 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trace-card.special {
  border-color: #d99a2a;
  box-shadow: 0 0 0 2px color-mix(in srgb, #d99a2a 18%, transparent);
}

@keyframes cardDrop {
  from { opacity: 0; transform: translateY(-18px) scale(0.88); }
  to   { opacity: 1; transform: none; }
}

.tc-bar { height: 6px; }

.tc-body { padding: 12px 12px 10px; }

.tc-pillar {
  display: block;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 7px;
}

.tc-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 9px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tc-date {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.tc-special {
  margin: 0 12px 10px;
  font-size: 11px;
  color: #d99a2a;
  font-weight: 800;
}

.route-line {
  color: var(--muted);
  line-height: 1.65;
}

.route-box {
  padding: 14px;
  margin-top: 12px;
  border-left: 4px solid var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, var(--panel-solid));
  border-radius: 0 8px 8px 0;
}

.route-box p:last-child {
  margin-bottom: 0;
  line-height: 1.55;
}

.box-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.flow-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.flow-lane {
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
}

.flow-lane span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
}

.flow-lane strong {
  line-height: 1.55;
}

.review-prompts,
.entries {
  display: grid;
  gap: 12px;
}

.review-textarea {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 200ms;
}
.review-textarea:focus {
  outline: none;
  border-color: var(--leaf);
}
.review-last {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 6px 0 0;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--muted) 8%, var(--surface));
  border-radius: 6px;
  line-height: 1.5;
}
.review-last em { color: var(--text); font-style: italic; }

.prompt-card,
.entry-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
}

.entry-card p {
  margin-bottom: 8px;
  line-height: 1.6;
}

.entry-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.month-summary {
  display: grid;
  gap: 14px;
}

.month-memory-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--marigold) 12%, var(--panel-solid));
}

.month-memory-lead strong {
  font-size: 20px;
}

.month-memory-lead span {
  color: var(--muted);
  line-height: 1.45;
}

.month-memory-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.month-memory-item {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
}

.month-memory-item .color-dot {
  width: 28px;
  height: 28px;
}

.month-memory-item strong {
  line-height: 1.3;
}

.month-memory-item span:last-child {
  color: var(--muted);
  font-size: 22px;
  font-weight: 900;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-row {
    justify-content: flex-start;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .sidebar-panel {
    margin-top: 18px;
  }

  .two-col,
  .flow-map,
  .month-memory-grid {
    grid-template-columns: 1fr;
  }

  .sync-status-panel {
    grid-template-columns: 1fr;
    max-width: 760px;
    margin-inline: auto;
  }

  .sync-status-panel::after {
    right: 24px;
    bottom: 24px;
  }

  .sync-actions {
    max-width: 520px;
  }

  .sync-toolstrip {
    align-items: flex-start;
    flex-direction: column;
  }

  .sync-toolstrip .helper {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: 74px;
  }

  .top-visual {
    height: 76px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    min-height: 58px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
    box-shadow: 0 18px 44px rgba(35, 35, 31, 0.16);
    backdrop-filter: blur(18px);
  }

  .control-row,
  .sidebar-streak {
    display: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-tab {
    min-height: 42px;
    padding: 6px;
    border-radius: 12px;
  }

  .nav-tab.active {
    background: color-mix(in srgb, var(--forest) 8%, var(--panel-solid));
  }

  .nav-icon {
    width: 32px;
    height: 32px;
  }

  .main {
    padding: 22px 14px 10px;
  }

  .hero {
    display: grid;
  }

  .garden {
    gap: 3px;
  }

  .plant-svg-wrap {
    width: 50px;
    height: 62px;
  }

  .plant-name { font-size: 10px; }
  .plant-stage { font-size: 10px; }

  .week-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .month-memory-lead {
    align-items: flex-start;
    flex-direction: column;
  }

  #sync {
    max-width: none;
  }

  .sync-status-panel {
    min-height: auto;
    padding: 22px 18px;
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(35, 35, 31, 0.08);
  }

  .sync-status-panel::after {
    display: none;
  }

  .sync-status-panel .section-heading {
    margin-bottom: 18px;
  }

  .sync-state-row {
    align-items: flex-start;
  }

  .sync-state-dot {
    margin-top: 8px;
  }

  .sync-config-line {
    font-size: 22px;
  }

  .sync-message {
    font-size: 15px;
  }

  .sync-path {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    font-size: 11px;
  }

  .sync-path span:not(:last-child)::after {
    width: 14px;
  }

  .sync-actions {
    max-width: none;
    padding: 14px;
    border-radius: 12px;
  }

  .google-signin-btn,
  .connected-account,
  .sync-actions .primary,
  .sync-actions .secondary {
    min-height: 48px;
    font-size: 16px;
  }

  .sync-actions .form-row {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .sync-toolstrip {
    margin-top: 14px;
    padding: 10px 0;
    overflow-x: auto;
    flex-direction: row;
    align-items: center;
    scrollbar-width: none;
  }

  .sync-toolstrip::-webkit-scrollbar {
    display: none;
  }

  .toolstrip-label {
    position: sticky;
    left: 0;
    padding-right: 4px;
    background: var(--paper);
  }

  .toolstrip-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .sync-toolstrip .helper {
    display: none;
  }
}


/* ── Sidebar streak ─────────────────────────────────────────── */
.sidebar-streak {
  text-align: center;
  padding: 0 0 6px;
}
.ss-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 700;
}
.ss-streak-badge strong {
  color: var(--ink);
  font-size: 0.75rem;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.toggle-advanced-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 0 10px;
  text-align: left;
  transition: color 200ms;
}
.toggle-advanced-btn:hover { color: var(--text); }

#advancedSyncBox {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* ── Pillar bar (compact chip selector) ─────────────────────── */
.pillar-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pillar-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 200ms, background 200ms, color 200ms;
}

.pillar-chip:hover {
  border-color: var(--pcolor);
}

.pillar-chip.active {
  border-color: var(--pcolor);
  background: color-mix(in srgb, var(--pcolor) 12%, var(--surface));
  color: var(--pcolor);
  font-weight: 600;
}

.pc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pcolor);
  opacity: 0.3;
  flex-shrink: 0;
  transition: opacity 200ms;
}

.pc-dot.logged {
  opacity: 1;
}

/* ── Main input area ──────────────────────────────────────────── */
.main-input-area {
  margin-bottom: 24px;
}

.main-input-area #dailyNote {
  width: 100%;
  min-height: 150px;
  padding: 18px 20px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
  resize: none;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 200ms, box-shadow 200ms;
  display: block;
}

.main-input-area #dailyNote:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--leaf) 15%, transparent);
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding: 0 2px;
}

.input-actions .helper {
  flex: 1;
  margin: 0;
}

.save-btn {
  padding: 6px 18px;
  background: var(--leaf);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 200ms;
}

.save-btn:hover { opacity: 0.85; }

/* V2 sidebar narrower */
@media (min-width: 640px) {
  .sidebar {
    width: 88px;
    min-width: 88px;
  }

  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .control-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
}


/* ═══════════════════════════════════════════════════════════
   V2 VISUAL POLISH
   ═══════════════════════════════════════════════════════════ */

/* ── Entry cards: pillar color left accent ────────────────── */
.entry-card {
  border-left: 3px solid var(--ecolor, var(--leaf));
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  transition: transform 150ms, box-shadow 150ms;
}
.entry-card:hover {
  transform: translateX(2px);
  box-shadow: -3px 0 0 var(--ecolor, var(--leaf)), var(--shadow);
}
.entry-card p {
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 10px;
  color: var(--ink);
}
.em-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── Prompt cards: pillar color left accent ───────────────── */
.prompt-card {
  border-left: 3px solid var(--pcard-color, var(--leaf));
  border-radius: 0 10px 10px 0;
  padding: 16px 18px;
}
.prompt-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 4px 0 10px;
  line-height: 1.45;
}
.pc-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* ── Main textarea: active pillar color accent ────────────── */
.main-input-area #dailyNote:focus {
  border-color: var(--active-pillar, var(--leaf));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--active-pillar, var(--leaf)) 15%, transparent);
}
.main-input-area {
  border-top: 2.5px solid var(--active-pillar, var(--leaf));
  padding-top: 18px;
  transition: border-color 250ms;
  border-radius: 0 0 0 0;
}

/* ── Progress panel ───────────────────────────────────────── */
.progress-panel {
  position: relative;
}

/* ── Date chip: stronger presence ────────────────────────────*/
.date-chip {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ── Sidebar: tighter, cleaner ───────────────────────────────*/
.sidebar {
  padding: 14px 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.control-row {
  margin-bottom: 14px;
  justify-content: center;
}

/* Nav tabs: icon-only, tighter gap */
.nav-tabs {
  gap: 4px;
  flex: 1;
}
.nav-tab {
  padding: 10px 8px;
  border-radius: 10px;
}
.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Sidebar streak: push to bottom */
.sidebar-streak {
  margin-top: auto;
  padding: 10px 6px 0;
}
.ss-row {
  justify-content: center;
  gap: 6px;
}
.ss-streak {
  font-size: 0.68rem;
  margin-left: 2px;
}

/* ── Week summary: stronger numbers ──────────────────────────*/
.week-summary {
  margin-bottom: 18px;
}
.ws-left strong {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}
.ws-left span {
  font-size: 0.78rem;
}

/* ── Review entries: spaced out ──────────────────────────────*/
.entries {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* ── Ambient button ──────────────────────────────────────────── */
.ambient-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 3px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 200ms;
  line-height: 1;
}
.ambient-btn:hover {
  border-color: var(--leaf);
  color: var(--ink);
}
.ambient-btn.active {
  background: color-mix(in srgb, var(--leaf) 15%, var(--surface));
  border-color: var(--leaf);
  color: var(--leaf);
}

/* ── Char counter ────────────────────────────────────────────── */
.char-count {
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  flex-shrink: 0;
}

/* ── Save button: renamed "留下" — same style, softer feel ────── */
.save-btn {
  letter-spacing: 0.02em;
}

/* ── System dark mode auto-detect ────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f6f1e5;
    --muted: #c2bba9;
    --line: #285144;
    --paper: #092f28;
    --white: #103d33;
    --panel: rgba(16, 61, 51, 0.92);
    --panel-solid: #123f35;
    --surface-1: #072720;
    --surface-2: #0b493b;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
    --surface: #123f35;
    --text: #f6f1e5;
  }
}
