:root {
  --background: #f4eee8;
  --paper: #fffdf9;
  --paper-strong: #ffffff;
  --foreground: #2c292b;
  --muted: #766d6b;
  --faint: #a49894;
  --wine: #8f394c;
  --wine-dark: #702b3b;
  --wine-soft: #f5e4e8;
  --ink: #29384f;
  --green: #4d7969;
  --rose: #c26475;
  --border: #ded2cc;
  --border-strong: #cdbbb3;
  --shadow: 0 18px 55px rgba(58, 42, 43, 0.09);
  --serif: "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-family: var(--sans);
  color: var(--foreground);
  background: var(--background);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--background); font-size: 16px; }
body.no-scroll { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(143, 57, 76, 0.28); outline-offset: 2px; }

.locked-page {
  min-height: calc(100svh - 48px);
  padding: 42px 20px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 32px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 15%, rgba(143, 57, 76, 0.12), transparent 26%),
    radial-gradient(circle at 84% 82%, rgba(41, 56, 79, 0.11), transparent 28%),
    linear-gradient(135deg, #f7f1eb, #f1eae4);
}
.locked-page::before,
.locked-page::after {
  content: "";
  position: fixed;
  inset: 24px;
  pointer-events: none;
  border: 1px solid rgba(73, 51, 55, 0.13);
}
.locked-page::after { inset: 31px; border-style: dashed; }

.login-card {
  width: min(470px, 100%);
  padding: 64px 52px 40px;
  position: relative;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: 4px 28px 28px 4px;
  background: linear-gradient(90deg, rgba(95, 58, 58, 0.09) 0 12px, transparent 12px), var(--paper);
  box-shadow: 0 30px 90px rgba(56, 38, 42, 0.15), 9px 0 0 #eee2dc inset;
}
.book-mark {
  width: 76px;
  height: 76px;
  margin: -104px auto 25px;
  display: grid;
  place-items: center;
  color: #fff9f7;
  border: 7px solid #f4eee8;
  border-radius: 50%;
  background: var(--wine);
  box-shadow: 0 8px 24px rgba(112, 43, 59, 0.28);
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.08em;
}
.eyebrow { margin: 0 0 10px; color: var(--wine); font-size: 12px; font-weight: 750; letter-spacing: 0.18em; text-transform: uppercase; }
.login-card h1 { margin: 0; font-family: var(--serif); font-size: clamp(34px, 8vw, 46px); letter-spacing: 0.08em; }
.login-poem { margin: 18px 0 32px; color: var(--muted); font-family: var(--serif); font-size: 16px; line-height: 1.95; }
.login-form, .dialog-form, .entry-form { display: grid; gap: 18px; text-align: left; }
.login-form { gap: 13px; }
label { display: grid; gap: 8px; color: #5d5353; font-size: 14px; font-weight: 700; }
label em { color: var(--faint); font-style: normal; font-weight: 400; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d7cac5;
  border-radius: 10px;
  outline: none;
  color: var(--foreground);
  background: #fff;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, select:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(143, 57, 76, 0.1); }
.login-form input { height: 50px; }
.form-error { min-height: 19px; margin: 0; color: #a52f39; font-size: 13px; }
.privacy-note { margin: 24px 0 0; color: #8f8280; font-size: 13px; }
.login-footer { margin: 0; color: #9b8b88; font-family: Georgia, serif; font-size: 12px; letter-spacing: 0.22em; }

.skeleton { overflow: hidden; position: relative; border-radius: 9px; background: #e9dfd9; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent); animation: shimmer 1.5s infinite; }
.skeleton-title { width: 200px; height: 40px; }
.skeleton-line { width: 270px; max-width: 90%; height: 16px; }
.skeleton-field { width: 100%; height: 50px; margin-top: 8px; }
.skeleton-card { height: 190px; }
.stats-skeleton { min-height: 510px; }
@keyframes shimmer { to { transform: translateX(100%); } }

.button {
  min-height: 42px;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.62; transform: none; }
.primary-button { color: #fff; background: var(--wine); box-shadow: 0 9px 22px rgba(112, 43, 59, 0.2); }
.primary-button:hover { background: var(--wine-dark); box-shadow: 0 12px 27px rgba(112, 43, 59, 0.25); }
.outline-button { color: #5d5052; border: 1px solid #d3c2bc; background: #fff; box-shadow: none; }
.light-button { color: var(--wine); background: rgba(255, 255, 255, 0.9); box-shadow: none; }
.text-button { min-height: 36px; padding: 5px 2px; border: 0; color: var(--wine); background: transparent; cursor: pointer; font-size: 14px; font-weight: 700; }
.text-button:hover { color: var(--wine-dark); text-decoration: underline; }
.danger-text { color: #a43b43; }

.diary-app { min-height: 100vh; background: linear-gradient(rgba(82, 62, 65, 0.035) 1px, transparent 1px), var(--background); background-size: 100% 34px; }
.topbar {
  min-height: 76px;
  padding: 10px max(22px, calc((100vw - 1320px) / 2));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(89, 67, 69, 0.14);
  background: rgba(250, 247, 243, 0.94);
  backdrop-filter: blur(18px);
}
.brand-lockup { padding: 0; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.brand-seal { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; border-radius: 50%; background: var(--wine); font-family: Georgia, serif; font-size: 12px; letter-spacing: 0.06em; box-shadow: 0 5px 14px rgba(112, 43, 59, 0.2); }
.brand-lockup > span:last-child { display: grid; gap: 1px; }
.brand-lockup strong { font-family: var(--serif); font-size: 18px; letter-spacing: 0.08em; }
.brand-lockup small { color: #998b88; font-family: Georgia, serif; font-size: 12px; letter-spacing: 0.1em; }
.main-nav { justify-self: center; display: flex; align-items: center; gap: 3px; }
.nav-link { min-height: 42px; padding: 8px 13px; border: 0; border-radius: 9px; color: #655b5d; background: transparent; cursor: pointer; font-size: 14px; }
.main-nav .nav-link:hover { background: #f1e7e4; }
.main-nav .nav-link.is-active { color: var(--wine); background: var(--wine-soft); font-weight: 750; }
.account-actions { display: flex; gap: 2px; }
.icon-text-button { min-height: 39px; padding: 7px 9px; display: flex; gap: 5px; align-items: center; border: 0; border-radius: 8px; color: #74696a; background: transparent; cursor: pointer; font-size: 13px; }
.icon-text-button:hover { background: #ede4df; }

.app-main { min-height: calc(100vh - 160px); }
.app-section { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 36px; }
.page-intro { margin-bottom: 30px; display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.page-intro h1 { margin: 0; max-width: 860px; font-family: var(--serif); font-size: clamp(34px, 4.7vw, 62px); font-weight: 650; line-height: 1.2; letter-spacing: -0.03em; }
.compact-intro h1 { font-size: clamp(32px, 4vw, 50px); }
.intro-copy { max-width: 720px; margin: 13px 0 0; color: var(--muted); line-height: 1.75; }
.home-intro { margin-bottom: 24px; }
.panel-card { border: 1px solid var(--border); border-radius: 18px; background: rgba(255, 253, 249, 0.94); box-shadow: var(--shadow); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.card-heading h2 { margin: 0; font-family: var(--serif); font-size: 25px; }
.card-heading .eyebrow { margin-bottom: 4px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(350px, 0.75fr); gap: 24px; align-items: stretch; }
.carousel-card { min-height: 500px; position: relative; overflow: hidden; border-radius: 22px 6px 22px 6px; color: #fff; background: var(--ink); box-shadow: 0 24px 65px rgba(35, 42, 54, 0.18); }
.overlay-heading { width: 100%; padding: 23px 24px; position: absolute; z-index: 2; top: 0; left: 0; background: linear-gradient(rgba(18, 23, 32, 0.74), transparent); }
.overlay-heading .eyebrow { color: #f1c3cf; }
.overlay-heading h2 { color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
.glass-button { min-height: 38px; padding: 7px 12px; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 9px; color: #fff; background: rgba(15, 20, 30, 0.24); backdrop-filter: blur(8px); cursor: pointer; font-size: 13px; }
.glass-button:hover { background: rgba(15, 20, 30, 0.46); }
.carousel-stage { height: 100%; min-height: 500px; }
.carousel-slide { height: 500px; margin: 0; position: relative; animation: fade-in 0.55s ease; }
.carousel-slide::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(transparent 52%, rgba(16, 19, 27, 0.78)); }
.carousel-slide img { width: 100%; height: 100%; display: block; object-fit: cover; cursor: zoom-in; }
.carousel-slide figcaption { padding: 28px 28px 54px; display: flex; align-items: end; justify-content: space-between; gap: 20px; position: absolute; z-index: 1; inset: auto 0 0; }
.carousel-slide figcaption strong { font-family: var(--serif); font-size: clamp(20px, 3vw, 31px); font-weight: 600; }
.carousel-slide figcaption time { flex: 0 0 auto; color: rgba(255, 255, 255, 0.76); font-size: 13px; }
.carousel-empty { min-height: 500px; padding: 120px 30px 60px; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; background: radial-gradient(circle at 50% 30%, rgba(194, 100, 117, 0.22), transparent 35%), var(--ink); }
.carousel-empty-mark { color: #e6aaba; font-size: 52px; }
.carousel-empty h3 { margin: 2px 0; font-family: var(--serif); font-size: 25px; }
.carousel-empty p { margin: 0 0 10px; color: #cbd1d9; }
.carousel-controls { padding: 0 20px 15px; display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 12px; position: absolute; z-index: 3; inset: auto 0 0; }
.round-button { width: 34px; height: 34px; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 50%; color: #fff; background: rgba(20, 23, 31, 0.35); cursor: pointer; font-size: 24px; line-height: 1; }
.carousel-dots { display: flex; justify-content: center; gap: 7px; }
.carousel-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.48); cursor: pointer; transition: width 0.2s ease, background 0.2s ease; }
.carousel-dot[data-active="true"] { width: 22px; background: #fff; }
@keyframes fade-in { from { opacity: 0.2; transform: scale(1.01); } }

.checkin-card { padding: 27px; }
.muted-copy { margin: 9px 0 22px; color: var(--muted); font-size: 13px; }
.goal-columns { display: grid; gap: 18px; }
.goal-column { padding: 17px; border: 1px solid #e4d9d4; border-radius: 13px; background: #fff; }
.goal-column.girlfriend { border-color: #ead2d8; background: #fffbfc; }
.goal-column.boyfriend { border-color: #d5dde7; background: #fbfcfe; }
.goal-owner-heading { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.goal-owner-heading strong { font-family: var(--serif); font-size: 18px; }
.goal-owner-heading span { color: var(--muted); font-size: 13px; }
.goal-list { display: grid; gap: 8px; }
.goal-row { min-height: 42px; display: grid; grid-template-columns: 1fr 28px; align-items: center; gap: 4px; }
.goal-check { min-width: 0; display: flex; grid-template-columns: none; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.goal-check input { width: 1px; min-height: 1px; height: 1px; position: absolute; opacity: 0; }
.check-mark { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border: 1px solid #cdbfba; border-radius: 50%; color: transparent; background: #fff; font-size: 13px; transition: 0.18s ease; }
.goal-row[data-checked="true"] .check-mark { color: #fff; border-color: var(--green); background: var(--green); }
.goal-row[data-checked="true"] .goal-title { color: #918987; text-decoration: line-through; }
.goal-title { overflow-wrap: anywhere; }
.goal-delete { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; color: #aa9d99; background: transparent; cursor: pointer; font-size: 19px; }
.goal-delete:hover { color: #a43b43; background: #f8e9ea; }
.goal-empty { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

.recent-section { margin-top: 24px; padding: 28px; }
.recent-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.recent-card { min-width: 0; min-height: 190px; padding: 20px; display: flex; flex-direction: column; position: relative; overflow: hidden; border: 1px solid #e2d6d0; border-radius: 4px 15px 15px 4px; background: #fff; box-shadow: 4px 0 0 #eee2dc inset; }
.recent-card h3 { margin: 14px 0 4px; font-family: var(--serif); font-size: 19px; }
.recent-card .entry-content { max-height: 5.85em; display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.recent-photo { margin: auto -20px -20px; padding-top: 15px; }
.recent-photo figure { height: 118px; margin: 0; position: relative; overflow: hidden; background: #eee8e4; }
.recent-photo .photo-open-button { width: 100%; height: 100%; padding: 0; display: block; overflow: hidden; border: 0; background: #eee8e4; cursor: zoom-in; }
.recent-photo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.recent-photo-count { padding: 4px 8px; position: absolute; right: 9px; bottom: 8px; pointer-events: none; border-radius: 999px; color: #fff; background: rgba(38, 31, 34, 0.72); font-size: 12px; line-height: 1.2; }
.empty-inline { grid-column: 1 / -1; margin: 0; padding: 30px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 12px; text-align: center; }

.memory-count { min-width: 180px; padding: 16px 24px; display: grid; justify-items: center; border: 1px solid #c9abae; border-radius: 50%; color: #715e62; transform: rotate(2deg); }
.memory-count span { color: var(--wine); font-family: Georgia, serif; font-size: 36px; line-height: 1; }
.memory-count small { margin-top: 4px; font-size: 13px; }
.diary-shell { display: grid; grid-template-columns: minmax(360px, 0.82fr) minmax(450px, 1.18fr); align-items: start; gap: 24px; }
.composer-panel, .timeline-panel { padding: 31px; }
.composer-panel { position: sticky; top: 100px; border-radius: 5px 20px 20px 5px; box-shadow: 8px 0 0 #ebdfd9 inset, var(--shadow); }
.timeline-panel { min-height: 680px; border-radius: 20px 5px 5px 20px; }
.section-title { display: flex; align-items: center; gap: 13px; }
.section-title > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--wine); background: var(--wine-soft); font-size: 20px; }
.section-title p { margin: 0 0 2px; color: #a06f7a; font-family: Georgia, serif; font-size: 12px; letter-spacing: 0.15em; }
.section-title h2 { margin: 0; font-family: var(--serif); font-size: 25px; }
.entry-form { margin-top: 26px; gap: 21px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 11px; color: #5d5353; font-size: 14px; font-weight: 700; }
.mood-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.mood-option { min-width: 0; padding: 9px 3px 8px; display: grid; justify-items: center; gap: 3px; border: 1px solid #ded2cc; border-radius: 10px; color: #73696a; background: #fff; cursor: pointer; transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.mood-option:hover { transform: translateY(-2px); border-color: var(--mood-color); }
.mood-option[data-selected="true"] { border-color: var(--mood-color); color: #4e4446; background: color-mix(in srgb, var(--mood-color) 12%, white); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mood-color) 12%, transparent); }
.mood-emoji { font-size: 21px; }
.mood-option small { font-size: 12px; }
.lined-textarea { min-height: 165px; padding-top: 10px; line-height: 30px; background-color: #fff; background-image: repeating-linear-gradient(transparent 0, transparent 29px, rgba(128, 99, 99, 0.11) 30px); }
.character-count { margin-top: -5px; color: var(--faint); font-size: 12px; font-weight: 400; text-align: right; }
.save-entry { width: 100%; min-height: 50px; }
.composer-note { margin: 20px 0 0; color: #958784; font-family: var(--serif); font-size: 13px; text-align: center; }
.timeline-heading { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#mobile-new-button { display: none; }
.entry-list, .loading-list { display: grid; gap: 16px; }
.entry-card { position: relative; padding: 25px 58px 25px 25px; overflow: hidden; border: 1px solid #e0d4ce; border-radius: 5px 17px 17px 5px; background: #fff; box-shadow: 5px 0 0 #eee2dc inset; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.entry-card:hover { transform: translateY(-2px); border-color: #cdb8b1; box-shadow: 5px 0 0 #e8d5d6 inset, 0 10px 25px rgba(68, 49, 52, 0.07); }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.entry-meta time { color: var(--wine); font-size: 13px; font-weight: 750; }
.entry-author { padding: 5px 9px; border-radius: 999px; color: #6e6263; background: #f2e9e5; font-size: 12px; }
.entry-card h3 { margin: 17px 0 7px; font-family: var(--serif); font-size: 23px; }
.entry-content { margin: 11px 0 0; color: #51494a; font-family: var(--serif); font-size: 16px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-actions { position: absolute; top: 17px; right: 13px; display: grid; gap: 3px; opacity: 0.3; transition: opacity 0.2s ease; }
.entry-card:hover .entry-actions, .entry-card:focus-within .entry-actions { opacity: 1; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 9px; color: #816f71; background: transparent; cursor: pointer; font-size: 21px; }
.icon-button:hover { background: #f1e6e3; }
.danger-button:hover { color: #a63f45; }
.empty-memory { min-height: 440px; display: grid; place-items: center; align-content: center; gap: 9px; color: #908280; text-align: center; border: 1px dashed #d6c5bf; border-radius: 5px 17px 17px 5px; }
.empty-heart { color: #b66b79; font-size: 45px; }
.empty-memory h3 { margin: 3px 0 0; color: #5d5254; font-family: var(--serif); font-size: 23px; }
.empty-memory p { max-width: 300px; margin: 0; font-size: 14px; line-height: 1.7; }

.photo-field { padding: 16px; border: 1px dashed #d4c0bd; border-radius: 13px; background: #fdf9f7; }
.photo-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #5d5353; font-size: 14px; font-weight: 700; }
.photo-field-heading em { color: var(--faint); font-style: normal; font-weight: 400; }
.file-button { min-height: 36px; padding: 7px 10px; display: inline-flex; align-items: center; border: 1px solid #d3b9bd; border-radius: 8px; color: var(--wine); background: #fff; cursor: pointer; font-size: 13px; white-space: nowrap; }
.file-button input { width: 1px; min-height: 1px; height: 1px; position: absolute; opacity: 0; }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.photo-drafts { margin-top: 12px; display: grid; gap: 10px; }
.photo-drafts:empty { display: none; }
.photo-draft { padding: 8px; display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: 10px; border: 1px solid #e2d7d2; border-radius: 10px; background: #fff; }
.photo-draft img { width: 78px; height: 72px; object-fit: cover; border-radius: 7px; }
.photo-draft-details { min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 9px; align-items: center; }
.photo-draft-details strong { grid-column: 1 / -1; overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.photo-draft-details input { min-width: 0; min-height: 38px; }
.entry-photo-grid { margin: 18px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.entry-photo-grid.count-1 { grid-template-columns: 1fr; }
.entry-photo-grid figure { min-width: 0; margin: 0; }
.entry-photo-grid .photo-open-button { width: 100%; height: 190px; padding: 0; display: block; overflow: hidden; border: 0; border-radius: 10px; background: #eee5df; cursor: zoom-in; }
.entry-photo-grid.count-1 .photo-open-button { height: min(390px, 48vw); }
.entry-photo-grid img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 0.25s ease; }
.entry-photo-grid .photo-open-button:hover img { transform: scale(1.025); }
.entry-photo-grid figcaption { padding: 7px 4px 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.prediction-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.prediction-card { min-height: 154px; padding: 22px; display: grid; align-content: space-between; gap: 8px; border: 1px solid var(--border); border-top: 4px solid var(--wine); border-radius: 14px; background: #fff; box-shadow: 0 12px 36px rgba(58, 42, 43, 0.07); }
.prediction-card.rose { border-top-color: var(--rose); }
.prediction-card.blue { border-top-color: #54728e; }
.prediction-card.green { border-top-color: var(--green); }
.prediction-label { color: var(--muted); font-size: 13px; }
.prediction-value { font-family: var(--serif); font-size: clamp(20px, 2vw, 26px); line-height: 1.35; }
.prediction-card small { color: var(--faint); font-size: 12px; line-height: 1.5; }
.prediction-empty { grid-column: 1 / -1; min-height: 156px; padding: 28px; display: grid; justify-items: center; align-content: center; gap: 5px; border: 1px dashed #d3bcbf; border-radius: 14px; color: var(--muted); text-align: center; background: rgba(255, 253, 249, 0.72); }
.prediction-empty > span { color: var(--wine); font-size: 31px; }
.prediction-empty p { margin: 0; font-size: 14px; }
.health-note { margin: 13px 0 26px; padding: 11px 14px; color: #6c6263; border-left: 3px solid #c48b97; background: rgba(255, 253, 249, 0.6); font-size: 13px; line-height: 1.65; }
.period-layout { display: grid; grid-template-columns: minmax(330px, 0.72fr) minmax(440px, 1.28fr); gap: 24px; align-items: start; }
.period-form-card, .period-history-card { padding: 28px; }
.period-history { margin-top: 22px; display: grid; gap: 10px; }
.period-row { padding: 14px 14px 14px 17px; display: grid; grid-template-columns: 130px 1fr auto; align-items: start; gap: 16px; border: 1px solid #e2d7d2; border-left: 4px solid #c16a79; border-radius: 10px; background: #fff; }
.period-row.status-ongoing { border-left-color: #a26a77; }
.period-row.status-ended { border-left-color: #777386; }
.period-row time { color: var(--wine); font-size: 13px; font-weight: 750; }
.period-row-details { min-width: 0; display: grid; gap: 4px; }
.period-row-details strong { font-family: var(--serif); font-size: 17px; }
.period-row-details small { color: var(--muted); font-size: 12px; }
.period-row-details p { margin: 5px 0 0; color: #615758; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.vertical-actions { display: grid !important; gap: 0 !important; }

.stats-intro { align-items: end; }
.month-filter { min-width: 190px; }
.mood-summary { margin-bottom: 18px; padding: 15px 19px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid #dac9c4; border-radius: 12px; background: rgba(255, 253, 249, 0.8); }
.mood-summary strong { font-family: var(--serif); font-size: 19px; }
.mood-summary span { color: var(--muted); font-size: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.stats-card { padding: 28px; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.stats-card.boyfriend { border-top: 4px solid var(--ink); }
.stats-card.girlfriend { border-top: 4px solid var(--wine); }
.stats-card-heading { margin-bottom: 25px; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 13px; }
.avatar-letter { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-family: var(--serif); font-size: 21px; }
.girlfriend .avatar-letter { background: var(--wine); }
.stats-card-heading h2 { margin: 0; font-family: var(--serif); font-size: 24px; }
.stats-card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.stats-total { color: #d8cdca; font-family: Georgia, serif; font-size: 43px; }
.mood-bars { display: grid; gap: 11px; }
.mood-bar-row { display: grid; grid-template-columns: 116px 1fr 25px; align-items: center; gap: 10px; }
.mood-bar-label { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mood-bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: #eee8e5; }
.mood-bar-fill { height: 100%; display: block; border-radius: inherit; transition: width 0.45s ease; }
.mood-count { color: var(--muted); font-size: 13px; text-align: right; }

.site-footer { padding: 44px 24px 36px; color: #8d7e7d; font-family: var(--serif); font-size: 14px; text-align: center; }
.site-footer p { margin: 6px 0; }
.site-footer span { color: var(--wine); }
.filing-footer { min-height: 48px; padding: 12px 20px 16px; color: #8e807e; background: var(--background); font-size: 12px; text-align: center; }
.filing-footer p { margin: 0; }
.filing-links a { color: #7f706f; text-decoration: none; }
.filing-links a:hover { text-decoration: underline; }

dialog { width: min(680px, calc(100% - 28px)); max-height: 92vh; padding: 0; overflow-y: auto; border: 1px solid #d2c0bb; border-radius: 18px; color: var(--foreground); background: var(--paper); box-shadow: 0 30px 90px rgba(48, 34, 37, 0.26); }
dialog::backdrop { background: rgba(38, 32, 35, 0.58); backdrop-filter: blur(3px); }
.small-dialog { width: min(480px, calc(100% - 28px)); }
.wide-dialog { width: min(780px, calc(100% - 28px)); }
.dialog-form { padding: 29px; gap: 19px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin: 0; font-family: var(--serif); font-size: 26px; }
.dialog-heading .eyebrow { margin-bottom: 3px; }
.dialog-description { margin: -8px 0 4px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: end; gap: 10px; margin-top: 4px; }
.gallery-upload-form { padding: 18px; display: grid; gap: 15px; border: 1px solid #e1d4ce; border-radius: 13px; background: #faf5f2; }
.gallery-drop { min-height: 145px; padding: 22px; display: grid; place-items: center; align-content: center; gap: 5px; border: 1px dashed #cdb2b6; border-radius: 11px; color: var(--muted); background: #fff; cursor: pointer; text-align: center; }
.gallery-drop:hover { border-color: var(--wine); background: #fffbfc; }
.gallery-drop:focus-within { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(143, 57, 76, 0.1); }
.gallery-drop input { width: 1px; min-height: 1px; height: 1px; position: absolute; opacity: 0; }
.gallery-drop-icon { color: var(--wine); font-size: 33px; font-weight: 400; }
.gallery-drop strong { color: #54494b; font-size: 16px; }
.gallery-drop small { font-size: 12px; }
.gallery-selection { min-width: 0; padding: 9px; display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 12px; border: 1px solid #dfd2cd; border-radius: 11px; background: #fff; }
.gallery-selection img { width: 92px; height: 78px; display: block; object-fit: contain; border-radius: 8px; background: #eee8e4; }
.gallery-selection div { min-width: 0; display: grid; gap: 5px; }
.gallery-selection strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-selection small { color: var(--muted); font-size: 13px; }
.upload-message { min-height: 20px; margin: -2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.upload-message[data-type="ready"], .upload-message[data-type="success"] { color: var(--green); }
.upload-message[data-type="busy"] { color: var(--wine); }
.upload-message[data-type="error"] { color: #a33b44; }
.gallery-manager-list { display: grid; gap: 11px; }
.gallery-manager-card { padding: 10px; display: grid; grid-template-columns: 110px 1fr; gap: 12px; border: 1px solid #e1d5d0; border-radius: 11px; background: #fff; }
.gallery-manager-card img { width: 110px; height: 106px; object-fit: cover; border-radius: 8px; }
.gallery-manager-fields { min-width: 0; display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.gallery-manager-fields input { min-width: 0; min-height: 39px; }
.inline-actions { display: flex; align-items: center; gap: 13px; }
.gallery-manager-fields .inline-actions { grid-column: 1 / -1; }
.existing-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.existing-photo-grid:empty { display: none; }
.existing-photo { padding: 9px; display: grid; gap: 8px; border: 1px solid #e0d5d0; border-radius: 10px; background: #fff; }
.existing-photo img { width: 100%; height: 150px; object-fit: cover; border-radius: 7px; }
.existing-photo input { min-height: 39px; }

.lightbox { padding: 30px; display: grid; place-items: center; align-content: center; position: fixed; z-index: 50; inset: 0; background: rgba(22, 20, 23, 0.92); }
.lightbox img { max-width: min(1100px, 94vw); max-height: 82vh; display: block; border-radius: 6px; box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35); }
.lightbox p { max-width: 760px; margin: 14px 0 0; color: #f7eeee; text-align: center; line-height: 1.6; }
.lightbox-close { width: 44px; height: 44px; position: fixed; top: 18px; right: 20px; border: 1px solid rgba(255, 255, 255, 0.42); border-radius: 50%; color: #fff; background: rgba(0, 0, 0, 0.25); cursor: pointer; font-size: 28px; }
.toast { max-width: calc(100% - 32px); padding: 12px 17px; position: fixed; z-index: 70; left: 50%; top: 18px; transform: translate(-50%, -18px); border-radius: 10px; color: #fff; background: #51494a; box-shadow: 0 13px 35px rgba(45, 32, 35, 0.25); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.toast[data-type="error"] { background: #a33b44; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: auto 1fr; gap: 15px; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-self: stretch; justify-content: center; border-top: 1px solid #e8ddd8; }
  .account-actions { justify-self: end; }
  .home-grid { grid-template-columns: 1fr; }
  .checkin-card { min-height: 0; }
  .goal-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diary-shell { grid-template-columns: 1fr; }
  .composer-panel { position: static; }
  .prediction-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-layout { grid-template-columns: 1fr; }
}

@media (max-width: 740px) {
  .topbar { padding: 9px 13px 0; gap: 8px; }
  .brand-lockup small { display: none; }
  .account-actions span:last-child { display: none; }
  .main-nav { margin: 0 -13px; padding: 5px 9px 7px; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-link { flex: 0 0 auto; padding: 7px 11px; }
  .app-section { width: min(100% - 24px, 680px); padding-top: 34px; }
  .page-intro { align-items: start; }
  .page-intro h1 { font-size: 37px; }
  .home-intro .primary-button { flex: 0 0 auto; }
  .carousel-card, .carousel-stage, .carousel-slide, .carousel-empty { min-height: 420px; height: 420px; }
  .recent-grid { grid-template-columns: 1fr; }
  .recent-card { min-height: 0; }
  .goal-columns { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-intro { align-items: start; flex-direction: column; }
  .month-filter { width: 100%; }
  .mood-summary { align-items: start; flex-direction: column; gap: 4px; }
  .composer-panel, .timeline-panel, .period-form-card, .period-history-card, .stats-card { padding: 23px 19px; }
  .mood-picker { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .mood-option { padding-inline: 1px; }
  .entry-card { padding: 22px 49px 22px 18px; }
  .entry-actions { right: 9px; opacity: 0.65; }
  .entry-photo-grid .photo-open-button { height: 150px; }
  .period-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .period-row time { grid-column: 1 / -1; }
  .gallery-manager-card { grid-template-columns: 88px 1fr; }
  .gallery-manager-card img { width: 88px; height: 100%; min-height: 100px; }
}

@media (max-width: 520px) {
  .locked-page { padding: 30px 15px; }
  .locked-page::before { inset: 11px; }
  .locked-page::after { inset: 17px; }
  .login-card { padding: 58px 25px 31px; }
  .topbar { min-height: 66px; }
  .brand-seal { width: 36px; height: 36px; font-size: 10px; }
  .brand-lockup strong { font-size: 17px; }
  .page-intro { margin-bottom: 22px; }
  .page-intro h1 { font-size: 33px; }
  .home-intro { display: grid; }
  .home-intro .primary-button { width: 100%; }
  .memory-count { display: none; }
  .carousel-card, .carousel-stage, .carousel-slide, .carousel-empty { min-height: 380px; height: 380px; }
  .overlay-heading { padding: 19px; }
  .overlay-heading h2 { font-size: 22px; }
  .carousel-slide figcaption { padding: 22px 20px 51px; display: grid; gap: 3px; }
  .checkin-card, .recent-section { padding: 21px 17px; }
  .card-heading h2 { font-size: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .mood-picker { grid-template-columns: repeat(5, 1fr); }
  .mood-emoji { font-size: 18px; }
  .mood-option small { font-size: 12px; }
  #mobile-new-button { display: inline-flex; }
  .photo-field-heading { align-items: flex-start; flex-direction: column; }
  .photo-draft { grid-template-columns: 68px 1fr; }
  .photo-draft img { width: 68px; height: 68px; }
  .photo-draft-details { grid-template-columns: 1fr; }
  .photo-draft-details strong { grid-column: auto; }
  .photo-draft-details .text-button { justify-self: start; }
  .entry-meta { display: grid; justify-content: stretch; }
  .entry-author { width: fit-content; }
  .entry-photo-grid { grid-template-columns: 1fr; }
  .entry-photo-grid .photo-open-button { height: 210px; }
  .entry-photo-grid.count-1 .photo-open-button { height: 240px; }
  .prediction-grid { grid-template-columns: 1fr; }
  .prediction-card { min-height: 132px; }
  .mood-bar-row { grid-template-columns: 103px 1fr 22px; gap: 7px; }
  .dialog-form { padding: 23px 17px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .gallery-manager-card { grid-template-columns: 1fr; }
  .gallery-manager-card img { width: 100%; height: 170px; }
  .gallery-manager-fields { grid-template-columns: 1fr; }
  .gallery-manager-fields .inline-actions { grid-column: auto; }
  .gallery-selection { grid-template-columns: 72px minmax(0, 1fr); }
  .gallery-selection img { width: 72px; height: 66px; }
  .existing-photo-grid { grid-template-columns: 1fr; }
  .lightbox { padding: 18px; }
}

@media (max-width: 380px) {
  .mood-picker { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
