/* Shared look for the landing page and all three apps. Mobile first. */
:root {
  --green: #165b33;
  --green-dark: #0b3d22;
  --green-soft: #eef6f0;
  --red: #bb2528;
  --red-dark: #991f22;
  --gold: #f8b229;
  --ink: #1f2a24;
  --muted: #5d6b63;
  --line: #dfe6e1;
  --card: #ffffff;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Scrolling something into view (anchors, focus, taps) keeps it clear of the sticky top bar. */
html { scroll-padding-top: 64px; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 16px 48px;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--green-dark);
}

/* The green backdrop stays put while the page scrolls. A fixed layer is used
   because background-attachment: fixed is unreliable on phones. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
}

main { max-width: 760px; margin: 0 auto; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h2 { color: var(--green); font-size: 1.25rem; }
p { margin: 0 0 12px; }
a { color: var(--green); }
[hidden] { display: none !important; }

/* Top bar, filled in by Xmas.mountHeader() */
.topbar {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -16px 16px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--green-dark); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
.topbar a { color: #fff; text-decoration: none; font-size: .9rem; opacity: .85; white-space: nowrap; }
.topbar .title { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.card.accent { border-top: 4px solid var(--red); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px;
  border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none;
  color: #fff; background: var(--green);
}
.btn:hover { background: var(--green-dark); }
.btn.red { background: var(--red); }
.btn.red:hover { background: var(--red-dark); }
.btn.ghost { background: var(--green-soft); color: var(--green); }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: .875rem; }
.btn:disabled { background: #c9d1cc; color: #fff; cursor: not-allowed; }

label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--green); }
input[type='text'], input[type='url'], input[type='number'], input[type='date'], textarea, select {
  width: 100%; padding: 10px 12px;
  font: inherit; color: inherit; background: #fff;
  border: 2px solid var(--line); border-radius: 10px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); }
textarea { min-height: 88px; resize: vertical; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .8125rem; font-weight: 600;
  background: var(--green-soft); color: var(--green);
}
.chip.red { background: #fbeaea; color: var(--red); }
.chip.gold { background: #fef3d6; color: #8a5a00; }

.notice {
  padding: 10px 12px; border-radius: 0 10px 10px 0;
  border-left: 4px solid var(--green); background: var(--green-soft);
}
.notice.secret { border-left-color: var(--red); background: #fbeaea; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: #fff; z-index: 50;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  pointer-events: none; /* never swallow a tap meant for what is underneath */
}
.toast.error { background: var(--red-dark); }

/* Feedback, mounted by Xmas on every page with a person on it. The button sits
   above the toast's line, clear of the phone's home bar; the page gets room at
   the bottom so nothing it shows has to stay under the button. */
body.has-feedback { padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.feedback-fab {
  position: fixed; z-index: 40; /* under the toast (50) and every sheet (60+) */
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  min-height: 44px; padding: 10px 14px; border: 2px solid #fff; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .9375rem; font-weight: 700; color: #fff; background: var(--green);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.feedback-fab:hover { background: var(--green-dark); }
body.typing .feedback-fab { display: none; }
.feedback-fab { transition: opacity .15s; }
.feedback-fab.tucked { opacity: 0; pointer-events: none; } /* making way for a control of the page underneath */
.feedback-fab:focus-visible, .feedback-sheet .btn:focus-visible, .feedback-anon input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.feedback-backdrop {
  position: fixed; inset: 0; z-index: 65; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .45); padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.feedback-sheet { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; margin: 0; border-top: 6px solid var(--red); }
.feedback-close { min-width: 44px; padding: 0; font-size: 1.1rem; }
.feedback-anon { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-weight: 600; cursor: pointer; }
.feedback-anon input { width: 22px; height: 22px; margin: 0; accent-color: var(--green); }
.feedback-sheet .btn[type='submit'] { width: 100%; }
.feedback-mine-box { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.feedback-mine-box h3 { font-size: 1rem; color: var(--green); }
.feedback-note { padding: 8px 0; border-top: 1px solid var(--line); }
.feedback-note:first-child { border-top: 0; }
.feedback-note p { margin: 0; }
.feedback-body { white-space: pre-wrap; overflow-wrap: anywhere; }
