:root {
  color-scheme: dark;

  /* Elevation */
  --bg: #0b0b0f;
  --surface: #17171d;
  --surface-2: #202027;
  --surface-3: #2b2b33;
  --track: #1b1b21;
  --thumb: #2e2e37;
  --thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);

  /* Text */
  --label: #f5f5f7;
  --label-2: rgba(235, 235, 245, 0.66);
  --label-3: rgba(235, 235, 245, 0.55);

  /* Hairlines */
  --separator: rgba(255, 255, 255, 0.1);
  --separator-strong: rgba(255, 255, 255, 0.2);
  --rule: rgba(255, 255, 255, 0.07);

  /* Accent */
  --accent: #0071e3;
  --accent-2: #0a84ff;
  --accent-text: #4da3ff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --on-accent: #ffffff;
  --green: #30d158;

  /* Section label hues, tuned for contrast on this background */
  --hue-pink: #ff6482;
  --hue-orange: #ffb340;
  --hue-indigo: #7d7aff;
  --hue-purple: #da8fff;

  /* Brand mark + streak */
  --brand-a: #5e5ce6;
  --brand-b: #ff375f;
  --streak-a: #ffd60a;
  --streak-b: #ff9f0a;
  --on-streak: #3d2a00;

  /* Destructive */
  --danger: #e03127;
  --danger-fill-hover: #c9261d;
  --danger-text: #ff6961;
  --danger-text-hover: #ff8a82;
  --danger-soft: rgba(255, 69, 58, 0.16);
  --danger-line: rgba(255, 69, 58, 0.34);
  --on-danger: #ffffff;

  /* Overlays */
  --overlay: rgba(0, 0, 0, 0.74);
  --toast-bg: #2e2e37;
  --toast-fg: #f5f5f7;

  --glow: rgba(10, 132, 255, 0.5);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.42);

  --radius: 14px;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e6e6eb;
  --track: #e8e8ed;
  --thumb: #ffffff;
  --thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);

  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, 0.78);
  --label-3: rgba(60, 60, 67, 0.75);

  --separator: rgba(60, 60, 67, 0.16);
  --separator-strong: rgba(60, 60, 67, 0.28);
  --rule: rgba(60, 60, 67, 0.1);

  --accent: #0071e3;
  --accent-2: #005ec4;
  --accent-text: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --on-accent: #ffffff;
  --green: #248a3d;

  --hue-pink: #c9184a;
  --hue-orange: #a25600;
  --hue-indigo: #4340c4;
  --hue-purple: #8944ab;

  --brand-a: #5856d6;
  --brand-b: #ff2d55;
  --streak-a: #ffcc00;
  --streak-b: #ff9500;
  --on-streak: #4a3200;

  --danger: #d70015;
  --danger-fill-hover: #b3000f;
  --danger-text: #d70015;
  --danger-text-hover: #b3000f;
  --danger-soft: rgba(255, 59, 48, 0.1);
  --danger-line: rgba(215, 0, 21, 0.28);
  --on-danger: #ffffff;

  --overlay: rgba(0, 0, 0, 0.62);
  --toast-bg: #1c1c1e;
  --toast-fg: #ffffff;

  --glow: rgba(0, 113, 227, 0.4);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--label);
  background: var(--bg);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--label);
  font-weight: 700;
  text-decoration: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--brand-a) 0%, var(--brand-b) 100%);
}

.brand-icon svg {
  width: 19px;
  height: 19px;
}

.button,
.icon-button,
.tab-button {
  border: 0;
  min-height: 44px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.button:hover,
.icon-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
.date-picker-button:focus-visible,
.tab-button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--glow);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto;
  padding: 0 17px;
  border-radius: var(--radius);
  font-weight: 600;
}

.button svg,
.icon-button svg,
.tab-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button-primary {
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 6px 16px var(--accent-soft);
}

.button-primary:hover {
  background: var(--accent-2);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

.button-quiet {
  color: var(--label);
  background: var(--surface);
  border: 1px solid var(--separator);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: var(--label-2);
  background: var(--surface);
  border: 1px solid var(--separator);
}

.app-view {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 14px max(16px, calc((100% - 1180px) / 2));
  border-bottom: 1px solid var(--separator);
  background: var(--bg);
}

.app-brand {
  justify-self: start;
  max-width: 100%;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 4px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  background: var(--track);
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  padding: 0 14px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--label-2);
  background: transparent;
  font-weight: 600;
}

.tab-button.active {
  color: var(--accent-text);
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
}

.tab-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.account-action {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.account-action span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent-text);
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.content-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
  position: relative;
  z-index: 1;
}

.view-pane {
  display: none;
}

.view-pane.active {
  display: block;
}

.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(300px, 0.74fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.side-column {
  display: grid;
  gap: 18px;
}

.surface {
  min-width: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.editor-surface,
.photo-surface,
.streak-surface,
.history-surface,
.gallery-surface,
.export-surface {
  padding: clamp(16px, 3vw, 24px);
}

.date-bar,
.section-heading,
.gallery-toolbar,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-bar {
  align-items: flex-end;
  flex-wrap: wrap;
}

.date-field {
  display: grid;
  gap: 5px;
  min-width: min(100%, 210px);
  color: var(--label-2);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.date-input-wrap,
.month-input-wrap {
  position: relative;
  display: grid;
}

.month-input-wrap {
  width: 150px;
  max-width: 100%;
}

input[type="date"],
.note-title-input,
.month-input {
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--label);
  background: var(--surface);
}

input[type="date"],
.month-input {
  padding-right: 40px;
  background-image: linear-gradient(var(--surface), var(--surface));
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.month-input {
  width: 100%;
}

input[type="date"]::-webkit-calendar-picker-indicator,
.month-input::-webkit-calendar-picker-indicator {
  opacity: 0;
}

.date-picker-button {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--label-2);
  background: transparent;
  transform: translateY(-50%);
}

.date-picker-button:hover {
  background: var(--accent-soft);
}

.date-picker-button svg {
  width: 19px;
  height: 19px;
}

.note-title-input {
  width: 100%;
  min-height: 56px;
  margin-bottom: 12px;
  padding: 0 17px;
  color: var(--label);
  font-size: clamp(1.24rem, 3vw, 1.55rem);
  font-weight: 700;
}

.note-title-input::placeholder {
  color: var(--label-3);
}

.entry-heading {
  margin: 30px 0 8px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--section, var(--accent-text));
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  color: var(--label);
  font-size: clamp(1.26rem, 3vw, 1.65rem);
  letter-spacing: 0;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label);
  background:
    linear-gradient(var(--surface) 29px, var(--rule) 30px),
    var(--surface);
  background-size: 100% 30px;
  line-height: 30px;
  box-shadow: none;
}

textarea::placeholder {
  color: var(--label-3);
}

.editor-actions {
  justify-content: space-between;
  margin-top: 14px;
}

.save-state {
  min-height: 22px;
  margin: 0;
  color: var(--label-2);
  font-size: 0.92rem;
}

.autosave-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label-2);
  background: var(--surface);
  font-weight: 700;
  white-space: nowrap;
}

.autosave-badge svg {
  width: 17px;
  height: 17px;
}

.section-heading,
.gallery-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-heading > div,
.gallery-toolbar > div {
  min-width: 0;
}

.photo-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 116px;
}

.daily-photo,
.gallery-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  background: var(--surface);
}

.daily-photo {
  aspect-ratio: 1 / 1;
}

.photo-open {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
}

.daily-photo img,
.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 116px;
  padding: 22px;
  border: 1px dashed var(--separator-strong);
  border-radius: var(--radius);
  color: var(--label-2);
  background: var(--surface);
  text-align: center;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(78px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label);
  background: var(--surface);
  text-align: left;
}

.history-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.history-date {
  color: var(--label-2);
  font-weight: 700;
}

.history-snippet {
  min-width: 0;
  overflow: hidden;
  color: var(--label-2);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--section, var(--accent-text));
  font-size: 0.82rem;
  font-weight: 700;
}

.streak-headline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.streak-flame {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: var(--on-streak);
  background: linear-gradient(180deg, var(--streak-a) 0%, var(--streak-b) 100%);
  box-shadow: 0 6px 16px rgba(255, 159, 10, 0.28);
}

.streak-flame svg {
  width: 21px;
  height: 21px;
}

.streak-figure {
  display: grid;
  line-height: 1.1;
}

.streak-count {
  color: var(--label);
  font-size: 1.6rem;
  font-weight: 700;
}

.streak-caption {
  color: var(--label-2);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.streak-weekday {
  display: grid;
  place-items: center;
  padding-bottom: 2px;
  color: var(--label-2);
  font-size: 0.7rem;
  font-weight: 700;
}

.streak-blank {
  aspect-ratio: 1 / 1;
}

.streak-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: 50%;
  color: var(--label-2);
  background: var(--surface);
  font-size: 0.84rem;
  font-weight: 700;
}

.streak-day > span {
  position: relative;
  z-index: 1;
}

.streak-day.has-entry {
  color: var(--on-streak);
  border-color: transparent;
  background: linear-gradient(180deg, var(--streak-a) 0%, var(--streak-b) 100%);
}

/* Chain consecutive completed days together, Duolingo style. */
.streak-day.link-prev::before,
.streak-day.link-next::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 9px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, var(--streak-a) 0%, var(--streak-b) 100%);
  z-index: 0;
}

.streak-day.link-prev::before {
  right: 50%;
  left: -8px;
}

.streak-day.link-next::after {
  left: 50%;
  right: -8px;
}

.streak-day.is-today {
  box-shadow: 0 0 0 2px var(--accent);
}

.streak-day.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.streak-day.is-future {
  opacity: 0.42;
}

.export-surface .section-heading {
  margin-bottom: 0;
}

.export-open-action {
  min-width: 118px;
}

.gallery-surface {
  min-height: 560px;
}

.gallery-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.gallery-filter {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label-2);
  background: var(--surface);
}

.gallery-filter svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.gallery-month-select {
  min-height: 38px;
  min-width: 142px;
  border: 0;
  color: var(--label);
  background: transparent;
  font: inherit;
  font-weight: 600;
}

.gallery-month-select option {
  color: var(--label);
  background: var(--surface);
}

.gallery-month-select option:checked {
  color: var(--on-accent);
  background: var(--accent);
}

.gallery-month-select:focus-visible {
  outline: 0;
}

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

.gallery-card {
  aspect-ratio: 4 / 5;
  /* Skip layout/paint for cards scrolled out of view. The aspect ratio still
     reserves the right box, so the scrollbar stays stable. */
  content-visibility: auto;
}

.gallery-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 32px 10px 10px;
  color: #ffffff;
  background: linear-gradient(180deg, transparent, var(--overlay));
  font-size: 0.84rem;
  font-weight: 700;
}

.image-dialog {
  width: min(920px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--label);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.image-dialog::backdrop,
.account-dialog::backdrop,
.confirm-dialog::backdrop,
.export-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: var(--surface);
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
}

.dialog-layout img {
  width: 100%;
  height: min(72vh, 620px);
  object-fit: contain;
  background: var(--bg);
}

.dialog-note {
  padding: 28px;
  align-self: center;
}

#dialogNoteText {
  color: var(--label-2);
  line-height: 1.7;
  white-space: pre-wrap;
}

.dialog-actions {
  margin-top: 22px;
}

.button-danger {
  color: var(--on-danger);
  background: var(--danger);
  box-shadow: 0 6px 16px var(--danger-soft);
}

.button-danger:hover {
  background: var(--danger-fill-hover);
}

.account-dialog {
  width: min(550px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-dialog-body {
  padding: 28px;
}

.account-dialog h2 {
  margin: 4px 0 18px;
  color: var(--label);
  font-size: 1.55rem;
  line-height: 1.08;
}

.account-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--separator-strong);
  border-radius: 999px;
  color: var(--label-2);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
}

.account-status .mode-badge {
  min-height: auto;
  padding: 0;
  color: var(--label);
  background: transparent;
  font-size: inherit;
}

.account-profile {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--label-2);
}

.account-profile .avatar {
  width: 24px;
  height: 24px;
}

.account-profile span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 38px;
  padding: 14px 16px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label-2);
  background: var(--surface);
}

.account-info svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
}

.account-google-action {
  width: 100%;
  min-height: 58px;
  margin-top: 38px;
  font-size: 1rem;
}

.account-divider {
  height: 1px;
  margin: 22px 0 16px;
  background: var(--separator);
}

.account-delete-action {
  width: 100%;
  min-height: 58px;
  color: var(--danger-text);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  box-shadow: none;
}

.account-delete-action:hover {
  color: var(--danger-text-hover);
  background: var(--danger-soft);
}

.confirm-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--label);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-dialog-body {
  padding: 28px;
}

.confirm-icon {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  color: var(--danger-text);
  background: var(--danger-soft);
}

.confirm-icon svg {
  width: 20px;
  height: 20px;
}

.confirm-dialog h2 {
  margin: 4px 0 10px;
  color: var(--label);
  font-size: 1.55rem;
  line-height: 1.1;
}

.confirm-copy,
.confirm-count {
  color: var(--label-2);
  line-height: 1.6;
}

.confirm-count {
  padding: 10px 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
}

.confirm-label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--label-2);
  font-weight: 600;
}

.confirm-label input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label);
  background: var(--surface-2);
  font-weight: 700;
  letter-spacing: 0;
}

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

.confirm-actions .button {
  min-width: 140px;
}

.export-dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.export-dialog-body {
  padding: 28px;
}

.export-dialog h2 {
  margin: 4px 0 18px;
  color: var(--label);
  font-size: 1.55rem;
  line-height: 1.08;
}

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

.export-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--label-2);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.export-field:last-child {
  grid-column: 1 / -1;
}

.export-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--label);
  background: var(--surface);
  font: inherit;
  font-weight: 600;
}

.export-select option {
  color: var(--label);
  background: var(--surface);
}

.export-summary {
  min-height: 44px;
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--label-2);
  background: var(--surface);
  font-weight: 600;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--toast-fg);
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.print-export {
  display: none;
}

@media (max-width: 1280px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .view-tabs {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

  .tab-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 10px;
  }

}

@media (max-width: 1120px) {
  .entry-grid,
  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  :root,
  :root[data-theme="light"] {
    --shadow: var(--shadow-sm);
  }

  .app-header {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .app-brand,
  .user-menu,
  .view-tabs {
    justify-self: stretch;
    width: 100%;
  }

  .app-brand {
    justify-content: center;
  }

  .user-menu {
    justify-content: center;
  }

  .account-action {
    flex: 1 1 auto;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading .month-input-wrap {
    width: 100%;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
  }

  .tab-button {
    gap: 6px;
    width: 100%;
    padding: 0 8px;
  }
}

@media (max-width: 560px) {
  .content-shell {
    width: min(100% - 20px, 1180px);
    margin-top: 16px;
  }

  .app-header {
    padding: 12px 10px;
    gap: 10px;
  }

  .date-bar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
  }

  #prevDay {
    grid-column: 1;
    grid-row: 1;
  }

  #nextDay {
    grid-column: 3;
    grid-row: 1;
  }

  .date-bar .date-field {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .date-bar .button-quiet {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
  }

  .gallery-toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .date-field,
  .month-input-wrap,
  .gallery-tools,
  .gallery-filter,
  .gallery-month-select {
    flex: 1 1 100%;
    width: 100%;
  }

  .photo-row {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr auto;
  }

  .editor-actions {
    align-items: stretch;
  }

  .autosave-badge {
    justify-content: center;
  }

  .confirm-actions .button {
    flex: 1 1 100%;
    width: 100%;
  }

  .export-range-grid {
    grid-template-columns: 1fr;
  }

  .history-snippet {
    grid-column: 1 / -1;
  }

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

  .dialog-layout img {
    height: 52vh;
  }
}

@media (max-width: 430px) {
  .tab-button {
    padding: 0 6px;
    font-size: 0.9rem;
  }

}

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

  .button:hover,
  .icon-button:hover,
  .tab-button:hover {
    transform: none;
  }
}


/* Each card carries its own label hue, the way Apple tints system sections. */
.photo-surface {
  --section: var(--hue-pink);
}

.streak-surface {
  --section: var(--hue-orange);
}

.history-surface {
  --section: var(--hue-indigo);
}

.export-surface {
  --section: var(--hue-purple);
}

.gallery-surface {
  --section: var(--accent-text);
}

.button-quiet:hover,
.icon-button:hover {
  background: var(--surface-3);
}

.autosave-badge svg {
  color: var(--green);
}

/* ::backdrop cannot be relied on to inherit custom properties, so it is literal. */
:root[data-theme="light"] .image-dialog::backdrop,
:root[data-theme="light"] .account-dialog::backdrop,
:root[data-theme="light"] .confirm-dialog::backdrop,
:root[data-theme="light"] .export-dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
}

@media print {
  @page {
    margin: 14mm;
  }

  html,
  body {
    min-height: auto;
    color: #172015 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  body > :not(#printExport) {
    display: none !important;
  }

  #printExport {
    display: block !important;
    color: #172015;
    background: #ffffff;
    font:
      11pt/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
      sans-serif;
  }

  .print-cover {
    padding: 0 0 10mm;
    margin: 0 0 9mm;
    border-bottom: 1px solid #b8c4ad;
  }

  .print-kicker,
  .print-date,
  .print-meta,
  .print-range,
  .print-image figcaption {
    margin: 0;
    color: #53614d;
  }

  .print-kicker,
  .print-date {
    color: #4d642f;
    font-weight: 800;
    text-transform: uppercase;
  }

  .print-kicker {
    font-size: 10pt;
  }

  .print-cover h1 {
    margin: 3mm 0 2mm;
    color: #172015;
    font-size: 27pt;
    line-height: 1.08;
  }

  .print-range {
    font-size: 13pt;
    font-weight: 760;
  }

  .print-meta {
    margin-top: 3mm;
    font-size: 9pt;
  }

  .print-entry {
    break-inside: avoid;
    page-break-inside: avoid;
    padding-top: 7mm;
    margin-top: 7mm;
    border-top: 1px solid #d4ddca;
  }

  .print-entry:first-of-type {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
  }

  .print-date {
    margin-bottom: 2mm;
    font-size: 9pt;
  }

  .print-entry h2 {
    margin: 0 0 4mm;
    color: #172015;
    font-size: 17pt;
    line-height: 1.18;
  }

  .print-note {
    white-space: pre-wrap;
  }

  .print-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5mm;
    margin-top: 6mm;
  }

  .print-image {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0;
    padding: 2mm;
    border: 1px solid #cad5c0;
    border-radius: 2mm;
  }

  .print-image img {
    width: 100%;
    max-height: 96mm;
    object-fit: contain;
  }

  .print-image figcaption {
    margin-top: 1.8mm;
    font-size: 8pt;
    line-height: 1.35;
  }
}
