:root {
  --bg: #1a0d06;
  --bg2: #2a1408;
  --saffron: #ff8a1f;
  --saffron-deep: #e2580b;
  --gold: #f5c86a;
  --gold-soft: #f7dfa6;
  --ink: #fff6e8;
  --muted: rgba(255, 240, 220, .55);
  --dim: rgba(255, 240, 220, .28);
  --glass: rgba(40, 18, 6, .55);
  --line: rgba(245, 200, 106, .18);
  --level: 0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 0%, #3b1a08 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  overflow-x: hidden;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; color: inherit; cursor: pointer; }

#aura { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.bg {
  position: fixed; inset: -40px; z-index: 0; pointer-events: none;
  background-size: cover; background-position: center;
  filter: blur(40px) saturate(1.3); opacity: .22;
  transform: scale(calc(1.05 + var(--level) * .04));
  transition: transform .12s linear;
}

.app {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  min-height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  gap: 12px;
}

/* header */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.om {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--saffron), var(--saffron-deep));
  box-shadow: 0 0 calc(10px + var(--level) * 30px) rgba(255, 138, 31, .6);
}
.brand h1 { margin: 0; font: 700 22px/1.1 'Cormorant Garamond', serif; letter-spacing: .02em; color: var(--gold-soft); }
.brand p { margin: 0; font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.song-pick select {
  appearance: none; background: var(--glass); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 34px 8px 14px; font: 500 14px Inter, sans-serif; max-width: 70vw;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: right 16px center, right 11px center; background-size: 5px 5px; background-repeat: no-repeat;
}

/* stage */
.stage {
  display: grid; grid-template-columns: minmax(240px, 380px) 1fr;
  gap: 32px; align-items: center; min-height: 0;
}
.cover { position: relative; margin: 0; aspect-ratio: 1; }
.cover img {
  position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 3px solid rgba(245, 200, 106, .55);
  transform: scale(calc(1 + var(--level) * .025));
  transition: transform .1s linear;
}
.halo {
  position: absolute; inset: -14%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 180, 70, .55) 0%, rgba(255, 120, 20, .25) 40%, transparent 68%);
  opacity: calc(.35 + var(--level) * .9);
  transform: scale(calc(.92 + var(--level) * .18));
  transition: transform .1s linear, opacity .1s linear;
}
body:not(.playing) .halo { animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); opacity: .55; } }

.lyrics-wrap {
  position: relative; height: min(58vh, 520px); overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.lyrics { position: absolute; left: 0; right: 0; top: 0; transition: transform .6s cubic-bezier(.2, .7, .2, 1); will-change: transform; }
.line {
  font: 600 clamp(22px, 3.2vw, 36px)/1.25 'Cormorant Garamond', serif;
  padding: 10px 4px; color: var(--dim); cursor: pointer;
  transform-origin: left center; transform: scale(.9);
  transition: color .35s, transform .45s cubic-bezier(.2, .7, .2, 1), opacity .35s;
}
.line:hover { color: var(--muted); }
.line.past { color: rgba(255, 240, 220, .38); }
.line.active { transform: scale(1); color: var(--ink); }
.line.next { color: var(--muted); }
.line.bhajan { font-style: italic; color: rgba(255, 190, 120, .4); }
.line.bhajan.active { color: var(--gold-soft); }
.line.intro, .line.hum { font-style: italic; }
.w { position: relative; display: inline-block; white-space: pre; }
.line.active .w { color: rgba(255, 246, 232, .5); }
.line.active .w::after {
  content: attr(data-t); position: absolute; left: 0; top: 0;
  color: #ffb53d; text-shadow: 0 0 16px rgba(255, 140, 30, .7);
  clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0);
}
.line.active.bhajan .w::after { color: var(--saffron); }
.countdown { display: flex; gap: 10px; padding: 6px 4px 0; height: 22px; }
.countdown i { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); opacity: .2; transition: opacity .2s, transform .2s; }
.countdown i.on { opacity: 1; transform: scale(1.2); box-shadow: 0 0 10px var(--gold); }

/* controls */
.controls {
  background: var(--glass); border: 1px solid var(--line); border-radius: 22px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  padding: 16px 20px; display: grid;
  grid-template-columns: 1fr auto; grid-template-areas: "meta mode" "seek seek" "btns btns" "hint hint";
  gap: 10px 16px; align-items: center;
}
.meta { grid-area: meta; min-width: 0; }
.meta h2 { margin: 0; font: 700 22px/1.15 'Cormorant Garamond', serif; color: var(--gold-soft); }
.meta p { margin: 0; color: var(--muted); font-size: 13px; }

.mode {
  grid-area: mode; position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 999px; padding: 4px;
}
.mode button {
  position: relative; z-index: 1; border: 0; background: none;
  padding: 8px 14px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; border-radius: 999px;
  transition: color .25s;
}
.mode button[aria-checked="true"] { color: #2a1206; }
.mode-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--saffron));
  transition: transform .3s cubic-bezier(.2, .7, .2, 1);
}
.mode[data-mode="backing"] .mode-pill { transform: translateX(100%); }

.seek { grid-area: seek; display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }
.seek input { flex: 1; appearance: none; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--saffron) var(--fill, 0%), rgba(255, 255, 255, .15) var(--fill, 0%)); outline-offset: 6px; }
.seek input::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--gold-soft); box-shadow: 0 0 8px rgba(255, 180, 70, .8); }
.seek input::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--gold-soft); }

.buttons { grid-area: btns; display: flex; justify-content: center; align-items: center; gap: 22px; }
.icon { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; color: var(--muted); }
.icon:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.icon svg { width: 28px; height: 28px; fill: currentColor; }
.play {
  width: 64px; height: 64px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--saffron-deep)); color: #2a1206;
  box-shadow: 0 6px 24px rgba(255, 120, 20, .45), 0 0 0 calc(var(--level) * 10px) rgba(255, 160, 50, .18);
  transition: transform .15s;
}
.play:active { transform: scale(.94); }
.play svg { width: 30px; height: 30px; fill: currentColor; }
.play .i-pause, body.playing .play .i-play { display: none; }
body.playing .play .i-pause { display: block; }
.hint { grid-area: hint; margin: 0; text-align: center; font-size: 12px; color: var(--dim); }
kbd { font: 600 11px Inter, sans-serif; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }

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

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; gap: 12px; }
  .cover { width: min(44vw, 200px); justify-self: center; }
  .lyrics-wrap { height: 38vh; }
  .line { text-align: center; transform-origin: center; font-size: 24px; padding: 8px 0; }
  .countdown { justify-content: center; }
  .controls { grid-template-columns: 1fr; grid-template-areas: "meta" "mode" "seek" "btns" "hint"; padding: 14px 16px; text-align: center; }
  .mode { justify-self: center; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}
.mode button:disabled { opacity: .4; cursor: not-allowed; }
.song-pick select option:disabled { color: #8a7a6a; }
