@font-face {
  font-family: "Playfair Display";
  src: url("/fonts/playfair-italic.woff") format("woff");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("/fonts/playfair.woff") format("woff");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("/fonts/cinzel.woff") format("woff");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Great Vibes";
  src: url("/fonts/great-vibes.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit.woff") format("woff");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #1a1412;
  --cream: #f7efe4;
  --cream-soft: rgba(247, 239, 228, 0.88);
  --gold: #f0c27a;
  --coral: #e08a6c;
  --ink: #1a1412;
  --glass: rgba(20, 14, 16, 0.42);
  --glass-border: rgba(255, 244, 230, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: Outfit, "Segoe UI", sans-serif;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
body { min-height: 100dvh; }
.app, .scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  background: var(--bg);
  transition: opacity 0.6s ease;
}
.photo.is-loading { opacity: 0.4; }

.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom,
      rgba(10, 6, 8, 0.38) 0%,
      rgba(10, 6, 8, 0.05) 22%,
      rgba(10, 6, 8, 0.00) 40%,
      rgba(10, 6, 8, 0.18) 62%,
      rgba(10, 6, 8, 0.62) 82%,
      rgba(8, 4, 6, 0.84) 100%);
}

.top-chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(var(--safe-top) + 18px) 24px 0;
  text-align: center;
  pointer-events: none;
}
.wordmark {
  margin: 0;
  font-family: Cinzel, serif;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
  opacity: 0.9;
}
.slot-label {
  margin: 6px 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--cream-soft);
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  opacity: 0.8;
}

.saying-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(118px + var(--safe-bottom));
  margin: 0;
  padding: 0 28px;
  text-align: center;
}
.saying-wrap blockquote {
  margin: 0 auto;
  max-width: 22em;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.55rem, 5.4vw, 2.45rem);
  line-height: 1.32;
  color: #fff8f0;
  text-shadow:
    0 1px 1px rgba(0,0,0,0.35),
    0 2px 16px rgba(0,0,0,0.55),
    0 8px 28px rgba(0,0,0,0.45);
}
.credit {
  display: block;
  margin-top: 12px;
  font-family: Cinzel, serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(247, 239, 228, 0.8);
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}
.credit[hidden] { display: none; }

.attribution {
  position: absolute;
  left: calc(16px + var(--safe-left));
  right: calc(16px + var(--safe-right));
  bottom: calc(72px + var(--safe-bottom));
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  color: rgba(247, 239, 228, 0.58);
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 12px calc(14px + var(--safe-bottom));
}

.pill, .icon-btn, .btn {
  font-family: Outfit, sans-serif;
  appearance: none;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--cream);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}
.pill {
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: 0 0 auto;
}
.pill:active, .icon-btn:active, .btn:active { transform: scale(0.97); }
.pill:focus-visible, .icon-btn:focus-visible, .btn:focus-visible, .seg:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + 64px);
  transform: translateX(-50%);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  color: var(--cream);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 40;
  pointer-events: none;
  animation: fadein 0.35s ease;
}
.toast[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; transform: translateX(-50%) translateY(-8px);} to { opacity: 1; } }

/* Breath overlay */
.breathe {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 6, 10, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.breathe[hidden], .hidden[hidden] { display: none !important; }
.breathe-close {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  right: calc(var(--safe-right) + 16px);
}
.orb-wrap {
  width: min(62vw, 280px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.orb {
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffe7c8, #e08a6c 45%, #8a4a62 100%);
  box-shadow:
    0 0 40px rgba(240, 194, 122, 0.35),
    0 0 80px rgba(224, 138, 108, 0.25);
}
.orb.inhale {
  animation: inhale 4s ease-in-out forwards;
}
.orb.exhale {
  animation: exhale 6s ease-in-out forwards;
}
@keyframes inhale {
  from { transform: scale(1); }
  to { transform: scale(2.15); }
}
@keyframes exhale {
  from { transform: scale(2.15); }
  to { transform: scale(1); }
}
.breathe-cue {
  margin: 28px 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 1.8rem;
  text-shadow: 0 2px 16px rgba(0,0,0,0.5);
}
.breathe-sub {
  margin: 8px 0 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* Settings sheet */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 12vh;
  z-index: 25;
  background: linear-gradient(180deg, rgba(32, 22, 24, 0.94), rgba(18, 12, 14, 0.98));
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(255, 244, 230, 0.12);
  border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.sheet-handle {
  width: 44px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,244,230,0.28);
  margin: 10px auto 0;
  flex: 0 0 auto;
}
.sheet-body {
  overflow: auto;
  padding: 8px 20px calc(28px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.sheet-head h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.7rem;
}
.card {
  background: rgba(255, 244, 230, 0.05);
  border: 1px solid rgba(255, 244, 230, 0.1);
  border-radius: 16px;
  padding: 16px 16px 18px;
  margin: 0 0 14px;
}
.card h3 {
  margin: 0 0 8px;
  font-family: Cinzel, serif;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.hint {
  margin: 0 0 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(247, 239, 228, 0.82);
}
.card.how ul, .card ul {
  margin: 0;
  padding-left: 1.15em;
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(247, 239, 228, 0.86);
}
.card.how li + li { margin-top: 8px; }

.segmented {
  display: flex;
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
  padding: 3px;
  margin: 4px 0 14px;
}
.seg {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(247, 239, 228, 0.75);
  font-family: Outfit, sans-serif;
  font-size: 0.88rem;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.seg[aria-selected="true"] {
  background: rgba(255, 244, 230, 0.14);
  color: var(--cream);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
}
.count-row span { font-size: 0.95rem; }
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stepper button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255,244,230,0.08);
  color: var(--cream);
  font-size: 1.2rem;
  cursor: pointer;
}
.stepper strong {
  min-width: 1.6em;
  text-align: center;
  font-size: 1.15rem;
}
.time-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.time-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  flex: 1;
}
input[type="time"] {
  font-family: Outfit, sans-serif;
  font-size: 1rem;
  color: var(--cream);
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 10px;
  color-scheme: dark;
  min-width: 0;
  flex: 1;
}

.time-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}
.time-pills li {
  background: rgba(240, 194, 122, 0.12);
  border: 1px solid rgba(240, 194, 122, 0.28);
  color: var(--cream);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.custom-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.custom-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.custom-list input[type="time"] { flex: 1; }
.custom-list .remove {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255,244,230,0.08);
  color: var(--cream);
  cursor: pointer;
  font-size: 1.1rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn {
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 0.92rem;
}
.btn-primary {
  background: linear-gradient(180deg, #e8a07a, #c56b4a);
  border-color: transparent;
  color: #2a1610;
  font-weight: 600;
}
.btn-quiet { background: rgba(255,244,230,0.08); }

.footnote {
  margin: 8px 4px 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(247, 239, 228, 0.5);
}
.tip {
  background: rgba(240, 194, 122, 0.12);
  border-color: rgba(240, 194, 122, 0.3);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (min-width: 720px) {
  .saying-wrap blockquote { font-size: 2.6rem; }
  .sheet { left: 50%; right: auto; width: min(520px, 100%); transform: translateX(-50%); }
}
