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

html {
  background-color: var(--bg-home);
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

/* Timing tokens (theme-agnostic). --view-fade is read by app.js so the
   page-fade duration has a single source of truth. */
:root {
  --view-fade: 170ms;
}

:root,
html[data-theme="light"] {
  --primary: #e11d48;
  --primary-alt: #ec4899;
  --primary-light: #fce7ed;
  --primary-dark: #be123c;
  --text-primary: #1c1917;
  --text-secondary: #78716c;
  --surface: #ffffff;
  --bg: #fafaf9;
  --bg-home: rgb(255, 241, 242);
  --border: #e7e5e4;
  --danger: #dc2626;
  --success: #059669;
  --extra-bg: #fef3c7;
  --extra-icon-bg: #fde68a;
  --extra-icon-color: #b45309;
  --extra-bullet: #f59e0b;
  --footer-msg-bg: rgba(255, 255, 255, 0.6);
  --peek-tips-bg: rgba(254, 243, 199, 0.55);
  --skeleton: rgba(0, 0, 0, 0.07);
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.06);
  --shadow-card-strong: 0 4px 20px rgba(0, 0, 0, 0.13);
  --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.18);
  --shadow-btn: 0 4px 14px rgba(0, 0, 0, 0.12);
  --shadow-chevron: 0 4px 14px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

html[data-theme="dark"] {
  --primary: #f43f5e;
  --primary-alt: #f472b6;
  --primary-light: #3f1d2a;
  --primary-dark: #fb7185;
  --text-primary: #f5f5f4;
  --text-secondary: #a8a29e;
  --surface: #292524;
  --bg: #1c1917;
  --bg-home: #1c1917;
  --border: #44403c;
  --danger: #ef4444;
  --success: #10b981;
  --extra-bg: #3a2e10;
  --extra-icon-bg: #5b4416;
  --extra-icon-color: #fcd34d;
  --extra-bullet: #fbbf24;
  --footer-msg-bg: rgba(255, 255, 255, 0.04);
  --peek-tips-bg: rgba(252, 211, 77, 0.08);
  --skeleton: rgba(255, 255, 255, 0.08);
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-card-strong: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-btn: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-chevron: 0 4px 14px rgba(0, 0, 0, 0.4);
}

body {
  font-family: 'Open Sans', sans-serif;
  background: var(--bg-home);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
}

body.home {
  max-width: 960px;
}

/* Hide the static markup until the app has decided the route and painted the
   first view. Otherwise a deep link (e.g. #keeping/1) flashes the home header
   while the i18n dictionary is still loading. The html background still shows,
   so the gap reads as a clean blank, not a missing page. */
body.booting > header,
body.booting > #main-content,
body.booting > footer {
  visibility: hidden;
}

/* ── Header ── */
header {
  padding: 16px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body.home header {
  background: transparent;
}

body.wizard header {
  display: none;
}

.btn-chevron {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-chevron);
}

.btn-chevron:active {
  transform: scale(0.94);
}

/* ── Main content ── */
main {
  flex: 1;
  padding: 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.wizard main {
  padding-bottom: 28px;
}

/* ── Wizard ── */
.wizard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wizard-phase-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wizard-phase-title {
  font-family: 'Nunito', sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.wizard-step-badge {
  align-self: flex-start;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: white;
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.wizard-step-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
  touch-action: pan-y;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.4s ease;
  user-select: none;
  -webkit-user-select: none;
}

.wizard-step-card.is-swiping {
  transition: none;
}

.wizard-step-card.is-entering {
  transition: none;
}

/* ── Wizard stack (peek behind active card) ── */
.wizard-stack {
  position: relative;
  margin-top: 14px; /* room above for the peek cards */
}

.wizard-stack > .wizard-step-card:not(.peek) {
  position: relative;
  z-index: 3;
}

.wizard-stack > .peek {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-origin: top center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wizard-stack > .peek.peek-1 {
  z-index: 2;
  transform: scale(0.96) translateY(-10px);
  opacity: 0.7;
}

.wizard-stack > .peek.peek-2 {
  z-index: 1;
  transform: scale(0.92) translateY(-22px);
  opacity: 0.4;
}

.wizard-stack > .peek.peek-3 {
  z-index: 0;
  transform: scale(0.88) translateY(-34px);
  opacity: 0;
}

.peek-skeleton .skeleton-line {
  height: 14px;
  background: var(--skeleton);
  border-radius: 4px;
}

.peek-skeleton .skeleton-line.title {
  height: 26px;
  width: 65%;
  margin-bottom: 6px;
}

.peek-skeleton .skeleton-line.short { width: 55%; }
.peek-skeleton .skeleton-line.medium { width: 80%; }

.peek-skeleton .peek-tips {
  background: var(--peek-tips-bg);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  flex: 1;
}

.peek-home {
  align-items: center;
  justify-content: center;
}

.peek-home svg {
  width: 50%;
  height: auto;
  color: var(--text-secondary);
  opacity: 0.45;
}

.peek-check {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.peek-check-circle {
  width: 50%;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
}

.peek-check-circle svg {
  width: 50%;
  height: auto;
  color: var(--text-secondary);
  opacity: 0.6;
}

.wizard-step-title {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
}

.wizard-step-description {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wizard-step-description p {
  margin: 0;
}

.wizard-step-description strong {
  font-weight: 700;
}

.wizard-step-description em {
  font-style: italic;
}

.wizard-extra {
  background: var(--extra-bg);
  border-radius: var(--radius);
  padding: 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.wizard-extra-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-extra-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--extra-icon-bg);
  color: var(--extra-icon-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wizard-extra-title {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.wizard-extra-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
}

.wizard-extra-list,
.wizard-step-description ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 4px;
  margin: 0;
}

.wizard-extra-list li,
.wizard-step-description ul li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
}

.wizard-extra-list li::before,
.wizard-step-description ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--extra-bullet);
}

/* ── Footer (wizard nav) ── */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 14px 20px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  border: none;
  pointer-events: none;
}

footer > * {
  pointer-events: auto;
}

body.wizard main {
  padding-bottom: 90px;
}

.wizard-nav {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  gap: 28px;
  justify-content: center;
  align-items: center;
}


button {
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}

button:active {
  transform: scale(0.94);
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.wizard-btn-restart,
.wizard-btn-prev,
.wizard-btn-next {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  box-shadow: var(--shadow-btn);
}

.wizard-btn-prev,
.wizard-btn-next {
  width: 60px;
  height: 60px;
  transition: color 0.5s ease, transform 0.1s, box-shadow 0.15s;
}

.wizard-btn-restart {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  color: var(--extra-bullet);
}

.wizard-btn-restart:active {
  transform: translateY(-50%);
}

.wizard-btn-prev::before,
.wizard-btn-next::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.5s ease;
}

.wizard-btn-prev::before { background: #ec4899; }
.wizard-btn-next::before { background: #10b981; }

.wizard-btn-prev svg,
.wizard-btn-next svg {
  position: relative;
  z-index: 1;
}

.wizard-btn-prev { color: #ec4899; }
.wizard-btn-next { color: #10b981; }

@media (hover: hover) and (pointer: fine) {
  .wizard-btn-prev:hover,
  .wizard-btn-next:hover {
    color: var(--surface);
  }

  .wizard-btn-prev:hover::before,
  .wizard-btn-next:hover::before {
    transform: scale(1);
  }
}

.wizard-btn-prev.is-active,
.wizard-btn-next.is-active {
  color: var(--surface);
}

.wizard-btn-prev.is-active::before,
.wizard-btn-next.is-active::before {
  transform: scale(1);
}

/* ── Home meta (theme + credits + version) ── */
.home-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}

.home-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-credits {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-credits:hover {
  color: var(--primary);
}

.locale-select {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  box-sizing: border-box;
  height: 22px;
  margin-left: 4px;
  line-height: 1;
  padding: 3px 24px 0 10px;
  border-radius: 999px;
  background-color: var(--border);
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 10px 10px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.locale-select:hover {
  color: var(--primary);
}

html[data-theme="dark"] .locale-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
}

.theme-switch {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 0;
}

.theme-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s ease;
}

.theme-switch-icon {
  position: absolute;
  top: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

.theme-switch-icon-sun  { left: 0; }
.theme-switch-icon-moon { right: 0; }

.theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 2;
}

html[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(22px);
}

/* The active icon sits above the thumb and uses the primary colour so the
   current theme is obvious. The inactive icon stays dim on the track. */
html[data-theme="light"] .theme-switch-icon-sun,
html[data-theme="dark"]  .theme-switch-icon-moon {
  color: var(--primary);
  opacity: 1;
  z-index: 3;
}

#app-version {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* ── Install banner ── */
body:not(.home) .install-banner {
  display: none !important;
}

.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-light);
  border: 1.5px solid var(--primary-alt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.install-banner:active {
  background: #fecdd3;
}

.install-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.install-banner-text {
  flex: 1;
}

.install-banner-text strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
}

.install-banner-text span {
  font-size: 12px;
  color: var(--primary);
}

.install-banner-dismiss {
  background: transparent;
  color: var(--primary-alt);
  padding: 4px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Install instructions modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 24px max(24px, env(safe-area-inset-bottom));
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideUp 0.3s ease;
}

.modal-title {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.modal-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-step {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  line-height: 1.4;
}

.modal-step-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 50%;
}

.btn-modal-close {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); } to { transform: translateY(0); }
}

/* ── Home header ── */
.home-header {
  text-align: center;
  padding: 20px 0 8px;
}

.home-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--primary), var(--primary-alt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.title-line-top {
  display: block;
  white-space: nowrap;
  font-size: clamp(40px, calc(14.8vw - 5.9px), 137px);
  color: var(--primary);
}

.title-word-dating {
  display: block;
  font-family: 'Gorditas', cursive;
  font-size: clamp(80px, calc(29.1vw - 13.7px), 265px);
  margin-top: -0.55em;
  margin-bottom: -0.15em;
  padding: 0.4em 0 0.28em;
  background: linear-gradient(90deg, #e11d48, #e11dad, #e11d48);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow-shift 5s linear infinite;
}

@keyframes rainbow-shift {
  from { background-position: 0% center; }
  to   { background-position: 200% center; }
}

.home-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.home-footer-msg {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--footer-msg-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  line-height: 1.5;
}

/* ── Section home grid ── */
.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 600px) {
  .section-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card-strong);
  cursor: pointer;
  /* Smooth settle back to rest when the pointer leaves. */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Fluid expand on hover, pointer devices only. The overshoot easing on the
   grow gives the springy feel; the calmer ease on rest (above) avoids
   dipping below the original size on the way out. */
@media (hover: hover) and (pointer: fine) {
  .section-card:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-card-hover);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section-card,
  .section-card:hover {
    transition: none;
    transform: none;
  }
}

/* ── View transitions (home ⇄ section ⇄ credits) ──
   The whole page fades out to the background colour, swaps, then fades back
   in — header (title), content and footer together as one unit. Driven by a
   single class on <body>. The wizard step-swipe is untouched. */
header,
#main-content,
footer {
  transition: opacity var(--view-fade) ease;
}
body.view-fading header,
body.view-fading #main-content,
body.view-fading footer {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  header,
  #main-content,
  footer { transition: none; }
  body.view-fading header,
  body.view-fading #main-content,
  body.view-fading footer { opacity: 1; }
}

.section-card-image {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  overflow: hidden;
}

.section-card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: overlay;
}

.section-card-title {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: white;
  position: relative;
  z-index: 1;
}

.section-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
  pointer-events: none;
}

.section-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.section-card-cta {
  color: var(--primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── WIP card ── */
.wip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.wip-title {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.wip-sub {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Credits page ── */
.credits-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.credits-title {
  font-family: 'Nunito', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.credits-section {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 8px;
}

.credits-intro {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.credits-card p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

.credits-card a {
  color: var(--primary);
  text-decoration: none;
}

.credits-card a:hover {
  text-decoration: underline;
}

.credits-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
