:root {
  --bg: #f4efe7;
  --panel: rgba(255, 250, 244, 0.9);
  --panel-strong: #efe4d1;
  --ink: #1d1f1a;
  --muted: #5d5a51;
  --olive: #3e4e3d;
  --olive-deep: #25382d;
  --gold: #b08a4a;
  --gold-soft: #d7c097;
  --line: rgba(29, 31, 26, 0.12);
  --shadow: 0 24px 65px rgba(34, 31, 24, 0.16);
  --shadow-hover: 0 32px 80px rgba(34, 31, 24, 0.25);
}

* { box-sizing: border-box; }

html { 
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top, rgba(176, 138, 74, 0.10), transparent 35%),
    linear-gradient(135deg, #f6f2ea 0%, #ece3d3 40%, #f9f5f0 100%);
  color: var(--ink);
  overflow-x: hidden;
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px rgba(31, 27, 22, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold), #efe1bd);
  color: var(--olive-deep);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.2rem, 1vw + 0.9rem, 1.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.brand span { display: flex; flex-direction: column; gap: 3px; }
.brand span small { color: var(--gold-deep); font-size: 0.62rem; letter-spacing: 0.16em; font-weight: 600; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: 0.2s ease;
}

.nav-links a:hover {
  background: rgba(62, 78, 61, 0.08);
  color: var(--olive-deep);
}

.nav-links .cta {
  background: linear-gradient(135deg, var(--olive), var(--olive-deep));
  color: #f5f0e9;
  box-shadow: 0 10px 18px rgba(37, 56, 45, 0.18);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-top: 28px;
  align-items: stretch;
}

.hero-copy,
.hero-card,
.progress-panel,
.library-panel,
.reader-panel,
.reward-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 36px 34px;
  position: relative;
  overflow: hidden;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(176,138,74,0.08), rgba(37,56,45,0.05));
  pointer-events: none;
}

.hero-copy > * {
  position: relative;
  z-index: 1;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(176, 138, 74, 0.35);
  background: rgba(176,138,74,0.08);
  color: var(--olive-deep);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero-copy h2 {
  margin: 18px 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 3.5vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.accent {
  color: var(--gold);
}

.hero-copy p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.welcome-line { margin: 20px 0 -8px !important; color: var(--olive-deep) !important; font-size: 0.94rem !important; }
.welcome-line strong { color: var(--gold-deep); }

.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.primary-btn,
.secondary-btn,
.book-button,
.chapter-button {
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  position: relative;
  user-select: none;
  font-weight: 600;
}

.primary-btn {
  padding: 14px 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--olive), var(--olive-deep));
  color: #f7f3ee;
  font-weight: 700;
  box-shadow: 0 14px 24px rgba(32, 48, 40, 0.18);
  overflow: hidden;
}

.primary-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(32, 48, 40, 0.28);
}

.primary-btn:hover::before {
  opacity: 1;
}

.primary-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(32, 48, 40, 0.15);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 8px 16px rgba(32, 48, 40, 0.08);
}

.secondary-btn {
  padding: 13px 20px;
  border-radius: 14px;
  background: rgba(176,138,74,0.1);
  color: var(--olive-deep);
  border: 1.5px solid rgba(176,138,74,0.2);
  font-weight: 700;
}

.secondary-btn:hover {
  transform: translateY(-2px);
  background: rgba(176,138,74,0.18);
  border-color: rgba(176,138,74,0.35);
  box-shadow: 0 10px 20px rgba(176,138,74,0.12);
}

.secondary-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(176,138,74,0.08);
}

.secondary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.book-button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  color: var(--ink);
}

.book-button:hover {
  transform: translateX(4px);
  background: rgba(62, 78, 61, 0.05);
  border-color: rgba(176, 138, 74, 0.35);
  box-shadow: 0 6px 16px rgba(62, 78, 61, 0.08);
}

.book-button:active {
  transform: translateX(2px);
}

.book-button.active {
  background: linear-gradient(135deg, rgba(62,78,61,0.12), rgba(176,138,74,0.1));
  border-color: rgba(176,138,74,0.48);
  box-shadow: 0 8px 20px rgba(176,138,74,0.15);
}

.chapter-button {
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(62,78,61,0.06);
  color: var(--olive-deep);
  border: 1px solid rgba(62,78,61,0.12);
  font-weight: 700;
}

.chapter-button:hover {
  transform: translateY(-2px);
  background: rgba(62,78,61,0.12);
  border-color: rgba(62,78,61,0.24);
  box-shadow: 0 8px 16px rgba(62,78,61,0.1);
}

.chapter-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(62,78,61,0.08);
}

.chapter-button.primary {
  background: linear-gradient(135deg, var(--olive), var(--olive-deep));
  color: #f5efe6;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(32, 48, 40, 0.15);
}

.chapter-button.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(32, 48, 40, 0.22);
}

.chapter-button.primary:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(32, 48, 40, 0.12);
}

/* Loading State */
.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* Button feedback */
@keyframes pulse-success {
  0% { box-shadow: 0 0 0 0 rgba(25, 93, 77, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(25, 93, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(25, 93, 77, 0); }
}

.btn-success {
  animation: pulse-success 0.6s ease-out;
}

.hero-card {
  padding: 20px 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(37,56,45,0.96), rgba(16,23,20,0.96));
  color: #f4efe7;
}

.character-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.character-badge .label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: rgba(244, 239, 231, 0.7);
}

.character-avatar {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(176,138,74,0.95), rgba(255,236,188,0.75));
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.character-name {
  margin: 0 0 8px;
  font-size: 1.9rem;
  font-family: Georgia, "Times New Roman", serif;
}

.character-blurb {
  margin: 0;
  line-height: 1.6;
  color: rgba(244,239,231,0.82);
}

.meter {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.83rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
}

.progress-track {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  transition: width 0.35s ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.hero-panel .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat-card {
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,0.3);
}

.stat-card .stat-number {
  font-size: clamp(1.6rem, 2vw, 2.3rem);
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--olive-deep);
}

.stat-card .stat-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 24px;
  margin-top: 28px;
}

.library-panel {
  padding: 18px 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  max-height: 760px;
  overflow-y: auto;
  padding-right: 8px;
}

.book-button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  color: var(--ink);
}

.book-button.active {
  background: linear-gradient(135deg, rgba(62,78,61,0.08), rgba(176,138,74,0.08));
  border-color: rgba(176,138,74,0.38);
}

.book-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.book-name {
  font-weight: 700;
}

.book-chapters {
  font-size: 0.8rem;
  color: var(--muted);
}

.reader-panel {
  width: 100%;
  padding: 24px;
}

.chapter-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.chapter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(62,78,61,0.08);
  color: var(--olive-deep);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.chapter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.small-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.4);
  color: var(--ink);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 600;
}

.small-btn:hover {
  background: rgba(255,255,255,0.65);
  border-color: rgba(62,78,61,0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(62,78,61,0.08);
}

.small-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(62,78,61,0.04);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(176,138,74,0.08);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-radius: 10px;
  border: 2px solid rgba(176,138,74,0.08);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--gold), var(--olive));
}

.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-top: 24px;
}

.reader-header h2 {
  margin: 0;
  font-size: clamp(2rem, 2vw + 1rem, 3rem);
  font-family: Georgia, "Times New Roman", serif;
}

.reader-header .chapter-tag {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.reader-copy {
  margin-top: 24px;
  padding: 22px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(213,197,168,0.14));
  border: 1px solid rgba(176,138,74,0.18);
}

.reader-copy p {
  margin: 0 0 18px;
  font-size: clamp(1.04rem, 1vw + 0.75rem, 1.28rem);
  line-height: 1.9;
  color: var(--ink);
}

.reader-copy p:last-child { margin-bottom: 0; }

.verse-badge {
  display: inline-block;
  margin-right: 10px;
  color: var(--gold);
  font-weight: 800;
}

.reader-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.chapter-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chapter-button {
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(62,78,61,0.06);
  color: var(--olive-deep);
  border: 1px solid rgba(62,78,61,0.12);
  font-weight: 700;
}

.chapter-button.primary {
  background: linear-gradient(135deg, var(--olive), var(--olive-deep));
  color: #f5efe6;
  border-color: transparent;
}

.reward-panel {
  padding: 22px;
  margin-top: 28px;
}

.reward-panel h3 {
  margin: 0 0 14px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ===== Authentication & Modal Styles ===== */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(29, 31, 26, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  display: block !important;
  opacity: 1;
}

/* Modal */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 100;
  max-width: 450px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  display: none;
  opacity: 0;
  transition: all 0.2s ease;
}

.modal.show {
  display: block !important;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-content {
  background: linear-gradient(135deg, #f6f2ea 0%, #efe5d2 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: 0 20px 60px rgba(29, 31, 26, 0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.15s ease;
  border-radius: 10px;
}

.modal-close:hover {
  color: var(--ink);
  background: rgba(176,138,74,0.1);
  transform: rotate(90deg);
}

/* Auth Forms */
.auth-form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.form-group input {
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-group input:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(176,138,74,0.25);
}

.form-group input:focus {
  outline: none;
  border-color: var(--olive);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(62, 78, 61, 0.1), inset 0 1px 3px rgba(62, 78, 61, 0.05);
}

.form-group input::placeholder {
  color: var(--muted);
}

.form-group input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(200, 200, 200, 0.1);
}

.form-message {
  padding: 13px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-top: 12px;
  border: 1.5px solid;
  animation: slideIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reader-copy {
  animation: fadeIn 0.3s ease;
}

.form-message.success {
  background: rgba(25, 93, 77, 0.12);
  color: #1a5545;
  border-color: rgba(25, 93, 77, 0.35);
}

.form-message.error {
  background: rgba(220, 70, 70, 0.12);
  color: #9e2c2c;
  border-color: rgba(220, 70, 70, 0.35);
}

.link-button {
  background: none;
  border: none;
  color: var(--olive-deep);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  transition: color 0.15s ease;
  border-bottom: 1.5px solid rgba(37, 56, 45, 0.3);
}

.link-button:hover {
  color: var(--olive);
  border-bottom-color: rgba(37, 56, 45, 0.6);
}

/* Auth Section Styles */
#authSection, #userSection {
  display: flex;
  align-items: center;
  gap: 12px;
}

#userGreeting {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.topbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.cta-button {
  background: linear-gradient(135deg, var(--olive-deep) 0%, var(--olive) 100%);
  color: #f7f3ec;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 10px 22px rgba(47,58,43,0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  cursor: pointer;
  border: none;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.cta-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(47,58,43,0.3);
}

.cta-button:hover::before {
  opacity: 1;
}

.cta-button:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(47,58,43,0.15);
}

.cta-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.secondary-button {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: rgba(255,255,255,0.32);
  color: var(--ink);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 600;
}

.secondary-button:hover {
  background: rgba(255,255,255,0.52);
  border-color: rgba(62, 78, 61, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(62,78,61,0.1);
}

.secondary-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.secondary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Responsive */
@media (max-width: 720px) {
  .modal-content {
    padding: 28px 20px;
  }

  #authSection, #userSection {
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-inner {
    flex-direction: column;
    gap: 12px;
  }

  .nav {
    display: none;
  }
}

.reward-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.reward-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.28);
}

.reward-card.locked {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.reward-card .emoji {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 10px;
}

.reward-card h4 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.reward-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .reader-header,
  .chapter-topbar,
  .reader-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid,
  .reward-row {
    grid-template-columns: 1fr;
  }

  .nav-links {
    width: 100%;
  }

  .nav-links a {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Daily practice and reflection */
.today-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  margin-top: 28px;
  padding: 34px;
  border-radius: 28px;
  color: #f5f0e7;
  background: linear-gradient(115deg, #23352d 0%, #3e5141 58%, #6d6a45 100%);
  box-shadow: 0 26px 65px rgba(35, 53, 45, 0.22);
  position: relative;
  overflow: hidden;
}

.today-panel::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -100px;
  bottom: -180px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(255,255,255,0.03), 0 0 0 70px rgba(255,255,255,0.025);
}

.today-intro, .today-focus { position: relative; z-index: 1; }
.today-intro .eyebrow { color: #e5d2a2; border-color: rgba(229,210,162,0.3); background: rgba(229,210,162,0.1); }
.today-date { margin: 25px 0 0; color: rgba(245,240,231,0.65); font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; }
.today-intro h2 { margin: 10px 0 16px; font: 400 clamp(2.6rem, 4vw, 4.6rem)/0.95 Georgia, serif; letter-spacing: -0.06em; }
.today-intro h2 em, .reflection-copy h3 em { color: #dbc58e; font-style: italic; }
.today-note { max-width: 48ch; color: rgba(245,240,231,0.74); line-height: 1.7; margin: 0 0 25px; }
.today-panel .cta-button { background: #dbc58e; color: #24352d; box-shadow: 0 12px 24px rgba(12,24,18,0.2); }
.today-focus { align-self: end; padding: 26px; border: 1px solid rgba(255,255,255,0.14); background: rgba(16,28,22,0.24); border-radius: 20px; }
.focus-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.focus-heading .muted-label { color: rgba(245,240,231,0.62); }
.focus-heading h3 { margin: 8px 0 0; font: 400 2.2rem/1 Georgia, serif; letter-spacing: -0.04em; }
.focus-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(229,210,162,0.35); border-radius: 50%; color: #dbc58e; }
.today-focus > p { color: rgba(245,240,231,0.72); line-height: 1.65; margin: 22px 0 30px; }
.focus-progress > span { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.focus-progress strong { font-size: 0.84rem; }
.focus-progress small { color: rgba(245,240,231,0.65); }
.today-focus .progress-track { background: rgba(255,255,255,0.13); }
.today-focus .progress-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: #dbc58e; transition: width 0.35s ease; }
.reflection-panel, .plans-panel, .badges-panel { margin-top: 28px; padding: 30px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,250,244,0.76); box-shadow: var(--shadow); }
.reflection-panel { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 40px; align-items: center; }
.reflection-copy h3 { margin: 10px 0 14px; font: 400 clamp(2rem, 3vw, 3.2rem)/1 Georgia, serif; letter-spacing: -0.055em; }
.reflection-copy p { max-width: 38ch; color: var(--muted); line-height: 1.7; margin: 0; }
.journal-box { padding: 20px; border-left: 3px solid var(--gold); background: rgba(239,228,209,0.5); }
.journal-box label { display: block; margin-bottom: 10px; color: var(--olive-deep); font-weight: 700; }
.journal-box textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: var(--ink); background: rgba(255,255,255,0.7); font: 1rem/1.6 Georgia, serif; }
.journal-box textarea:focus { outline: 2px solid rgba(176,138,74,0.35); border-color: var(--gold); }
.journal-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.journal-actions span, .plan-card small { color: var(--muted); font-size: 0.78rem; }
.section-head h3 { margin-top: 7px; }
.plan-caption { color: var(--muted); font-style: italic; }
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.plan-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.34); position: relative; }
.plan-card.active { border-color: rgba(176,138,74,0.65); box-shadow: inset 0 0 0 1px rgba(176,138,74,0.22); }
.plan-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--olive-deep); color: #e8d39c; font: 700 1.25rem Georgia, serif; }
.plan-card h4 { margin: 7px 0 6px; font: 400 1.65rem Georgia, serif; letter-spacing: -0.04em; }
.plan-card p { margin: 0 0 16px; color: var(--muted); line-height: 1.55; }
.plan-meter { height: 6px; border-radius: 99px; overflow: hidden; background: rgba(62,78,61,0.12); margin-bottom: 7px; }
.plan-meter span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 0.3s ease; }
.plan-button { grid-column: 2; justify-self: start; padding: 8px 0; color: var(--olive-deep); background: transparent; border-bottom: 1px solid rgba(62,78,61,0.3); font-weight: 700; }
.plan-card.active .plan-button { color: var(--gold-deep); }
.badge-count { color: var(--gold-deep); font-weight: 700; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.badge-item { min-height: 130px; padding: 17px; display: grid; grid-template-columns: auto 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 16px; opacity: 0.48; background: rgba(255,255,255,0.3); }
.badge-item.earned { opacity: 1; background: rgba(219,197,142,0.13); border-color: rgba(176,138,74,0.35); }
.badge-icon { color: var(--gold-deep); font-size: 1.8rem; }
.badge-item strong { color: var(--olive-deep); }
.badge-item p { margin: 5px 0 10px; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }
.badge-item small { grid-column: 2; color: var(--gold-deep); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.site-footer { max-width: 1440px; margin: 0 auto; padding: 0 24px 28px; color: var(--muted); font-size: 0.76rem; letter-spacing: 0.08em; text-align: center; }
.site-footer a { color: var(--gold-deep); font-weight: 700; }
.site-footer a:hover { color: var(--olive-deep); text-decoration: underline; }

@media (max-width: 800px) {
  .today-panel, .reflection-panel, .plan-grid { grid-template-columns: 1fr; }
  .today-panel, .reflection-panel, .plans-panel, .badges-panel { padding: 22px 18px; }
  .today-focus { margin-top: 10px; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .hero-panel .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel .stat-box strong { font-size: 1.25rem; }
}

@media (max-width: 480px) {
  .site-footer { padding-inline: 14px; }
  .badge-grid { grid-template-columns: 1fr; }
  .plan-card { grid-template-columns: 52px 1fr; gap: 12px; }
  .plan-mark { width: 52px; height: 52px; }
  .plan-button { grid-column: 2; }
  .journal-actions { align-items: flex-start; flex-direction: column; }
}
