:root {
  --bg: #ffffff;
  --ink: #2a3633;
  --muted: #999999;
  --mint: #669999;
  --rose: #ff9999;
  --cream: #ffffcc;
  --cloud: #f5f5f0;
  --card: #ffffff;
  --border: rgba(42, 54, 51, 0.12);
  --shadow: 0 18px 40px rgba(42, 54, 51, 0.12);
  --radius: 24px;
  --font-brand: "Nunito", sans-serif;
  --font-tagline: "Cormorant Garamond", serif;
  --font-hand: "Caveat", "Bradley Hand", cursive;
  --paper: #fbf6ef;
  --paper-line: rgba(184, 154, 124, 0.28);
  --safe-bottom: max(env(safe-area-inset-bottom), 24px);
  --viewport-safe: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-brand);
  letter-spacing: 0.01em;
  text-transform: lowercase;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.screen {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  border: 1px solid rgba(42, 54, 51, 0.08);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(102, 153, 153, 0.06), transparent 55%),
              radial-gradient(circle at 80% 20%, rgba(255, 153, 153, 0.05), transparent 60%);
  pointer-events: none;
}

.screen-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.screen-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.topbar {
  padding: 18px 20px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 120px;
}

.page-quote {
  position: relative;
  text-align: center;
  padding: 0 64px 12px;
}

.quote-save {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(102, 153, 153, 0.12);
  border: 1px solid rgba(102, 153, 153, 0.35);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.quote-save:hover {
  border-color: rgba(102, 153, 153, 0.6);
  box-shadow: 0 8px 18px rgba(42, 54, 51, 0.18);
}

.quote-save:focus-visible {
  outline: 2px solid rgba(102, 153, 153, 0.55);
  outline-offset: 2px;
}

.quote-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.quote-text {
  font-family: var(--font-tagline);
  font-style: italic;
  font-size: 1.05rem;
  color: rgba(42, 54, 51, 0.75);
  max-width: 420px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .page-quote {
    padding: 0 56px 12px;
  }

  .quote-save {
    right: 12px;
  }
}

.quote-card-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.quote-card {
  position: relative;
  width: min(100%, 1100px, calc((100vh - 48px) * 1.5));
  aspect-ratio: 3 / 2;
}

.quote-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quote-bubble {
  position: absolute;
  left: 10.5%;
  top: 11.5%;
  width: 50%;
  height: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4%;
}

.quote-bubble-text {
  font-family: var(--font-tagline);
  font-style: italic;
  font-size: clamp(20px, 3.1vw, 44px);
  line-height: 1.2;
  color: rgba(42, 54, 51, 0.85);
  text-transform: none;
  word-break: break-word;
}

.quote-modal {
  padding: 18px;
}

.quote-modal-card {
  width: min(92vw, 640px);
  background: var(--card);
  border-radius: 22px;
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: 0 24px 48px rgba(42, 54, 51, 0.2);
  display: grid;
  gap: 12px;
}

.quote-modal-close {
  justify-self: end;
  border: none;
  background: rgba(102, 153, 153, 0.16);
  color: var(--ink);
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.quote-modal-body {
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
}

.quote-modal-canvas,
.quote-modal-fallback {
  width: 100%;
  height: auto;
  display: block;
}

.quote-modal-canvas {
  display: none;
}

.quote-modal.is-rendered .quote-modal-canvas {
  display: block;
}

.quote-modal.is-rendered .quote-modal-fallback {
  display: none;
}

.quote-modal-actions {
  display: flex;
  justify-content: center;
}

.brand-tagline {
  font-family: var(--font-tagline);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--mint);
}

.content {
  flex: 1;
  padding: 0 20px calc(140px + var(--safe-bottom) + var(--viewport-safe));
  overflow: visible;
  background: var(--bg);
  min-height: 0;
}

.journal-paper {
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.98)),
    repeating-linear-gradient(0deg, var(--paper-line), var(--paper-line) 1px, transparent 1px, transparent 30px);
  border-radius: 22px;
  padding: 10px 10px 16px;
  border: 1px solid rgba(42, 54, 51, 0.08);
  box-shadow: 0 16px 36px rgba(42, 54, 51, 0.1);
}

.hero {
  margin-top: 10px;
  display: grid;
  gap: 16px;
}
.hero-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero h1 {
  font-size: 2.1rem;
  line-height: 1.1;
  margin: 0;
}

.hero p {
  font-size: 1.05rem;
  margin: 0;
  color: rgba(42, 54, 51, 0.75);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  background: var(--cream);
  border: 1px solid rgba(42, 54, 51, 0.1);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--ink);
}

.pill a {
  margin-left: 6px;
  font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 12px 30px rgba(42, 54, 51, 0.08);
}

.stack {
  display: grid;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: var(--bg);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn-primary {
  background: var(--mint);
  color: #ffffff;
  border-color: rgba(42, 54, 51, 0.08);
}

.btn-rose {
  background: var(--rose);
  color: #2f2b2b;
}

.btn-ghost {
  background: transparent;
}

.btn-soft {
  background: rgba(255, 153, 153, 0.18);
  border-color: rgba(42, 54, 51, 0.12);
  color: var(--ink);
}

.btn-inline {
  width: auto;
  padding: 8px 14px;
  font-size: 0.95rem;
  border-radius: 14px;
}

.btn-edit {
  margin-top: 6px;
}

.btn-row {
  display: grid;
  gap: 10px;
}

.icon-trash {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.note {
  font-size: 0.95rem;
  color: rgba(42, 54, 51, 0.65);
}

.sprigg-frame {
  background: linear-gradient(180deg, rgba(102, 153, 153, 0.18), rgba(255, 153, 153, 0.1));
  border-radius: 20px;
  padding: 12px;
  border: 1px solid rgba(42, 54, 51, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.sprigg-frame img {
  border-radius: 14px;
  max-height: 100%;
  width: auto;
  height: auto;
}

.section-title {
  font-size: 1.3rem;
  margin: 0 0 8px;
}

.section-title-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.section-title-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(42, 54, 51, 0.72);
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  inset-inline: 0;
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom) + var(--viewport-safe));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(42, 54, 51, 0.08);
  backdrop-filter: blur(8px);
  z-index: 4;
  flex-shrink: 0;
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 6px 8px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 600;
  color: rgba(42, 54, 51, 0.7);
  background: rgba(102, 153, 153, 0.12);
  cursor: pointer;
  font-family: inherit;
  min-height: 84px;
  grid-template-rows: auto auto;
  align-content: start;
}

.nav-item.is-active {
  border-color: rgba(42, 54, 51, 0.12);
  background: rgba(255, 153, 153, 0.18);
  color: var(--ink);
}

.nav-icon {
  height: 56px;
  width: 100%;
  display: grid;
  place-items: center;
}

.nav-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal {
  position: absolute;
  inset: 0;
  background: rgba(22, 28, 27, 0.62);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 5;
  backdrop-filter: blur(2px);
}

.modal.is-open {
  display: flex;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 26px;
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: 0 20px 40px rgba(42, 54, 51, 0.12);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tab {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.12);
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.is-active {
  background: rgba(255, 153, 153, 0.22);
}

.auth-panel[hidden] { display: none !important; }

.auth-subtle {
  margin-top: 14px;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.7;
}
.auth-subtle a { text-decoration: underline; }

.auth-card[data-auth="login"] .auth-panel[data-panel="login"],
.auth-card[data-auth="register"] .auth-panel[data-panel="register"] {
  display: grid;
  gap: 12px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.14);
  font-size: 1rem;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  background: rgba(42, 54, 51, 0.12);
}

.close-btn {
  margin-top: 8px;
}

.auth-footer {
  font-size: 0.95rem;
  text-align: center;
  color: var(--muted);
}

.auth-footer button {
  background: none;
  border: none;
  color: var(--mint);
  font-weight: 700;
  cursor: pointer;
}

.status {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.1);
  background: rgba(102, 153, 153, 0.12);
  font-size: 0.95rem;
}

.status.error {
  background: rgba(255, 153, 153, 0.2);
}

.section {
  margin-top: 20px;
}

.auth-page .hero {
  text-align: center;
  justify-items: center;
}

.auth-page .section {
  display: flex;
  justify-content: center;
}

.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.1);
  font-size: 0.95rem;
}

.app-hero {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.app-hero h1 {
  font-size: 1.9rem;
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(102, 153, 153, 0.12);
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.stat-card strong {
  font-size: 1.4rem;
}

.chart-card {
  background: rgba(255, 153, 153, 0.12);
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: 120px;
}

.chart-bars span {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: rgba(102, 153, 153, 0.6);
}

.entry-list {
  display: grid;
  gap: 12px;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-month {
  border: 1px solid rgba(42, 54, 51, 0.12);
  border-radius: 20px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
}

.timeline-month summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 6px;
}

.timeline-month summary::-webkit-details-marker {
  display: none;
}

.timeline-month summary::marker {
  content: "";
}

.timeline-entry {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.98)),
    repeating-linear-gradient(0deg, var(--paper-line), var(--paper-line) 1px, transparent 1px, transparent 28px);
}

.timeline-entry + .timeline-entry {
  margin-top: 12px;
}

.timeline-dayblock {
  text-align: center;
}

.timeline-day {
  font-family: var(--font-tagline);
  font-style: italic;
  font-size: 2.8rem;
  line-height: 0.95;
  color: var(--ink);
}

.timeline-date {
  font-size: 0.85rem;
  color: rgba(42, 54, 51, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.timeline-body {
  display: grid;
  gap: 10px;
}

.timeline-mood {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: 1.02rem;
  color: rgba(42, 54, 51, 0.8);
}

.timeline-mood img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(102, 153, 153, 0.12);
  border: 1px solid rgba(42, 54, 51, 0.12);
  padding: 4px;
  object-fit: contain;
}

.timeline-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-hand);
  font-size: 1.05rem;
}

.timeline-lines li {
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(42, 54, 51, 0.12);
}

.timeline-lines li:last-child {
  border-bottom: none;
}

.timeline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.entry-card {
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  padding: 14px;
  display: grid;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
}

.entry-photo-frame {
  width: 100%;
  border-radius: 14px;
  background: rgba(102, 153, 153, 0.08);
  overflow: hidden;
  aspect-ratio: 3 / 2;
  max-height: 320px;
}

.entry-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(var(--photo-scale, 1));
  transform-origin: var(--photo-origin-x, 50%) var(--photo-origin-y, 50%);
  display: block;
}

.entry-card .entry-photo-frame {
  max-height: 240px;
}

.entry-view {
  background: transparent;
  border: none;
  box-shadow: none;
  font-family: var(--font-hand);
}

.entry-view-head {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.entry-view .section-title,
.entry-view .pill {
  font-family: var(--font-brand);
}

.entry-view-dayblock {
  text-align: center;
}

.entry-view-day {
  font-family: var(--font-tagline);
  font-style: italic;
  font-size: 2.6rem;
  line-height: 1;
}

.entry-view-week {
  font-size: 0.85rem;
  color: rgba(42, 54, 51, 0.55);
  font-family: var(--font-hand);
}

.entry-view-section {
  display: grid;
  gap: 10px;
}

.entry-view-text {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(42, 54, 51, 0.2);
  border-radius: 0;
  padding: 6px 2px 10px;
  line-height: 1.7;
  font-family: var(--font-hand);
  font-size: 1.08rem;
}

.entry-view-items {
  display: grid;
  gap: 10px;
}

.entry-view-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

.entry-view-thumb {
  width: 72px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(42, 54, 51, 0.12);
}

.entry-view-actions {
  display: grid;
  gap: 10px;
}

.journal-edit .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.92));
}

.journal-edit .textarea,
.journal-edit .input,
.journal-edit .line-text,
.journal-edit .note,
.prompt-text {
  font-family: var(--font-hand);
  font-size: 1.05rem;
}

.journal-edit .textarea {
  background-color: rgba(255, 255, 255, 0.9);
}

.inline-form {
  margin: 0;
}

.line-item {
  border: 1px solid rgba(42, 54, 51, 0.12);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
}

.line-item + .line-item {
  margin-top: 10px;
}

.hydration-list {
  display: grid;
  gap: 10px;
}

.hydration-item {
  display: grid;
  grid-template-columns: auto 1fr 120px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(255, 255, 255, 0.92);
  font-size: 1rem;
}

.hydration-item--other {
  grid-template-columns: auto auto 1fr 120px;
}

.hydration-item.is-disabled {
  opacity: 0.6;
}

.hydration-check {
  width: 18px;
  height: 18px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(42, 54, 51, 0.35);
  border-radius: 6px;
  background: #ffffff;
  display: grid;
  place-items: center;
  margin: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 10px 8px;
}

.hydration-check:checked {
  background-color: var(--mint);
  border-color: rgba(42, 54, 51, 0.2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 9'%3E%3Cpath d='M1 5l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.hydration-check:focus-visible {
  outline: 2px solid rgba(102, 153, 153, 0.45);
  outline-offset: 2px;
}

.hydration-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.hydration-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.hydration-icon img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 6px;
}

.hydration-qty {
  padding: 8px 10px;
  border-radius: 12px;
  text-align: center;
}

.journal-edit .hydration-qty {
  font-size: 1rem;
}

.hydration-qty::-webkit-outer-spin-button,
.hydration-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hydration-qty {
  -moz-appearance: textfield;
}

.hydration-stepper {
  display: grid;
  grid-template-columns: 1fr 28px;
  align-items: center;
  gap: 6px;
}

.hydration-stepper-buttons {
  display: grid;
  gap: 4px;
}

.hydration-step {
  width: 28px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid rgba(42, 54, 51, 0.18);
  background: rgba(102, 153, 153, 0.12);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  color: rgba(42, 54, 51, 0.8);
}

.hydration-step:disabled {
  opacity: 0.5;
  cursor: default;
}

.hydration-qty:disabled {
  background: rgba(42, 54, 51, 0.05);
  color: rgba(42, 54, 51, 0.55);
}

.hydration-other {
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
}

.hydration-view {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hydration-view-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.hydration-view-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.hydration-view-count {
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(42, 54, 51, 0.8);
}

.hydration-view-label {
  font-size: 0.95rem;
  color: rgba(42, 54, 51, 0.8);
}

.line-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  cursor: pointer;
  font-weight: 600;
}

.line-summary::-webkit-details-marker {
  display: none;
}

.line-summary::marker {
  content: "";
}

.line-action {
  color: var(--mint);
  font-size: 0.9rem;
  font-weight: 700;
  margin-left: auto;
}

.line-item[open] .line-summary {
  margin-bottom: 10px;
}

.line-media {
  flex: 0 0 auto;
}

.line-thumb {
  width: 54px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  object-fit: cover;
  background: #ffffff;
}

.line-thumb.is-placeholder {
  object-fit: contain;
  padding: 6px;
  background: rgba(255, 255, 255, 0.9);
}

.line-text {
  flex: 1;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.14);
  font-size: 1rem;
  background: #ffffff;
}

.textarea {
  min-height: 160px;
  resize: vertical;
}

.form-row {
  display: grid;
  gap: 10px;
}

.form-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px dashed rgba(42, 54, 51, 0.22);
  background: rgba(102, 153, 153, 0.12);
  color: var(--ink);
  font-weight: 600;
  gap: 8px;
  min-height: 48px;
  width: 100%;
}

.upload-btn span {
  pointer-events: none;
}

.upload-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.upload-row .upload-btn {
  flex: 1;
}

.photo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.photo-grid--food {
  grid-template-columns: 248px minmax(0, 1fr);
  align-items: start;
}

.photo-pair {
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 8px;
  align-items: center;
}

.photo-frame {
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.08);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  touch-action: none;
  cursor: grab;
}

.photo-frame:active {
  cursor: grabbing;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(var(--photo-scale, 1));
  transform-origin: var(--photo-origin-x, 50%) var(--photo-origin-y, 50%);
  user-select: none;
  -webkit-user-drag: none;
}

.photo-placeholder {
  text-align: center;
  color: rgba(42, 54, 51, 0.6);
  font-size: 0.95rem;
  padding: 12px;
  display: grid;
  gap: 8px;
  place-items: center;
}

.photo-placeholder img {
  width: 70%;
  max-width: 160px;
}

.photo-frame.mini .photo-placeholder {
  padding: 6px;
}

.photo-frame.mini .photo-placeholder img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

.meal-sprigg-tile {
  cursor: default;
  aspect-ratio: 1 / 1;
  padding: 4px;
  box-sizing: border-box;
}

.meal-sprigg-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.food-photo-editor .meal-sprigg-tile {
  display: none;
}

.food-photo-editor.has-photo .meal-sprigg-tile {
  display: grid;
}

.avatar-frame {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  overflow: hidden;
  background: rgba(102, 153, 153, 0.12);
  display: grid;
  place-items: center;
}

.avatar-frame--hero {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mood-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mood-preview {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.08);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mood-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hint {
  font-size: 0.88rem;
  color: rgba(42, 54, 51, 0.6);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.toggle input {
  appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(42, 54, 51, 0.2);
  background: rgba(42, 54, 51, 0.16);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(42, 54, 51, 0.2);
  transition: transform 0.2s ease;
}

.toggle input:checked {
  background: var(--mint);
  border-color: rgba(42, 54, 51, 0.1);
}

.toggle input:checked::after {
  transform: translateX(18px);
}

.nav-item span {
  font-size: 0.92rem;
  line-height: 1.1;
}

.toast {
  position: absolute;
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  width: min(92%, 420px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 2px solid rgba(102, 153, 153, 0.25);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(42, 54, 51, 0.22);
  z-index: 6;
  font-size: 1.02rem;
  line-height: 1.4;
  min-height: 84px;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast span {
  font-weight: 600;
}

.toast.is-hidden {
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px));
  pointer-events: none;
}

.toast.is-error {
  background: rgba(255, 153, 153, 0.2);
}

.toast button {
  border: none;
  background: rgba(102, 153, 153, 0.22);
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.98rem;
  width: 100%;
}

.autosave-toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(102, 153, 153, 0.18);
  border: 1px solid rgba(42, 54, 51, 0.12);
  color: rgba(42, 54, 51, 0.8);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 6;
}

.autosave-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

@media (min-width: 900px) {
  .screen {
    height: calc(100vh - 48px);
    max-height: 920px;
  }
  .page {
    padding: 24px;
  }
}

@media (max-width: 420px) {
  .grid-2,
  .form-row.two,
  .stat-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    padding: 12px 16px calc(28px + env(safe-area-inset-bottom) + var(--viewport-safe));
  }
}

@media (max-width: 640px) {
  .page {
    padding: 0;
  }

  .screen {
    max-width: none;
    height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .screen-scroll {
    scrollbar-width: none;
  }

  .screen-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
}

/* --- journal feel tweaks (edit + view) --- */
.journal-paper .card{
  box-shadow:none;
  border-radius:18px;
}

.journal-paper .card.entry-view{
  background: transparent;
}

.textarea.ruled{
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.96)),
    repeating-linear-gradient(0deg, var(--paper-line), var(--paper-line) 1px, transparent 1px, transparent 30px);
  line-height: 30px;
}

/* make inner sections read more like a page */
.journal-paper .section-title{
  margin-top: 2px;
}

/* larger sprigg thumbnails for food + movement placeholders (and real thumbs) */
.entry-view-item { grid-template-columns: 92px minmax(0, 1fr); }
.entry-view-thumb-frame {
  width: 92px;
  height: 120px;
  border-radius: 12px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  overflow: hidden;
  background: #ffffff;
  display: block;
  box-sizing: border-box;
}
.entry-view-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--photo-scale, 1));
  transform-origin: var(--photo-origin-x, 50%) var(--photo-origin-y, 50%);
  display: block;
}
.entry-view-thumb-frame.is-placeholder {
  background: rgba(102, 153, 153, 0.08);
  padding: 8px;
}
.entry-view-thumb-frame.is-placeholder .entry-view-thumb {
  object-fit: contain;
  transform: none;
}

/* edit-page food/movement thumbs (partials usually use .line-thumb) */
.line-thumb { width: 72px; height: 96px; }
.line-thumb.is-placeholder { padding: 8px; }
/* ---- timeline: planner / real-journal look ---- */

/* make each entry feel like a single planner row, not a bubble card */
.timeline.timeline-journal {
  gap: 14px;
}

.timeline-entry.timeline-entry-journal {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border-radius: 18px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.98)),
    repeating-linear-gradient(0deg, var(--paper-line), var(--paper-line) 1px, transparent 1px, transparent 28px);
  box-shadow: 0 14px 32px rgba(42, 54, 51, 0.10);
  text-decoration: none;
  color: inherit;
}

.timeline-entry.timeline-entry-journal:focus-visible {
  outline: 3px solid rgba(102, 153, 153, 0.35);
  outline-offset: 2px;
}

.timeline-dayblock.timeline-dayblock-journal {
  padding: 14px 10px;
  border-right: 1px dashed rgba(42, 54, 51, 0.18);
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.55);
}

.timeline-dayblock.timeline-dayblock-journal .timeline-day {
  font-size: 2.9rem;
  line-height: 0.95;
}

.timeline-dayblock.timeline-dayblock-journal .timeline-date {
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.timeline-day-sprigg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.10);
  padding: 6px;
  display: grid;
  place-items: center;
}

.timeline-day-sprigg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.timeline-day-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.timeline-day-icons img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(102, 153, 153, 0.10);
  padding: 6px;
  object-fit: contain;
}

.timeline-entry.timeline-entry-journal .timeline-body {
  padding: 12px 12px 14px;
  display: grid;
  gap: 10px;
}

/* photo should read like it sits "on" the page */
.timeline-entry.timeline-entry-journal .entry-photo-frame,
.timeline-entry.timeline-entry-journal .timeline-photo-placeholder {
  border-radius: 14px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.timeline-entry.timeline-entry-journal .timeline-photo-placeholder {
  aspect-ratio: 3 / 2;
  display: grid;
  place-items: center;
}

.timeline-entry.timeline-entry-journal .timeline-photo-placeholder img {
  width: 80%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
}

.timeline-mood.timeline-mood-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-hand);
  color: rgba(42, 54, 51, 0.78);
}

.timeline-tags {
  gap: 8px;
  margin: 0;
}

.timeline-flag {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(42, 54, 51, 0.12);
  background: rgba(255, 153, 153, 0.18);
  font-family: var(--font-brand);
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(42, 54, 51, 0.86);
}

.timeline-snippet {
  font-family: var(--font-hand);
  font-size: 1.08rem;
  line-height: 1.7;
  color: rgba(42, 54, 51, 0.85);
  padding-bottom: 2px;
}

.timeline-hydration {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.timeline-hydration img {
  width: 24px;
  height: 24px;
  border-radius: 0;
  border: none;
  background: transparent;
  padding: 0;
  object-fit: contain;
}

@media (max-width: 420px) {
  .timeline-entry.timeline-entry-journal {
    grid-template-columns: 92px minmax(0, 1fr);
  }
  .timeline-day-sprigg {
    width: 56px;
    height: 56px;
  }
}


/* keep photo placeholder clickable: image should not steal pointer events */
.photo-frame img{ pointer-events:none; }
/* handwriting sizing (bigger, more readable) */
:root{
  /* optional: make handwriting scale easy to tune */
  --hand-size: 1.6rem;
  --hand-size-lg: 1.8rem;
}

/* edit screens */
.journal-edit .textarea,
.journal-edit .input,
.journal-edit .line-text,
.journal-edit .note,
.prompt-text{
  font-size: var(--hand-size);
}

/* ruled writing areas */
.textarea.ruled{
  font-size: var(--hand-size-lg);
}

/* view + timeline text */
.entry-view-text,
.timeline-lines,
.timeline-snippet{
  font-size: var(--hand-size-lg);
}

/* smaller handwriting bits */
.timeline-mood,
.timeline-mood-inline,
.entry-view-week,
.entry-view .note{
  font-size: var(--hand-size);
}


