@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #142e37;
  --ink-soft: #557078;
  --paper: #f5f3ec;
  --paper-deep: #e9e9df;
  --white: #fffefa;
  --line: #d5ddd8;
  --teal: #2c8581;
  --teal-dark: #216b6b;
  --mint: #cfe8d9;
  --coral: #f28a68;
  --yellow: #f5c967;
  --shadow: 0 18px 45px rgba(20, 46, 55, 0.09);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 24px;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 15px;
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(20, 46, 55, 0.15);
}

.brand-mark img { width: 29px; height: 29px; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.2;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Space Grotesk', 'DM Sans', sans-serif; }
h1 { margin: 0; font-size: 19px; letter-spacing: -.03em; }

.live-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.live-dot span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(44, 133, 129, .12);
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 24px 22px 20px;
  border-radius: 25px;
  color: var(--white);
  background: var(--ink);
  box-shadow: var(--shadow);
}

.hero-card::after {
  position: absolute;
  right: -58px;
  bottom: -78px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(207, 232, 217, .15);
  border-radius: 50%;
  box-shadow: 0 0 0 20px rgba(207, 232, 217, .035), 0 0 0 42px rgba(207, 232, 217, .025);
  content: '';
}

.hero-copy { position: relative; z-index: 1; max-width: calc(100% - 90px); }
.hero-card .eyebrow { color: var(--mint); }
.hero-card h2 { margin: 0 0 7px; font-size: clamp(24px, 7vw, 34px); line-height: 1.05; letter-spacing: -.06em; }
.muted { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.hero-card .muted { margin: 0; color: #a5bec0; font-size: 12px; }

.progress-ring {
  position: absolute;
  z-index: 1;
  top: 24px;
  right: 22px;
  display: flex;
  width: 67px;
  height: 67px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(207, 232, 217, .3);
  border-radius: 50%;
  color: var(--mint);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1;
}

.progress-ring::before {
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(207, 232, 217, .35);
  border-radius: 50%;
  content: '';
}

.progress-ring span { font-size: 23px; font-weight: 700; }
.progress-ring small { align-self: flex-end; margin: 0 0 18px 2px; font-size: 10px; }

.progress-track {
  position: relative;
  z-index: 1;
  height: 5px;
  margin: 30px 0 13px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 254, 250, .15);
}

.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--coral); transition: width .35s ease; }
.hero-footer { position: relative; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hero-footer strong { font-size: 12px; font-weight: 600; }
.hero-footer span { color: #a5bec0; font-size: 11px; text-align: right; }

.meal-section { padding: 31px 2px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 13px; }
.section-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.06em; }
.section-note { color: var(--ink-soft); font-size: 11px; }
.meal-list { display: grid; gap: 10px; }

.meal-card {
  display: grid;
  width: 100%;
  min-height: 78px;
  grid-template-columns: 48px 1fr auto 31px;
  align-items: center;
  gap: 10px;
  padding: 13px 14px 13px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 254, 250, .63);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.meal-card:active { transform: scale(.985); }
.meal-card:focus-visible, .settings-toggle:focus-visible, .primary-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgba(44, 133, 129, .32); outline-offset: 3px; }
.meal-card:hover { border-color: #b7cbc4; box-shadow: 0 7px 18px rgba(20, 46, 55, .05); }
.meal-card.is-done { border-color: #b8d8c5; background: var(--mint); }
.meal-card.is-pending { opacity: .62; pointer-events: none; }

.meal-icon { position: relative; display: grid; width: 48px; height: 48px; place-items: center; border-radius: 15px; }
.meal-icon::before, .meal-icon::after, .meal-icon span::before, .meal-icon span::after { position: absolute; display: block; content: ''; }
.meal-icon-sun { background: #ffead1; }
.meal-icon-sun::before { width: 17px; height: 17px; border: 2px solid #e28b51; border-radius: 50%; }
.meal-icon-sun::after { width: 28px; height: 2px; background: #e28b51; box-shadow: 0 -11px #e28b51, 0 11px #e28b51; transform: rotate(90deg); }
.meal-icon-sun span::before { width: 5px; height: 5px; border-radius: 50%; background: #e28b51; box-shadow: 13px 0 #e28b51, 6px -12px #e28b51, 6px 12px #e28b51; }
.meal-icon-midday { background: #dcefeb; }
.meal-icon-midday::before { width: 22px; height: 22px; border: 2px solid var(--teal); border-radius: 50%; }
.meal-icon-midday::after { bottom: 12px; width: 30px; height: 2px; background: var(--teal); }
.meal-icon-midday span::before { width: 2px; height: 10px; background: var(--teal); transform: translateY(-7px); }
.meal-icon-midday span::after { width: 2px; height: 8px; background: var(--teal); transform: translate(6px, -8px) rotate(45deg); }
.meal-icon-moon { background: #e8e6f5; }
.meal-icon-moon::before { width: 22px; height: 22px; border-radius: 50%; background: #7473a7; transform: translate(2px, -1px); }
.meal-icon-moon::after { width: 21px; height: 21px; border-radius: 50%; background: #e8e6f5; transform: translate(9px, -7px); }
.meal-icon-moon span::before, .meal-icon-moon span::after { width: 3px; height: 3px; border-radius: 50%; background: #7473a7; }
.meal-icon-moon span::before { transform: translate(-14px, -14px); box-shadow: 27px 11px #7473a7; }

.meal-copy { display: grid; gap: 4px; min-width: 0; }
.meal-copy strong { font-family: 'Space Grotesk', sans-serif; font-size: 16px; letter-spacing: -.03em; }
.meal-copy small { overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.meal-card.is-done .meal-copy small { color: #39705f; }
.meal-time { align-self: start; padding-top: 3px; color: var(--ink-soft); font-size: 10px; font-weight: 600; white-space: nowrap; }
.meal-card.is-done .meal-time { color: #39705f; }
.meal-check { position: relative; display: block; width: 27px; height: 27px; border: 1px solid #b9c8c4; border-radius: 50%; }
.meal-check::after { position: absolute; top: 6px; left: 8px; width: 7px; height: 4px; border-bottom: 2px solid transparent; border-left: 2px solid transparent; content: ''; transform: rotate(-45deg); }
.meal-card.is-done .meal-check { border-color: var(--teal); background: var(--teal); }
.meal-card.is-done .meal-check::after { border-color: var(--white); }
.tap-hint { margin: 12px 3px 0; color: var(--ink-soft); font-size: 11px; }

.encouragement { display: flex; align-items: center; gap: 10px; padding: 28px 0 24px; color: var(--teal-dark); }
.encouragement p { margin: 0; flex: 1; font-family: 'Space Grotesk', sans-serif; font-size: 12px; font-weight: 600; text-align: center; }
.encouragement-line { width: 28px; height: 1px; background: #b8ccc3; }

.settings-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 254, 250, .63); }
.settings-toggle { display: flex; width: 100%; align-items: center; gap: 12px; padding: 16px; border: 0; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.settings-toggle > span:nth-child(2) { display: grid; flex: 1; gap: 3px; }
.settings-toggle strong { font-family: 'Space Grotesk', sans-serif; font-size: 14px; }
.settings-toggle small { color: var(--ink-soft); font-size: 11px; }
.settings-symbol { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #b8ccc3; border-radius: 9px; color: var(--teal-dark); font-size: 20px; font-weight: 400; line-height: 1; transition: transform .2s ease; }
.settings-toggle[aria-expanded="true"] .settings-symbol { transform: rotate(45deg); }
.chevron { width: 8px; height: 8px; border-right: 1px solid var(--ink-soft); border-bottom: 1px solid var(--ink-soft); transform: rotate(45deg) translateY(-2px); transition: transform .2s ease; }
.settings-toggle[aria-expanded="true"] .chevron { transform: rotate(225deg) translate(-2px, -2px); }
.settings-content { padding: 0 16px 17px; }
.settings-block { padding-top: 5px; }
.settings-title-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.settings-title-row h3, .install-block h3 { margin: 0; font-size: 18px; letter-spacing: -.04em; }
.status-pill { padding: 5px 9px; border-radius: 99px; color: var(--ink-soft); background: var(--paper-deep); font-size: 10px; font-weight: 700; }
.status-pill.is-on { color: #286955; background: var(--mint); }
.settings-description { margin: 9px 0 14px; }
.push-diagnostics { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.push-diagnostics li { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 11px; }
.push-diagnostics strong { color: var(--ink); font-weight: 600; }
.push-diagnostics .dot { width: 8px; height: 8px; border-radius: 50%; background: #c4cfca; flex: none; }
.push-diagnostics li.is-ok .dot { background: var(--teal); }
.push-diagnostics li.is-bad .dot { background: var(--coral); }
.push-diagnostics li.is-warn .dot { background: var(--yellow); }
.primary-button, .secondary-button { min-height: 43px; border-radius: 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.primary-button { width: 100%; border: 0; color: var(--white); background: var(--teal-dark); box-shadow: 0 6px 12px rgba(33, 107, 107, .16); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { width: 100%; border: 1px solid #afc9be; color: var(--teal-dark); background: transparent; }
.settings-feedback { min-height: 15px; margin: 8px 0 0; color: var(--teal-dark); font-size: 11px; }
.switch-row { display: flex; align-items: center; gap: 12px; margin: 15px 0 13px; cursor: pointer; }
.switch-row > span:first-child { display: grid; flex: 1; gap: 3px; }
.switch-row strong { font-size: 12px; }
.switch-row small { color: var(--ink-soft); font-size: 10px; }
.switch-row input { position: absolute; opacity: 0; }
.switch { position: relative; display: block; width: 42px; height: 24px; border-radius: 99px; background: #cbd5d1; transition: background .2s ease; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(20, 46, 55, .2); content: ''; transition: transform .2s ease; }
.switch-row input:checked + .switch { background: var(--teal); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.reminder-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reminder-times label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 10px; font-weight: 600; }
.reminder-times input { width: 100%; padding: 9px 5px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--paper); font-size: 12px; }
.reminder-times input:focus { outline: 2px solid rgba(44, 133, 129, .3); outline-offset: 1px; }
.settings-divider { height: 1px; margin: 20px 0 17px; background: var(--line); }
.ios-tip { margin: 10px 0 0; padding: 10px 12px; border-radius: 9px; color: var(--ink-soft); background: var(--paper-deep); font-size: 11px; line-height: 1.5; }
.timezone-note { margin: 19px 0 0; color: var(--ink-soft); font-size: 10px; text-align: center; }
.app-footer { padding: 26px 0 0; color: #849794; font-size: 10px; text-align: center; }
.footer-cat { display: inline-block; margin-right: 4px; color: var(--coral); }
.toast { position: fixed; z-index: 5; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); left: 20px; max-width: 420px; margin: auto; padding: 12px 16px; border-radius: 12px; color: var(--white); background: var(--ink); box-shadow: var(--shadow); font-size: 12px; text-align: center; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width: 640px) {
  .app-shell { padding: 34px 34px 40px; }
  .app-header { padding-bottom: 30px; }
  .meal-list { grid-template-columns: repeat(3, 1fr); }
  .meal-card { display: flex; min-height: 190px; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 0; padding: 16px; }
  .meal-card .meal-icon { width: 54px; height: 54px; }
  .meal-copy { margin-top: 18px; }
  .meal-copy strong { font-size: 17px; }
  .meal-time { order: 4; align-self: auto; margin-top: 8px; padding: 0; }
  .meal-check { position: absolute; margin: 0 0 0 204px; }
  .meal-card { position: relative; }
  .tap-hint { text-align: right; }
}
