:root {
  color-scheme: light;
  --ink: #211a33;
  --muted: #625b73;
  --accent: #633caf;
  --accent-dark: #4d2a92;
  --line: #e7e0f0;
  --lavender: #f2effc;
  --selected: #eee7fc;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.auth-screen { position: relative; isolation: isolate; overflow: hidden; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 15%, #ffe5ec, #fff4f6 55%, #fff); }
.auth-fei { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; opacity: .5; pointer-events: none; filter: drop-shadow(0 10px 35px #d72d5720); }
.auth-card { position: relative; z-index: 1; width: min(100%, 390px); display: grid; gap: 13px; padding: clamp(24px, 6vw, 38px); border: 1px solid #f2dce2; border-radius: 24px; background: rgb(255 255 255 / 92%); box-shadow: 0 18px 60px #7c244018; backdrop-filter: blur(8px); }
.auth-heart { color: var(--accent); font-size: 42px; line-height: 1; }
.auth-card h1 { font-size: 27px; }
.auth-card p { color: var(--muted); margin: 0 0 7px; line-height: 1.65; }
.auth-card label { font-size: 14px; font-weight: 650; }
.auth-card input { min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.auth-card .primary { width: 100%; margin-top: 3px; }
#auth-status { min-height: 1.5em; font-size: 13px; }
.petal-intro { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; overflow: hidden; background: #080509 url("rose-reference.webp") center / cover no-repeat; color: #fff; isolation: isolate; }
.petal-intro::before { position: absolute; z-index: -1; inset: 0; content: ""; background: radial-gradient(ellipse at 50% 46%, rgb(15 5 10 / 25%), rgb(4 3 7 / 77%) 85%), linear-gradient(0deg, rgb(0 0 0 / 40%), transparent 48%, rgb(0 0 0 / 24%)); }
#petal-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro-caption { position: relative; z-index: 1; color: #fff4f5; font-size: clamp(30px, 8vw, 70px); font-weight: 800; letter-spacing: .16em; text-shadow: 0 2px 18px #ef254c, 0 0 42px #ff5278; opacity: 0; animation: caption-arrive .65s ease 3.2s forwards; }
@keyframes caption-arrive { to { opacity: .88; } }
.account-tools { display: flex; align-items: center; justify-content: flex-end; gap: 5px; color: var(--muted); font-size: 12px; }
.account-tools { margin-left: auto; min-width: 0; }
.account-tools #sync-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-tools .text-button { min-height: 36px; font-size: 13px; }
.icons { display: none; }
svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
.sidebar, .collection, .workspace { min-width: 0; min-height: 0; }
.sidebar {
  background: var(--lavender);
  padding: clamp(24px, 5vh, 56px) 16px max(24px, env(safe-area-inset-bottom));
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 5px; font-size: clamp(1rem, 1.45vw, 1.2rem); font-weight: 760; line-height: 1.35; text-wrap: balance; }
.brand-icon { display: grid; place-items: center; background: #dfd3f7; color: var(--accent-dark); border-radius: 14px; width: 46px; height: 46px; flex: none; }
.brand-icon svg { width: 25px; height: 25px; fill: #fff8; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 45px;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 680;
  white-space: nowrap;
}
.primary:hover { background: var(--accent-dark); }
.folders, .utility { display: grid; gap: 4px; }
.folders button, .utility button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}
.folders button[data-view="all"] { color: var(--accent-dark); background: #e6dcf8; font-weight: 700; }
.folders button:hover, .utility button:hover { background: #e6dcf8; }
.count { margin-left: auto; font-size: 13px; }
.utility { display: flex; flex-wrap: wrap; margin: 0 0 8px; }
.collection {
  display: flex;
  flex-direction: column;
  background: #fcfbfe;
  overflow: auto;
}
.collection-header { padding: 29px 18px 16px; }
.collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 17px; }
h1, h2 { margin: 0; }
h1 { font-size: 24px; letter-spacing: -.04em; }
.search { display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); padding: 0 10px; }
.search input { width: 100%; min-width: 0; min-height: 43px; border: 0; background: transparent; font-size: 16px; outline: none; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.note-list { flex: none; padding: 0 11px max(14px, env(safe-area-inset-bottom)); }
.note-row {
  width: 100%;
  min-height: 87px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  text-align: left;
  display: grid;
  gap: 7px;
  padding: 12px;
}
.note-row:hover { background: #f5f1fc; }
.note-row[aria-current="true"] { background: var(--selected); border-color: #e0d2f7; }
.row-title { display: flex; gap: 8px; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 690; min-width: 0; }
.row-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title svg { width: 16px; height: 16px; color: var(--accent); }
.row-date { font-size: 13px; color: var(--muted); }
.empty-list { padding: 20px 8px; margin: 0; color: var(--muted); text-align: center; }
.workspace { display: flex; flex-direction: column; }
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 6px clamp(15px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
}
.status { color: var(--muted); font-size: 13px; }
.editor-actions { display: flex; flex: none; align-items: center; gap: 4px; margin-left: auto; }
.icon-button, .text-button, .back {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 650;
}
.icon-button:hover, .text-button:hover, .back:hover, .icon-button[aria-pressed="true"] { background: var(--lavender); }
.text-button.danger { color: #a02f4c; }
.editor {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 13px;
  min-height: 0;
  width: min(100%, 850px);
  margin-inline: auto;
  padding: clamp(22px, 5vw, 60px) clamp(22px, 5vw, 62px) max(18px, env(safe-area-inset-bottom));
}
.editor time { font-size: 13px; color: var(--muted); }
#note-body { min-width: 0; width: 100%; border: none; padding: 0; background: transparent; }
#note-body { flex: 1; min-height: 0; resize: none; font-size: 17px; line-height: 1.85; padding-bottom: 8px; }
#note-body::placeholder { color: #736985; }
.toast {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  right: 20px;
  max-width: calc(100vw - 40px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: 0 4px 20px #211a3330;
  font-size: 14px;
}
@media (max-width: 760px) {
  .brand { font-size: 21px; }
  .brand-icon { width: 38px; height: 38px; border-radius: 12px; }
  .brand-icon svg { width: 22px; height: 22px; }
  .folders button { gap: 5px; padding-inline: 7px; }
  .folders svg, .utility svg { width: 16px; height: 16px; }
  .utility { display: flex; flex-wrap: wrap; gap: 0 10px; }
  .utility button { padding-block: 0; }
  .collection { border: 0; }
  .collection-header { padding: 16px 14px 12px; }
  .collection-heading { margin-bottom: 12px; }
  .editor-header { min-height: 55px; padding-inline: 9px; }
  .editor { padding-inline: 18px; }
}

.collection { background: #f9f7ff; }
.collection-header, .note-list { width: min(100%, 860px); margin-inline: auto; }
.collection-header { padding: clamp(18px, 4vw, 50px) clamp(14px, 3vw, 32px) 10px; }
.collection-heading { margin-bottom: 18px; }
h1 { font-size: clamp(25px, 4vw, 42px); line-height: 1.25; text-wrap: balance; }
.search { max-width: 100%; }
.outline-tools, .compact-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.outline-tools { margin-top: 8px; }
.sort-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; }
.sort-label select {
  max-width: 100%;
  min-height: 44px;
  padding: 5px 25px 5px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 10px center, right 5px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.sort-label select:focus-visible { outline: 2px solid var(--accent); }
#compact-outline[aria-pressed="true"] { background: var(--selected); }
.compact-tools { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.note-list { padding-inline: clamp(14px, 3vw, 32px); }
.note-row {
  min-height: 79px;
  gap: 8px;
  margin-bottom: 8px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
}
.note-row:hover { border-color: #cbb6ef; }
.row-title { align-items: flex-start; }
.row-title span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 630;
  line-height: 1.45;
}
.row-details { display: flex; flex-wrap: wrap; gap: 5px 14px; align-items: center; }
.row-details .due { color: var(--accent-dark); font-weight: 650; }
.row-details .overdue { color: #a02f4c; }
.note-list.compact .note-row { min-height: 65px; padding-block: 9px; }
.back { display: inline-flex; white-space: nowrap; }
.editor-header { padding-inline: clamp(10px, 1.7vw, 28px); }
.editor { gap: 15px; padding-top: clamp(20px, 4vw, 45px); }
.editor-details { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.editor-details p { margin: 4px 0; color: var(--muted); font-size: 14px; }
.editor-details time { font-size: inherit; }
.deadline-field label, .body-label { display: block; font-size: 14px; font-weight: 680; }
.deadline-field label span { color: var(--muted); font-weight: 500; }
.deadline-control { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 3px; }
#note-deadline { min-width: 145px; min-height: 44px; max-width: 100%; padding-inline: 8px; border: 1px solid var(--line); border-radius: 9px; background: #f9f7ff; }
#note-body { padding: 4px 0 12px; }
#ai-copy-dialog { width: min(540px, calc(100% - 32px)); padding: 18px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); }
#ai-copy-dialog::backdrop { background: #211a3355; }
#ai-copy-dialog form { float: right; }
#ai-copy-dialog h2 { font-size: 19px; padding: 9px 0; margin-bottom: 8px; }
#ai-copy-text { display: block; clear: both; width: 100%; height: 240px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 760px) {
  .collection-header { padding-top: 14px; }
  .collection-heading { margin-bottom: 12px; }
  .editor { gap: 12px; }
}

/* Rounded controls and warm accents for the personal views. */
:root {
  --accent: #924661;
  --accent-dark: #722f4a;
  --lavender: #faf0f3;
  --selected: #f7e7ee;
  --line: #eadbe3;
}
.collection { background-color: #fdf8fa; }
.primary, .home-actions .text-button, #compact-outline { border-radius: 999px; }
.brand-icon {
  border: 1px solid #eed6e1;
  background: #f5dfeb;
  color: var(--accent-dark);
}
.brand-icon.has-icon {
  background-image: var(--icon);
  background-size: cover;
  background-position: center;
}
.brand-icon.has-icon svg { visibility: hidden; }
.folders button[data-view="all"], .folders button:hover, .utility button:hover { background: var(--selected); }
#outline[data-section="all"].has-wallpaper {
  background-image: linear-gradient(#f5e4eb55, #f8edf2a0), var(--wallpaper);
  background-size: cover;
  background-position: center;
}
.has-wallpaper[data-section="all"] .collection-heading h1,
.has-wallpaper[data-section="all"] .outline-group,
.has-wallpaper[data-section="all"] .empty-list,
.has-wallpaper[data-section="all"] .outline-tools,
.has-wallpaper[data-section="all"] .compact-tools {
  background: #fff9fc;
  border-radius: 14px;
  padding-inline: 12px;
}
.home-actions { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 12px; }
.home-actions .text-button { padding-inline: 14px; background: #fff; border: 1px solid var(--line); }
.home-actions .text-button:hover { background: var(--selected); }
.countdown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff4f8;
  color: var(--accent-dark);
  overflow-wrap: anywhere;
}
.idea-card { background: #fffaf2; color: var(--ink); }
.idea-details { flex: 1 1 230px; padding-block: 5px; }
.idea-details p { margin: 0; line-height: 1.5; }
.outline-group {
  width: fit-content;
  margin: 12px 0 6px;
  padding: 4px 0;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 720;
}
.memory-line {
  color: var(--accent-dark);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.editor { overflow: auto; }
#note-body { min-height: 95px; }
.related-day, .memory-fields { display: grid; gap: 6px; font-size: 14px; font-weight: 680; }
.related-day select, .memory-fields input:not([type="file"]), .day-form input:not([type="checkbox"]) {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffafd;
  padding: 8px;
  font: inherit;
  font-size: 16px;
}
.memory-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.memory-photo img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 10px;
}
.finish-actions { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 8px; }
#save-note { min-height: 45px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--accent-dark); font-weight: 680; white-space: nowrap; }
#save-note:hover { background: var(--lavender); }
.photo-picker { position: relative; cursor: pointer; }
.photo-picker input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.photo-picker:focus-within { outline: 2px solid var(--accent); }
.photo-picker:has(input:disabled) { opacity: .55; pointer-events: none; }
#appearance-dialog, #days-dialog, #references-dialog {
  width: min(510px, calc(100% - 30px));
  max-height: 85dvh;
  overflow: auto;
  padding: 16px 18px;
  color: var(--ink);
  background: #fffafd;
  border: 1px solid var(--line);
  border-radius: 20px;
}
#appearance-dialog::backdrop, #days-dialog::backdrop, #references-dialog::backdrop { background: #35203470; }
.dialog-close { float: right; }
#appearance-heading, #days-heading, #references-heading { margin: 8px 0 15px; font-size: 22px; }
.photo-setting, .day-row {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.photo-setting span, .day-row span { flex: 1; overflow-wrap: anywhere; }
.dialog-hint, #appearance-status, #day-status { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
#appearance-status:empty, #day-status:empty { display: none; }
.day-form { display: grid; gap: 9px; clear: both; padding-top: 9px; }
.day-form label { display: grid; gap: 4px; font-size: 14px; }
.day-form .annual { display: inline-flex; align-items: center; min-height: 44px; }

.utility .references-button {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  justify-self: start;
  color: var(--accent-dark);
}
.references-button span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
#references-dialog h3 { clear: both; margin: 16px 0 6px; font-size: 16px; }
.references-list { list-style: none; padding: 0; margin: 0; }
.references-list li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-height: 42px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.references-list a { color: var(--accent-dark); text-underline-offset: 3px; }
.references-list span { color: var(--muted); font-size: 14px; }


.folders .folder-label { white-space: normal; line-height: 1.35; }
.click-heart {
  position: fixed;
  z-index: 100;
  width: 25px;
  height: 25px;
  fill: #e47e9f;
  color: #a43b64;
  pointer-events: none;
  animation: click-heart-rise 780ms ease-out both;
}
@keyframes click-heart-rise {
  0% { opacity: .45; transform: translate(-50%, -50%) scale(.65); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% + var(--heart-travel, -38px))) scale(.95); }
}
@keyframes click-heart-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .click-heart {
    transform: translate(-50%, -50%);
    animation: click-heart-fade 480ms ease-out both;
  }
}


.day-bar {
  position: relative;
  z-index: 2;
  padding: env(safe-area-inset-top) 12px 0;
  background: #fff9fc;
  border-bottom: 1px solid var(--line);
}
.day-bar-inner {
  display: flex;
  align-items: center;
  gap: 4px 12px;
  width: min(100%, 860px);
  min-height: 51px;
  margin-inline: auto;
}
.day-bar button { flex: none; }
#countdown {
  min-width: 0;
  padding-block: 5px;
  color: var(--accent-dark);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.sidebar > * { flex: none; width: min(100%, 320px); }
.sidebar .brand { margin-bottom: 2px; font-size: clamp(1.3rem, 3vw, 1.55rem); }
.sidebar .brand-icon { width: 55px; height: 55px; border-radius: 16px; }
.sidebar > .primary { min-height: 54px; font-size: 16px; }
.sidebar .folders button { min-height: 55px; padding-inline: 13px; font-size: 16px; }
.collection-header { flex: none; padding-top: 12px; }
.collection-heading { flex-wrap: wrap; margin-top: 5px; }
#return-home { margin-inline-start: -9px; }
#outline:not([data-section="all"]) .collection-heading .primary { display: none; }
