:root {
  --bg: #faf6ee;
  --paper: #fffdf8;
  --ink: #262a46;
  --muted: #6b6f87;
  --gold: #a8782a;
  --gold-soft: #efe2bd;
  --line: #e6dfcf;
  --btn-bg: #2b3358;
  --btn-fg: #ffffff;
  --link: #3d4a86;
  --danger: #9a3b3b;
  --shadow: 0 10px 30px rgba(43, 51, 88, 0.14);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --body: 'Lora', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121730;
    --paper: #1b2243;
    --ink: #efe9dc;
    --muted: #a4a8c2;
    --gold: #e0b858;
    --gold-soft: #4a4224;
    --line: #2d3566;
    --btn-bg: #e0b858;
    --btn-fg: #1a1c2e;
    --link: #a9b7ff;
    --danger: #ee9a9a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% -10%, var(--gold-soft), transparent 60%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.05rem;
  line-height: 1.6;
}

#shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(48px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 0 10px;
}

.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.menu-btn {
  font: inherit;
  font-size: 0.95rem;
  color: var(--link);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
}

.menu {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow);
  padding: 8px;
  margin-bottom: 14px;
  display: grid;
}

.menu[hidden] { display: none; }

.menu a, .menu button {
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  text-decoration: none;
  cursor: pointer;
}

.menu a:hover, .menu button:hover { background: var(--gold-soft); }

main { outline: none; }

a { color: var(--link); }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.15; }

.title {
  font-size: clamp(2.3rem, 10vw, 3.2rem);
  margin: 0 0 1.2rem;
  text-align: center;
}

.title .subtitle {
  display: block;
  font-size: 0.55em;
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
  margin-top: 0.25em;
  letter-spacing: 0.04em;
}

.welcome-to {
  text-align: center;
  font-family: var(--serif);
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.2rem 0 0.2rem;
}

.intro { margin: 0 0 1.1rem; }

.daymeta {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 12px;
}

.photo { margin: 0 0 16px; }

.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow);
  background: var(--gold-soft);
}

.breath {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  margin: 6px 0 10px;
}

.breath { flex-wrap: wrap; text-align: center; row-gap: 2px; }

.breath .link { margin-left: 4px; white-space: nowrap; }

.breath::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.8); opacity: 0.55; }
  50% { transform: scale(1.7); opacity: 1; }
}

.question { text-align: center; margin: 4px 0 22px; }

.question.pending { opacity: 0; }

.question.rise { animation: rise 1.6s ease both; }

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

.qtext {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 6.6vw, 2.35rem);
  font-weight: 500;
  line-height: 1.22;
  margin: 0;
}

.ref {
  margin: 8px 0 0;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.answer, .pool {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
}

.pool { background: transparent; border-style: dashed; }

.pool h2 { font-size: 1.5rem; margin: 0 0 4px; }

textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.35;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  resize: vertical;
  min-height: 112px;
}

textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 6px 0 10px; }

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

.note { font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; }

.msg { min-height: 1.4em; margin: 6px 0 0; font-size: 0.9rem; color: var(--danger); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.btn {
  font: inherit;
  font-size: 0.98rem;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 20px;
  border: 1px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn.ghost { background: transparent; color: var(--link); border-color: var(--line); }

.btn[disabled] { opacity: 0.55; cursor: default; }

.link {
  font: inherit;
  font-size: 0.82rem;
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}

.label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

blockquote.mine, .card p {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

blockquote.mine { border-left: 3px solid var(--gold); padding-left: 14px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 10px;
}

.card .link { display: block; margin-top: 4px; }

.quiet { color: var(--muted); font-style: italic; margin: 8px 0 0; }

.daynav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 14px;
}

.daynav .btn { padding: 9px 14px; font-size: 0.9rem; }

.share-row { text-align: center; margin: 4px 0 18px; }

.banner {
  background: var(--gold-soft);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.85rem;
  margin: 0 0 12px;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  position: relative;
}

.dot b { font-family: var(--serif); font-size: 1.5rem; line-height: 1; }
.dot small { font-size: 0.72rem; color: var(--muted); }
.dot.locked { opacity: 0.45; }
.dot.today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.dot.done::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.entry { margin-top: 18px; }
.entry h2 { font-size: 1.15rem; margin: 0; color: var(--gold); }
.entry .q { font-family: var(--serif); font-size: 1.15rem; margin: 2px 0 6px; font-style: italic; }
.entry .tag { font-size: 0.75rem; color: var(--muted); }

.center { text-align: center; }

.fine { font-size: 0.82rem; color: var(--muted); text-align: center; margin-top: 28px; }

input[type='time'] {
  font: inherit;
  font-size: 1.3rem;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Opening moment ---------- */
body.op-lock { overflow: hidden; }

.op {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0d1126;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 16px;
  color: #fff8e8;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.9s ease;
}

.op.leaving { opacity: 0; }
.op.leaving-quick { opacity: 0; transition-duration: 0.3s; }

.op-ambient {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center;
  filter: blur(46px) brightness(0.5) saturate(1.2);
}

.op-frame {
  position: relative;
  width: min(92vw, 68vh, 520px);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.op-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(24px);
  transform: scale(1.14);
  transition: filter 4.5s ease-in-out, transform 4.5s ease-in-out;
}

.op-frame.clear .op-img { filter: blur(0); transform: scale(1); }

.op-scrim {
  position: absolute;
  inset: 0;
  background: rgba(12, 16, 40, 0.42);
  transition: opacity 4.5s ease-in-out;
}

.op-frame.clear .op-scrim { opacity: 0; }

.op-greet {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8%;
  font-family: var(--serif);
  font-size: clamp(2rem, 8.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1.15;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.op-greet.show { opacity: 1; transform: none; }

.op-float {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.op-float.show { opacity: 1; }

.op-obj {
  position: absolute;
  left: 50%;
  top: 78%;
  width: 24%;
  transform: translate(-50%, -50%);
  color: #fff3d2;
  filter: drop-shadow(0 0 16px rgba(255, 236, 190, 0.85));
}

.op-obj svg { display: block; width: 100%; height: auto; }

.op-obj.run { animation: op-bob var(--cycle, 8000ms) ease-in-out 3 both; }

@keyframes op-bob {
  0% { top: 78%; }
  44% { top: 22%; }
  100% { top: 78%; }
}

.op-breath {
  position: relative;
  max-width: 22em;
  min-height: 2.8em;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  line-height: 1.35;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.op-breath.show { opacity: 1; }

.op-skip {
  position: absolute;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  font: inherit;
  font-size: 0.9rem;
  color: #fff8e8;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 7px 18px;
  cursor: pointer;
}
