:root {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-primary: #1F4F4A;
  --color-primary-strong: #173c39;
  --color-accent: #C8A85A;
  --color-olive: #6F8A5A;
  --color-text: #2B2B2B;
  --color-muted: #6f7168;
  --color-border: #E6E6E3;
  --color-subtle: #F7F6F2;
  --shadow-soft: 0 12px 28px rgba(31, 79, 74, 0.12);
  --radius-card: 16px;
  --radius-button: 12px;
  --font-body: "Source Sans 3", "Noto Sans", sans-serif;
  --font-heading: "Spectral", "Source Serif 4", serif;
  --font-script: "Dancing Script", "Spectral", serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; display: block; }

body {
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  color: var(--color-text);
  line-height: 1.6;
  background:
    radial-gradient(600px 320px at 50% 0%, rgba(31, 79, 74, 0.12), transparent 65%),
    linear-gradient(180deg, var(--color-bg) 0%, var(--color-subtle) 100%);
}

.wrap { max-width: 900px; margin: 0 auto; padding: 22px 20px 40px; }
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 20px 18px;
  margin: 14px 0;
  box-shadow: var(--shadow-soft);
}
.row { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

h1, h2 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  letter-spacing: 0.02em;
}
h1 { margin: 0 0 6px 0; font-size: clamp(34px, 8vw, 48px); }
h2 { margin: 10px 0; font-size: clamp(20px, 3.5vw, 28px); }

.small { color: var(--color-muted); font-size: 14px; }
label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--color-primary); }

input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 16px;
  background: #fff;
  color: var(--color-text);
}
input[type="date"]:focus,
input[type="time"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(200, 168, 90, 0.2);
}

button {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-button);
  font-size: 16px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}
button:hover { background: var(--color-primary-strong); border-color: var(--color-primary-strong); }
button:active { transform: translateY(1px); }
button:focus-visible {
  outline: 3px solid rgba(200, 168, 90, 0.45);
  outline-offset: 2px;
}
button.secondary {
  background: #fff;
  color: var(--color-olive);
  border-color: rgba(111, 138, 90, 0.7);
}
button.secondary:hover { background: rgba(111, 138, 90, 0.1); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

hr {
  border: none;
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
}

.pill {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #fbfaf7;
  color: var(--color-primary);
}
.pill.is-clickable { cursor: pointer; }
.mono { font-family: var(--font-mono); font-size: 13px; color: var(--color-muted); }
.logoheader { display: flex; justify-content: center; margin-bottom: 8px; }
.logoheader img { width: min(210px, 62vw); }

.logo-panel {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-panel--intro { padding: clamp(14px, 3.2vw, 24px); }
.logo-panel--intro .intro-logo { width: clamp(160px, 52vw, 260px); }
.logo-panel--app { padding: 12px; }

.notice {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(200, 168, 90, 0.6);
  border-radius: 12px;
  background: #fff8e6;
  color: #7a5b1b;
  font-size: 14px;
}
.notice--ok {
  border-color: rgba(111, 138, 90, 0.45);
  background: #f3f7f0;
  color: #3f5a43;
}
.notice--warn {
  border-color: rgba(200, 168, 90, 0.6);
  background: #fff8e6;
  color: #7a5b1b;
}
.install-cta {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(200, 168, 90, 0.6);
  background: linear-gradient(180deg, #fffdf6 0%, #fff7e6 100%);
  box-shadow: 0 10px 22px rgba(31, 79, 74, 0.1);
  display: grid;
  gap: 6px;
}
.install-cta__eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-olive);
  font-weight: 600;
}
.install-cta__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary);
}
.install-cta__body { font-size: 14px; color: var(--color-text); }
.install-cta__body--icons {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.install-lead {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.install-instruction { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.install-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}
.install-icon svg { width: 100%; height: 100%; display: block; }
.install-keyword { color: var(--color-primary); font-weight: 700; }
.install-cta__button { margin-top: 6px; }
.install-cta__hint { font-size: 12px; color: var(--color-muted); }
.install-cta--pulse { box-shadow: 0 0 0 3px rgba(200, 168, 90, 0.25), var(--shadow-soft); }
.install-card .modal-body { white-space: normal; }
.install-card .install-cta {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.install-graphic {
  min-height: 160px;
  border-radius: 16px;
  border: 2px dashed rgba(200, 168, 90, 0.55);
  background: #fffcf4;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  text-align: center;
  padding: 10px;
}
.install-graphic__img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}
.install-graphic__text {
  font-size: 12px;
  color: var(--color-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 12px;
}
.install-card .install-cta.install-cta--pulse {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 250, 235, 0.9);
  box-shadow: 0 0 0 3px rgba(200, 168, 90, 0.25), var(--shadow-soft);
}
@media (display-mode: standalone) {
  #installModal { display: none !important; }
}
@media (display-mode: fullscreen) {
  #installModal { display: none !important; }
}
@media (display-mode: standalone) and (min-width: 600px) {
  .wrap { max-width: 432px; }
  .intro { max-width: 432px; margin: 0 auto; }
}
.install-available #installModal { display: grid !important; }
.support-ad { margin: 14px 0 6px; }
.support-ad-link {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: 0 10px 22px rgba(31, 79, 74, 0.12);
}
.support-ad-img { width: 100%; height: auto; display: block; }
.admin-controls { margin-top: 12px; }
.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 14px;
}
.stats-card {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.stats-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin-bottom: 6px;
}
.stats-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-primary);
}
.stats-section { margin-top: 16px; }
.stats-chart { display: grid; gap: 8px; margin-top: 8px; }
.stats-bar {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  gap: 10px;
  align-items: center;
}
.stats-bar-label { font-size: 12px; color: var(--color-muted); }
.stats-bar-track {
  height: 10px;
  background: var(--color-subtle);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(31, 79, 74, 0.55), rgba(200, 168, 90, 0.9));
  border-radius: 999px;
}
.stats-bar-value { font-size: 12px; text-align: right; color: var(--color-text); }
.stats-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff;
  font-size: 12px;
  box-shadow: var(--shadow-soft);
}
.stats-pill-label { color: var(--color-muted); }
.stats-pill-value { color: var(--color-primary); font-weight: 600; }

.intro {
  min-height: 100svh;
  padding: 28px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}
.intro-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(26vh) scale(1.02);
  animation: hero-rise 900ms ease forwards;
}
.intro-logo { height: auto; }
.intro-content {
  max-width: 760px;
  width: 100%;
  opacity: 0;
  animation: intro-fade 700ms ease forwards;
  animation-delay: 800ms;
  text-align: left;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px 16px;
  box-shadow: var(--shadow-soft);
}
.intro-content p { margin: 8px 0; line-height: 1.5; }
.intro-quote {
  font-style: italic;
  margin: 2px 0 6px;
  font-size: 0.95rem;
  line-height: 1.6;
  border-left: 3px solid var(--color-accent);
  padding-left: 14px;
}
.intro-quote strong { font-weight: 700; color: var(--color-primary); }
.intro-verse { color: var(--color-accent); font-size: 13px; margin-bottom: 10px; }
.intro-actions { margin-top: 18px; display: flex; justify-content: center; }
.intro-actions button { max-width: 240px; }
.intro .notice {
  margin: 14px auto 0;
  max-width: 520px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.intro-close { font-weight: 600; color: var(--color-primary); margin-top: 6px; }

.day-choices { margin-bottom: 8px; }
.day-choices { flex-direction: row; }
.day-choices button { width: auto; flex: 1; }
.day-choices .selected { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.day-display {
  font-size: 14px;
  color: var(--color-primary);
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.day-display span { font-weight: 600; }
#dayOneLabel { font-weight: 400; }
.day-input { display: none; }
.setup-edit .day-choices { display: none; }
.setup-edit #dayOneTitle { display: none; }
.setup-edit #dayOneLabel { display: none; }

.setup-actions { gap: 12px; }
.setup-actions button { flex: 1 1 0; }
.reset-row { margin-top: 12px; }
.reset-row button { margin-bottom: 6px; }
button.danger {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
}
button.danger:hover { background: rgba(185, 28, 28, 0.08); }
.pause-row { gap: 10px; }
.pause-row { margin-top: 10px; }
.pause-row button { flex: 1 1 0; }

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill-list--center { justify-content: center; text-align: center; }
.ready-quote { margin-top: 10px; }

.time-grid { flex-direction: row; flex-wrap: nowrap; gap: 8px; }
.time-grid .time-field { flex: 1 1 0; min-width: 0; }
.time-grid label { margin-bottom: 3px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.time-control { position: relative; }
.time-display {
  width: 100%;
  padding: 10px 6px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
  border: 1px solid rgba(111, 138, 90, 0.7);
  border-radius: var(--radius-button);
  color: var(--color-olive);
  background: #fff;
  pointer-events: none;
}
.time-control:focus-within .time-display {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(200, 168, 90, 0.2);
}

.main-card { position: relative; padding-top: 20px; padding-bottom: 160px; }
.corner {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  display: flex;
  z-index: 10;
}
.corner-left { left: calc(12px + env(safe-area-inset-left)); }
.corner-right { right: calc(12px + env(safe-area-inset-right)); }
.main-head { text-align: center; margin-bottom: 12px; }
.kicker {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: clamp(18px, 5vw, 24px);
  color: var(--color-primary-strong);
  letter-spacing: 0.02em;
  text-transform: none;
}
.main-word {
  font-family: var(--font-heading);
  font-size: clamp(34px, 10vw, 54px);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.scripture-link {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--color-olive);
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 4px 0 8px;
  font-size: 14px;
  text-align: center;
  box-shadow: none;
}
.scripture-link:hover { color: var(--color-primary); }
.scripture-link:hover,
.scripture-link:active {
  background: transparent;
  border-color: transparent;
}
.what-is { font-weight: 600; color: var(--color-primary); margin-top: 6px; text-align: center; }
.item-title { font-size: 18px; font-weight: 600; text-align: center; margin: 6px 0 12px; }
.thought-bubbles {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 12px auto 0;
  max-width: 520px;
  position: relative;
}
.thought-bubble {
  position: relative;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid rgba(200, 168, 90, 0.45);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  width: 100%;
  transform: translate(var(--stack-x, 0px), var(--stack-offset, 0px)) scale(var(--stack-scale, 1));
  z-index: var(--stack-z, 1);
  transform-origin: center top;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.thought-bubble.is-current {
  border-color: rgba(31, 79, 74, 0.45);
  background: #f5fbfa;
}
.thought-bubbles.has-previous .thought-bubble.is-current { margin-top: 12px; }
.thought-bubble.is-previous { opacity: 0.82; }
.thought-bubble.is-previous + .thought-bubble.is-previous { margin-top: -14px; }
.thought-bubble.is-complete { opacity: 0.85; }
.thought-bubble.is-focused {
  opacity: 1;
  box-shadow: 0 12px 24px rgba(31, 79, 74, 0.16);
}
.thought-bubble::before,
.thought-bubble::after {
  content: "";
  position: absolute;
  background: #fff;
  border: 1px solid rgba(200, 168, 90, 0.45);
  border-radius: 999px;
}
.thought-bubble::before {
  width: 14px;
  height: 14px;
  bottom: -10px;
  right: 36px;
}
.thought-bubble::after {
  width: 8px;
  height: 8px;
  bottom: -20px;
  right: 24px;
}
.thought-bubble.tail-left::before {
  right: auto;
  left: 36px;
}
.thought-bubble.tail-left::after {
  right: auto;
  left: 24px;
}
.prompt-text { font-size: 18px; text-align: center; }
.main-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  z-index: 12;
}
.main-actions #ack { width: min(520px, 92vw); }
.action-row {
  width: min(520px, 92vw);
  flex-direction: row;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: nowrap;
}
.mini { padding: 8px 10px; font-size: 12px; width: auto; flex: 1 1 0; }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 28, 0.5);
}
.modal-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px;
  width: min(520px, 90vw);
  box-shadow: var(--shadow-soft);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.modal-title { font-weight: 600; color: var(--color-primary); }
.modal-body { font-size: 15px; line-height: 1.6; color: var(--color-text); white-space: pre-line; }
.verse-card {
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.verse-body {
  white-space: normal;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1 1 auto;
}
.chapter-block { margin-bottom: 14px; }
.chapter-title {
  font-weight: 600;
  color: var(--color-primary);
  margin: 6px 0 8px;
}
.verse-line {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  scroll-margin-top: 12px;
}
.verse-line.is-highlight {
  background: rgba(200, 168, 90, 0.2);
  box-shadow: inset 3px 0 0 rgba(200, 168, 90, 0.6);
}
.verse-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
  text-align: right;
  padding-top: 2px;
}
.verse-text { font-size: 15px; color: var(--color-text); }
.calendar-card { padding: 16px; }
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 6px;
  text-align: center;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-status {
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
  margin: 4px 0 6px;
}
.calendar-status:empty { display: none; }
.cal-day {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 8px 0;
  text-align: center;
  font-size: 13px;
  background: #fff;
  color: var(--color-text);
  min-height: 34px;
}
.cal-day--empty {
  border: none;
  background: transparent;
}
.cal-day--1 {
  background: #e5efd8;
  border-color: #8aa171;
  color: #3f5a43;
}
.cal-day--2 {
  background: #f4e3b6;
  border-color: #c8a85a;
  color: #7a5b1b;
}
.cal-day--3 {
  background: #d4e4e1;
  border-color: #1f4f4a;
  color: #1f4f4a;
}
.cal-day--today {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-muted);
}
.legend-item { display: inline-flex; gap: 6px; align-items: center; }
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: #fff;
}
.legend-0 { background: #fff; border-color: var(--color-border); }
.legend-1 { background: #e5efd8; border-color: #8aa171; }
.legend-2 { background: #f4e3b6; border-color: #c8a85a; }
.legend-3 { background: #d4e4e1; border-color: #1f4f4a; }
.time-input {
  position: absolute;
  inset: 0;
  opacity: 0.01;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  border: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 720px) {
  .wrap,
  .intro {
    max-width: 432px;
    margin-left: auto;
    margin-right: auto;
  }
  .main-actions {
    left: 50%;
    right: auto;
    width: min(432px, 92vw);
    transform: translateX(-50%);
  }
  .main-actions #ack,
  .action-row {
    width: 100%;
  }
  .corner-left { left: calc(50% - 216px + 12px); }
  .corner-right { right: calc(50% - 216px + 12px); }
  .wrap { padding: 28px 24px 56px; }
  .row { flex-direction: row; align-items: center; }
  button { width: auto; }
  .card { padding: 24px 22px; }
  .intro { padding: 56px 40px 72px; }
  .intro-content { padding: 28px 30px; }
}

@media (min-width: 1000px) {
  .intro { gap: 32px; }
  .intro-hero { transform: translateY(16vh) scale(1.06); }
}

@keyframes hero-rise {
  from { transform: translateY(26vh) scale(1.08); }
  to { transform: translateY(0) scale(1); }
}
@keyframes intro-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .intro-hero { animation: none; transform: none; }
  .intro-content { animation: none; opacity: 1; }
}
