:root {
  --surface: #f9f9f7;
  --surface-low: #f3f1ee;
  --surface-high: #ece8e3;
  --surface-highest: #e4dfd9;
  --surface-card: #ffffff;
  --surface-dim: #ddd8d1;
  --text: #1f1c1a;
  --text-soft: #605853;
  --text-muted: #8a8179;
  --primary: #371567;
  --primary-soft: #ebe3f8;
  --secondary: #8a6a05;
  --secondary-soft: #ead9a1;
  --outline-soft: rgba(74, 69, 80, 0.14);
  --shadow-soft: 0 16px 32px rgba(36, 29, 20, 0.05);
  --shadow-modal: 0 32px 80px rgba(29, 22, 15, 0.14);
  --radius-sm: 0.2rem;
  --radius-md: 0.38rem;
  --radius-lg: 0.7rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
}

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

html {
  background: var(--surface);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top, rgba(55, 21, 103, 0.035), transparent 34%),
    linear-gradient(180deg, #fbfbfa 0%, var(--surface) 32%, #f4f2ef 100%);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.page-shell {
  position: relative;
  width: min(100%, 46rem);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-12);
}

.page-aurora,
.page-grid {
  display: none;
}

.hero,
main,
.settings-section-wrapper,
.anchors-section-wrapper,
.account-section-wrapper,
footer {
  position: relative;
  z-index: 1;
}

.hero {
  padding-top: var(--space-2);
}

.hero-copy {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  color: var(--text-soft);
}

.hero-kicker,
.category-header h2,
.category-meta,
.weekly-badge,
.notes-label,
.settings-category-header,
.settings-optional-badge,
.account-toggle,
.account-switch,
.today-indicator,
.modal-kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.hero-kicker {
  color: var(--primary);
}

.hero-tagline {
  margin: 0.35rem 0 0;
  font-family: 'Noto Serif', serif;
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text-soft);
}

.about-footer {
  display: grid;
  gap: var(--space-3);
  text-align: left;
  max-width: 36rem;
  margin-inline: auto;
}

.about-definition {
  margin: 0;
  font-family: 'Noto Serif', serif;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.about-disclaimer {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-soft);
}

.header-top h1 {
  font-family: 'Noto Serif', serif;
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.hero-panel {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
}

.date-nav {
  width: 100%;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
  gap: var(--space-3);
}

.date-nav button,
#today-btn,
.account-btn,
.details-toggle,
.settings-toggle {
  border: none;
  cursor: pointer;
}

.date-nav button {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.35rem;
}

.date-nav button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.date-center {
  display: grid;
  justify-items: center;
  gap: 0.18rem;
  text-align: center;
}

#current-date {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

#lent-day {
  font-family: 'Noto Serif', serif;
  font-size: clamp(1.05rem, 3.5vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.today-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: var(--space-2);
  color: var(--secondary);
}

.pulse-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}

.hero-actions {
  min-height: 0;
}

#today-btn {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.progress-ring {
  width: 1.6rem;
  height: 1.6rem;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: #dfd9d3;
  stroke-width: 3.5;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

main {
  display: grid;
  gap: var(--space-10);
  margin-top: var(--space-6);
}

.category,
.notes-section,
.settings-panel,
.account-form-container,
.message,
.all-done {
  background: transparent;
}

.category-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.category-header h2 {
  color: var(--text-muted);
  font-weight: 600;
}

.category-meta {
  color: rgba(138, 129, 121, 0.72);
  letter-spacing: 0.16em;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.item + .item {
  margin-top: var(--space-4);
}

.item:active {
  transform: scale(0.995);
}

.item.checked {
  background:
    linear-gradient(90deg, rgba(138, 106, 5, 0.14), rgba(138, 106, 5, 0.02) 0.18rem, #fff 0.18rem);
}

.item input[type="checkbox"] {
  order: 2;
  appearance: none;
  -webkit-appearance: none;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 999px;
  background: var(--surface-dim);
  position: relative;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.item input[type="checkbox"]:checked {
  background: var(--secondary);
  box-shadow: 0 0 0 0.3rem rgba(138, 106, 5, 0.08);
}

.item input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.item-text {
  order: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.item-label {
  font-family: 'Noto Serif', serif;
  font-size: 1.28rem;
  line-height: 1.22;
}

.item.checked .item-label {
  color: var(--text);
}

.item-hint,
.item-details,
.account-info {
  color: var(--text-soft);
}

.item-hint {
  font-size: 0.78rem;
  font-weight: 500;
}

.weekly-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: var(--space-2);
  padding: 0.32rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--surface-low);
  color: var(--text-muted);
  letter-spacing: 0.14em;
}

.weekly-badge.complete {
  background: #efe3bc;
  color: var(--secondary);
}

.readings-link {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.readings-link:hover {
  text-decoration: underline;
}

.details-toggle {
  width: fit-content;
  margin-top: var(--space-2);
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.78rem;
}

.item-details {
  font-size: 0.82rem;
  line-height: 1.55;
  padding-top: var(--space-2);
}

.item-details p + p {
  margin-top: var(--space-2);
}

.message {
  color: var(--text-soft);
  line-height: 1.6;
}

.all-done {
  color: var(--secondary);
  font-weight: 600;
}

.notes-section {
  padding-top: var(--space-2);
}

.notes-label {
  display: inline-block;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.notes-textarea,
.account-input {
  width: 100%;
  padding: 0.95rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 -1px 0 var(--outline-soft);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.notes-textarea {
  min-height: 6rem;
  resize: vertical;
  line-height: 1.6;
}

.notes-textarea::placeholder,
.account-input::placeholder {
  color: var(--text-muted);
}

.notes-textarea:focus,
.account-input:focus {
  outline: none;
  box-shadow: inset 0 -2px 0 rgba(55, 21, 103, 0.35);
}

.settings-section-wrapper,
.anchors-section-wrapper,
.account-section-wrapper {
  margin-top: var(--space-10);
}

.settings-toggle,
.account-toggle {
  background: transparent;
  color: var(--primary);
  padding: 0;
}

.settings-panel,
.account-form-container {
  margin-top: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
}

.settings-category + .settings-category {
  margin-top: var(--space-6);
}

.settings-category-header {
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0.8rem 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.settings-item + .settings-item {
  margin-top: var(--space-2);
}

.settings-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 2.6rem;
  height: 1.4rem;
  min-width: 2.6rem;
  border-radius: 999px;
  background: #ddd9d2;
  position: relative;
  transition: background 0.2s ease;
}

.settings-item input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 0.17rem;
  left: 0.17rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.2s ease;
}

.settings-item input[type="checkbox"]:checked {
  background: var(--primary);
}

.settings-item input[type="checkbox"]:checked::after {
  transform: translateX(1.18rem);
}

.settings-item-label {
  line-height: 1.45;
}

.settings-optional-badge {
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.account-form-container,
.forgot-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.account-btn {
  width: 100%;
  padding: 0.88rem 1rem;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.account-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.sign-out-btn {
  background: var(--surface-low);
  color: var(--text);
}

.account-switch {
  width: fit-content;
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
}

.account-error,
.account-success {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
}

.account-error {
  background: #f8e6e4;
  color: #8b2d2d;
}

.account-success {
  background: #eaf2e7;
  color: #45683f;
}

.account-info {
  line-height: 1.6;
}

.forgot-container[hidden] {
  display: none;
}

.reset-heading {
  font-family: 'Noto Serif', serif;
  font-size: 1.5rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(242, 239, 234, 0.82);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(100%, 28rem);
  margin-top: 0;
  background: var(--surface-card);
  box-shadow: var(--shadow-modal);
}

.modal-kicker {
  color: var(--primary);
}

.anchors-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.anchors-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--secondary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.anchors-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.anchors-section-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.anchors-loading,
.anchors-empty {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.anchor-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-soft);
}

.anchor-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.anchor-username {
  font-family: 'Noto Serif', serif;
  font-size: 1.02rem;
  word-break: break-all;
}

.anchor-card-meta {
  color: var(--secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.anchor-card-subheader {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.anchor-category {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.anchor-category + .anchor-category {
  margin-top: var(--space-2);
}

.anchor-category-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.anchor-category-icon {
  font-size: 0.95rem;
}

.anchor-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.25rem 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.4;
}

.anchor-item.checked {
  color: var(--text);
}

.anchor-check {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.12rem;
}

.anchor-item.checked .anchor-check {
  background: var(--secondary);
  color: #fff;
}

.anchor-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.anchor-remove-btn {
  color: #8b2d2d;
}

.anchor-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.75rem var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
}

.anchor-invite-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.anchor-invite-label strong {
  word-break: break-all;
}

.anchor-invite-sub {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.anchor-invite-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.anchor-mini-btn {
  width: auto;
  padding: 0.5rem 0.95rem;
  font-size: 0.85rem;
}

.anchor-invite-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

footer {
  padding-top: var(--space-10);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

footer a {
  color: var(--text-soft);
}

@media (max-width: 599px) {
  .page-shell {
    padding: var(--space-4) var(--space-4) var(--space-8);
  }

  .hero-copy {
    margin-bottom: var(--space-3);
  }

  .header-top h1 {
    font-size: 0.98rem;
  }

  .date-nav {
    grid-template-columns: 2.2rem 1fr 2.2rem;
    gap: var(--space-2);
  }

  .date-nav button {
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
  }

  #current-date {
    font-size: 0.63rem;
  }

  main {
    gap: var(--space-8);
    margin-top: var(--space-5);
  }

  .category-header {
    margin-bottom: var(--space-4);
  }

  .category-heading {
    display: grid;
    gap: 0.3rem;
  }

  .item {
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .item + .item {
    margin-top: var(--space-3);
  }

  .item input[type="checkbox"] {
    width: 1.7rem;
    height: 1.7rem;
    min-width: 1.7rem;
  }

  .item-label {
    font-size: 1.08rem;
  }

  .item-hint,
  .item-details {
    font-size: 0.74rem;
  }

  .settings-panel,
  .account-form-container {
    padding: var(--space-5);
  }

  .anchor-invite-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .anchor-invite-actions {
    width: 100%;
  }

  .anchor-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}
