:root {
  color-scheme: light;
  --ink: #1b1a17;
  --muted: #6f665b;
  --accent: #c3622b;
  --accent-soft: rgba(195, 98, 43, 0.18);
  --surface: #fff7ed;
  --border: #e6d7c4;
  --bg: #f6efe3;
  --radius: 16px;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  color: var(--ink);
  background: var(--bg) url("background.webp") center / cover no-repeat fixed;
  min-height: 100vh;
}

.shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 20px 32px;
  display: grid;
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  margin-left: auto;
}

body.view-list .header-left {
  display: none;
}

body.step-book .header-left {
  display: none;
}

body.step-book .app-header {
  justify-content: flex-end;
}

.back-button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.back-button:disabled {
  visibility: hidden;
}

.flash-preview {
  font-weight: 600;
  font-size: 1rem;
}

.flash-preview:empty {
  display: none;
}

.tab-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  overflow: hidden;
}

.tab-highlight {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  background: var(--accent);
  border-radius: 999px;
  width: 40px;
  transform: translateX(0);
  transition: transform 0.25s ease, width 0.25s ease;
  z-index: 0;
}

.tab-button {
  position: relative;
  z-index: 1;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 999px;
}

.tab-button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.views {
  display: grid;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.flash-shell {
  display: grid;
  gap: 16px;
}

.flash-step {
  display: none;
  gap: 14px;
}

.flash-step.active {
  display: grid;
}

.book-groups {
  display: grid;
  gap: 14px;
}

.book-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  color: var(--muted);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 10px;
  max-height: 75vh;
  overflow: auto;
  padding-right: 6px;
}

.verse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 10px;
  max-height: 70vh;
  overflow: auto;
  padding-right: 6px;
}

.option-button,
.verse-button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 14px 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, background 0.2s ease;
}

.option-button:hover,
.verse-button:hover {
  transform: translateY(-1px);
}

.option-button.active,
.verse-button.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.verse-button.range {
  background: var(--accent-soft);
  border-color: transparent;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  font: inherit;
}

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  cursor: pointer;
}

.ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  cursor: pointer;
}

.flash-feedback {
  min-height: 1.2rem;
  margin: 0;
  color: var(--accent);
  font-size: 0.9rem;
}

.list-shell {
  display: grid;
  gap: 16px;
}

.list-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.list-delete {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
}

.list-selected {
  color: var(--muted);
  font-size: 0.85rem;
}

.list-empty {
  color: var(--muted);
  font-weight: 600;
}

.list-groups {
  display: grid;
  gap: 16px;
}

.day-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.day-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  color: var(--muted);
}

.day-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.verse-pill {
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.verse-pill.selected {
  background: #a84d1b;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 8px);
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(27, 26, 23, 0.4);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
}

.modal-card {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 20px 40px rgba(27, 26, 23, 0.2);
}

.hidden {
  display: none;
}

.modal.hidden {
  display: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-weight: 600;
}

.modal-close {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
}

.modal-textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  min-height: 140px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .shell {
    padding: 10px 12px 16px;
    gap: 10px;
  }

  .app-header {
    flex-wrap: wrap;
    align-items: center;
  }

  .header-right {
    margin-left: auto;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal {
    align-items: end;
  }

  .modal-card {
    border-radius: 16px 16px 0 0;
    width: 100%;
  }
}
