/* ==========================================================================
   拾光 · design tokens
   ========================================================================== */
:root {
  --bg: #f5f2ea;
  --bg-2: #efe9dd;
  --surface: #fffdf8;
  --surface-2: #f4efe5;
  --surface-3: #ece5d7;
  --ink: #23201b;
  --ink-2: #5b554a;
  --ink-3: #928a7a;
  --line: #e3dccd;
  --line-strong: #d3c9b7;
  --accent: #2f5d50;
  --accent-2: #24483e;
  --accent-ink: #ffffff;
  --accent-soft: #e4ede8;
  --gold: #b0813f;
  --danger: #a9422e;
  --danger-soft: #f6e7e2;
  --ring: rgba(47, 93, 80, 0.18);
  --shadow-sm: 0 1px 2px rgba(46, 36, 20, 0.04);
  --shadow-md: 0 10px 30px -12px rgba(46, 36, 20, 0.18), 0 2px 6px rgba(46, 36, 20, 0.04);
  --shadow-lg: 0 40px 80px -30px rgba(30, 24, 14, 0.35);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "STSong",
    "SimSun", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #121110;
  --bg-2: #191713;
  --surface: #1b1a16;
  --surface-2: #23211c;
  --surface-3: #2b2822;
  --ink: #ece6d9;
  --ink-2: #b6ac9b;
  --ink-3: #80776a;
  --line: #2e2b25;
  --line-strong: #3c382f;
  --accent: #8fc2ab;
  --accent-2: #a8d5be;
  --accent-ink: #10201a;
  --accent-soft: #1c2a24;
  --gold: #cfa163;
  --danger: #e08a75;
  --danger-soft: #2c1c18;
  --ring: rgba(143, 194, 171, 0.22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 30px -14px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   reset & base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(1100px 520px at 8% -10%, rgba(160, 128, 70, 0.075), transparent 60%),
    radial-gradient(900px 600px at 105% 105%, rgba(47, 93, 80, 0.06), transparent 55%);
}

[data-theme="dark"] body::before {
  background: radial-gradient(1100px 520px at 8% -10%, rgba(150, 120, 70, 0.07), transparent 60%),
    radial-gradient(900px 600px at 105% 105%, rgba(70, 120, 100, 0.08), transparent 55%);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
  background-clip: content-box;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}
.boot-mark {
  font-family: var(--font-serif);
  font-size: 34px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-2);
  animation: breathe 2.4s var(--ease) infinite;
}
.boot-line {
  width: 54px;
  height: 1px;
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
}
.boot-line::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--accent);
  animation: sweep 1.4s var(--ease) infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}
@keyframes sweep {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(260%);
  }
}

.noscript {
  padding: 40px;
  text-align: center;
}

/* ==========================================================================
   typography helpers
   ========================================================================== */
.serif {
  font-family: var(--font-serif);
}

.muted {
  color: var(--ink-3);
}

.page-fade {
  animation: rise 0.36s var(--ease);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.spin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   buttons & fields
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease),
    transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: translateY(0.5px);
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn svg {
  flex: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-2);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink-2);
  background: var(--surface);
}
.btn-ghost:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-soft {
  background: var(--surface-2);
  color: var(--ink-2);
}
.btn-soft:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.btn-danger {
  color: var(--danger);
  background: transparent;
}
.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  color: var(--ink-2);
}
.btn-icon:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.link {
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > label {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.input {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.input::placeholder {
  color: var(--ink-3);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.input[type="date"] {
  font-variant-numeric: tabular-nums;
}
textarea.input {
  resize: vertical;
  min-height: 84px;
  line-height: 1.7;
}

/* ==========================================================================
   auth
   ========================================================================== */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background: var(--bg);
}
.auth-card {
  width: min(404px, 100%);
  padding: 52px 40px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: rise 0.5s var(--ease);
}
.auth-seal {
  width: 46px;
  height: 46px;
  margin: 0 auto 22px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 0;
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.12);
}
.auth-title {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: var(--ink);
}
.auth-sub {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--ink-3);
}
.auth-form {
  margin-top: 38px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.auth-form .input {
  height: 46px;
  text-align: center;
  letter-spacing: 0.14em;
  font-size: 15px;
}
.auth-submit {
  height: 46px;
  margin-top: 4px;
  font-size: 14px;
  border-radius: 11px;
}
.auth-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  letter-spacing: 0.02em;
}
.auth-foot {
  margin-top: 26px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}
.auth-foot button {
  font-size: 11.5px;
  color: var(--ink-3);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   shell
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 30px 20px 24px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 34px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 15px;
  flex: none;
}
.brand-text {
  font-family: var(--font-serif);
  font-size: 21px;
  letter-spacing: 0.12em;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  margin-top: 5px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav a svg {
  color: var(--ink-3);
  transition: color 0.16s var(--ease);
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav a.active svg {
  color: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 20px;
}
.sidebar-user {
  padding: 2px 10px 10px;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

.main {
  min-width: 0;
  padding: 40px clamp(22px, 4.4vw, 60px) 120px;
}
.content {
  max-width: 880px;
  margin: 0 auto;
}

.mobile-top,
.bottom-nav {
  display: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.page-head h1 {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.15;
}
.page-head .sub {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ==========================================================================
   diary
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.search .clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--ink-3);
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.search .clear:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.tag-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 6px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.tag-row::-webkit-scrollbar {
  display: none;
}
.tag-row,
.album-bar {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: all 0.15s var(--ease);
}
button.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.chip-count {
  opacity: 0.55;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.timeline {
  display: flex;
  flex-direction: column;
}

.month-label {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 2px 10px;
  background: linear-gradient(var(--bg) 62%, transparent);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.month-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.entry {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 16px 22px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.18s var(--ease);
}
@media (hover: hover) {
  .entry:hover {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
  }
}
.entry-date {
  text-align: center;
  padding-top: 2px;
}
.entry-day {
  font-family: var(--font-serif);
  font-size: 29px;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.entry-weekday {
  margin-top: 7px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.entry-main {
  min-width: 0;
}
.entry h3 {
  font-family: var(--font-serif);
  font-size: 18.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.entry h3.untitled {
  color: var(--ink-2);
}
.entry-excerpt {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-2);
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 11px;
  flex-wrap: wrap;
}
.entry-mood {
  font-size: 14px;
  line-height: 1;
}
.entry-time {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 26px 0 0;
}

.empty {
  padding: 74px 20px 80px;
  text-align: center;
  color: var(--ink-2);
}
.empty-mark {
  font-family: var(--font-serif);
  font-size: 46px;
  color: var(--ink-3);
  opacity: 0.55;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
}
.empty h3 {
  margin-top: 18px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
}
.empty p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.empty .btn {
  margin-top: 22px;
}

.search-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px 14px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.search-summary strong {
  color: var(--ink);
  font-weight: 600;
}

/* ==========================================================================
   editor modal
   ========================================================================== */
dialog {
  color: var(--ink);
}
dialog::backdrop {
  background: rgba(24, 20, 14, 0.44);
  backdrop-filter: blur(5px);
}

dialog.editor {
  width: min(860px, calc(100vw - 36px));
  height: min(88vh, 920px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.22s var(--ease);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.editor-form {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--line);
}
.editor-date {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.editor-date:hover {
  background: var(--surface-2);
}
.editor-head-spacer {
  flex: 1;
}
.save-state {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  min-width: 62px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s;
}
.save-state.show {
  opacity: 1;
}
.editor-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px clamp(20px, 5vw, 40px) 14px;
  display: flex;
  flex-direction: column;
}
.editor-title {
  width: 100%;
  border: 0;
  padding: 0;
  margin-bottom: 14px;
  background: transparent;
  font-family: var(--font-serif);
  font-size: clamp(23px, 3vw, 28px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  outline: none;
}
.editor-title::placeholder {
  color: var(--ink-3);
  opacity: 0.7;
  font-weight: 400;
}
.editor-text {
  width: 100%;
  flex: 1;
  min-height: 280px;
  border: 0;
  padding: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.95;
  letter-spacing: 0.015em;
  color: var(--ink);
}
.editor-text::placeholder {
  color: var(--ink-3);
  opacity: 0.75;
}
.editor-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  background: var(--surface);
}
.moods {
  display: flex;
  gap: 2px;
}
.mood-btn {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0.5;
  transition: all 0.15s var(--ease);
}
@media (hover: hover) {
  .mood-btn:hover {
    opacity: 1;
    background: var(--surface-2);
  }
  .mood-btn.active:hover {
    background: var(--accent-soft);
  }
}
.mood-btn.active {
  opacity: 1;
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.editor-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 150px;
  flex-wrap: wrap;
}
.editor-tags .chip {
  background: var(--surface-2);
}
.editor-tags .chip button {
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  display: grid;
  place-items: center;
  opacity: 0.5;
}
.editor-tags .chip button:hover {
  opacity: 1;
}
.tag-input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 12px;
  padding: 4px 2px;
  min-width: 92px;
  flex: 1;
  color: var(--ink);
}
.tag-input::placeholder {
  color: var(--ink-3);
}
.editor-count {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.draft-hint {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}
.draft-hint.show {
  display: flex;
}

/* ==========================================================================
   photos
   ========================================================================== */
.album-bar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 8px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.album-bar::-webkit-scrollbar {
  display: none;
}
.album-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
  transition: all 0.15s var(--ease);
}
.album-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.album-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.album-chip .n {
  font-size: 10.5px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}
.album-chip.drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.album-add {
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-3);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 5px;
}
.photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: zoom-in;
  border: 0;
  padding: 0;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s var(--ease), opacity 0.3s;
}
@media (hover: hover) {
  .photo:hover img {
    transform: scale(1.04);
  }
  .photo:hover .photo-cap {
    opacity: 1;
  }
}
.photo-cap {
  position: absolute;
  inset: auto 0 0;
  padding: 26px 11px 9px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  color: #fff;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: min(340px, calc(100vw - 28px));
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.upload-panel h4 {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.upload-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
}
.upload-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.upload-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-row .bar {
  width: 44px;
  height: 3px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  flex: none;
}
.upload-row .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}
.upload-row.done .bar i {
  width: 100%;
}
.upload-row.error {
  color: var(--danger);
}

.drop-hint {
  display: none;
  position: fixed;
  inset: 12px;
  z-index: 30;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 0.1em;
  place-items: center;
  pointer-events: none;
}
body.dragging .drop-hint {
  display: grid;
}

photo-grid .empty,
.photo-empty {
  grid-column: 1 / -1;
}

/* lightbox */
dialog.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0b0a;
  color: #f2ede2;
  overflow: hidden;
}
dialog.lightbox::backdrop {
  background: #0b0b0a;
}
.lb-top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 34px;
  background: linear-gradient(rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
}
.lb-title {
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
}
.lb-top .spacer {
  flex: 1;
}
.lb-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  transition: background 0.15s;
  backdrop-filter: blur(6px);
}
.lb-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lb-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 70px 70px 118px;
}
.lb-img {
  max-width: calc(100vw - 140px);
  max-height: calc(100dvh - 188px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}
.lb-nav:hover {
  background: rgba(255, 255, 255, 0.18);
}
.lb-prev {
  left: 14px;
}
.lb-next {
  right: 14px;
}
.lb-nav:disabled {
  opacity: 0.18;
  pointer-events: none;
}
.lb-foot {
  position: absolute;
  inset: auto 0 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 46px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92) 45%);
}
.lb-caption {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f2ede2;
  font-size: 13px;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.lb-caption::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.lb-caption:hover,
.lb-caption:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
}
.lb-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.05em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.lb-select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eee;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  outline: none;
}
.lb-select option {
  background: #1b1a16;
  color: #eee;
}

/* ==========================================================================
   calendar
   ========================================================================== */
.calendar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.calendar-month {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.calendar-head .spacer {
  flex: 1;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.cal-dow {
  text-align: center;
  padding: 6px 0 10px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}
.cal-cell {
  position: relative;
  min-height: 62px;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background 0.15s var(--ease);
}
.cal-cell:hover {
  background: var(--surface);
}
.cal-cell .num {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.cal-cell.out .num {
  color: var(--ink-3);
  opacity: 0.45;
}
.cal-cell.today .num {
  color: var(--accent);
  font-weight: 700;
}
.cal-cell.today {
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
}
.cal-cell.selected {
  background: var(--accent-soft);
}
.cal-cell.selected .num {
  color: var(--accent);
}
.cal-dots {
  position: absolute;
  left: 9px;
  bottom: 8px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  max-width: calc(100% - 18px);
}
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-dot.photo {
  background: var(--gold);
}
.cal-count {
  position: absolute;
  right: 8px;
  bottom: 7px;
  font-size: 10px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.day-panel {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.day-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.day-panel-head h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
}
.day-panel-head .spacer {
  flex: 1;
}
.day-empty {
  padding: 26px 0 10px;
  color: var(--ink-3);
  font-size: 13px;
}
.mini-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.mini-entry:hover {
  background: var(--surface);
}
.mini-entry .mood {
  font-size: 15px;
}
.mini-entry .t {
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-entry .tags {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ==========================================================================
   settings
   ========================================================================== */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.card-head .hint {
  font-size: 11.5px;
  color: var(--ink-3);
}
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.card-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.card-row .label {
  font-size: 13px;
}
.card-row .desc {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 3px;
}
.card-row .value {
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-row .field {
  flex: 1;
  min-width: 160px;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 10px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.backup-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.backup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 12px;
}
.backup-item .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.backup-item .size {
  color: var(--ink-3);
  font-size: 11px;
}
.storage-bar {
  height: 5px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 10px;
}
.storage-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.about-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

/* ==========================================================================
   toasts & dialogs
   ========================================================================== */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  padding: 10px 17px;
  border-radius: 999px;
  background: #23201b;
  color: #f7f2e8;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.24s var(--ease);
  max-width: 100%;
  text-align: center;
}
.toast.error {
  background: #8f3526;
}
.toast.success {
  background: #2b5346;
}
[data-theme="dark"] .toast {
  background: #f0ead9;
  color: #1c1a16;
}
[data-theme="dark"] .toast.error {
  background: #7d3226;
  color: #fff2ed;
}
[data-theme="dark"] .toast.success {
  background: #2f5d50;
  color: #f0fbf5;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.22s;
}

dialog.confirm {
  width: min(400px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 26px 26px 20px;
  box-shadow: var(--shadow-lg);
}
dialog.confirm h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 8px;
}
dialog.confirm p {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

dialog.prompt {
  width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
dialog.prompt h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: 16px;
}

/* ==========================================================================
   responsive
   ========================================================================== */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    display: none;
  }
  .main {
    padding: 76px 16px 108px;
  }
  .mobile-top {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 58px;
    padding: 0 16px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-top .brand {
    margin: 0;
    padding: 0;
    gap: 8px;
    flex: 1;
  }
  .mobile-top .brand-mark {
    width: 27px;
    height: 27px;
    font-size: 13px;
  }
  .mobile-top .brand-text {
    font-size: 18px;
  }
  .mobile-top .brand-sub {
    display: none;
  }
  .bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 0;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    border-radius: 10px;
  }
  .bottom-nav a.active {
    color: var(--accent);
  }
  .bottom-nav a svg {
    width: 20px;
    height: 20px;
  }
  .page-head {
    align-items: center;
    margin-bottom: 18px;
  }
  .page-head h1 {
    font-size: 25px;
  }
  .page-head .sub {
    margin-top: 4px;
    font-size: 11.5px;
  }
  .entry {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 8px 18px 2px;
  }
  .entry-day {
    font-size: 24px;
  }
  .entry h3 {
    font-size: 16.5px;
  }
  .entry-excerpt {
    font-size: 13px;
    -webkit-line-clamp: 2;
  }
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 3px;
  }
  .photo {
    border-radius: 6px;
  }
  .photo-cap {
    display: none;
  }
  .cal-cell {
    min-height: 48px;
    padding: 6px;
    border-radius: 8px;
  }
  .cal-cell .num {
    font-size: 11.5px;
  }
  .cal-dots {
    left: 6px;
    bottom: 6px;
  }
  .cal-count {
    display: none;
  }
  dialog.editor {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .editor-body {
    padding: 20px 18px 10px;
  }
  .editor-title {
    font-size: 22px;
  }
  .editor-text {
    font-size: 16px;
  }
  .editor-foot {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }
  .lb-stage {
    padding: 56px 0 96px;
  }
  .lb-img {
    max-width: 100vw;
    max-height: calc(100dvh - 160px);
  }
  .lb-prev {
    left: 8px;
  }
  .lb-next {
    right: 8px;
  }
  .lb-nav {
    width: 38px;
    height: 38px;
  }
  .lb-foot {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .lb-select {
    max-width: 92px;
  }
  .upload-panel {
    right: 12px;
    bottom: 76px;
    width: calc(100vw - 24px);
  }
  .auth-card {
    padding: 42px 26px 32px;
  }
  .card {
    padding: 18px 16px;
  }
}

@media (max-width: 380px) {
  .cal-cell {
    min-height: 42px;
  }
  .entry-day {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
