/* ---------- Fonts ---------- */
:root {
  --font-classic: 'Lora', Georgia, serif;                 /* buttons, labels, everyday text */
  --font-statement: 'Cinzel', Georgia, serif;             /* statements and messages */
  --font-message: 'Montserrat', 'Helvetica Neue', sans-serif; /* small hints */
  --font-elegant: 'Cormorant Garamond', Georgia, serif;   /* title and Bible quotes */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  font-family: var(--font-classic);
  -webkit-font-smoothing: antialiased;
  touch-action: none; /* we handle pinches ourselves, so the browser shouldn't zoom the page */
}

/* iPhones running Novael from the home screen can report a screen height shorter than the real
   screen. "lvh" means "the full height of the screen", so everything reaches the very bottom. */
html, body { min-height: 100lvh; }

/* On the white pages, the background behind everything is white too, so no black shows anywhere */
html.light-page, html.light-page body { background: #fff; }

/* ---------- Layers (bottom to top: space, glow, flight text, screens) ---------- */
#space {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100lvh;
  display: block;
  z-index: 0;
}

/* Colored light around the edges: mostly nebula pink, blue and green in the corners.
   --glow and --deep are set from js/flight.js as the flight goes on. */
#glow {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: var(--glow, 0);
  background:
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 50%, rgba(255, 70, 170, 0.55) 100%),
    radial-gradient(circle at 0% 0%, rgba(60, 120, 255, 0.45), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(40, 220, 150, 0.35), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(255, 60, 160, 0.35), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(255, 90, 190, 0.3), transparent 40%);
}

/* The deeper tint that builds in the second half */
#glow::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--deep, 0);
  background:
    radial-gradient(ellipse 110% 85% at 50% 50%, transparent 35%, rgba(170, 0, 120, 0.6) 100%),
    rgba(45, 0, 60, 0.3);
}

#glow.is-fading {
  opacity: 0;
  transition: opacity 3s ease;
}

/* Glare when the galaxy first comes into view: bright warm light washing over everything,
   like your eyes adjusting after a long time in the dark */
#glare {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 58%, rgba(255, 245, 225, 0.95) 0%, rgba(255, 228, 190, 0.55) 35%, rgba(255, 215, 175, 0.25) 100%);
}

/* The hyperspace flash */
#flash {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 1) 0%, rgba(255, 190, 230, 0.8) 35%, rgba(255, 110, 200, 0.4) 100%);
}

/* "This is Your Universe..." typed out at the top, out of the galaxy's way */
#final-text {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 7vh);
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0 24px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

#final-text.is-visible { opacity: 1; }

#final-text p {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.35rem, 5.5vw, 2.5rem);
  letter-spacing: 0.02em;
  line-height: 1.35;
  min-height: 1.35em;
  margin: 0 0 0.3em;
  text-shadow: 0 0 20px rgba(255, 240, 220, 0.3);
}

#flight-text {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

#flight-text.is-visible { opacity: 1; }

.ui {
  position: fixed;
  inset: 0;
  z-index: 3;
}

/* Each screen sits in the middle and fades in and out */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.2s ease, visibility 0s linear 1.2s;
}

.screen.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 1.2s ease;
}

/* ---------- Home ---------- */
.title {
  font-family: var(--font-elegant);
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 5rem);
  letter-spacing: 0.35em;
  padding-left: 0.35em; /* letter-spacing adds space after the last letter, this re-centers it */
  margin: 0 0 3rem;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(260px, 80vw);
}

.btn {
  font-family: var(--font-classic);
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.btn:hover,
.btn:focus-visible {
  border-color: #fff;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
  outline: none;
}

.btn-quiet {
  border-color: transparent;
  opacity: 0.75;
}

/* ---------- Sign up / sign in steps ---------- */
form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(340px, 86vw);
  transition: opacity 0.4s ease;
}

form.swap { opacity: 0; }

label {
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

input {
  width: 100%;
  font-family: var(--font-classic);
  font-size: 1.1rem; /* 16px or bigger stops iPhones from zooming in on tap */
  color: #fff;
  caret-color: #fff;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0;
  padding: 10px 4px;
  outline: none;
  transition: border-color 0.3s;
}

input:focus { border-bottom-color: #fff; }

/* Stops browsers painting autofilled inputs yellow or blue */
input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  transition: background-color 99999s;
}

.step-note {
  font-size: 0.85rem;
  opacity: 0.55;
  margin: -0.9rem 0 1.2rem;
  min-height: 0;
}

.step-note:empty { display: none; }

.link[hidden] { display: none; }

.error {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: #ffb3c7;
  margin: 0.8rem 0 1.4rem;
}

.link {
  margin-top: 1.5rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-classic);
  font-size: 0.95rem;
  cursor: pointer;
}

/* ---------- Statements and quotes ---------- */
.statement {
  font-family: var(--font-statement);
  font-weight: 400;
  font-size: clamp(1.3rem, 5.2vw, 2.3rem);
  letter-spacing: 0.06em;
  line-height: 1.5;
  max-width: 20ch;
  margin: 0;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
}

.quote {
  font-family: var(--font-elegant);
  font-style: italic;
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  line-height: 1.35;
  max-width: 22ch;
  margin: 0;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
}

.cite {
  font-family: var(--font-statement);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  opacity: 0.6;
  margin: 1.2rem 0 0;
}

.headphones {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  left: 0;
  right: 0;
  margin: 0;
  font-family: var(--font-message);
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  opacity: 0.4;
}

/* "Skip intro" in the top-left corner (signing in only) */
.skip-intro {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  z-index: 5;
  font-family: var(--font-classic);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.skip-intro[hidden] { display: none; }

/* "Continue" after the intro, at the bottom of the screen */
.continue {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 40px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

.continue.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- The slogan (tiny, two lines, with a hidden gold 3·6·9) ---------- */
.slogan {
  font-family: var(--font-elegant);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  line-height: 1.5;
  margin: 0;
  opacity: 0.75;
}

.slogan-line { display: block; }

.slogan-glow {
  color: #c9a24b;
  text-shadow: 0 0 8px rgba(230, 190, 100, 0.5);
}

.slogan-dark { margin: -2rem 0 2.5rem; color: #fff; }
.slogan-dark .slogan-glow { color: #f0cf7a; }

/* ---------- Welcome back: a small white card in the star field ---------- */
.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(300px, 82vw);
  padding: 20px 18px 14px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 255, 255, 0.08);
}

.welcome-continue {
  width: 100%;
  font-family: var(--font-classic);
  font-size: 1.05rem;
  color: #fff;
  background: #000;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  cursor: pointer;
}

.welcome-switch {
  font-family: var(--font-classic);
  font-size: 0.85rem;
  color: #777;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

/* ---------- Home page (white for now; colors come later in Settings) ---------- */
.homepage {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100lvh; /* the phone's full screen height */
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 7vh) 24px calc(env(safe-area-inset-bottom, 0px) + 110px);
  background: #fff;
  color: #111;
  text-align: center;
  overflow-y: auto;
}

.homepage[hidden] { display: none; }

.hp-header { margin-bottom: 4vh; }

.hp-title {
  font-family: var(--font-elegant);
  font-weight: 500;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  letter-spacing: 0.3em;
  padding-left: 0.3em; /* re-centers the letter spacing */
  margin: 0 0 0.4rem;
}

.greeting {
  font-family: var(--font-classic);
  font-size: 1rem;
  color: #555;
  margin: 1.4rem 0 0;
  min-height: 1.4em;
}

/* Tonight's 3·6·9 card */
.ritual-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(300px, 82vw);
  padding: 26px 20px 22px;
  background: #fff;
  color: #111;
  border: 1px solid #111;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 0 18px 2px rgba(235, 180, 60, 0.35);
  animation: invite 3.5s ease-in-out infinite; /* a warm golden glow that breathes, inviting you to tap */
  transition: transform 0.2s;
}

.ritual-card:active { transform: scale(0.98); }

@keyframes invite {
  50% { box-shadow: 0 0 40px 10px rgba(240, 185, 55, 0.65), 0 0 12px 2px rgba(255, 215, 120, 0.5); }
}

/* Once tonight's routine is done (ready for later) */
.ritual-card.is-done {
  animation: none;
  border-color: #bbb;
  color: #777;
}

.ritual-number {
  font-family: var(--font-elegant);
  font-weight: 500;
  font-size: 3.2rem;
  line-height: 1;
  letter-spacing: 0.05em;
}

/* The middle dot sits halfway up the numbers, not on the bottom like a period */
.mid-dot {
  display: inline-block;
  margin: 0 0.12em;
  transform: translateY(-0.05em);
}

.ritual-label {
  font-family: var(--font-classic);
  font-size: 0.95rem;
  color: #555;
}

.ritual-msg {
  font-family: var(--font-classic);
  font-size: 0.85rem;
  color: #8a6d2b;
  max-width: 280px;
  min-height: 2.6em;
  margin: 12px 0 0;
  opacity: 0;
  transition: opacity 0.5s;
}

.ritual-msg.is-visible { opacity: 1; }

/* Verse of the day: the verse, a line, then the reference */
.verse {
  width: min(340px, 86vw);
  margin-top: 3vh;
}

.verse-heading {
  font-family: var(--font-statement);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #888;
  margin: 0 0 0.8rem;
}

.verse-text {
  font-family: var(--font-elegant);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.45;
  margin: 0;
}

.verse-line {
  width: 70%;
  border: none;
  border-top: 2px solid #111;
  margin: 1rem auto 0.8rem;
}

.verse-ref {
  font-family: var(--font-statement);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0;
}

/* Settings */
.settings { gap: 12px; }
.settings .hp-title { font-size: 2rem; margin-bottom: 1.5rem; }

.setting-row {
  width: min(300px, 82vw);
  font-family: var(--font-classic);
  font-size: 1rem;
  text-align: left;
  color: #111;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
}

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

.setting-select select {
  font-family: var(--font-classic);
  font-size: 1rem; /* 16px+ so iPhones don't zoom in */
  color: #111;
  background: #f4f4f4;
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
}

.setting-note {
  font-family: var(--font-classic);
  font-size: 0.8rem;
  color: #888;
  max-width: 290px;
  margin: -2px 0 10px;
}

.align-button:disabled { opacity: 0.6; cursor: default; }

.setting-soon {
  font-family: var(--font-classic);
  font-size: 0.85rem;
  color: #999;
  max-width: 280px;
  margin-top: 1rem;
}

/* ---------- Your universe: the gold icons ---------- */
:root { --gold: #f0c35a; }

.universe-icons {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none; /* only the icons themselves are tappable */
}

.universe-icons[hidden] { display: none; }

.universe-icon {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  color: var(--gold);
  opacity: 0.5;
  animation: icon-pulse 2.6s ease-in-out infinite; /* empty parts softly pulse, inviting a tap */
  transition: opacity 1.2s;
  will-change: transform;
}

.universe-icon svg {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 6px rgba(240, 195, 90, 0.8)) drop-shadow(0 0 14px rgba(240, 175, 60, 0.45));
}

.universe-icon.icon-core svg { width: 40px; height: 40px; }

/* The Core's label sits on the brightest part of the galaxy, so give it a dark backing to stay readable */
.universe-icon.icon-core .universe-icon-label {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  padding: 2px 8px;
}

.universe-icon svg .line,
.part-icon svg .line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.universe-icon svg .fill,
.part-icon svg .fill { fill: currentColor; }

.universe-icon-label {
  font-family: var(--font-statement);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

/* Filled-in parts glow steady and bright */
.universe-icon.is-filled {
  opacity: 1;
  animation: none;
}

@keyframes icon-pulse {
  50% { opacity: 0.85; }
}

/* ---------- Align My Universe ---------- */
.align-button {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 7vh);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  background: rgba(10, 10, 18, 0.55);
  border: 1px solid rgba(240, 195, 90, 0.7);
  border-radius: 999px;
  padding: 13px 26px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 18px rgba(240, 185, 60, 0.35);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.align-button[hidden] { display: none; }
.align-button.is-visible { opacity: 1; }

/* "Next alignment: Tuesday, Oct 14", just under the button */
.align-caption {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 7vh + 56px);
  left: 0;
  right: 0;
  z-index: 4;
  margin: 0;
  text-align: center;
  font-family: var(--font-message);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(240, 195, 90, 0.75);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.align-caption.is-visible { opacity: 1; }

.align-note {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 7vh + 80px);
  left: 0;
  right: 0;
  z-index: 4;
  padding: 0 32px;
  margin: 0;
  text-align: center;
  font-family: var(--font-classic);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
}

.align-note.is-visible { opacity: 1; }

/* ---------- The pop-up card ---------- */
.part-panel {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s;
  touch-action: auto; /* let the text box scroll normally */
}

.part-panel[hidden] { display: none; }
.part-panel.is-open { opacity: 1; }

.part-card {
  position: relative;
  width: min(380px, 100%);
  max-height: calc(100lvh - 80px);
  overflow-y: auto;
  padding: 26px 22px 20px;
  text-align: center;
  color: #111;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(240, 185, 60, 0.18);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.25s ease;
}

.part-panel.is-open .part-card { transform: none; }

.part-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
}

/* On the white card, a deeper gold reads better than the bright glow gold */
.part-card { --gold-ink: #b8862a; }

.part-icon {
  color: var(--gold);
  margin-bottom: 4px;
}

.part-icon svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 0 8px rgba(240, 195, 90, 0.7));
}

.part-title {
  font-family: var(--font-statement);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  color: var(--gold-ink);
  margin: 4px 0 6px;
}

.part-optional {
  font-family: var(--font-classic);
  font-size: 0.8rem;
  color: #777;
  margin: 0 0 6px;
}

.part-optional[hidden], .part-learn-text[hidden] { display: none; }

.part-learn {
  font: inherit;
  color: var(--gold-ink);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.part-learn-text {
  font-family: var(--font-classic);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  color: #444;
  background: #f6f3ec;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 10px;
}

.part-quote {
  font-family: var(--font-elegant);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.4;
  color: #333;
  margin: 6px 0 18px;
}

.part-prompt {
  display: block;
  font-family: var(--font-classic);
  font-size: 1rem;
  margin: 0;
}

.part-hint {
  font-family: var(--font-classic);
  font-size: 0.8rem;
  color: #888;
  margin: 2px 0 10px;
}

/* A text box that looks like lines to write on */
.part-input {
  width: 100%;
  font-family: var(--font-classic);
  font-size: 1rem; /* 16px+ so iPhones don't zoom in */
  line-height: 2rem;
  color: #111;
  background: repeating-linear-gradient(transparent 0 calc(2rem - 1px), rgba(184, 134, 42, 0.4) calc(2rem - 1px) 2rem);
  border: none;
  border-radius: 0;
  padding: 0 4px;
  resize: none;
  outline: none;
  text-align: left;
}


.part-status {
  min-height: 1.2em;
  font-family: var(--font-classic);
  font-size: 0.8rem;
  color: #b3364f;
  margin: 8px 0;
}

.part-save {
  width: 100%;
  font-family: var(--font-classic);
  font-size: 1rem;
  color: #fff;
  background: #111;
  border: none;
  border-radius: 999px;
  padding: 13px;
  cursor: pointer;
}

.part-save:disabled { opacity: 0.6; }

/* ---------- Nightly streak (under the 3·6·9 card) ---------- */
.streak {
  font-family: var(--font-classic);
  font-size: 1rem;
  color: #333;
  margin: 14px 0 0;
}

.streak[hidden] { display: none; }

/* ---------- Tonight's 3·6·9: the routine screen ---------- */
.routine {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100lvh;
  z-index: 8;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: #f3f1ec; /* the "table" the book sits on */
  color: #111;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.35s, transform 0.35s;
  touch-action: pan-y; /* up/down scrolls normally; left/right swipes turn the page */
}

.routine[hidden] { display: none; }
.routine.is-open { opacity: 1; transform: none; }

.routine-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 40px;
}

.routine-close {
  position: absolute;
  left: 0;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
}

.routine-dots { display: flex; gap: 8px; }

.routine-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6d2c8;
  transition: background 0.3s, transform 0.3s;
}

.routine-dot.is-done { background: #c9a24b; }
.routine-dot.is-current { background: #111; transform: scale(1.3); }

/* The book: each page is a sheet hinged on its left edge */
.routine-book {
  position: relative;
  flex: 1;
  margin: 10px 0;
  perspective: 1800px;
}

.routine-page {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 6px 18px 18px 6px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08), inset 6px 0 10px -6px rgba(0, 0, 0, 0.12);
  transform-origin: left center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* While a page is mid-turn, it casts a deeper shadow */
.routine-page.is-turning { box-shadow: 12px 6px 30px rgba(0, 0, 0, 0.18); }

.routine-page.is-shaking { animation: page-shake 0.4s; }

@keyframes page-shake {
  20% { translate: -8px 0; }
  40% { translate: 7px 0; }
  60% { translate: -5px 0; }
  80% { translate: 3px 0; }
}

.routine-page-inner {
  height: 100%;
  overflow-y: auto;
  padding: 30px 24px 40px;
  text-align: center;
  touch-action: pan-y;
}

.routine-step {
  font-family: var(--font-statement);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #b8862a;
  margin: 0 0 6px;
}

.routine-title {
  font-family: var(--font-elegant);
  font-weight: 500;
  font-size: 2rem;
  margin: 0 0 18px;
}

.routine-text {
  font-family: var(--font-classic);
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
  margin: 0 0 18px;
}

.routine-opening { font-size: 1.15rem; margin-top: 10vh; }

.routine-swipe-tip {
  font-family: var(--font-message);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #aaa;
  margin-top: 8vh;
  animation: breathe 3s ease-in-out infinite;
}

.routine-prompt {
  font-family: var(--font-classic);
  font-size: 0.95rem;
  font-style: italic;
  color: #555;
  margin: 16px 0 4px;
}

/* Writing lines, like the universe cards */
.routine-input {
  width: 100%;
  font-family: var(--font-classic);
  font-size: 1.05rem; /* 16px+ so iPhones don't zoom in */
  line-height: 2rem;
  color: #111;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(184, 134, 42, 0.45);
  border-radius: 0;
  padding: 2px 4px;
  outline: none;
  text-align: left;
}

.routine-input:focus { border-bottom-color: #b8862a; }

.routine-textarea {
  resize: none;
  border-bottom: none;
  background: repeating-linear-gradient(transparent 0 calc(2rem - 1px), rgba(184, 134, 42, 0.45) calc(2rem - 1px) 2rem);
}

.routine-verse {
  font-family: var(--font-elegant);
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.45;
  margin: 0;
}

.routine-verse-ref {
  font-family: var(--font-statement);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-top: 2px solid #111;
  display: inline-block;
  padding-top: 8px;
  margin: 12px 0 18px;
}

.routine-vision {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.4;
  margin: 0 0 16px;
}

.vision-stars {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  max-width: 320px;
  margin: 0 auto 14px;
}

.vision-star {
  font-size: 1.3rem;
  color: #ddd6c6;
  transition: color 0.4s, text-shadow 0.4s, transform 0.4s;
  user-select: none;
}

.vision-star.is-lit {
  color: #e2a93a;
  text-shadow: 0 0 10px rgba(240, 185, 60, 0.8);
  transform: scale(1.15);
}

.vision-star.is-tappable { cursor: pointer; font-size: 1.8rem; padding: 6px 0; }

/* Tap mode: the stars stay faded until you've written your vision once */
.vision-stars.is-locked .vision-star { opacity: 0.35; }

/* The next star to tap glows softly... */
.vision-star.is-next:not(.is-lit) {
  color: #c9a24b;
  animation: next-star 1.6s ease-in-out infinite;
}

@keyframes next-star {
  50% { text-shadow: 0 0 10px rgba(240, 185, 60, 0.7); }
}

/* ...but right after a tap, it slowly fills in over 3 seconds before it can be tapped */
.vision-star.is-next.is-waiting:not(.is-lit) {
  animation: star-wait 3s linear forwards, next-star 1.6s ease-in-out 3s infinite;
}

@keyframes star-wait {
  from { color: #ece6d8; transform: scale(0.8); }
  to { color: #c9a24b; transform: scale(1); }
}

/* What to say, shown right above the stars */
.routine-say-it {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.4;
  color: #111;
  background: #fbf6ea;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 6px 0 14px;
}

.routine-vision-line { margin-bottom: 4px; }

.routine-prayer {
  font-family: var(--font-elegant);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.55;
  margin: 10px 0 24px;
}

.routine-care {
  font-family: var(--font-classic);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
  color: #5a4520;
  background: #fbf3e2;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 22px;
}

.routine-amen {
  font-family: var(--font-elegant);
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: #fff;
  background: #111;
  border: none;
  border-radius: 999px;
  padding: 12px 46px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(240, 185, 60, 0.45);
}

.routine-amen:disabled { opacity: 0.6; }

.routine-hint {
  min-height: 1.3em;
  font-family: var(--font-classic);
  font-size: 0.85rem;
  color: #a0522d;
  text-align: center;
  margin: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.routine-hint.is-visible { opacity: 1; }

.routine-footer {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 0;
}

.routine-nav {
  font-family: var(--font-classic);
  font-size: 0.95rem;
  color: #666;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.routine-nav:disabled { visibility: hidden; }
.routine-nav[hidden] { visibility: hidden; display: block; }

/* ---------- "A new star has been added to your universe" ---------- */
.star-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(380px, calc(100% - 24px));
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -150%);
  transition: transform 0.55s cubic-bezier(.2, .9, .3, 1.2);
}

.star-toast[hidden] { display: none; }
.star-toast.is-visible { transform: translate(-50%, 0); }

.star-toast-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  font-size: 1.2rem;
  color: #f0c35a;
  background: #111;
  border-radius: 10px;
  text-shadow: 0 0 8px rgba(240, 195, 90, 0.9);
}

.star-toast-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }

.star-toast-app {
  font-family: var(--font-message);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #888;
}

.star-toast-message {
  font-family: var(--font-classic);
  font-size: 0.95rem;
  color: #111;
}

/* ---------- The bar at the bottom ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 28px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e5e5e5;
  border-radius: 22px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.tabbar[hidden] { display: none; }

.tab {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s, background 0.2s;
}

.tab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.is-active {
  color: #111;
  background: #f1f1f1;
}

/* In your universe: dark see-through glass, so it's easy to read but lets the stars show */
.tabbar.is-dark {
  background: rgba(14, 14, 24, 0.6);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.tabbar.is-dark .tab { color: rgba(255, 255, 255, 0.55); }

.tabbar.is-dark .tab.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

/* Small sound on/off button in the top corner */
.sound-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  z-index: 4;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  background: transparent;
  border: none;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.3s;
}

.sound-toggle[hidden] { display: none; }

.sound-toggle:hover,
.sound-toggle:focus-visible { opacity: 0.9; outline: none; }

.hint {
  font-family: var(--font-message);
  font-weight: 300;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-top: 3rem;
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  50% { opacity: 0.15; }
}
