:root {
  color-scheme: light;
  --page: #171310;
  --surface: #f8f2e8;
  --surface-soft: #efe4d6;
  --ink: #302821;
  --ink-soft: #6f6053;
  --muted: #9a897a;
  --line: #d8c8b6;
  --accent: #a86752;
  --accent-dark: #7e4a3b;
  --accent-soft: #ead8cb;
  --yellow: #d9b676;
  --yellow-soft: #efe3ca;
  --yellow-deep: #a97820;
  --gold: #c4a36f;
  --rose-mist: #eedbd8;
  --on-photo: #fbf5eb;
  --on-photo-soft: #e4d5c5;
  --success: #75a987;
  --danger: #d84b69;
  --shadow: 0 24px 70px rgba(151, 101, 115, 0.09);
  --radius-large: 28px;
  --radius-medium: 20px;
  --radius-small: 14px;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold",
    "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--on-photo);
  background:
    linear-gradient(180deg, rgba(17, 13, 11, 0.32), rgba(17, 13, 11, 0.72)),
    var(--scene-image) center / cover fixed no-repeat,
    var(--page);
  font-weight: 500;
}

body[data-scene="today"] {
  --scene-image: url("assets/backgrounds/today-big-ben.jpg");
}

body[data-scene="food"] {
  --scene-image: url("assets/backgrounds/food-cafe-table.jpg");
}

body[data-scene="plan"] {
  --scene-image: url("assets/backgrounds/paris-eiffel.jpg");
}

body[data-scene="writing"] {
  --scene-image: url("assets/backgrounds/writing-surf-coffee.jpg");
}

body::after {
  position: fixed;
  z-index: 50;
  inset: 9px;
  border: 1px solid rgba(246, 232, 211, 0.38);
  border-radius: 22px;
  content: "";
  pointer-events: none;
  box-shadow: inset 0 0 0 5px rgba(22, 18, 15, 0.2);
}

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

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(239, 113, 159, 0.3);
  outline-offset: 3px;
}

.app-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff9fc;
  background: linear-gradient(145deg, #f8a7bd, var(--accent));
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(217, 83, 129, 0.25);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.primary-button {
  color: #fffaf4;
  background: linear-gradient(145deg, #f1b4c6, var(--accent));
  box-shadow:
    0 8px 22px rgba(181, 100, 129, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary-button > span {
  margin-right: 6px;
  font-size: 1.15rem;
  font-weight: 400;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
}

.secondary-button:hover {
  background: var(--surface-soft);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.danger-button:hover {
  background: #873126;
}

.intro {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: center;
  gap: 38px;
  padding: 70px 0 52px;
}

.intro-content {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-family: "Snell Roundhand", "Apple Chancery", "Brush Script MT", cursive;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: none;
}

.intro h1 {
  margin: 13px 0 12px;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: clamp(2.7rem, 6vw, 5.2rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.12;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.62);
}

.intro-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.current-date {
  display: inline-flex;
  margin: 24px 0 0;
  border: 1px solid rgba(218, 85, 132, 0.18);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--accent-dark);
  background: rgba(255, 250, 253, 0.78);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 5px 18px rgba(197, 88, 128, 0.08);
}

.hero-mascot {
  position: relative;
  justify-self: end;
  width: 276px;
  height: 276px;
  padding: 10px;
}

.hero-mascot::before {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(214, 163, 178, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.94) 0 58%, transparent 59%),
    repeating-conic-gradient(
      from 0deg,
      rgba(234, 200, 207, 0.42) 0deg 2deg,
      transparent 2deg 9deg
    );
  box-shadow:
    0 0 0 7px rgba(255, 253, 249, 0.9),
    0 0 0 8px rgba(224, 180, 191, 0.45),
    0 22px 46px rgba(166, 111, 127, 0.12);
  content: "";
}

.hero-mascot img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  mix-blend-mode: multiply;
  transform: rotate(-2deg);
}

.hero-lace-bow {
  position: absolute;
  z-index: 3;
  top: 1px;
  right: 28px;
  font-size: 2rem;
  filter: drop-shadow(0 4px 5px rgba(150, 102, 116, 0.13));
  transform: rotate(9deg);
}

.hero-sparkle {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 252, 254, 0.88);
  box-shadow: 0 6px 18px rgba(197, 88, 128, 0.12);
  font-weight: 800;
}

.sparkle-one {
  top: 12px;
  left: 3px;
  transform: rotate(-12deg);
}

.sparkle-two {
  top: 38px;
  right: -2px;
  color: #fff;
  background: #f78bb0;
}

.sparkle-three {
  right: 20px;
  bottom: 0;
  width: 27px;
  height: 27px;
  font-size: 0.7rem;
}

.app-notice {
  margin: 0 0 18px;
  border: 1px solid #edbbd0;
  border-radius: var(--radius-small);
  padding: 12px 15px;
  color: #8d3655;
  background: #fff2f7;
  font-size: 0.9rem;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 22px;
  align-items: start;
}

.dashboard > *,
.panel,
.app-view {
  min-width: 0;
  max-width: 100%;
}

.panel {
  position: relative;
  border: 1px solid rgba(239, 211, 224, 0.96);
  border-radius: var(--radius-large);
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 245, 0.76)),
    var(--surface);
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.58),
    var(--shadow);
}

.panel::before {
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(218, 173, 185, 0.38);
  border-radius: calc(var(--radius-large) - 9px);
  content: "";
  pointer-events: none;
}

.panel::after {
  position: absolute;
  right: 20px;
  bottom: 14px;
  color: rgba(226, 150, 174, 0.2);
  content: "❀";
  font-size: 1.35rem;
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.panel-heading h2,
.modal-heading h2 {
  margin: 6px 0 0;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
}

.panel-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-card {
  border: 1px solid #f4cddd;
  border-radius: var(--radius-medium);
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), transparent),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.2) 0 8px,
      rgba(247, 205, 219, 0.14) 8px 16px
    ),
    var(--accent-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.summary-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.summary-number {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.summary-number strong {
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: 2.65rem;
  font-weight: 700;
  line-height: 1;
}

.summary-number span {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.summary-label {
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.progress-track {
  height: 7px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(151, 70, 104, 0.12);
}

.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f48cb1, #e45c8e);
  transition: width 280ms ease;
}

.summary-caption {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.habit-list,
.history-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.habit-item {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 9px 10px 9px 12px;
  background: #fffbfd;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.habit-item:hover {
  border-color: #e7b8cb;
}

.habit-item.is-complete {
  border-color: #cfe5d5;
  background: #f4fbf5;
}

.habit-toggle {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 13px;
  border-radius: 9px;
  cursor: pointer;
}

.habit-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.checkmark {
  position: relative;
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border: 1.5px solid #dbb6c6;
  border-radius: 50%;
  background: #fff;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.checkmark::after {
  width: 9px;
  height: 5px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.habit-checkbox:checked + .checkmark {
  border-color: var(--success);
  background: var(--success);
}

.habit-checkbox:checked + .checkmark::after {
  opacity: 1;
}

.habit-checkbox:focus-visible + .checkmark {
  outline: 3px solid rgba(239, 113, 159, 0.3);
  outline-offset: 3px;
}

.habit-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.is-complete .habit-name {
  color: #6f8675;
  text-decoration: line-through;
  text-decoration-color: rgba(111, 134, 117, 0.5);
}

.habit-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  border: 1px dashed #e8b9cc;
  border-radius: var(--radius-medium);
  padding: 30px;
  text-align: center;
}

.empty-mascot {
  display: block;
  width: 94px;
  height: 94px;
  margin: 0 auto 13px;
  border-radius: 50%;
  object-fit: cover;
  mix-blend-mode: multiply;
}

.empty-state h3 {
  margin: 0;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.empty-state p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.text-button {
  border: 0;
  padding: 4px;
  color: var(--accent-dark);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

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

.calendar {
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.month-label {
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 800;
}

.calendar-nav {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.calendar-nav:hover:not(:disabled) {
  border-color: #e1aec2;
  background: var(--surface-soft);
}

.calendar-nav:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 700;
  text-align: center;
}

.calendar-grid {
  row-gap: 4px;
}

.calendar-day,
.calendar-blank {
  aspect-ratio: 1;
  min-height: 38px;
}

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  align-self: center;
  width: 100%;
  max-width: 42px;
  margin: 0 auto;
  border: 0;
  border-radius: 13px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.8rem;
  cursor: pointer;
}

.calendar-day:hover:not(:disabled) {
  background: var(--surface-soft);
}

.calendar-day:disabled {
  color: #d8c1ca;
  cursor: not-allowed;
}

.calendar-day.is-today {
  color: var(--accent-dark);
  font-weight: 800;
}

.calendar-day.is-selected {
  color: #fffafd;
  background: var(--accent);
  box-shadow: 0 5px 13px rgba(205, 78, 124, 0.22);
}

.day-state {
  position: absolute;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  opacity: 0;
}

.calendar-day.is-partial .day-state {
  opacity: 1;
  background: var(--accent);
}

.calendar-day.is-full .day-state {
  width: 11px;
  opacity: 1;
  background: var(--success);
}

.calendar-day.is-selected .day-state {
  background: #fffafd;
}

.day-journal {
  position: absolute;
  top: 1px;
  right: 2px;
  color: var(--accent);
  font-size: 0.62rem;
  line-height: 1;
}

.calendar-day.is-selected .day-journal {
  color: #fffafd;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.68rem;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.legend-dot.full {
  width: 11px;
  background: var(--success);
}

.legend-heart {
  color: var(--accent);
  font-size: 0.85rem;
  font-style: normal;
  line-height: 1;
}

.day-detail {
  padding-top: 20px;
}

.day-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.day-detail-heading h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.detail-count {
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.7rem;
  font-weight: 800;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #f3e1e8;
  padding: 9px 2px;
  font-size: 0.82rem;
}

.history-item:last-child {
  border-bottom: 0;
}

.history-item-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.history-item-name::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 1.5px solid #d8bac7;
  border-radius: 50%;
  content: "";
}

.history-item.is-done .history-item-name::before {
  border-color: var(--success);
  background: var(--success);
}

.history-item-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
}

.history-item.is-done .history-status {
  color: var(--success);
  font-weight: 700;
}

.history-empty {
  margin: 16px 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-journal {
  margin-top: 16px;
  border: 1px solid #f2d2df;
  border-radius: 16px;
  padding: 13px 14px;
  background: linear-gradient(135deg, #fff6fa, #fff0f5);
}

.history-journal-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
}

.history-journal-mood {
  font-size: 1.15rem;
}

.history-journal-block {
  margin-top: 9px;
}

.history-journal-block > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.history-journal-block p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.journal-section {
  position: relative;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid rgba(241, 198, 215, 0.96);
  border-radius: var(--radius-large);
  padding: 30px;
  background:
    radial-gradient(circle at 92% 7%, rgba(255, 255, 255, 0.95), transparent 12rem),
    linear-gradient(135deg, rgba(255, 234, 242, 0.96), rgba(255, 249, 252, 0.98));
  box-shadow: var(--shadow);
}

.journal-section::after {
  position: absolute;
  right: 34px;
  bottom: -25px;
  color: rgba(233, 117, 157, 0.08);
  content: "♡";
  font-size: 10rem;
  font-weight: 800;
  line-height: 1;
  transform: rotate(-12deg);
  pointer-events: none;
}

.journal-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.journal-heading h2 {
  margin: 7px 0 5px;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: 1.65rem;
}

.journal-heading p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.journal-flower {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: #fffafd;
  box-shadow: 0 8px 20px rgba(205, 78, 124, 0.12);
  font-size: 1.5rem;
  transform: rotate(10deg);
}

.journal-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.journal-card {
  min-width: 0;
  border: 1px solid rgba(240, 206, 219, 0.95);
  border-radius: var(--radius-medium);
  padding: 20px;
  background: rgba(255, 252, 254, 0.94);
  box-shadow: 0 10px 28px rgba(163, 91, 120, 0.07);
}

.food-card {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.7), transparent 55%),
    #fff5f9;
}

.mood-card {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.7), transparent 55%),
    #fff0f5;
}

.journal-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mini-mascot {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 7px 18px rgba(182, 86, 122, 0.12);
}

.mini-mascot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  transform: scale(1.08);
}

.journal-friend {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.journal-card h3 {
  margin: 0;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: 1.08rem;
}

.journal-label {
  display: block;
  margin: 0 0 7px;
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 700;
}

.journal-textarea {
  display: block;
  width: 100%;
  min-height: 126px;
  resize: vertical;
  border: 1px solid #edccda;
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.87rem;
  line-height: 1.65;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.journal-textarea:focus {
  border-color: #eb93b3;
  background: #fff;
  outline: 3px solid rgba(239, 113, 159, 0.13);
}

.journal-textarea::placeholder {
  color: #ba96a5;
}

.note-textarea {
  min-height: 65px;
}

.journal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.67rem;
}

.journal-meta span:first-child {
  color: var(--accent-dark);
}

.mood-fieldset {
  min-width: 0;
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}

.mood-options {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.mood-choice {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 8px 3px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.62rem;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

.mood-choice:hover {
  transform: translateY(-1px);
  background: #fff;
}

.mood-choice:has(input:checked) {
  border-color: #eea1bd;
  color: var(--accent-dark);
  background: #fff;
  box-shadow: 0 5px 14px rgba(215, 95, 139, 0.1);
}

.mood-choice:focus-within {
  outline: 3px solid rgba(239, 113, 159, 0.25);
  outline-offset: 2px;
}

.mood-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.mood-face {
  font-size: 1.32rem;
  line-height: 1.15;
  filter: saturate(0.92);
}

.app-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 36px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.modal {
  width: min(450px, calc(100% - 32px));
  border: 0;
  border-radius: var(--radius-large);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 30px 100px rgba(100, 43, 67, 0.22);
}

.modal::backdrop {
  background: rgba(87, 47, 63, 0.38);
  backdrop-filter: blur(3px);
}

.modal[open] {
  animation: modal-in 180ms ease-out;
}

.modal-form {
  padding: 28px;
}

.modal-heading {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.text-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 13px 14px;
  color: var(--ink);
  background: #fffafd;
}

.text-field::placeholder {
  color: #bb99a7;
}

.text-field[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--danger);
  font-size: 0.76rem;
}

.delete-copy {
  margin: -8px 0 24px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.delete-copy strong {
  color: var(--ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 20px;
    padding: 56px 0 42px;
  }

  .hero-mascot {
    width: 220px;
    height: 220px;
  }

  .journal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-shell {
    width: min(calc(100% - 24px), 1180px);
    padding-top: 18px;
  }

  .app-header {
    gap: 12px;
  }

  .brand {
    font-size: 0.88rem;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    min-height: 42px;
    padding: 0 16px;
    font-size: 0.86rem;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 10px;
    padding: 48px 2px 34px;
  }

  .intro h1 {
    margin-top: 10px;
    font-size: clamp(2.2rem, 11vw, 3rem);
  }

  .intro-copy {
    font-size: 0.84rem;
  }

  .hero-mascot {
    width: 112px;
    height: 112px;
  }

  .hero-sparkle {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
  }

  .sparkle-one {
    top: -3px;
    left: -5px;
  }

  .sparkle-two {
    top: 6px;
    right: -4px;
  }

  .sparkle-three {
    display: none;
  }

  .current-date {
    margin-top: 18px;
  }

  .panel {
    border-radius: 21px;
    padding: 20px;
  }

  .panel-note {
    display: none;
  }

  .summary-number strong {
    font-size: 2.3rem;
  }

  .habit-item {
    min-height: 60px;
  }

  .habit-toggle {
    gap: 11px;
  }

  .habit-name {
    font-size: 0.92rem;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .calendar-day,
  .calendar-blank {
    min-height: 36px;
  }

  .journal-section {
    border-radius: 21px;
    padding: 20px;
  }

  .journal-heading {
    gap: 14px;
  }

  .journal-heading h2 {
    font-size: 1.35rem;
  }

  .journal-flower {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
  }

  .journal-card {
    padding: 16px;
  }

  .mood-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mood-choice {
    grid-template-columns: auto 1fr;
    justify-items: start;
    gap: 7px;
    padding: 9px 10px;
  }

  .mood-face {
    font-size: 1.18rem;
  }

  .app-footer {
    flex-wrap: wrap;
    padding-top: 28px;
  }

  .modal-form {
    padding: 24px 20px 20px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

[hidden] {
  display: none !important;
}

body {
  font-weight: 500;
  letter-spacing: 0.01em;
}

.app-nav {
  display: inline-flex;
  gap: 4px;
  margin-top: 24px;
  border: 1px solid rgba(229, 196, 204, 0.7);
  border-radius: 999px;
  padding: 5px;
  background: rgba(255, 252, 247, 0.82);
  box-shadow:
    0 8px 24px rgba(155, 91, 115, 0.07),
    inset 0 0 0 3px rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(10px);
}

.nav-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.nav-button span {
  color: var(--accent);
  font-size: 0.88rem;
}

.nav-button:hover {
  background: var(--yellow-soft);
}

.nav-button.is-active {
  color: var(--ink);
  background: linear-gradient(135deg, #ffedb4, #fbd6e1);
  box-shadow:
    inset 0 0 0 1px rgba(219, 155, 175, 0.16),
    0 3px 10px rgba(181, 121, 137, 0.08);
}

.app-view {
  opacity: 1;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 50px 0 30px;
}

.page-heading h1 {
  margin: 9px 0 9px;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "YouYuan",
    "Arial Rounded MT Bold", "Hiragino Sans GB", sans-serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.page-heading p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.food-mascot {
  width: 170px;
  height: 170px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 6px solid rgba(255, 255, 255, 0.75);
  border-radius: 46% 54% 52% 48%;
  background: rgba(255, 240, 185, 0.58);
  box-shadow:
    0 0 0 5px rgba(255, 250, 243, 0.88),
    0 0 0 6px rgba(226, 185, 195, 0.46),
    0 16px 36px rgba(170, 92, 119, 0.1);
  transform: rotate(3deg);
}

.food-mascot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  transform: scale(1.08);
}

.food-polaroid-mascot {
  width: 218px;
  height: 184px;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  padding: 9px 9px 29px;
  background: #fffefb;
  box-shadow:
    0 0 0 1px rgba(225, 190, 200, 0.55),
    0 18px 36px rgba(170, 112, 132, 0.12);
  transform: rotate(2deg);
}

.food-polaroid-mascot::before {
  position: absolute;
  z-index: 2;
  top: -12px;
  left: 50%;
  width: 76px;
  height: 25px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.34) 0 5px,
      transparent 5px 10px
    ),
    rgba(255, 220, 151, 0.72);
  content: "";
  transform: translateX(-50%) rotate(-3deg);
}

.food-polaroid-mascot::after {
  position: absolute;
  right: 10px;
  bottom: 6px;
  left: 10px;
  color: var(--accent-dark);
  content: "yummy day  ♡";
  font-family: "Snell Roundhand", "Apple Chancery", cursive;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.food-polaroid-mascot img {
  border-radius: 4px;
  object-position: center;
  transform: none;
}

.burn-pill {
  display: grid;
  justify-items: end;
  gap: 2px;
  border: 1px solid rgba(203, 151, 49, 0.18);
  border-radius: 14px;
  padding: 8px 11px;
  color: #976617;
  background: rgba(255, 239, 180, 0.72);
}

.burn-pill span {
  font-size: 0.63rem;
  font-weight: 700;
}

.burn-pill strong {
  font-size: 0.82rem;
}

.habit-text {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.habit-burn-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  color: #9b6a17;
  background: #fff2bd;
  font-size: 0.63rem;
  font-weight: 700;
}

.day-food-link {
  margin-top: 12px;
  text-decoration: none;
}

.mood-section {
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 224, 133, 0.45), transparent 14rem),
    radial-gradient(circle at 8% 100%, rgba(255, 201, 219, 0.46), transparent 18rem),
    linear-gradient(135deg, rgba(255, 248, 230, 0.98), rgba(255, 239, 246, 0.96));
}

.mood-section-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 22px;
  align-items: end;
}

.mood-mascot {
  width: 72px;
  height: 72px;
}

.mood-note-wrap {
  min-width: 0;
}

.mood-meta {
  grid-column: 1 / -1;
}

.food-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 9px 26px rgba(157, 95, 119, 0.07);
}

.return-today-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(228, 176, 190, 0.72);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--accent-dark);
  background: linear-gradient(145deg, #fffefb, #ffeaf1);
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.return-today-button:hover {
  border-color: var(--accent);
  background: #fff7fa;
}

.return-today-button span {
  font-size: 0.9rem;
}

.date-picker-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.date-picker {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--yellow-soft);
  font-weight: 800;
}

.date-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  max-width: 760px;
  margin: 0 auto 22px;
}

.date-chip {
  position: relative;
  display: grid;
  min-height: 64px;
  place-items: center;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.84);
  cursor: pointer;
}

.date-chip span {
  color: var(--muted);
  font-size: 0.62rem;
}

.date-chip strong {
  font-size: 1rem;
}

.date-chip:hover {
  border-color: #eab9ca;
  background: #fff;
}

.date-chip.is-selected {
  border-color: #f0aec4;
  color: #fff;
  background: linear-gradient(145deg, #f68bb2, var(--accent));
  box-shadow: 0 8px 18px rgba(210, 88, 132, 0.2);
}

.date-chip.is-selected span {
  color: rgba(255, 255, 255, 0.88);
}

.date-chip i {
  position: absolute;
  right: 7px;
  bottom: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.date-chip.is-selected i {
  background: #fff;
}

.food-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.food-stat {
  display: grid;
  min-height: 118px;
  align-content: center;
  border: 1px solid #f3d7df;
  border-radius: var(--radius-medium);
  padding: 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.68), transparent), #fff2f6;
  box-shadow: 0 10px 30px rgba(150, 83, 108, 0.07);
}

.food-stat span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.food-stat strong {
  margin: 4px 0 0;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold",
    sans-serif;
  font-size: 2rem;
  line-height: 1;
}

.food-stat small {
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 800;
}

.burn-stat {
  border-color: #efdda8;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.68), transparent), #fff5c9;
}

.burn-stat small {
  color: var(--yellow-deep);
}

.net-stat {
  border-color: #e9d5f1;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.68), transparent), #f8effb;
}

.net-stat small {
  color: #8b619a;
}

.health-stat.tone-high {
  border-color: #cce5d0;
  background: #f2fbf2;
}

.health-stat.tone-good {
  border-color: #eedca5;
  background: #fff9df;
}

.health-stat.tone-medium {
  border-color: #f0c7a5;
  background: #fff4e9;
}

.health-stat.tone-low {
  border-color: #efbdc8;
  background: #fff0f3;
}

.food-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  padding: 18px 20px;
  background: rgba(255, 253, 248, 0.84);
}

.food-overview h2 {
  margin: 4px 0 3px;
  font-family: "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 1.35rem;
}

.food-overview p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.target-pill {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 2px;
  border-radius: 14px;
  padding: 9px 12px;
  background: var(--yellow-soft);
}

.target-pill span {
  color: var(--yellow-deep);
  font-size: 0.62rem;
  font-weight: 700;
}

.target-pill strong {
  font-size: 0.84rem;
}

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

.meal-card {
  display: flex;
  min-width: 0;
  min-height: 310px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  padding: 18px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.78), transparent 50%),
    #fff7f9;
  box-shadow: 0 10px 28px rgba(150, 83, 108, 0.06);
}

.meal-lunch,
.meal-dinner {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.78), transparent 50%),
    #fffaeb;
}

.meal-teatime {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.78), transparent 50%),
    #fff2d6;
}

.meal-snack {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.78), transparent 50%),
    #fff0f6;
}

.meal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meal-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

.meal-heading h3 {
  margin: 0;
  font-family: "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 1.06rem;
}

.meal-total {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

.meal-heading-side {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 3px;
}

.meal-health-badge {
  border-radius: 999px;
  padding: 2px 6px;
  color: var(--muted);
  background: #f3ecee;
  font-size: 0.55rem;
  font-weight: 800;
}

.meal-health-badge.tone-good {
  color: #52745d;
  background: #eaf6ec;
}

.meal-health-badge.tone-medium,
.meal-health-badge.tone-light {
  color: #98651d;
  background: #fff0bd;
}

.meal-health-badge.tone-warn {
  color: #a94159;
  background: #ffe0e7;
}

.meal-target {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.64rem;
}

.food-entry-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.food-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 7px;
  border-radius: 11px;
  padding: 8px 8px 8px 10px;
  background: rgba(255, 255, 255, 0.72);
}

.food-entry-info {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.food-entry-info strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.food-entry-info span {
  color: var(--muted);
  font-size: 0.61rem;
}

.food-entry-kcal {
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.food-remove {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
}

.food-remove:hover {
  color: var(--danger);
  background: #fff0f3;
}

.meal-empty {
  border: 1px dashed rgba(214, 171, 186, 0.75);
  border-radius: 11px;
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.68rem;
}

.meal-advice {
  flex: 1;
  margin: 10px 0 12px;
  color: var(--ink-soft);
  font-size: 0.67rem;
  line-height: 1.55;
}

.add-food-button {
  min-height: 36px;
  border: 1px dashed #e4aabe;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.add-food-button:hover {
  border-style: solid;
  background: #fff;
}

.meal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.skip-meal-button {
  min-height: 36px;
  border: 1px solid rgba(229, 191, 202, 0.72);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  font-size: 0.67rem;
  font-weight: 700;
  cursor: pointer;
}

.skip-meal-button:hover {
  color: var(--accent-dark);
  background: #fff;
}

.legacy-food-card {
  grid-column: 1 / -1;
  border: 1px solid #eed7a4;
  border-radius: var(--radius-medium);
  padding: 15px 18px;
  background: #fff9e6;
}

.legacy-food-card strong {
  color: var(--yellow-deep);
  font-size: 0.76rem;
}

.legacy-food-card p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.advice-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  border: 1px solid #f0d49a;
  border-radius: var(--radius-large);
  padding: 20px 22px;
  background:
    radial-gradient(circle at 96% 20%, rgba(255, 255, 255, 0.7), transparent 8rem),
    linear-gradient(135deg, #fff3c8, #ffe6ef);
}

.advice-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: #fffafd;
  font-size: 1.35rem;
  box-shadow: 0 7px 18px rgba(165, 92, 120, 0.1);
}

.advice-banner h2 {
  margin: 0 0 4px;
  font-family: "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 1.05rem;
}

.advice-banner p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}

.advice-banner .text-button {
  justify-self: start;
  margin-top: 6px;
  text-decoration: none;
}

.estimate-note {
  align-self: end;
  color: var(--muted) !important;
  font-size: 0.62rem !important;
}

.plan-mascot {
  background: rgba(255, 222, 232, 0.64);
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.goal-panel {
  position: sticky;
  top: 18px;
}

.goal-form {
  display: grid;
  gap: 15px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.goal-form label,
.modal-food-row label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.goal-form input {
  width: 100%;
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 11px 48px 11px 12px;
  color: var(--ink);
  background: #fffdf9;
}

.goal-form input:focus {
  border-color: #eba0b9;
  outline: 3px solid rgba(239, 113, 159, 0.12);
}

.input-with-unit {
  position: relative;
  display: block;
}

.input-with-unit input {
  width: 100%;
  padding-right: 48px;
}

.input-with-unit em {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  transform: translateY(-50%);
  pointer-events: none;
}

.form-hint {
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.6;
}

.goal-form .primary-button {
  justify-self: start;
}

.plan-result {
  overflow: hidden;
  border: 1px solid #f0d39e;
  border-radius: var(--radius-large);
  padding: 24px;
  background:
    radial-gradient(circle at 94% 4%, rgba(255, 255, 255, 0.9), transparent 12rem),
    linear-gradient(135deg, #fff4cc, #ffe8f1);
  box-shadow: var(--shadow);
}

.plan-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.plan-hero h2 {
  margin: 5px 0 5px;
  font-family: "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 1.45rem;
}

.plan-hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.plan-target {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--accent-dark);
}

.plan-target strong {
  font-family: "Yuanti SC", "Hannotate SC", sans-serif;
  font-size: 2.6rem;
  line-height: 1;
}

.plan-target span {
  font-size: 0.7rem;
  font-weight: 800;
}

.plan-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.plan-metrics div {
  display: grid;
  gap: 4px;
  border-radius: 13px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.58);
}

.plan-metrics span {
  color: var(--muted);
  font-size: 0.62rem;
}

.plan-metrics strong {
  font-size: 0.8rem;
}

.plan-warning {
  margin: 12px 0 0;
  border: 1px solid #f0c793;
  border-radius: 12px;
  padding: 10px 12px;
  color: #8d5a1d;
  background: rgba(255, 250, 229, 0.86);
  font-size: 0.7rem;
  line-height: 1.6;
}

.body-composition-note {
  margin-top: 12px;
  border: 1px solid rgba(235, 192, 152, 0.8);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 249, 229, 0.72);
}

.body-composition-note strong {
  color: #915d23;
  font-size: 0.68rem;
}

.body-composition-note p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.69rem;
  line-height: 1.6;
}

.tomorrow-plan-wrap {
  margin-top: 20px;
}

.tomorrow-plan-wrap h3 {
  margin: 0 0 10px;
  font-family: "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 1rem;
}

.tomorrow-plan {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tomorrow-meal {
  border: 1px solid rgba(232, 193, 167, 0.8);
  border-radius: 13px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.75);
}

.tomorrow-meal > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
}

.tomorrow-meal > div span {
  color: var(--accent-dark);
  font-size: 0.67rem;
  font-weight: 800;
}

.tomorrow-meal p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.55;
}

.plan-empty {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed #e4c690;
  border-radius: 14px;
  padding: 25px;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
}

.plan-disclaimer {
  display: block;
  margin-top: 16px;
  line-height: 1.6;
}

.food-dialog {
  width: min(540px, calc(100% - 32px));
}

.food-reference {
  min-height: 18px;
  margin: 5px 0 9px;
  color: var(--muted);
  font-size: 0.68rem;
}

.food-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -1px 0 11px;
}

.food-quick-pick {
  border: 1px solid rgba(228, 190, 201, 0.72);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--ink-soft);
  background: #fffafb;
  font-size: 0.63rem;
  cursor: pointer;
}

.food-quick-pick:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #fff2f6;
}

.modal-food-row {
  margin-top: 10px;
}

.text-field select,
select.text-field {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.food-calorie-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 15px;
  border-radius: 13px;
  padding: 12px 14px;
  background: var(--yellow-soft);
}

.food-calorie-preview span {
  color: var(--yellow-deep);
  font-size: 0.72rem;
  font-weight: 700;
}

.food-calorie-preview strong {
  color: var(--accent-dark);
  font-size: 1rem;
}

.auto-calorie-note {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.55;
}

.modal-input-unit {
  width: 100%;
}

.burn-field-label {
  margin-top: 14px;
}

.day-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.writing-heading {
  padding-bottom: 24px;
}

.writing-mascot {
  background: rgba(255, 238, 187, 0.72);
}

.writing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.writing-main {
  display: grid;
  gap: 16px;
}

.writing-inspiration {
  background:
    radial-gradient(circle at 96% 4%, rgba(255, 226, 142, 0.38), transparent 11rem),
    linear-gradient(145deg, #fffdf8, #fff8e9);
}

.writing-inspiration .panel-heading {
  align-items: center;
  margin-bottom: 16px;
}

.soft-button {
  min-height: 36px;
  border: 1px solid #efd293;
  border-radius: 999px;
  padding: 0 13px;
  color: #946018;
  background: #fff4c9;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

.soft-button:hover {
  background: #ffeba0;
}

.inspiration-prompt {
  position: relative;
  margin: 0 0 16px;
  border: 1px solid #f1d59c;
  border-radius: 17px;
  padding: 18px 20px 18px 50px;
  color: var(--ink);
  background: rgba(255, 250, 231, 0.86);
  font-family: "Yuanti SC", "Hannotate SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.65;
}

.inspiration-prompt::before {
  position: absolute;
  top: 14px;
  left: 18px;
  color: #e7a32d;
  content: "“";
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1;
}

.writing-ideas {
  min-height: 108px;
}

.writing-studio {
  background:
    radial-gradient(circle at 96% 8%, rgba(255, 203, 219, 0.25), transparent 13rem),
    linear-gradient(145deg, #fffdf9, #fff6fa);
}

.writing-draft {
  min-height: 290px;
  background:
    linear-gradient(transparent 31px, rgba(234, 194, 207, 0.2) 32px),
    #fffdfa;
  background-size: 100% 32px;
  font-size: 0.92rem;
  line-height: 2;
}

.upload-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  border: 1px dashed #e5b9c8;
  border-radius: 15px;
  padding: 13px 14px;
  background: rgba(255, 245, 249, 0.76);
}

.upload-panel strong {
  font-size: 0.78rem;
}

.upload-panel p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.upload-button {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 9px 13px;
  color: #fff;
  background: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

.upload-button:hover {
  background: var(--accent-dark);
}

.uploaded-file {
  margin-top: 9px;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff3d5;
}

.uploaded-file > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.uploaded-file strong {
  font-size: 0.76rem;
}

.uploaded-file span {
  color: var(--yellow-deep);
  font-size: 0.64rem;
}

.uploaded-file .text-button {
  margin-top: 2px;
  color: var(--accent-dark);
  font-size: 0.66rem;
}

.uploaded-file > p {
  max-height: 170px;
  overflow: auto;
  margin: 8px 0 0;
  border-top: 1px solid rgba(206, 160, 80, 0.2);
  padding-top: 8px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.writing-plan-panel {
  position: sticky;
  top: 18px;
  border: 1px solid #efd59e;
  border-radius: var(--radius-large);
  padding: 22px;
  background:
    radial-gradient(circle at 92% 2%, rgba(255, 255, 255, 0.8), transparent 9rem),
    linear-gradient(145deg, #fff8da, #fff1f6);
  box-shadow: var(--shadow);
}

.writing-plan-panel .panel-heading {
  margin-bottom: 17px;
}

.writing-plan-result {
  margin-top: 18px;
  border-top: 1px solid rgba(215, 171, 105, 0.3);
  padding-top: 16px;
}

.writing-plan-result > h3 {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-family: "Yuanti SC", "Hannotate SC", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 0.82rem;
  line-height: 1.55;
}

.writing-plan-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.writing-plan-metrics div {
  display: grid;
  gap: 3px;
  border-radius: 11px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.64);
}

.writing-plan-metrics span {
  color: var(--muted);
  font-size: 0.58rem;
}

.writing-plan-metrics strong {
  color: var(--accent-dark);
  font-size: 0.75rem;
}

.writing-milestones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.writing-milestone {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(229, 195, 131, 0.65);
  border-radius: 11px;
  padding: 9px;
  background: rgba(255, 253, 245, 0.68);
}

.writing-milestone strong {
  font-size: 0.66rem;
}

.writing-milestone span {
  color: var(--accent-dark);
  font-size: 0.69rem;
  font-weight: 800;
}

.writing-milestone small {
  color: var(--muted);
  font-size: 0.58rem;
}

.writing-routine {
  margin: 11px 0 0;
  border-radius: 11px;
  padding: 10px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.66rem;
  line-height: 1.6;
}

.app-shell {
  position: relative;
}

.app-shell::before {
  position: absolute;
  z-index: -1;
  top: 118px;
  left: 50%;
  width: min(1120px, calc(100% - 18px));
  height: calc(100% - 150px);
  border: 1px solid rgba(199, 163, 171, 0.16);
  border-radius: 38px;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.intro::after {
  position: absolute;
  right: 24px;
  bottom: 23px;
  color: rgba(177, 132, 145, 0.48);
  content: "✧ ─── ❀ ─── ✧";
  font-family: "Snell Roundhand", "Apple Chancery", cursive;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.section-kicker::before {
  margin-right: 5px;
  content: "✦";
  font-family: sans-serif;
  font-size: 0.66em;
}

.panel-heading h2,
.modal-heading h2,
.food-overview h2,
.meal-heading h3,
.writing-plan-result > h3 {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.current-date {
  border-color: rgba(219, 174, 186, 0.55);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 244, 235, 0.78));
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.5),
    0 6px 18px rgba(164, 105, 123, 0.08);
}

.current-date::before {
  margin-right: 6px;
  color: var(--accent);
  content: "❀";
}

.journal-section,
.writing-plan-panel,
.plan-result,
.advice-banner {
  position: relative;
  border: 1px solid rgba(227, 187, 196, 0.8);
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.52),
    var(--shadow);
  outline: 1px solid rgba(225, 177, 190, 0.3);
  outline-offset: 5px;
}

.journal-section::before,
.writing-plan-panel::before,
.plan-result::before {
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(218, 173, 185, 0.34);
  border-radius: calc(var(--radius-large) - 9px);
  content: "";
  pointer-events: none;
}

.meal-card,
.food-overview,
.food-stat {
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.48),
    0 10px 28px rgba(150, 83, 108, 0.06);
}

.food-stat {
  position: relative;
  overflow: hidden;
}

.food-stat::after {
  position: absolute;
  top: 7px;
  right: 10px;
  color: rgba(218, 138, 163, 0.23);
  content: "✦";
  font-size: 0.9rem;
}

.meal-card {
  position: relative;
  border-color: rgba(232, 195, 204, 0.72);
  outline: 1px dashed rgba(229, 189, 201, 0.65);
  outline-offset: -7px;
}

.meal-card::after {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: rgba(215, 145, 167, 0.18);
  content: "♡";
  font-size: 1.25rem;
  pointer-events: none;
}

.text-field,
.goal-form input,
.journal-textarea {
  border-color: rgba(223, 190, 199, 0.78);
  background-color: rgba(255, 253, 249, 0.9);
}

.icon-button:hover,
.calendar-nav:hover:not(:disabled) {
  background: #fff7ed;
}

.app-footer::before {
  color: var(--accent);
  content: "❀";
}

.calendar-center {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.calendar {
  border: 1px solid rgba(226, 190, 200, 0.62);
  border-radius: 20px;
  padding: 15px 14px 17px;
  background:
    radial-gradient(circle at 0 0, rgba(239, 208, 215, 0.28), transparent 4rem),
    radial-gradient(circle at 100% 100%, rgba(255, 234, 170, 0.28), transparent 5rem),
    rgba(255, 253, 249, 0.58);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.52);
}

.day-detail {
  margin-top: 14px;
  border: 1px solid rgba(230, 200, 207, 0.48);
  border-radius: 17px;
  padding: 16px;
  background: rgba(255, 251, 247, 0.56);
}

.calendar-day {
  transition:
    color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

.calendar-day:hover:not(:disabled) {
  transform: translateY(-1px);
}

.calendar-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px rgba(233, 135, 166, 0.42);
}

.calendar-today-button {
  min-height: 27px;
  border: 1px solid rgba(219, 174, 186, 0.52);
  border-radius: 999px;
  padding: 2px 12px;
  color: var(--accent-dark);
  background: linear-gradient(145deg, #fffdf9, #ffe5ed);
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.calendar-today-button::before {
  margin-right: 4px;
  content: "↺";
  font-size: 0.8rem;
}

.calendar-today-button:hover {
  border-color: var(--accent);
  background: #fff6f8;
}

.history-summary {
  margin-top: 12px;
  border: 1px solid rgba(207, 171, 111, 0.52);
  border-radius: 15px;
  padding: 13px 15px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), transparent),
    #fff8e5;
}

.history-summary > span {
  color: var(--gold);
  font-family: "Snell Roundhand", "Apple Chancery", cursive;
  font-size: 0.76rem;
  font-weight: 700;
}

.history-summary p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.73rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.daily-summary-section {
  overflow: visible;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 224, 231, 0.75), transparent 16rem),
    radial-gradient(circle at 92% 100%, rgba(255, 237, 182, 0.66), transparent 17rem),
    linear-gradient(145deg, #fff9f2, #fff0f5);
}

.daily-summary-section::after {
  right: 32px;
  bottom: -32px;
  content: "♡";
}

.daily-summary-heading {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.daily-summary-heading h2 {
  margin: 5px 0 4px;
  font-family:
    "Yuanti SC", "Hannotate SC", "HanziPen SC", "Hiragino Maru Gothic ProN",
    "Arial Rounded MT Bold", sans-serif;
  font-size: 1.55rem;
}

.daily-summary-heading p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.6;
}

.summary-seal {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 5px solid #fff;
  border-radius: 50%;
  background: var(--rose-mist);
  box-shadow:
    0 0 0 1px rgba(215, 174, 185, 0.7),
    0 0 0 6px rgba(255, 251, 247, 0.75),
    0 10px 22px rgba(152, 91, 113, 0.11);
}

.summary-seal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
}

.daily-summary-paper {
  position: relative;
  z-index: 1;
  min-height: 150px;
  margin-top: 20px;
  border: 1px solid rgba(214, 180, 144, 0.6);
  border-radius: 20px 20px 28px 28px;
  padding: 27px 31px 22px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.52)),
    repeating-linear-gradient(
      0deg,
      transparent 0 28px,
      rgba(218, 178, 188, 0.22) 28px 29px
    ),
    #fffdf8;
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.62),
    0 15px 34px rgba(149, 103, 118, 0.08);
}

.daily-summary-paper::before,
.daily-summary-paper::after {
  position: absolute;
  color: rgba(190, 130, 143, 0.42);
  content: "❀";
  font-size: 1rem;
}

.daily-summary-paper::before {
  top: 14px;
  left: 16px;
}

.daily-summary-paper::after {
  right: 16px;
  bottom: 12px;
}

.summary-date {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--gold);
  font-family: "Snell Roundhand", "Apple Chancery", cursive;
  font-size: 0.84rem;
  font-weight: 700;
}

.daily-summary-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.83rem;
  line-height: 1.9;
  white-space: pre-wrap;
}

.summary-generated-at {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  text-align: right;
}

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

  .writing-plan-panel {
    position: static;
  }
}

@media (max-width: 520px) {
  .nav-button {
    gap: 3px;
    font-size: 0.72rem;
  }

  .nav-button span {
    display: none;
  }

  .writing-inspiration .panel-heading {
    align-items: flex-start;
  }

  .upload-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-button {
    width: 100%;
    text-align: center;
  }

  .writing-plan-panel {
    padding: 18px;
  }

}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .plan-layout {
    grid-template-columns: 1fr;
  }

  .goal-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .intro::after {
    display: none;
  }

  .daily-summary-heading {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .daily-summary-heading > .soft-button {
    grid-column: 2;
    justify-self: start;
  }

  .daily-summary-paper {
    padding: 24px 20px 19px;
  }

  .page-heading {
    gap: 18px;
    padding: 38px 2px 24px;
  }

  .page-heading h1 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .food-mascot {
    width: 118px;
    height: 118px;
  }

  .food-polaroid-mascot {
    width: 142px;
    height: 122px;
    padding: 7px 7px 25px;
  }

  .mood-section-content {
    grid-template-columns: 1fr;
  }

  .food-stats {
    grid-template-columns: 1fr 1fr;
  }

  .food-stat {
    min-height: 102px;
  }

  .food-toolbar {
    width: 100%;
  }

  .date-picker-label {
    flex: 1;
    justify-content: center;
  }

  .date-strip {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .date-strip::-webkit-scrollbar {
    display: none;
  }

  .date-chip {
    min-width: 62px;
    flex: 0 0 62px;
  }

  .meal-grid {
    grid-template-columns: 1fr;
  }

  .meal-card {
    min-height: 0;
  }

  .advice-banner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .advice-banner .estimate-note {
    grid-column: 1 / -1;
  }

  .plan-metrics {
    grid-template-columns: 1fr;
  }

  .tomorrow-plan {
    grid-template-columns: 1fr;
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .nav-button {
    min-width: 0;
    justify-content: center;
    padding: 0 5px;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .page-heading {
    align-items: flex-end;
  }

  .food-mascot {
    width: 88px;
    height: 88px;
    border-width: 4px;
  }

  .food-polaroid-mascot {
    width: 108px;
    height: 105px;
    padding: 6px 6px 23px;
  }

  .food-overview {
    align-items: flex-start;
    flex-direction: column;
  }

  .target-pill {
    justify-items: start;
  }

  .food-stat {
    padding: 13px;
  }

  .food-stat strong {
    font-size: 1.65rem;
  }

  .form-row,
  .modal-food-row {
    grid-template-columns: 1fr;
  }

  .plan-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

.app-shell {
  z-index: 1;
}

.app-header .brand {
  color: var(--on-photo);
  text-shadow: 0 2px 14px rgba(10, 8, 7, 0.4);
}

.brand-mark {
  border: 1px solid rgba(255, 244, 226, 0.48);
  background: rgba(28, 23, 21, 0.54);
  box-shadow:
    0 0 0 4px rgba(255, 244, 226, 0.09),
    0 8px 20px rgba(10, 8, 7, 0.25);
  backdrop-filter: blur(10px);
}

.primary-button {
  color: #332820;
  background: linear-gradient(145deg, #f6ead8, #d9c09d);
  box-shadow:
    0 10px 26px rgba(17, 12, 10, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.primary-button:hover {
  color: #fffaf1;
  background: #9b604d;
}

.app-nav {
  border-color: rgba(246, 232, 213, 0.32);
  background: rgba(25, 20, 17, 0.42);
  box-shadow:
    0 12px 28px rgba(8, 7, 6, 0.18),
    inset 0 0 0 1px rgba(255, 249, 239, 0.08);
  backdrop-filter: blur(18px) saturate(0.8);
}

.nav-button {
  color: rgba(252, 245, 235, 0.76);
}

.nav-button span {
  color: #d9bd8e;
}

.nav-button:hover {
  color: var(--on-photo);
  background: rgba(255, 249, 239, 0.1);
}

.nav-button.is-active {
  color: #322922;
  background: linear-gradient(145deg, #fbf4e9, #dfc9a9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 5px 16px rgba(10, 8, 7, 0.2);
}

.intro-content,
.page-heading > div:first-child {
  border: 1px solid rgba(249, 235, 215, 0.3);
  border-radius: 32px 14px 32px 14px;
  padding: 30px 34px;
  background:
    linear-gradient(135deg, rgba(24, 19, 17, 0.62), rgba(24, 19, 17, 0.3));
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 240, 0.08),
    0 18px 44px rgba(7, 6, 5, 0.18);
  backdrop-filter: blur(12px) saturate(0.75);
}

.eyebrow,
.intro .section-kicker,
.page-heading .eyebrow {
  color: #dcc08e;
}

.intro h1,
.page-heading h1 {
  color: var(--on-photo);
  text-shadow: 0 3px 22px rgba(8, 6, 5, 0.52);
}

.intro-copy,
.page-heading p:last-child {
  color: var(--on-photo-soft);
  text-shadow: 0 1px 10px rgba(8, 6, 5, 0.45);
}

.current-date {
  border-color: rgba(249, 235, 215, 0.32);
  color: #f4e7d5;
  background: rgba(255, 248, 237, 0.1);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
}

.current-date::before {
  color: #d9bd8e;
}

.hero-mascot::before {
  border-color: rgba(247, 230, 204, 0.72);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 251, 244, 0.98) 0 58%, transparent 59%),
    repeating-conic-gradient(
      from 0deg,
      rgba(217, 183, 118, 0.42) 0deg 2deg,
      transparent 2deg 9deg
    );
  box-shadow:
    0 0 0 7px rgba(255, 248, 237, 0.12),
    0 0 0 8px rgba(217, 183, 118, 0.5),
    0 24px 52px rgba(7, 5, 4, 0.32);
}

.hero-mascot img,
.food-mascot img,
.mini-mascot img,
.summary-seal img,
.empty-mascot {
  filter: sepia(0.12) saturate(0.76) contrast(0.96);
}

.food-mascot {
  border-color: rgba(255, 247, 236, 0.82);
  background: rgba(245, 235, 218, 0.9);
  box-shadow:
    0 0 0 5px rgba(255, 250, 241, 0.16),
    0 0 0 6px rgba(200, 166, 116, 0.52),
    0 18px 42px rgba(8, 6, 5, 0.25);
}

.food-polaroid-mascot {
  background: #f7efe3;
}

.panel,
.writing-plan-panel,
.plan-result,
.daily-summary-section,
.mood-section,
.advice-banner {
  color: var(--ink);
  border-color: rgba(221, 198, 173, 0.76);
  background:
    linear-gradient(145deg, rgba(252, 248, 241, 0.94), rgba(241, 232, 220, 0.9));
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, 0.42),
    0 24px 60px rgba(6, 5, 4, 0.2);
  backdrop-filter: blur(18px) saturate(0.8);
}

.panel::before,
.journal-section::before,
.writing-plan-panel::before,
.plan-result::before {
  border-color: rgba(164, 130, 101, 0.32);
}

.panel::after {
  color: rgba(151, 103, 80, 0.22);
}

.summary-card,
.habit-item,
.calendar,
.day-detail,
.mood-choice,
.meal-card,
.food-overview,
.food-stat,
.journal-textarea,
.text-field,
.goal-form input,
.writing-milestone,
.tomorrow-meal {
  border-color: rgba(205, 183, 162, 0.68);
  background-color: rgba(250, 246, 239, 0.9);
}

.food-toolbar,
.date-chip,
.meal-card,
.food-overview,
.food-stat {
  color: var(--ink);
}

.summary-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.63), transparent),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.16) 0 8px,
      rgba(212, 188, 159, 0.13) 8px 16px
    ),
    #f5e9dc;
}

.meal-breakfast,
.meal-lunch,
.meal-dinner,
.meal-teatime,
.meal-snack {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.62), transparent 52%),
    rgba(248, 242, 233, 0.92);
}

.daily-summary-paper {
  background:
    linear-gradient(rgba(252, 248, 241, 0.88), rgba(252, 248, 241, 0.88)),
    url("assets/backgrounds/coffee-ticket.jpg") center / cover no-repeat;
}

.food-toolbar,
.date-chip {
  border-color: rgba(236, 220, 199, 0.58);
  background: rgba(250, 246, 239, 0.88);
  backdrop-filter: blur(14px);
}

.date-chip.is-selected {
  color: #fff9ef;
  background: #9b604d;
}

.calendar-today-button,
.return-today-button,
.soft-button {
  border-color: rgba(192, 153, 100, 0.48);
  color: #725143;
  background: rgba(250, 244, 234, 0.9);
}

.app-footer {
  color: rgba(249, 239, 226, 0.7);
  text-shadow: 0 1px 10px rgba(8, 6, 5, 0.45);
}

@media (max-width: 760px) {
  .intro-content,
  .page-heading > div:first-child {
    padding: 22px 20px;
    border-radius: 24px 12px 24px 12px;
  }

  body {
    background-attachment: scroll;
  }
}

.ios-install-hint {
  position: fixed;
  z-index: 70;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(242, 225, 201, 0.52);
  border-radius: 20px;
  padding: 13px 14px;
  color: #f9f1e5;
  background: rgba(27, 22, 19, 0.88);
  box-shadow: 0 16px 40px rgba(5, 4, 3, 0.3);
  backdrop-filter: blur(18px);
}

.ios-install-hint strong {
  font-size: 0.78rem;
}

.ios-install-hint p {
  margin: 3px 0 0;
  color: rgba(249, 241, 229, 0.75);
  font-size: 0.68rem;
  line-height: 1.5;
}

.ios-install-hint button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(249, 241, 229, 0.22);
  border-radius: 50%;
  color: #f9f1e5;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.15rem;
  cursor: pointer;
}

@media (max-width: 700px) {
  body {
    min-height: 100svh;
    overscroll-behavior-y: none;
    -webkit-text-size-adjust: 100%;
  }

  .app-shell {
    width: 100%;
    padding:
      max(14px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      calc(102px + env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .app-nav {
    position: fixed;
    z-index: 60;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: auto;
    border: 1px solid rgba(241, 224, 201, 0.34);
    border-radius: 22px;
    padding: 6px;
    background: rgba(24, 19, 17, 0.78);
    box-shadow:
      0 18px 42px rgba(6, 5, 4, 0.34),
      inset 0 0 0 1px rgba(255, 248, 238, 0.08);
    backdrop-filter: blur(22px) saturate(0.9);
  }

  .nav-button {
    display: flex;
    min-height: 52px;
    flex-direction: column;
    gap: 2px;
    padding: 5px 2px;
    font-size: 0.62rem;
  }

  .nav-button span {
    display: inline;
    font-size: 0.98rem;
  }

  .nav-button.is-active {
    color: #30271f;
    background: linear-gradient(145deg, #faf1e4, #dfc8a7);
  }

  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  .app-header .primary-button {
    min-height: 40px;
    padding: 0 13px;
    font-size: 0.74rem;
  }

  .intro {
    padding-top: 32px;
  }

  .intro-content,
  .page-heading > div:first-child {
    padding: 20px 18px;
  }

  .intro h1 {
    font-size: clamp(2.05rem, 10.5vw, 2.8rem);
  }

  .page-heading h1 {
    font-size: clamp(1.9rem, 9vw, 2.7rem);
  }

  .food-toolbar {
    margin-bottom: 14px;
  }

  .journal-section,
  .mood-section,
  .daily-summary-section {
    border-radius: 24px;
  }
}

html.is-standalone .ios-install-hint {
  display: none !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sync-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(246, 232, 213, 0.38);
  border-radius: 999px;
  padding: 0 14px;
  color: #f8efe3;
  background: rgba(25, 20, 17, 0.5);
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 249, 239, 0.06);
  backdrop-filter: blur(14px);
}

.sync-button span {
  color: #d9bd8e;
  font-size: 1rem;
}

.sync-button:hover {
  background: rgba(43, 34, 29, 0.75);
}

.sync-button.is-connected::after {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #92bd91;
  box-shadow: 0 0 0 2px rgba(146, 189, 145, 0.18);
  content: "";
}

.sync-dialog {
  width: min(520px, calc(100% - 32px));
}

.sync-status-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin-bottom: 19px;
  border: 1px solid rgba(207, 184, 161, 0.65);
  border-radius: 15px;
  padding: 13px 14px;
  background: rgba(239, 228, 214, 0.64);
}

.sync-status-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: #a99788;
}

.sync-status-dot.is-connected {
  background: #7fa17f;
  box-shadow: 0 0 0 3px rgba(127, 161, 127, 0.15);
}

.sync-status-card strong {
  font-size: 0.82rem;
}

.sync-status-card p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.6;
}

.sync-key-field {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.sync-key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.sync-key-actions .secondary-button {
  min-height: 36px;
  padding: 0 13px;
  font-size: 0.7rem;
}

.sync-qr {
  display: block;
  width: min(220px, 100%);
  height: auto;
  margin: 14px auto 4px;
  border: 1px solid rgba(210, 187, 165, 0.7);
  border-radius: 15px;
  background: #fbf6ed;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.55);
}

.sync-pairing-hint {
  margin: 5px auto 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.6;
  text-align: center;
}

.sync-help,
.sync-last-run {
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.6;
}

.sync-help {
  margin: 10px 0 0;
}

.sync-last-run {
  min-height: 18px;
  margin: 4px 0 0;
  text-align: right;
}

.sync-dialog-actions {
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .header-actions {
    gap: 6px;
  }

  .sync-button {
    min-height: 40px;
    padding: 0 11px;
    font-size: 0.7rem;
  }

  .sync-dialog-actions {
    grid-template-columns: 1fr;
  }

  .sync-dialog-actions .primary-button {
    grid-column: 1 / -1;
  }
}

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