/* Prodigal Pet — calm, gentle styles. No flashing, nothing moves by itself. */

:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-soft: #f3ecdf;
  --text: #3d3630;
  --muted: #7a6f63;
  --border: #e3d9c8;
  --accent: #7a9e7e;
  --accent-dark: #55755b;
  --accent-soft: #e6efe4;
  --gold: #c9a227;
  --danger: #a8544a;
  --shadow: 0 1px 3px rgba(80, 64, 40, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211d19;
    --surface: #2d2823;
    --surface-soft: #38322b;
    --text: #efe8dc;
    --muted: #b8ab99;
    --border: #4a433a;
    --accent: #93bd97;
    --accent-dark: #b7d6ba;
    --accent-soft: #33402f;
    --gold: #dcb84a;
    --danger: #d08a7f;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 17px;
}

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

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-inner {
  max-width: 640px; margin: 0 auto; padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-weight: 700; color: var(--accent-dark); }
.auth-chip { color: var(--muted); font-size: 0.9em; }

/* ---------- Layout ---------- */
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 110px; }
.page h1 { font-size: 1.6em; margin: 8px 0 4px; }
.page-intro { color: var(--muted); margin-top: 0; }
.center { text-align: center; }

.logo {
  display: block; width: 100%; max-width: 420px; height: auto;
  margin: 8px auto; border-radius: 16px;
}
#page-home h1 { text-align: center; }
.mission { text-align: center; font-size: 1.08em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 16px 0;
}
.card.quiet { background: var(--surface-soft); }
.card h2 { margin-top: 0; font-size: 1.2em; }
.card h3 { margin-bottom: 4px; }

.stack { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.item-card h3 { margin: 4px 0; }
.item-card p { margin: 4px 0; }
.item-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }
.meta { color: var(--muted); font-size: 0.88em; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: 0.82em; font-weight: 600;
}
.badge.gold { background: transparent; border: 1px solid var(--gold); color: var(--gold); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-block;
  background: var(--accent); color: #fff;
  border: none; border-radius: 10px;
  padding: 10px 16px; font-size: 1em; font-family: inherit;
  cursor: pointer; margin: 4px 4px 4px 0; text-decoration: none;
  min-height: 44px;
}
.btn:hover, .btn:focus { background: var(--accent-dark); }
.btn.soft { background: var(--accent-soft); color: var(--accent-dark); }
.btn.big { display: block; width: 100%; padding: 14px; font-size: 1.05em; margin: 8px 0; }
.btn.chip { background: var(--surface-soft); color: var(--text); border: 1px solid var(--border); min-height: 40px; }
.btn.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 0.92em; }
.link-btn {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--accent-dark); text-decoration: underline; cursor: pointer;
}

label { display: block; font-weight: 600; margin: 12px 0 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.9em; }
input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], select, textarea {
  width: 100%; padding: 10px; font-size: 1em; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
input[type="file"] { width: 100%; padding: 8px 0; font-family: inherit; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; }
.form-msg { min-height: 1.2em; color: var(--accent-dark); font-weight: 600; }
.note { color: var(--muted); font-size: 0.92em; }

.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; justify-content: center; }
.type-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }

/* ---------- Verse ---------- */
.verse-card { text-align: center; background: var(--accent-soft); }
.verse-title { margin-bottom: 0; }
.verse-sub { color: var(--muted); margin-top: 2px; font-size: 0.92em; }
.verse-text { font-size: 1.15em; font-style: italic; }
.verse-ref { color: var(--accent-dark); font-weight: 600; font-style: normal; }

/* ---------- My pet ---------- */
.treat-line { font-size: 1.1em; }
.companion-img { width: 100%; max-width: 300px; height: auto; border-radius: 14px; }
.profile-photo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; }
.profile-initial {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4em; font-weight: 700;
}

/* ---------- Messages ---------- */
.thread { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 50vh; overflow-y: auto; }
.msg {
  max-width: 82%; padding: 8px 12px; border-radius: 14px;
  background: var(--surface-soft); align-self: flex-start;
}
.msg.mine { background: var(--accent-soft); align-self: flex-end; }
.msg .meta { display: block; }
#message-form { display: flex; gap: 8px; }
#message-form input { flex: 1; }

/* ---------- Lists ---------- */
.plain-list { padding-left: 20px; }
.plain-list li { margin: 8px 0; }
details.item-card summary { cursor: pointer; font-weight: 700; font-size: 1.05em; }
details.item-card p { font-weight: 400; }

/* ---------- Child accounts ---------- */
.note-card {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.95em;
  text-align: left;
}
.note-card p { margin: 6px 0; }
.note-card ul { margin: 6px 0; padding-left: 20px; }
.note-card li { margin: 4px 0; }
.pet-pick {
  background: none; border: 3px solid transparent; border-radius: 50%;
  padding: 2px; cursor: pointer; line-height: 0; font-family: inherit;
}
.pet-pick img { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; display: block; }
.pet-pick.active { border-color: var(--accent); }
.pet-pick:hover, .pet-pick:focus { border-color: var(--accent-dark); }

/* ---------- Terms & Conditions ---------- */
.terms-body h2 { margin-top: 1.4em; }
.terms-body h2:first-of-type { margin-top: 0; }

/* ---------- Animal control helper ---------- */
.ac-block { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 6px; }
.ac-block .ac-msg:empty { min-height: 0; }

/* ---------- Bottom page bar ---------- */
.pagebar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
}
.pagebar-btn {
  background: none; border: none; font-family: inherit; cursor: pointer;
  color: var(--muted); font-size: 0.82em; font-weight: 600;
  padding: 10px 4px; min-height: 48px; flex: 1; border-radius: 10px;
}
.pagebar-btn.active { color: var(--accent-dark); background: var(--accent-soft); }

a.btn { text-align: center; }
