:root {
  --ink: #fdfcf8;
  --ink-soft: rgba(253, 252, 248, 0.74);
  --ink-faint: rgba(253, 252, 248, 0.5);
  --glass: rgba(18, 20, 26, 0.32);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --accent: #9bd17f;
  --bg: #0e1116;
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
body.dark-text {
  --ink: #1d1f24;
  --ink-soft: rgba(29, 31, 36, 0.76);
  --ink-faint: rgba(29, 31, 36, 0.52);
  --glass: rgba(255, 255, 255, 0.34);
  --glass-edge: rgba(255, 255, 255, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: color 1.2s ease;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
}

/* ---------- animated background ---------- */
.stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2.4s ease;
  will-change: transform, opacity;
}
.bg.show { opacity: 1; }
.bg.pan { animation: pan 70s ease-in-out infinite alternate; }
.bg.zoom { animation: zoom 50s ease-in-out infinite alternate; }
.bg.drift { animation: drift 60s ease-in-out infinite alternate; }
@keyframes pan { from { transform: translate3d(-7%, 0, 0) scale(1.05); } to { transform: translate3d(7%, 0, 0) scale(1.05); } }
@keyframes zoom { from { transform: scale(1); } to { transform: scale(1.16) translate3d(1%, -1%, 0); } }
@keyframes drift { 0% { transform: translate3d(-3%, 2%, 0) scale(1.06) rotate(-0.6deg); } 100% { transform: translate3d(3%, -2%, 0) scale(1.1) rotate(0.6deg); } }
.scrim {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.34) 100%);
}
body.dark-text .scrim { background: radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.25) 100%); }
.motes { position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1.5px); background-size: 140px 140px; animation: motes 120s linear infinite; opacity: .25; mix-blend-mode: soft-light; }
@keyframes motes { to { background-position: 140px -560px; } }

.ripple { position: fixed; border-radius: 50%; pointer-events: none; border: 1.5px solid rgba(255,255,255,.55); transform: translate(-50%, -50%) scale(0); animation: ripple 1.6s ease-out forwards; z-index: 5; }
@keyframes ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* ---------- layout ---------- */
.top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(20px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 0;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .02em; color: var(--ink-soft); }
.brand img { width: 22px; height: 22px; border-radius: 6px; }
.clock { text-align: right; }
.date { font-size: 15px; color: var(--ink-soft); letter-spacing: .01em; }
.time { font-size: clamp(28px, 5vw, 40px); font-weight: 300; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.center {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px clamp(16px, 5vw, 48px); text-align: center; gap: 18px;
}
.greeting { margin: 0; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.card {
  margin: 0; max-width: 760px; width: 100%;
  padding: clamp(28px, 5vw, 52px) clamp(22px, 5vw, 56px);
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .22);
  transition: opacity .9s ease, transform .9s ease, filter .9s ease;
}
.card.out { opacity: 0; transform: translateY(8px) scale(.985); filter: blur(6px); }
blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 4.6vw, 46px);
  line-height: 1.22;
  letter-spacing: -.01em;
  text-wrap: balance;
}
figcaption { margin-top: 18px; font-size: 15px; color: var(--ink-soft); display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.chip { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 13px; }
body.dark-text .chip { background: rgba(0,0,0,.07); }
.next { margin: 0; font-size: 14px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pill {
  appearance: none; border: 1px solid var(--glass-edge); background: var(--glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: var(--ink); font: 600 15px var(--sans); padding: 11px 18px; border-radius: 999px; cursor: pointer;
  text-decoration: none; transition: transform .2s ease, background .2s ease;
}
.pill:hover { transform: translateY(-1px); background: rgba(255,255,255,.22); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pill.primary { background: var(--ink); color: #111; border-color: transparent; }
body.dark-text .pill.primary { color: #fff; }
.back { color: var(--ink-soft); font-size: 15px; }

.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 0 clamp(16px, 4vw, 40px) max(18px, env(safe-area-inset-bottom));
  font-size: 13px; color: var(--ink-faint);
}

/* ---------- breathing overlay ---------- */
.breathe {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(8, 10, 14, .55); -webkit-backdrop-filter: blur(26px); backdrop-filter: blur(26px);
  color: #fdfcf8; text-align: center; padding: 16px;
}
.breathe[hidden] { display: none; }
.ring { width: min(64vw, 300px); aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; }
.orb {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, var(--orb, #6FA8DC) 50%, color-mix(in srgb, var(--orb, #6FA8DC) 55%, #000) 100%);
  box-shadow: 0 0 80px color-mix(in srgb, var(--orb, #6FA8DC) 60%, transparent);
  transform: scale(.35); opacity: .92;
}
.phase { margin: 10px 0 0; font-family: var(--serif); font-size: 30px; }
.count { margin: 0; font-size: 48px; font-weight: 200; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.breathe .pill { color: #fdfcf8; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.pattern { margin: 0 0 8px; color: rgba(255,255,255,.6); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(20,22,28,.85); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20;
}

@media (max-width: 520px) {
  .brand span { display: none; }
  .foot { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .bg, .motes { animation: none !important; }
  .card { transition: opacity .4s ease; }
}
