/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:   #faf7f2;
  --parchment: #f0ead8;
  --warm-brown: #8b6f4e;
  --deep-brown: #4a3728;
  --olive:   #6b7c5c;
  --rust:    #c0622f;
  --rust-light: #f2e4d8;
  --gold:    #c9a84c;
  --text:    #2e2318;
  --muted:   #7a6555;
  --border:  #d9cbb8;
}

html, body {
  height: 100%;
  font-family: 'Georgia', serif;
  background: var(--cream);
  color: var(--text);
}

.hidden { display: none !important; }

/* The `hidden` ATTRIBUTE, made to actually work. The browser hides it with a
   built-in [hidden] { display: none } rule, but any author rule setting display
   beats a built-in one no matter how specific — so an element that is both
   `hidden` and styled `display: flex` stays on screen. That is silent and
   confusing: the markup says hidden, the JS sets hidden, and the thing renders.
   Same weight as .hidden above, so both ways of hiding behave the same. */
[hidden] { display: none !important; }

/* ── Screens ── */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Setup screen ── */
#setup-screen {
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.setup-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(74, 55, 40, 0.08);
}

.app-title {
  font-size: 2.2rem;
  color: var(--deep-brown);
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.setup-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  font-style: italic;
}

.setup-label {
  display: block;
  text-align: left;
  font-size: 1rem;
  color: var(--deep-brown);
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.setup-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: normal;
  font-style: italic;
  margin-top: 0.15rem;
}

.setup-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--cream);
  margin-bottom: 1.25rem;
  outline: none;
  transition: border-color 0.2s;
}
.setup-input:focus { border-color: var(--warm-brown); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--olive);
  color: white;
  width: 100%;
}
.btn-primary:hover { opacity: 0.88; }

.btn-reset {
  background: transparent;
  color: var(--rust);
  border: 1.5px solid var(--rust);
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
}
.btn-reset:hover { background: var(--rust-light); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s;
  line-height: 1;
}
.btn-icon:hover { color: var(--deep-brown); }

.header-back {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s;
  white-space: nowrap;
}
.header-back:hover { color: var(--deep-brown); }

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: white;
}

.header-title {
  font-size: 1.3rem;
  color: var(--deep-brown);
  letter-spacing: 0.05em;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Counter ── */
.counter-section {
  text-align: center;
  padding: 2rem 1rem;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(74, 55, 40, 0.06);
}

.fighting-label {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-style: italic;
}

.fighting-label span {
  color: var(--deep-brown);
  font-style: normal;
  font-weight: bold;
}

.days-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-bottom: 0.75rem;
}

.day-number {
  font-size: clamp(4rem, 18vw, 6.5rem);
  font-weight: bold;
  color: var(--olive);
  line-height: 1;
  font-family: 'Georgia', serif;
}

.day-word {
  font-size: 1.1rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: 'Georgia', serif;
}

.streak-start-date {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Reset section ── */
.reset-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.reset-hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Encouragement box ── */
.encourage-box {
  background: var(--parchment);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.encourage-text {
  font-size: 1.05rem;
  color: var(--deep-brown);
  line-height: 1.65;
  font-style: italic;
}

/* ── History ── */
.history-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: 'Georgia', serif;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.history-days {
  font-weight: bold;
  color: var(--deep-brown);
}

.history-days-label { color: var(--muted); }

.history-date {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.history-empty {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* ── Edit modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 35, 24, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-card {
  background: white;
  border-radius: 14px;
  padding: 2rem 1.75rem;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(74, 55, 40, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-card h3 {
  font-size: 1.1rem;
  color: var(--deep-brown);
}

.modal-card .setup-input { margin-bottom: 0; }

/* Explains a limit inside a modal — nothing has gone wrong, so it reads muted
   rather than red. */
.modal-note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

/* A save that actually failed, shown under the input it belongs to. */
.modal-error {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--rust);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}

.modal-actions .btn { flex: 1; }

.btn-secondary {
  background: var(--parchment);
  color: var(--deep-brown);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: var(--rust);
  color: white;
}
.btn-danger:hover { opacity: 0.88; }

/* ── Multi-tracker list ── */

#trackers-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tracker-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(74, 55, 40, 0.06);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tracker-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tracker-name {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: 'Georgia', serif;
}

.tracker-card-controls {
  display: flex;
  gap: 0.1rem;
}

.tracker-remove-btn:hover { color: var(--rust); }

.tracker-counter {
  text-align: center;
}

/* ── Collapsible history inside a card ── */

.tracker-history {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: 'Georgia', serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0;
  text-align: left;
  transition: color 0.15s;
}
.history-toggle:hover { color: var(--deep-brown); }

/* History items sit inside a white card, so use cream background */
.tracker-history .history-item {
  background: var(--cream);
}

/* ── Remove confirmation ── */

.remove-confirm {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.remove-confirm-text {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.remove-confirm-actions {
  display: flex;
  gap: 0.75rem;
}

.remove-confirm-actions .btn { flex: 1; }

/* ── Add tracker button ── */

.btn-add {
  width: 100%;
  padding: 0.8rem 1rem;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: border-color 0.15s, color 0.15s;
}
.btn-add:hover {
  border-color: var(--warm-brown);
  color: var(--deep-brown);
}

/* ── Verse for the moment ── */

/* ── Verse search ── */

.verse-search-row {
  display: flex;
  gap: 0.5rem;
}

.verse-search-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--cream);
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.verse-search-input:focus { border-color: var(--warm-brown); }
.verse-search-input::placeholder { color: var(--muted); font-style: italic; }

.btn-verse-search {
  padding: 0.7rem 1.1rem;
  background: var(--olive);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-verse-search:hover   { opacity: 0.88; }
.btn-verse-search:disabled { opacity: 0.5; cursor: not-allowed; }

.verse-suggestions-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.verse-suggestions-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: 'Georgia', serif;
}

.verse-loading {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 0.4rem 0;
}

.verse-encouragement {
  font-size: 0.88rem;
  color: var(--olive);
  line-height: 1.6;
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
  margin-top: 0.1rem;
}

/* ── Verse section ── */
.verse-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 2px 16px rgba(74, 55, 40, 0.06);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.verse-section-title {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: 'Georgia', serif;
}

.verse-prompt {
  font-size: 0.92rem;
  color: var(--deep-brown);
  font-style: italic;
}

.feeling-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.feeling-btn {
  padding: 0.35rem 0.85rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.83rem;
  color: var(--deep-brown);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.4;
}
.feeling-btn:hover {
  background: var(--parchment);
  border-color: var(--warm-brown);
}
.feeling-btn--active {
  background: var(--olive);
  border-color: var(--olive);
  color: white;
}

.verse-box {
  background: var(--parchment);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.verse-text {
  margin: 0;
  padding: 0;
  font-size: 1rem;
  color: var(--deep-brown);
  line-height: 1.72;
  font-style: italic;
  font-family: 'Georgia', serif;
}

.verse-ref {
  font-size: 0.82rem;
  color: var(--warm-brown);
  font-weight: bold;
  letter-spacing: 0.03em;
}

.btn-another {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  text-align: left;
  transition: color 0.15s;
}
.btn-another:hover { color: var(--deep-brown); }

/* ── BSB attribution ── */
/* BSB is CC0 (public domain); this notice is offered, not legally required. */
.esv-notice {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  font-size: 0.7rem;
  line-height: 1.6;
  text-align: center;
  color: var(--muted);
}

/* The verse feed fills the viewport and has no footer region, so the notice sits
   over it as a short line. It must never swallow a swipe on the slide beneath. */
.esv-notice--fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-width: none;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  font-size: 0.62rem;
  line-height: 1.4;
  opacity: 0.75;
  pointer-events: none;
}
