/* Kitchen Board phone page. Made for iPhone Safari first. */

:root {
  --bg: #f5f2ea;
  --card: #ffffff;
  --ink: #1c1b19;
  --muted: #64605a;
  --line: #e3ded3;
  --red: #c42a2f;
  --yellow: #f3cf3c;
  --blue: #2b56b3;
  --green: #2e7a46;
  --focus: #2b56b3;
  --radius: 16px;
  --tabbar: 64px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --card: #23211e;
    --ink: #f3efe6;
    --muted: #aaa49a;
    --line: #38352f;
    --red: #ef5a5e;
    --blue: #7ea0ec;
    --green: #67b883;
    --focus: #7ea0ec;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 12px; }
[hidden] { display: none !important; }
.small { font-size: 15px; }

/* Inputs are 17px so Safari doesn't zoom in when one is tapped. */
input, button { font: inherit; color: inherit; }

input[type="text"], input[type="date"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 17px;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus-visible, button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  cursor: pointer;
}
.button.wide { width: 100%; }
.button.quiet { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.button.danger { background: transparent; color: var(--red); border: 2px solid var(--line); }
.button:disabled { opacity: 0.5; }

/* Login and setup screens. */

.center {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}
.welcome {
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 18px;
  text-align: center;
}
.swatches { display: flex; justify-content: center; gap: 6px; }
.swatches span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); }
.message { min-height: 1.4em; color: var(--red); font-weight: 600; }

/* The app. */

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}
.screen[hidden] { display: none; }

.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.preview {
  width: 100%;
  aspect-ratio: 800 / 480;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}

/* Meals. */

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
}
.segmented button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.day h2.today { color: var(--red); }
.meal { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 10px; }
.meal label { font-weight: 600; color: var(--muted); font-size: 15px; }

/* Countdowns. */

.countdown { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 14px; }
.days {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: #1c1b19;
  border: 3px solid #1c1b19;
  font-size: 26px;
  font-weight: 800;
}
.days.zero { background: var(--red); color: #fff; font-size: 15px; }
.icon-button {
  min-width: 48px;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  cursor: pointer;
}
.form-row { display: grid; gap: 10px; }

/* Settings. */

.phone { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link-box { word-break: break-all; font-size: 15px; background: var(--bg); padding: 12px; border-radius: 12px; }
.row-buttons { display: flex; gap: 10px; }
.row-buttons > * { flex: 1; }

/* Bottom tabs. */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tabs button {
  min-height: 52px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs svg { width: 26px; height: 26px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
