:root {
  --maroon: #990066;
  --maroon-dark: #6e0049;
  --maroon-soft: #f4e8ef;
  --ink: #1c1c1c;
  --muted: #5a5558;
  --line: #e4d4dc;
  --card: #ffffff;
  --bg: #f6f3f4;
  --paper: #fffdfb;
  --ok: #2a6b4f;
  --danger: #8b2942;
  --shadow: 0 1px 2px rgba(80, 0, 50, 0.06), 0 8px 24px rgba(80, 0, 50, 0.06);
  --radius: 12px;
  --tap: 48px;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
}

body {
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
}

.boot {
  padding: 2rem 1.25rem;
  color: var(--muted);
}

a {
  color: var(--maroon);
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.05rem;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem 0.55rem;
  min-height: 56px;
}

.topbar .title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .ghost,
.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 0.7rem;
  border-radius: 10px;
  color: var(--maroon);
  font-weight: 600;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active,
.ghost:active,
.btn:active {
  transform: scale(0.98);
}

.page {
  padding: 0 1rem 2.5rem;
}

.lede {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.1rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--maroon);
  margin: 1.25rem 0 0.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.set-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
}

.set-row:last-child {
  border-bottom: 0;
}

.set-row .name {
  font-weight: 600;
  font-size: 1.05rem;
}

.set-row .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.set-row .due {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--maroon);
  background: var(--maroon-soft);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.set-row .done-pill {
  color: var(--ok);
  background: #e8f3ec;
}

.empty {
  padding: 1.35rem 1.1rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  background: var(--maroon);
  color: #fff;
  margin-top: 0.85rem;
}

.btn:disabled {
  opacity: 0.45;
}

.btn.secondary {
  background: var(--card);
  color: var(--maroon);
  border: 1.5px solid var(--maroon);
}

.btn.quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #e4c5ce;
}

.btn-row {
  display: flex;
  gap: 0.6rem;
}

.btn-row .btn {
  flex: 1;
}

.credit {
  margin: 2rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.how {
  margin-top: 0.75rem;
}

.how summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--maroon);
  font-weight: 600;
  cursor: pointer;
}

.how ol {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.how li {
  margin: 0.35rem 0;
}

/* Cover card — 3x5 feel */
.cover {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px 4px 12px 12px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1rem 1.15rem;
  margin-top: 0.15rem;
}

.cover-subject {
  text-align: center;
  font-size: 1.35rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid var(--maroon);
}

.tick-block {
  margin-bottom: 0.95rem;
}

.tick-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--maroon-dark);
  margin-bottom: 0.4rem;
}

.ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tick {
  width: 40px;
  height: 40px;
  border: 2px solid var(--maroon);
  border-radius: 6px;
  background: #fff;
  color: transparent;
  padding: 0;
  position: relative;
}

.tick[aria-pressed="true"] {
  background: var(--maroon);
}

.tick[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 7px;
  width: 8px;
  height: 16px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(40deg);
}

.tick:focus-visible {
  outline: 2px solid var(--maroon);
  outline-offset: 2px;
}

.monthly-note {
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--maroon-soft);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}

.chunk-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chunk-list li {
  border-bottom: 1px solid var(--line);
}

.chunk-list li:last-child {
  border-bottom: 0;
}

.chunk-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  min-height: var(--tap);
  padding: 0.7rem 0.15rem;
  gap: 0.75rem;
}

.chunk-link .ref {
  font-weight: 600;
}

.chunk-link .hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.weekday-row,
.field {
  margin: 0.75rem 0;
}

label.lbl {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--maroon-dark);
  margin-bottom: 0.3rem;
}

input[type="text"],
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.7rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--maroon);
  outline-offset: 1px;
  border-color: var(--maroon);
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.5;
}

.help {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

/* Practice card */
.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.session-bar strong {
  color: var(--ink);
}

.instruct {
  background: var(--maroon-soft);
  color: var(--maroon-dark);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}

.verse-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px 4px 10px 10px;
  box-shadow: var(--shadow);
  min-height: 280px;
  padding: 0.95rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
}

.vc-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.vc-ref {
  font-weight: 700;
  font-size: 1.05rem;
}

.vc-subject {
  color: var(--maroon);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: right;
}

.vc-trans {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.15rem 0 0.7rem;
}

.vc-body {
  flex: 1;
  font-size: 1.08rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.vc-body.hidden-text {
  color: var(--muted);
  font-style: italic;
}

.vc-foot {
  margin-top: 1rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
  text-align: center;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.85rem 0 0.2rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4c4cc;
}

.dot.on {
  background: var(--maroon);
}

.dot.done {
  background: #c089a8;
}

.practice-actions {
  margin-top: 0.4rem;
}

.nav-chunks {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.55rem;
}

.banner-ok {
  background: #e8f3ec;
  color: var(--ok);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0 0.75rem;
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 20;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
}

@media (min-width: 480px) {
  body {
    background: #efe8eb;
  }

  #app {
    box-shadow: 0 0 0 1px var(--line), var(--shadow);
    min-height: 100dvh;
  }
}
