:root {
  --bg: #0d0a14;
  --bg-2: #161022;
  --ink: #f3ece4;
  --ink-2: #b9aec4;
  --ink-3: #7f7590;
  --moon: #f1e3cb;
  --blood: #b3263b;
  --blood-2: #d6455b;
  --violet: #6b4fa0;
  --line: rgba(243, 236, 228, 0.12);
  --card: rgba(26, 19, 38, 0.92);
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--ink-2); }
[hidden] { display: none !important; }

.sky {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(107, 79, 160, 0.35), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(179, 38, 59, 0.22), transparent 60%),
    var(--bg);
}

#app { max-width: 480px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); }
.screen { animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 20px; letter-spacing: 0.04em; padding: 6px 0 18px; }
.mark { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset -5px -2px 0 0 var(--moon); transform: rotate(-20deg); }

/* Cover: a blood moon rising through haze */
.cover { position: relative; aspect-ratio: 1 / 1; border-radius: 24px; overflow: hidden; margin: 0 auto;
  background: linear-gradient(180deg, #120c1d 0%, #2a1530 55%, #4a1525 100%); box-shadow: 0 30px 60px -30px rgba(0,0,0,0.8); border: 1px solid var(--line); }
.cover.small { width: 62%; margin-top: 8px; }
.moon { position: absolute; left: 50%; top: 42%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #ffd9c2 0%, #e48a6a 35%, #a3283a 70%, #5b1424 100%);
  box-shadow: 0 0 60px 10px rgba(214, 69, 91, 0.45), 0 0 140px 40px rgba(179, 38, 59, 0.25);
  animation: rise 8s ease-in-out infinite alternate; }
@keyframes rise { from { top: 44%; } to { top: 40%; } }
.haze { position: absolute; inset: auto 0 0 0; height: 48%;
  background: linear-gradient(180deg, transparent, rgba(13, 10, 20, 0.85) 70%),
    repeating-linear-gradient(100deg, transparent 0 18px, rgba(13,10,20,0.35) 18px 22px);
  -webkit-mask: linear-gradient(180deg, transparent, #000 40%); mask: linear-gradient(180deg, transparent, #000 40%); }
.cover::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%;
  background: radial-gradient(60% 100% at 20% 100%, #07050c 60%, transparent 61%), radial-gradient(70% 120% at 85% 100%, #07050c 60%, transparent 61%); }

.intro { text-align: center; padding: 22px 4px 8px; }
.eyebrow { margin: 0 0 6px; color: var(--ink-3); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.05; margin: 0 0 10px; letter-spacing: 0.01em; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.15; margin: 0; }
h3 { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.2; margin: 0 0 14px; }
.tagline { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--moon); margin: 0 0 12px; line-height: 1.4; }
.desc { color: var(--ink-2); font-size: 15.5px; line-height: 1.55; margin: 0 0 14px; }

.start { display: grid; gap: 10px; margin: 14px 0 26px; }
.start label { font-size: 14px; color: var(--ink-2); }
.opt { color: var(--ink-3); }
.start input { width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  color: var(--ink); font-size: 17px; outline: none; transition: border-color .2s, background .2s; }
.start input:focus { border-color: var(--blood-2); background: rgba(255,255,255,0.07); }
.hint { font-size: 13px; color: var(--ink-3); margin: 0; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px 20px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.06); font-size: 17px; font-weight: 600; transition: transform .1s, filter .2s; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(180deg, var(--blood-2), var(--blood)); border-color: transparent; box-shadow: 0 10px 30px -10px rgba(214,69,91,0.7); }
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn[disabled] { filter: grayscale(0.6) brightness(0.8); cursor: wait; }
.link { background: none; border: 0; color: var(--ink-3); font-size: 14px; padding: 8px; text-decoration: underline; text-underline-offset: 3px; }

.how { list-style: none; padding: 18px; margin: 0 0 26px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.02);
  display: grid; gap: 10px; font-size: 14.5px; color: var(--ink-2); line-height: 1.45; }
.how strong { color: var(--ink); }
.foot { text-align: center; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.foot p { margin: 8px 0 0; }

/* Player */
.bar { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; }
.bar-title { font-family: var(--serif); color: var(--ink-2); font-size: 15px; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; }
.icon svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.big svg { width: 34px; height: 34px; }
.icon text { fill: var(--ink); stroke: none; font-size: 7px; font-family: var(--sans); font-weight: 700; }
.spacer { visibility: hidden; }
.now { text-align: center; padding: 22px 0 10px; min-height: 92px; }

.scrub { padding: 8px 2px 0; }
#seek { width: 100%; -webkit-appearance: none; appearance: none; height: 28px; background: transparent; }
#seek::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--blood-2) var(--p, 0%), rgba(255,255,255,0.15) var(--p, 0%)); }
#seek::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.15); }
#seek::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--blood-2); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); margin-top: -6px; }
#seek::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 0; }
.times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.controls { display: flex; align-items: center; justify-content: center; gap: 34px; padding: 18px 0 8px; }
.play { position: relative; width: 78px; height: 78px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; box-shadow: 0 12px 34px -12px rgba(241, 227, 203, 0.55); }
.play svg { width: 32px; height: 32px; fill: currentColor; grid-area: 1 / 1; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.play .spin { grid-area: 1 / 1; width: 86px; height: 86px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--blood-2); opacity: 0; }
.play.loading .spin { opacity: 1; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.path { text-align: center; color: var(--ink-3); font-size: 13px; min-height: 20px; margin: 12px 0 0; }

/* Sheets */
.sheet { position: fixed; inset: 0; z-index: 10; display: grid; align-items: end; justify-items: center; background: rgba(5, 3, 9, 0.66);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s ease; }
.sheet-card { width: 100%; max-width: 480px; background: var(--card); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 26px 22px max(26px, env(safe-area-inset-bottom)); text-align: center; animation: up .3s ease; }
@keyframes up { from { transform: translateY(30px); } to { transform: none; } }
.options { display: grid; gap: 12px; margin: 6px 0 16px; }
.option { padding: 18px 18px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); font-size: 17px;
  font-family: var(--serif); text-align: left; line-height: 1.35; transition: background .2s, border-color .2s, transform .1s; }
.option:hover, .option:focus-visible { border-color: var(--blood-2); background: rgba(214, 69, 91, 0.12); outline: none; }
.option:active { transform: scale(0.985); }
.option.picked { border-color: var(--blood-2); background: rgba(214, 69, 91, 0.25); }
.countdown { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; margin-bottom: 8px; }
.countdown span { display: block; height: 100%; width: 100%; background: var(--ink-3); transform-origin: left; }
#paywall .btn { margin: 6px 0 4px; }

#toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: #241a33; border: 1px solid var(--line); color: var(--ink); padding: 12px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 40px); box-shadow: 0 12px 30px -10px rgba(0,0,0,0.7); }

.cover:not(.small) { width: 80%; }
@media (min-width: 700px) {
  h1 { font-size: 48px; }
  .cover:not(.small) { width: 86%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
