:root {
  color-scheme: dark;
  --ink: #f3f6f1;
  --muted: #a4b2ac;
  --dim: #65746f;
  --stone: #0c1111;
  --line: rgba(183, 207, 200, 0.16);
  --gold: #d5c276;
  --gold-soft: #efe4a5;
  --gold-deep: #9c7f3a;
  --teal: #76b9ad;
  --candle: #ffb95e;
  --energy: 0;
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #040606;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 10%, rgba(118, 185, 173, 0.1), transparent 30rem),
    radial-gradient(circle at 50% 50%, rgba(213, 194, 118, 0.05), transparent 36rem),
    linear-gradient(180deg, #050707 0%, #0c1111 52%, #040505 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 100svh;
}

/* ================================ Stage ================================ */

.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(18px, 3.4vw, 46px);
  border-bottom: 1px solid rgba(198, 164, 86, 0.22);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.72), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.74)),
    repeating-linear-gradient(90deg, rgba(184, 219, 211, 0.02) 0 1px, transparent 1px 11vw);
  user-select: none;
  -webkit-user-select: none;
  transition: filter 2.4s ease;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(90deg, transparent 0 11%, rgba(172, 207, 198, 0.07) 11.3% 11.8%, transparent 12.2%),
    linear-gradient(90deg, transparent 0 88%, rgba(172, 207, 198, 0.07) 88.3% 88.8%, transparent 89.2%),
    radial-gradient(ellipse at center bottom, rgba(18, 36, 33, 0.85), transparent 62%);
  pointer-events: none;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 30%, transparent 72%, rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

body.vigil-on .stage {
  filter: brightness(0.86) saturate(1.08);
}

.rose-window {
  position: absolute;
  z-index: -2;
  top: clamp(-40px, -3vw, -16px);
  left: 50%;
  width: clamp(220px, 30vw, 420px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 8deg,
      rgba(213, 194, 118, 0.13) 0deg 8deg,
      rgba(118, 185, 173, 0.1) 8deg 16deg,
      rgba(124, 92, 153, 0.1) 16deg 24deg,
      rgba(213, 194, 118, 0.05) 24deg 30deg),
    radial-gradient(circle, rgba(239, 228, 165, 0.2) 0 18%, rgba(118, 185, 173, 0.12) 40%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle, #000 0 56%, transparent 71%);
  mask-image: radial-gradient(circle, #000 0 56%, transparent 71%);
  opacity: calc(0.3 + var(--energy) * 0.6);
  transition: opacity 600ms ease;
  pointer-events: none;
}

body.bell-rings .rose-window {
  opacity: 1;
}

.stage-light {
  position: absolute;
  z-index: -1;
  top: -16%;
  left: 50%;
  width: min(74vw, 860px);
  height: 88%;
  transform: translateX(-50%);
  clip-path: polygon(40% 0, 60% 0, 90% 100%, 10% 100%);
  background: linear-gradient(180deg, rgba(198, 224, 218, 0.26), rgba(118, 185, 173, 0.03));
  filter: blur(2px);
  opacity: calc(0.55 + var(--energy) * 0.45);
  transition: opacity 500ms ease;
  pointer-events: none;
}

.floor-glow {
  position: absolute;
  z-index: 0;
  bottom: -8%;
  left: 50%;
  width: 110%;
  height: 30%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 185, 94, 0.13), rgba(118, 185, 173, 0.06) 45%, transparent 72%);
  opacity: calc(0.5 + var(--energy) * 0.5);
  pointer-events: none;
}

/* Dust motes drifting in the light */
.motes {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: calc(0.4 + var(--energy) * 0.6);
  pointer-events: none;
}

.motes i {
  position: absolute;
  bottom: -3%;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 228, 165, 0.8), rgba(239, 228, 165, 0));
  animation: mote-rise var(--dur) linear infinite;
  animation-delay: var(--delay);
}

@keyframes mote-rise {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 0.7; }
  82% { opacity: 0.5; }
  100% { transform: translate(var(--drift), -86svh); opacity: 0; }
}

/* ------------------------------- Branding ------------------------------ */

.brand {
  position: relative;
  z-index: 2;
  text-align: center;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.brand p {
  margin: 0;
  color: var(--gold-soft);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.9;
}

.brand h1 {
  margin: 0.22rem 0 0;
  font-size: clamp(2.4rem, 6.6vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
}

/* ----------------------------- Top Controls ----------------------------- */

.top-controls {
  position: absolute;
  z-index: 9;
  top: calc(env(safe-area-inset-top, 0px) + clamp(8px, 1.5vw, 18px));
  left: calc(env(safe-area-inset-left, 0px) + clamp(8px, 1.5vw, 18px));
  display: grid;
  gap: 5px;
  width: min(520px, calc(100% - 18px));
  pointer-events: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.top-menu-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  pointer-events: auto;
}

.dropdown {
  position: relative;
  min-width: 0;
}

.top-controls .dropdown {
  position: static;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 36px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(183, 207, 200, 0.18);
  border-radius: 8px;
  color: rgba(231, 240, 233, 0.92);
  background: linear-gradient(180deg, rgba(18, 28, 27, 0.92), rgba(4, 7, 7, 0.88));
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.08), 0 10px 26px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.menu-button span:not(.settings-icon) {
  color: rgba(164, 178, 172, 0.9);
  text-transform: uppercase;
}

.menu-button strong {
  min-width: 0;
  overflow: hidden;
  color: var(--gold-soft);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-icon {
  color: var(--gold-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-1px);
}

.menu-button:hover,
.menu-button.is-open {
  transform: translateY(-1px);
  border-color: rgba(239, 228, 165, 0.56);
  color: var(--gold-soft);
  background: linear-gradient(180deg, rgba(28, 38, 35, 0.95), rgba(5, 9, 9, 0.92));
}

.dropdown-panel {
  position: absolute;
  top: 40px;
  left: 0;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 20px));
  max-height: min(68svh, 520px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(183, 207, 200, 0.16);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(10, 18, 17, 0.96), rgba(4, 7, 7, 0.94)),
    radial-gradient(circle at 20% 0%, rgba(118, 185, 173, 0.14), transparent 58%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(215, 238, 232, 0.08);
  pointer-events: auto;
}

.dropdown-panel[hidden] {
  display: none;
}

.menu-section,
.top-controls .row {
  display: grid;
  gap: 7px;
  width: 100%;
  margin: 0;
}

.top-controls .row {
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
}

.song-panel .liturgy-picker,
.song-panel .level-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  gap: 6px;
  overflow: visible;
  padding: 0;
}

.song-panel .level-picker {
  grid-template-columns: minmax(0, 1fr);
}

.song-panel .chip,
.top-controls .chip {
  width: 100%;
  min-height: 31px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 0.64rem;
}

.top-controls .chips {
  overflow-x: auto;
  padding: 0 0 2px;
}

.voice-select-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.voice-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 11px;
  width: 7px;
  height: 7px;
  border-right: 2px solid rgba(239, 228, 165, 0.86);
  border-bottom: 2px solid rgba(239, 228, 165, 0.86);
  transform: translateY(-66%) rotate(45deg);
  pointer-events: none;
}

.voice-select {
  appearance: none;
  width: 100%;
  min-height: 34px;
  padding: 0 34px 0 11px;
  border: 1px solid rgba(183, 207, 200, 0.18);
  border-radius: 8px;
  color: rgba(231, 240, 233, 0.94);
  background: linear-gradient(180deg, #101817 0%, #060808 100%);
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.07);
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 850;
}

.voice-select:focus-visible {
  outline: 2px solid rgba(239, 228, 165, 0.72);
  outline-offset: 3px;
}

.mode-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  pointer-events: none;
}

.mode-pill {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: rgba(164, 178, 172, 0.76);
  background: transparent;
  box-shadow: none;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.mode-pill[hidden] {
  display: none;
}

/* ------------------------------- Candles ------------------------------- */

.candles {
  position: absolute;
  z-index: 1;
  bottom: clamp(8px, 2vw, 26px);
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 0.7vw, 10px);
  filter: brightness(calc(0.8 + var(--energy) * 0.55));
  pointer-events: none;
}

.candles-left { left: clamp(4px, 1.2vw, 22px); }
.candles-right { right: clamp(4px, 1.2vw, 22px); }

.candle {
  position: relative;
  display: block;
  width: clamp(5px, 0.7vw, 9px);
  height: clamp(26px, 3.6vw, 52px);
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(180deg, #9a8f74 0%, #6e6450 38%, #423c30 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.candle.tall { height: clamp(36px, 4.8vw, 68px); }
.candle.short { height: clamp(18px, 2.6vw, 38px); }

.flame {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 8px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50% 50% 42% 42% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 78%, #fff5d6 0 22%, var(--candle) 48%, rgba(255, 122, 32, 0.9) 78%, transparent 100%);
  box-shadow:
    0 0 12px rgba(255, 185, 94, 0.85),
    0 0 34px rgba(255, 165, 64, 0.4),
    0 0 80px rgba(255, 165, 64, 0.22);
  animation: flicker 2.3s ease-in-out infinite;
}

.candle.tall .flame { animation-duration: 1.9s; }
.candle.short .flame { animation-duration: 2.8s; }

@keyframes flicker {
  0%, 100% { transform: translateX(-50%) scale(1) rotate(-1.4deg); opacity: 0.96; }
  22% { transform: translateX(-54%) scale(1.06, 1.14) rotate(2deg); opacity: 1; }
  45% { transform: translateX(-47%) scale(0.94, 0.92) rotate(-2.4deg); opacity: 0.88; }
  68% { transform: translateX(-52%) scale(1.03, 1.08) rotate(1.2deg); opacity: 1; }
  85% { transform: translateX(-49%) scale(0.97) rotate(-1deg); opacity: 0.93; }
}

/* --------------------------------- Hint --------------------------------- */

.hint {
  position: absolute;
  z-index: 5;
  top: clamp(96px, 17vw, 190px);
  left: 50%;
  width: max-content;
  max-width: 86vw;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(239, 228, 165, 0.78);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(0.7rem, 1.4vw, 0.84rem);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
  animation: hint-breathe 3.4s ease-in-out infinite;
  pointer-events: none;
  transition: opacity 900ms ease;
}

.hint.is-hidden {
  opacity: 0;
  animation: none;
}

@keyframes hint-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ================================= Choir ================================ */

.choir {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(4px, 0.8vw, 12px);
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: end;
  width: min(1100px, calc(100% - 10px));
  height: min(430px, 54svh);
  padding: 0 clamp(2px, 1.2vw, 16px);
  transform: translateX(-50%);
  touch-action: none;
}

/* Three rows mirroring the keyboard: Q row furthest back. */
.choir-row {
  display: grid;
  align-items: end;
  column-gap: clamp(1px, 0.8vw, 12px);
  margin: 0 auto;
  min-width: 0;
}

.row-back {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  width: 100%;
}

.row-middle {
  grid-template-columns: repeat(9, minmax(0, 1fr));
  width: 93%;
}

.row-front {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 76%;
}

.monk {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  cursor: pointer;
  min-width: 0;
  position: relative;
  z-index: var(--z, 2);
  opacity: var(--row-opacity, 1);
  transform: translateY(calc(var(--row-drop, 0px) + var(--edge-drop, 0px) + var(--lift, 0px))) scale(var(--scale, 1));
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.7));
  transition: transform 120ms ease, filter 150ms ease, opacity 150ms ease;
}

.monk:not(:disabled):hover { --lift: -5px; }

.monk:focus-visible {
  outline: 2px solid rgba(213, 194, 118, 0.85);
  outline-offset: 8px;
  border-radius: 12px;
}

.monk.back {
  --row-drop: 30px;
  --scale: 0.72;
  --row-opacity: 0.58;
  --z: 1;
  height: clamp(88px, 11.8vw, 166px);
}

.monk.middle {
  --row-drop: 14px;
  --scale: 0.87;
  --row-opacity: 0.82;
  --z: 2;
  height: clamp(102px, 13.8vw, 194px);
}

.monk.front {
  --row-drop: 0px;
  --scale: 1;
  --z: 3;
  height: clamp(116px, 15.6vw, 220px);
}

.choir-row .monk:first-child,
.choir-row .monk:last-child { --edge-drop: 13px; }

.choir-row .monk:nth-child(2),
.choir-row .monk:nth-last-child(2) { --edge-drop: 6px; }

.monk.center.front { height: clamp(128px, 17vw, 240px); }
.monk.center.middle { height: clamp(112px, 15vw, 210px); }
.monk.center.back { height: clamp(96px, 12.8vw, 180px); }

.monk .body {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 50% 100%;
  pointer-events: none;
}

.monk.is-singing .body {
  animation: monk-sway var(--sway-dur, 3.6s) ease-in-out infinite;
}

@keyframes monk-sway {
  0%, 100% { transform: rotate(-1.1deg); }
  50% { transform: rotate(1.1deg); }
}

.monk .halo,
.monk .hood,
.monk .face,
.monk .robe,
.monk .cord,
.monk .eyes,
.monk .mouth,
.monk .tag {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.monk .halo {
  top: -4%;
  width: 120%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 228, 165, 0.32) 0 18%, rgba(213, 194, 118, 0.14) 42%, transparent 68%);
  opacity: 0;
  transition: opacity 150ms ease;
}

.monk.is-singing .halo {
  opacity: calc(0.45 + var(--energy) * 0.55);
}

.monk .robe {
  bottom: 0;
  width: clamp(46px, 8vw, 104px);
  height: 76%;
  border-radius: 46% 46% 9px 9px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, transparent 30%, transparent 44%, rgba(196, 224, 218, 0.09) 52%, transparent 60%, rgba(0, 0, 0, 0.55) 100%),
    radial-gradient(ellipse 90% 26% at 50% 100%, rgba(0, 0, 0, 0.5), transparent 70%),
    linear-gradient(180deg, #232f2d 0%, #0a0e0f 100%);
  border: 1px solid rgba(174, 205, 198, 0.13);
}

.monk .robe::before,
.monk .robe::after {
  content: "";
  position: absolute;
  top: 22%;
  width: 24%;
  height: 52%;
  border-radius: 40% 60% 30% 30%;
  background: linear-gradient(180deg, rgba(196, 224, 218, 0.06), rgba(0, 0, 0, 0.4));
}

.monk .robe::before { left: -3%; transform: rotate(5deg); }
.monk .robe::after { right: -3%; transform: rotate(-5deg); }

.monk .cord {
  bottom: 34%;
  width: clamp(34px, 6vw, 78px);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(213, 194, 118, 0.55) 18%, rgba(213, 194, 118, 0.55) 82%, transparent);
}

.monk .cord::after {
  content: "";
  position: absolute;
  right: 16%;
  top: 0;
  width: 4px;
  height: 9px;
  border-radius: 2px;
  background: rgba(213, 194, 118, 0.5);
}

.monk .hood {
  top: 4%;
  width: clamp(44px, 7.2vw, 92px);
  height: 45%;
  border-radius: 50% 50% 44% 44%;
  background:
    radial-gradient(circle at 50% 56%, transparent 0 34%, rgba(0, 0, 0, 0.5) 35% 38%, transparent 39%),
    linear-gradient(180deg, #2b3a37 0%, #0e1313 82%);
  border: 1px solid rgba(185, 207, 201, 0.13);
  z-index: 3;
}

.monk .face {
  top: 23%;
  width: clamp(21px, 3.2vw, 42px);
  height: clamp(26px, 3.9vw, 54px);
  border-radius: 48%;
  background: linear-gradient(180deg, #c9b79c 0%, #6f665a 100%);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.5);
  z-index: 4;
}

.monk .eyes {
  top: 32%;
  width: 72%;
  height: 14%;
}

.monk .eyes::before,
.monk .eyes::after {
  content: "";
  position: absolute;
  top: 0;
  width: 30%;
  height: 100%;
  border-bottom: 1.6px solid #221610;
  border-radius: 0 0 50% 50%;
}

.monk .eyes::before { left: 8%; }
.monk .eyes::after { right: 8%; }

.monk .mouth {
  top: 64%;
  width: 22%;
  height: 7%;
  border-radius: 50%;
  background: #170d0b;
  transition: width 100ms ease, height 100ms ease, top 100ms ease;
}

.monk.is-singing .mouth {
  top: 58%;
  width: 36%;
  height: 24%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.7), inset 0 -2px 3px rgba(255, 180, 140, 0.18);
  animation: mouth-chant 1.9s ease-in-out infinite;
}

@keyframes mouth-chant {
  0%, 100% { transform: translateX(-50%) scale(1, 1); }
  30% { transform: translateX(-50%) scale(0.86, 0.62); }
  55% { transform: translateX(-50%) scale(1.05, 1.12); }
  78% { transform: translateX(-50%) scale(0.92, 0.85); }
}

.monk.is-singing {
  --lift: -8px;
  filter:
    drop-shadow(0 0 16px rgba(213, 194, 118, 0.3))
    drop-shadow(0 18px 26px rgba(0, 0, 0, 0.7));
  opacity: 1;
}

.choir.has-liturgy-lanes .monk:not(.is-liturgy-lane) {
  filter: brightness(0.62) saturate(0.72) drop-shadow(0 14px 20px rgba(0, 0, 0, 0.62));
}

.monk.is-liturgy-lane {
  --lift: -4px;
  opacity: 1;
  filter:
    drop-shadow(0 0 18px rgba(118, 185, 173, 0.34))
    drop-shadow(0 18px 26px rgba(0, 0, 0, 0.7));
}

.monk.is-liturgy-lane::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 4%;
  width: 84%;
  height: 82%;
  transform: translateX(-50%);
  border-radius: 48% 48% 14px 14px;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(239, 228, 165, 0.18), transparent 54%),
    linear-gradient(180deg, rgba(118, 185, 173, 0.12), transparent 64%);
  box-shadow:
    inset 0 0 0 1px rgba(239, 228, 165, 0.2),
    0 0 22px rgba(118, 185, 173, 0.18);
  opacity: 0.86;
  pointer-events: none;
}

.monk.is-liturgy-lane.is-singing::before {
  opacity: 1;
  box-shadow:
    inset 0 0 0 1px rgba(239, 228, 165, 0.48),
    0 0 30px rgba(239, 228, 165, 0.38),
    0 0 46px rgba(118, 185, 173, 0.22);
}

.monk.is-singing .robe {
  border-color: rgba(213, 194, 118, 0.34);
  box-shadow: inset 0 0 26px rgba(118, 185, 173, 0.12);
}

/* Key / note tag */
.monk .tag {
  bottom: clamp(15px, 2.1vw, 32px);
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: rgba(231, 240, 233, 0.88);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.tag-key {
  font-size: clamp(0.84rem, 1.6vw, 1.3rem);
  font-weight: 900;
}

.tag-note {
  color: rgba(176, 192, 186, 0.92);
  font-size: clamp(0.54rem, 0.9vw, 0.74rem);
  font-weight: 800;
}

.monk.is-singing .tag-key { color: var(--gold-soft); }

.monk.is-liturgy-lane .tag-key {
  color: #fff4bd;
  text-shadow: 0 0 12px rgba(239, 228, 165, 0.36), 0 2px 8px rgba(0, 0, 0, 0.85);
}

/* Touch feedback ring */
.touch-ring {
  position: fixed;
  z-index: 60;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(239, 228, 165, 0.85);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.touch-ring.is-live {
  animation: ring-out 600ms ease-out forwards;
}

@keyframes ring-out {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(3.4); opacity: 0; }
}

/* =============================== Console ================================ */

.console {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.2vw, 14px);
  align-content: start;
  padding: clamp(10px, 1.8vw, 22px) clamp(12px, 2.4vw, 32px) clamp(12px, 2vw, 22px);
  background:
    linear-gradient(180deg, rgba(4, 7, 7, 0.9), rgba(7, 10, 10, 0.98)),
    repeating-linear-gradient(90deg, rgba(180, 213, 205, 0.022) 0 1px, transparent 1px 23px);
  box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.55);
}

.console::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(213, 194, 118, 0.35), transparent);
  pointer-events: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.settings-panel {
  display: grid;
  gap: 7px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(183, 207, 200, 0.12);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(10, 16, 15, 0.82), rgba(4, 6, 6, 0.68));
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.05);
}

.settings-panel[hidden] {
  display: none;
}

.console-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.row-label {
  display: grid;
  gap: 3px;
  min-width: 68px;
  flex: 0 0 auto;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.row-label span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.row-label strong {
  color: var(--gold-soft);
  font-size: 0.76rem;
  font-weight: 900;
}

.chips {
  display: flex;
  flex: 1 1 auto;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(118, 185, 173, 0.5) transparent;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(183, 207, 200, 0.18);
  border-radius: 9px;
  color: rgba(231, 240, 233, 0.9);
  background: linear-gradient(180deg, #101817 0%, #060808 100%);
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.07);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.touch-control {
  display: grid;
  flex: 1 1 auto;
  min-width: 150px;
  gap: 4px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.touch-slider {
  appearance: none;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(239, 228, 165, 0.82), rgba(118, 185, 173, 0.78)) 0 / var(--touch-pos, 40%) 100% no-repeat,
    linear-gradient(90deg, rgba(183, 207, 200, 0.14), rgba(183, 207, 200, 0.08));
  outline: 1px solid rgba(183, 207, 200, 0.16);
  cursor: pointer;
}

.touch-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(7, 16, 15, 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #fff7d5 0 18%, #d9cb82 40%, #76b9ad 100%);
  box-shadow:
    0 0 14px rgba(118, 185, 173, 0.34),
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.touch-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(7, 16, 15, 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #fff7d5 0 18%, #d9cb82 40%, #76b9ad 100%);
  box-shadow:
    0 0 14px rgba(118, 185, 173, 0.34),
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.touch-scale {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  color: rgba(164, 178, 172, 0.78);
  font-size: 0.52rem;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.sfx-toggle {
  display: inline-flex;
  align-items: center;
  width: max-content;
  cursor: pointer;
}

.sfx-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sfx-toggle-track {
  position: relative;
  display: block;
  width: 54px;
  height: 28px;
  border: 1px solid rgba(183, 207, 200, 0.18);
  border-radius: 999px;
  background: linear-gradient(180deg, #111817, #060808);
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.08);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.sfx-toggle-track span {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(231, 240, 233, 0.92), rgba(118, 185, 173, 0.58));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transform: translateY(-50%);
  transition: transform 160ms ease, background 160ms ease;
}

.sfx-toggle input:checked + .sfx-toggle-track {
  border-color: rgba(239, 228, 165, 0.62);
  background: linear-gradient(180deg, rgba(53, 49, 25, 0.9), rgba(9, 16, 15, 0.94));
  box-shadow: 0 0 16px rgba(118, 185, 173, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sfx-toggle input:checked + .sfx-toggle-track span {
  background: radial-gradient(circle at 38% 30%, #fff8d2 0 20%, #e8dfa7 42%, #76b9ad 100%);
  transform: translate(26px, -50%);
}

.sfx-toggle input:focus-visible + .sfx-toggle-track {
  outline: 2px solid rgba(239, 228, 165, 0.75);
  outline-offset: 3px;
}

.chip:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: rgba(118, 185, 173, 0.62);
}

.chip.is-selected {
  border-color: rgba(239, 228, 165, 0.66);
  color: #07100f;
  background: linear-gradient(180deg, #e8dfa7 0%, #79beb2 100%);
  box-shadow: 0 0 16px rgba(118, 185, 173, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ------------------------------- Buttons -------------------------------- */

.actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.secondary-button,
.vigil-button,
.settings-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: linear-gradient(180deg, #17201f 0%, #080b0c 100%);
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.09), 0 8px 22px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 850;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, background 140ms ease;
}

.secondary-button:hover,
.vigil-button:hover,
.settings-button:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 185, 173, 0.62);
}

.secondary-button:active,
.vigil-button:active,
.settings-button:active {
  transform: translateY(1px);
}

.settings-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: rgba(231, 240, 233, 0.92);
}

.settings-button.is-open {
  border-color: rgba(239, 228, 165, 0.58);
  color: var(--gold-soft);
  background: linear-gradient(180deg, #1d2523 0%, #080b0c 100%);
}

.settings-icon {
  position: relative;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0.86;
}

.settings-icon::before,
.settings-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 2px;
  height: 21px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%);
}

.settings-icon::after {
  transform: translateX(-50%) rotate(90deg);
}

.vigil-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: rgba(213, 194, 118, 0.4);
  color: var(--gold-soft);
}

.vigil-button .ember {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe9b0, #c98a2e 70%);
  box-shadow: 0 0 6px rgba(255, 185, 94, 0.4);
  opacity: 0.5;
  transition: opacity 300ms ease;
}

.vigil-button.is-on {
  border-color: rgba(239, 228, 165, 0.75);
  background: linear-gradient(180deg, #2b2716 0%, #0c0a05 100%);
  box-shadow: 0 0 18px rgba(213, 194, 118, 0.35), inset 0 1px 0 rgba(255, 244, 200, 0.16);
}

.vigil-button.is-on .ember {
  opacity: 1;
  animation: ember-pulse 2.6s ease-in-out infinite;
}

@keyframes ember-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 185, 94, 0.45); transform: scale(1); }
  50% { box-shadow: 0 0 16px rgba(255, 185, 94, 0.95); transform: scale(1.25); }
}

/* -------------------------------- Status -------------------------------- */

.status {
  flex: 1 1 auto;
  min-height: 1.2rem;
  margin: 0;
  color: var(--dim);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  font-style: italic;
}

.keys-hint {
  width: min(1180px, 100%);
  margin: -4px auto 0;
  color: rgba(101, 116, 111, 0.62);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.68rem;
}

@media (hover: none) {
  .keys-hint { display: none; }
  .tag-key { display: none; }
  .tag-note {
    font-size: clamp(0.62rem, 2.4vw, 0.78rem);
    color: rgba(231, 240, 233, 0.85);
  }
  .monk.is-singing .tag-note { color: var(--gold-soft); }
}

/* =============================== Liturgy ================================ */

.liturgy-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.sigil-beam {
  position: absolute;
  top: 0;
  width: clamp(34px, 5.6vw, 64px);
  height: var(--beam-h, 200px);
  transform: translateX(-50%);
  background: linear-gradient(180deg,
    rgba(239, 228, 165, 0) 0%,
    rgba(239, 228, 165, 0.05) 30%,
    rgba(239, 228, 165, 0.22) 80%,
    rgba(255, 244, 210, 0.45) 100%);
  filter: blur(5px);
  opacity: 0;
  mix-blend-mode: screen;
}

.sigil-beam.is-hit {
  transition: opacity 180ms ease;
  opacity: 0;
}

.sigil {
  position: absolute;
  width: clamp(26px, 4.2vw, 44px);
  height: clamp(26px, 4.2vw, 44px);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.sigil-glow,
.sigil-mark {
  position: absolute;
  inset: 0;
}

.sigil-glow {
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 248, 224, 0.95) 0%, rgba(239, 228, 165, 0.55) 40%, transparent 74%);
  box-shadow: 0 0 18px rgba(239, 228, 165, 0.6), 0 0 4px rgba(255, 255, 255, 0.85);
  animation: sigil-pulse 1.1s ease-in-out infinite;
}

.sigil-mark {
  border: 2px solid rgba(15, 20, 19, 0.78);
  border-radius: 4px;
  transform: rotate(45deg) scale(0.46);
  background: rgba(255, 250, 230, 0.55);
}

.sigil-mark::before,
.sigil-mark::after {
  content: "";
  position: absolute;
  background: rgba(15, 20, 19, 0.7);
}

.sigil-mark::before { top: 50%; left: 8%; right: 8%; height: 2px; transform: translateY(-50%); }
.sigil-mark::after { left: 50%; top: 8%; bottom: 8%; width: 2px; transform: translateX(-50%); }

@keyframes sigil-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.16); opacity: 0.8; }
}

.sigil-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 224, 0.9);
  opacity: 0;
}

.sigil.is-hit .sigil-mark { display: none; }

.sigil.is-hit {
  animation: sigil-eaten 0.48s cubic-bezier(.18, .9, .24, 1) forwards;
}

.sigil.is-hit .sigil-glow {
  animation: sigil-burst 0.48s cubic-bezier(.18, .9, .24, 1) forwards;
}

.sigil.is-hit .sigil-ring {
  animation: sigil-ring-pop 0.5s cubic-bezier(.18, .9, .32, 1) forwards;
}

@keyframes sigil-eaten {
  0%   { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  16%  { transform: translate(-50%, -50%) scale(1.45) rotate(10deg); }
  48%  { transform: translate(-50%, -50%) scale(0.18) rotate(-18deg); opacity: 1; filter: brightness(1.8); }
  100% { transform: translate(-50%, -50%) scale(0) rotate(-28deg); opacity: 0; filter: brightness(0.8); }
}

@keyframes sigil-burst {
  0%   { box-shadow: 0 0 18px rgba(239, 228, 165, 0.6), 0 0 4px rgba(255, 255, 255, 0.85); transform: scale(1); opacity: 1; }
  30%  { box-shadow: 0 0 76px rgba(255, 244, 210, 1), 0 0 28px rgba(255, 255, 255, 1); transform: scale(2); opacity: 1; }
  100% { box-shadow: 0 0 6px rgba(239, 228, 165, 0); transform: scale(0.2); opacity: 0; }
}

@keyframes sigil-ring-pop {
  0%   { opacity: 0.95; transform: scale(0.5); border-width: 3px; }
  60%  { opacity: 0.4; transform: scale(2.6); border-width: 1px; }
  100% { opacity: 0; transform: scale(3.4); border-width: 0; }
}

.sigil.is-good .sigil-glow {
  background: radial-gradient(circle, rgba(214, 238, 232, 0.95) 0%, rgba(118, 185, 173, 0.55) 40%, transparent 74%);
}

.sigil.is-good .sigil-ring { border-color: rgba(214, 238, 232, 0.9); }

.sigil.is-miss {
  animation: sigil-miss 0.36s ease-out forwards;
}

.sigil.is-miss .sigil-glow {
  animation: none;
  background: radial-gradient(circle, rgba(186, 198, 194, 0.38), rgba(88, 101, 97, 0.18) 48%, transparent 74%);
  box-shadow: 0 0 10px rgba(176, 192, 186, 0.22);
}

@keyframes sigil-miss {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; filter: grayscale(0); }
  45% { transform: translate(-50%, -48%) scale(0.92); opacity: 0.48; filter: grayscale(0.7); }
  100% { transform: translate(-50%, -42%) scale(0.72); opacity: 0.18; filter: grayscale(1); }
}

/* Trailing bar for a held note: bright leading edge nearest the monk,
   fading toward the trailing end. Shrinks from the top as it's eaten. */
.sigil-bar {
  position: absolute;
  width: clamp(8px, 1.8vw, 16px);
  border-radius: 999px;
  transform: translateX(-50%);
  background: linear-gradient(180deg,
    rgba(255, 250, 230, 0) 0%,
    rgba(239, 228, 165, 0.55) 20%,
    rgba(255, 248, 224, 0.95) 100%);
  box-shadow: 0 0 16px rgba(239, 228, 165, 0.55), inset 0 0 6px rgba(255, 255, 255, 0.5);
  opacity: 0;
  overflow: visible;
}

.sigil-bar.is-consuming {
  background: linear-gradient(180deg,
    rgba(255, 250, 230, 0.02) 0%,
    rgba(239, 228, 165, 0.42) 46%,
    rgba(255, 248, 224, 1) 100%);
  box-shadow:
    0 0 22px rgba(239, 228, 165, 0.72),
    0 0 8px rgba(255, 255, 255, 0.72),
    inset 0 0 8px rgba(255, 255, 255, 0.65);
}

.sigil-bar.is-consuming::before,
.sigil-bar.is-consuming::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.sigil-bar.is-consuming::before {
  width: 42px;
  height: 42px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 8%, rgba(255, 248, 224, 0.72) 18%, rgba(239, 228, 165, 0.38) 44%, transparent 72%);
  animation: consume-flare 0.28s ease-in-out infinite alternate;
}

.sigil-bar.is-consuming::after {
  width: 13px;
  height: 13px;
  background: #fff6cf;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 1),
    0 0 24px rgba(255, 248, 224, 0.95),
    0 0 44px rgba(239, 228, 165, 0.74);
  animation: consume-core 0.16s ease-in-out infinite alternate;
}

.sigil-bar.is-miss {
  background: linear-gradient(180deg, rgba(176, 192, 186, 0), rgba(176, 192, 186, 0.22));
  box-shadow: none;
}

@keyframes consume-flare {
  0% { opacity: 0.48; transform: translateX(-50%) scale(0.7); filter: saturate(1); }
  100% { opacity: 1; transform: translateX(-50%) scale(1.18); filter: saturate(1.4); }
}

@keyframes consume-core {
  0% { transform: translateX(-50%) scale(0.65); }
  100% { transform: translateX(-50%) scale(1.34); }
}

.sigil-bar.is-hit {
  animation: sigil-bar-pop 0.34s ease-out forwards;
}

.sigil-bar.is-complete {
  animation: sigil-bar-complete 0.42s cubic-bezier(.16, .86, .22, 1) forwards;
}

@keyframes sigil-bar-pop {
  0%   { opacity: 1; transform: translateX(-50%) scaleX(1); }
  100% { opacity: 0; transform: translateX(-50%) scaleX(2.4); }
}

@keyframes sigil-bar-complete {
  0% { opacity: 1; transform: translateX(-50%) scaleX(1); filter: brightness(1); }
  38% { opacity: 1; transform: translateX(-50%) scale(2.2, 0.32); filter: brightness(2.2); }
  100% { opacity: 0; transform: translateX(-50%) scale(3.2, 0.05); filter: brightness(0.8); }
}

.liturgy-burst {
  position: absolute;
  z-index: 8;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.liturgy-burst i,
.hold-spark {
  position: absolute;
  width: var(--s, 3px);
  height: var(--s, 3px);
  border-radius: 50%;
  background: var(--spark, #fff6cf);
  box-shadow:
    0 0 8px rgba(255, 248, 224, 0.95),
    0 0 18px rgba(239, 228, 165, 0.65);
  pointer-events: none;
}

.liturgy-burst.is-good i {
  --spark: #c9fff4;
  box-shadow:
    0 0 8px rgba(201, 255, 244, 0.9),
    0 0 18px rgba(118, 185, 173, 0.62);
}

.liturgy-burst i {
  animation: burst-spark 0.68s cubic-bezier(.12, .72, .2, 1) forwards;
}

.hold-spark {
  z-index: 8;
  animation: hold-spark-rise 0.54s ease-out forwards;
}

.hold-counter {
  position: absolute;
  z-index: 9;
  transform: translate(14px, -50%);
  color: #fff4c8;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(0.68rem, 1.4vw, 0.92rem);
  font-weight: 950;
  letter-spacing: 0.02em;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.92),
    0 0 12px rgba(239, 228, 165, 0.7);
  pointer-events: none;
}

.hold-counter.is-ticking {
  animation: hold-counter-tick 0.18s ease-out;
}

.hold-counter.is-final {
  animation: hold-counter-final 0.62s cubic-bezier(.16, .84, .22, 1) forwards;
}

.hold-finish {
  position: absolute;
  z-index: 9;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.hold-finish::before,
.hold-finish::after,
.hold-finish span {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hold-finish::before {
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 248, 224, 0.8);
  box-shadow:
    0 0 18px rgba(255, 248, 224, 0.7),
    inset 0 0 16px rgba(239, 228, 165, 0.36);
  animation: hold-finish-ring 0.72s ease-out forwards;
}

.hold-finish::after {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(255, 255, 255, 1), rgba(239, 228, 165, 0.75) 42%, transparent 72%);
  animation: hold-finish-core 0.38s ease-out forwards;
}

.hold-finish span {
  width: 4px;
  height: 4px;
  background: #fff6cf;
  box-shadow: 0 0 10px rgba(255, 248, 224, 0.95);
  animation: hold-finish-spark 0.66s ease-out forwards;
}

.hold-finish span:nth-child(1) { --dx: -28px; --dy: -16px; }
.hold-finish span:nth-child(2) { --dx: 24px; --dy: -24px; }
.hold-finish span:nth-child(3) { --dx: 12px; --dy: 22px; }

@keyframes burst-spark {
  0% { transform: translate(-50%, -50%) scale(0.45); opacity: 1; }
  72% { opacity: 0.95; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.05); opacity: 0; }
}

@keyframes hold-spark-rise {
  0% { transform: translate(-50%, -50%) scale(0.35); opacity: 0.95; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); opacity: 0; }
}

@keyframes hold-counter-tick {
  0% { transform: translate(14px, -50%) scale(1); }
  50% { transform: translate(16px, -52%) scale(1.2); color: #fffbe4; }
  100% { transform: translate(14px, -50%) scale(1); }
}

@keyframes hold-counter-final {
  0% { opacity: 1; transform: translate(14px, -50%) scale(1); }
  36% { opacity: 1; transform: translate(20px, -86%) scale(1.32); color: #fffbe4; }
  100% { opacity: 0; transform: translate(26px, -160%) scale(0.9); }
}

@keyframes hold-finish-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); border-width: 4px; }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.55); border-width: 0; }
}

@keyframes hold-finish-core {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
}

@keyframes hold-finish-spark {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); }
}

/* Lights the targeted brother up the instant his sigil is eaten. */
.monk.liturgy-flash .halo {
  animation: liturgy-flash 0.42s ease-out;
}

.monk.liturgy-miss .halo {
  animation: liturgy-miss 0.28s ease-out;
}

@keyframes liturgy-flash {
  0% { filter: brightness(1); }
  35% { filter: brightness(2.4) saturate(1.4); }
  100% { filter: brightness(1); }
}

@keyframes liturgy-miss {
  0% { opacity: 0.4; filter: grayscale(0); }
  45% { opacity: 0.12; filter: grayscale(1); }
  100% { opacity: 0; filter: grayscale(1); }
}

.liturgy-judgment {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  animation: judgment-float 0.9s ease-out forwards;
}

.liturgy-judgment.is-perfect { color: var(--gold-soft); }
.liturgy-judgment.is-good { color: var(--teal); }
.liturgy-judgment.is-miss { color: rgba(231, 240, 233, 0.4); }
.liturgy-judgment.is-held { color: var(--gold-soft); }

.liturgy-points {
  position: absolute;
  z-index: 9;
  transform: translate(-50%, -100%);
  color: #fff4c8;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(0.78rem, 1.8vw, 1.05rem);
  font-weight: 950;
  letter-spacing: 0.02em;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(239, 228, 165, 0.62);
  pointer-events: none;
  animation: points-float 1.08s cubic-bezier(.16, .84, .24, 1) forwards;
}

.liturgy-points.is-good { color: #bff9ef; }
.liturgy-points.is-held { color: var(--gold-soft); }

.liturgy-countdown {
  position: absolute;
  z-index: 19;
  top: clamp(86px, 19svh, 154px);
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--gold-soft);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 950;
  line-height: 0.9;
  text-align: center;
  text-shadow:
    0 0 18px rgba(239, 228, 165, 0.7),
    0 5px 26px rgba(0, 0, 0, 0.95);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.liturgy-countdown span {
  color: rgba(190, 231, 218, 0.86);
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
}

.liturgy-countdown strong {
  color: #fff5c8;
  font-size: 5.2rem;
  line-height: 0.84;
}

.liturgy-countdown.is-tick strong {
  animation: countdown-pulse 0.82s cubic-bezier(.16, .84, .24, 1) both;
}

.liturgy-countdown.is-go strong {
  font-size: 3.8rem;
  animation: countdown-go 0.8s cubic-bezier(.16, .84, .24, 1) both;
}

@keyframes judgment-float {
  0% { opacity: 0; transform: translate(-50%, -90%) scale(0.8); }
  25% { opacity: 1; transform: translate(-50%, -130%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -230%) scale(1); }
}

@keyframes points-float {
  0% { opacity: 0; transform: translate(-50%, -55%) scale(0.72); }
  14% { opacity: 1; transform: translate(-50%, -95%) scale(1.16); }
  72% { opacity: 1; transform: translate(-50%, -155%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -210%) scale(0.92); }
}

@keyframes countdown-pulse {
  0% { opacity: 0; transform: scale(0.54); filter: blur(7px) brightness(1.3); }
  18% { opacity: 1; transform: scale(1.14); filter: blur(0) brightness(1.2); }
  70% { opacity: 1; transform: scale(1); filter: brightness(1); }
  100% { opacity: 0; transform: scale(0.88); filter: blur(2px) brightness(0.86); }
}

@keyframes countdown-go {
  0% { opacity: 0; transform: scale(0.72); filter: blur(5px) brightness(1.4); }
  22% { opacity: 1; transform: scale(1.08); filter: blur(0) brightness(1.28); }
  82% { opacity: 1; transform: scale(1); filter: brightness(1); }
  100% { opacity: 0; transform: scale(0.96); filter: blur(2px) brightness(0.9); }
}

.liturgy-result {
  position: absolute;
  z-index: 18;
  top: clamp(82px, 18svh, 150px);
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 5px;
  width: min(520px, 86vw);
  padding: clamp(14px, 2.4vw, 22px);
  border: 1px solid rgba(183, 207, 200, 0.2);
  border-radius: 10px;
  color: rgba(241, 247, 242, 0.96);
  background:
    linear-gradient(180deg, rgba(14, 23, 21, 0.9), rgba(3, 5, 5, 0.84)),
    radial-gradient(circle at 50% 0%, rgba(118, 185, 173, 0.2), transparent 62%);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.68),
    inset 0 1px 0 rgba(239, 228, 165, 0.08);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
  transform: translateX(-50%);
  animation: liturgy-result-in 520ms cubic-bezier(.16, .84, .24, 1) both;
}

.liturgy-result-kicker {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.liturgy-result strong {
  color: var(--gold-soft);
  font-size: clamp(1.45rem, 4.2vw, 3.1rem);
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 0.92;
  text-transform: uppercase;
}

.liturgy-result-score {
  color: #fff8cd;
  font-size: clamp(0.9rem, 2vw, 1.18rem);
  font-weight: 950;
}

.liturgy-result small,
.liturgy-result em {
  color: rgba(196, 215, 209, 0.88);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.liturgy-result em {
  color: rgba(239, 228, 165, 0.88);
}

.liturgy-result.is-perfect {
  border-color: rgba(239, 228, 165, 0.58);
  background:
    radial-gradient(circle at 50% 20%, rgba(239, 228, 165, 0.22), transparent 46%),
    linear-gradient(180deg, rgba(27, 25, 13, 0.92), rgba(4, 6, 5, 0.84));
  box-shadow:
    0 0 36px rgba(239, 228, 165, 0.28),
    0 30px 90px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 248, 210, 0.2);
}

.liturgy-result.is-perfect strong {
  font-size: clamp(2.4rem, 8vw, 6rem);
  letter-spacing: 0.06em;
  animation: perfect-title-pop 1.2s ease-in-out infinite;
}

.liturgy-result.is-perfect i {
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8d2, rgba(118, 185, 173, 0.1));
  box-shadow: 0 0 12px rgba(239, 228, 165, 0.85);
  transform-origin: 50% 100%;
  animation: perfect-sparkle 1.5s ease-out infinite;
  animation-delay: var(--d);
}

.liturgy-result.is-perfect i {
  transform: translateX(var(--x)) rotate(calc(var(--i) * 20deg));
}

.multiplier-celebration {
  position: absolute;
  z-index: 17;
  top: clamp(74px, 22svh, 180px);
  left: 50%;
  color: var(--gold-soft);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(2.6rem, 8vw, 6.2rem);
  font-weight: 950;
  line-height: 0.86;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 18px rgba(239, 228, 165, 0.7),
    0 0 42px rgba(118, 185, 173, 0.38),
    0 5px 28px rgba(0, 0, 0, 0.96);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: multiplier-celebrate 0.96s cubic-bezier(.16, .84, .24, 1) forwards;
}

@keyframes multiplier-celebrate {
  0% {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.62);
    filter: blur(7px) brightness(1.5);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.18);
    filter: blur(0) brightness(1.26);
  }
  62% {
    opacity: 1;
    transform: translate(-50%, -52%) scale(1);
    filter: brightness(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -68%) scale(0.92);
    filter: blur(3px) brightness(0.92);
  }
}

@keyframes liturgy-result-in {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(0.94); filter: blur(4px); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); filter: blur(0); }
}

@keyframes perfect-title-pop {
  0%, 100% { filter: brightness(1); text-shadow: 0 0 14px rgba(239, 228, 165, 0.28), 0 2px 14px rgba(0, 0, 0, 0.9); }
  50% { filter: brightness(1.18); text-shadow: 0 0 32px rgba(239, 228, 165, 0.62), 0 2px 14px rgba(0, 0, 0, 0.9); }
}

@keyframes perfect-sparkle {
  0% { opacity: 0; transform: translate(var(--x), 12px) rotate(calc(var(--i) * 20deg)) scaleY(0.3); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(var(--x) * 1.6), -96px) rotate(calc(var(--i) * 20deg + 90deg)) scaleY(0.08); }
}

/* ------------------------------ Liturgy HUD ------------------------------ */

.liturgy-hud {
  position: absolute;
  z-index: 7;
  top: clamp(10px, 2vw, 20px);
  right: clamp(10px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--gold-soft);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

body.liturgy-on .liturgy-hud {
  opacity: 1;
}

.liturgy-hud-score {
  font-size: clamp(0.9rem, 2.2vw, 1.3rem);
  font-weight: 900;
}

.liturgy-hud-multiplier {
  color: #fff7c9;
  font-size: clamp(0.78rem, 1.9vw, 1.04rem);
  font-weight: 950;
  letter-spacing: 0.04em;
}

.liturgy-hud-combo {
  min-height: 1.1em;
  color: var(--teal);
  font-size: clamp(0.66rem, 1.6vw, 0.9rem);
  font-weight: 800;
}

.liturgy-hud-misses {
  min-height: 1.05em;
  color: rgba(239, 228, 165, 0.72);
  font-size: clamp(0.6rem, 1.45vw, 0.78rem);
  font-weight: 800;
}

.liturgy-hud-perfect {
  min-height: 1.2em;
  padding: 2px 7px;
  border: 1px solid rgba(239, 228, 165, 0.46);
  border-radius: 999px;
  color: #fff6c7;
  background: rgba(11, 18, 17, 0.58);
  font-size: clamp(0.56rem, 1.25vw, 0.72rem);
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-3px) scale(0.96);
  box-shadow: 0 0 16px rgba(239, 228, 165, 0.18);
  transition: opacity 220ms ease, transform 220ms ease;
}

.liturgy-hud-perfect[hidden] {
  display: block;
}

body.perfect-mode .liturgy-hud-perfect {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: perfect-pulse 1.2s ease-in-out infinite;
}

@keyframes perfect-pulse {
  0%, 100% {
    box-shadow: 0 0 12px rgba(239, 228, 165, 0.22), inset 0 0 0 rgba(239, 228, 165, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 26px rgba(239, 228, 165, 0.54), inset 0 0 18px rgba(239, 228, 165, 0.12);
    filter: brightness(1.18);
  }
}

/* ---------------------------- Liturgy button ----------------------------- */

.row-liturgy {
  display: grid;
  width: min(1180px, 100%);
  min-width: 0;
  gap: 6px;
  margin: 0 auto;
}

.liturgy-picker,
.level-picker {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding: 0 2px;
  scrollbar-width: none;
}

.liturgy-picker::-webkit-scrollbar,
.level-picker::-webkit-scrollbar {
  display: none;
}

.liturgy-picker .chip,
.level-picker .chip {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.64rem;
}

.level-picker .chip {
  min-height: 26px;
  padding: 0 14px;
  border-color: rgba(118, 185, 173, 0.24);
}

.liturgy-start-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 0.9fr);
  gap: 7px;
  align-items: stretch;
  min-width: 0;
}

.liturgy-button {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
  min-height: 42px;
  padding: 6px 13px;
  border: 1px solid rgba(213, 194, 118, 0.4);
  border-radius: 8px;
  color: var(--gold-soft);
  background: linear-gradient(180deg, #1a1710 0%, #080a09 100%);
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.09), 0 8px 22px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: center;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.playback-controls {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 5px;
  min-width: 0;
}

.playback-button {
  min-width: 0;
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(118, 185, 173, 0.34);
  border-radius: 8px;
  color: rgba(231, 240, 233, 0.92);
  background: linear-gradient(180deg, #12201e 0%, #070b0b 100%);
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.09), 0 8px 22px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, background 140ms ease;
}

.stop-button {
  border-color: rgba(213, 194, 118, 0.28);
}

.liturgy-progress {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid rgba(183, 207, 200, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 20, 19, 0.88), rgba(5, 7, 7, 0.86));
  box-shadow: inset 0 1px 0 rgba(215, 238, 232, 0.06);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.liturgy-progress-time {
  color: rgba(231, 240, 233, 0.86);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
}

.liturgy-progress-track {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(183, 207, 200, 0.11);
  box-shadow: inset 0 0 0 1px rgba(183, 207, 200, 0.08);
}

.liturgy-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #efe4a5, #76b9ad);
  box-shadow: 0 0 14px rgba(118, 185, 173, 0.34);
  transition: width 120ms linear;
}

.liturgy-progress.is-live .liturgy-progress-time {
  color: var(--gold-soft);
}

.liturgy-button:hover,
.playback-button:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: rgba(239, 228, 165, 0.7);
}

.liturgy-button:active,
.playback-button:not(:disabled):active {
  transform: translateY(1px);
}

.liturgy-button-title {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liturgy-button-sub {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liturgy-button.is-on {
  border-color: rgba(239, 228, 165, 0.85);
  background: linear-gradient(180deg, #2b2716 0%, #0c0a05 100%);
  animation: liturgy-button-glow 2.4s ease-in-out infinite;
}

.playback-button.is-on {
  border-color: rgba(239, 228, 165, 0.82);
  color: #07100f;
  background: linear-gradient(180deg, #e8dfa7 0%, #78bbb0 100%);
  box-shadow: 0 0 22px rgba(118, 185, 173, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.playback-button:disabled {
  cursor: default;
  opacity: 0.46;
  transform: none;
}

.liturgy-button.is-on .liturgy-button-title::after {
  content: " — live";
  color: var(--teal);
  font-weight: 800;
}

body.liturgy-paused .liturgy-button.is-on .liturgy-button-title::after {
  content: " — paused";
}

@keyframes liturgy-button-glow {
  0%, 100% { box-shadow: 0 0 14px rgba(213, 194, 118, 0.3), inset 0 1px 0 rgba(255, 244, 200, 0.16); }
  50% { box-shadow: 0 0 28px rgba(213, 194, 118, 0.55), inset 0 1px 0 rgba(255, 244, 200, 0.16); }
}

/* ---------------------------- Compact Menus ----------------------------- */

.top-controls .settings-panel,
.top-controls .dropdown-panel {
  position: absolute;
  top: 40px;
  left: 0;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 20px));
  max-height: min(68svh, 520px);
  overflow-y: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(183, 207, 200, 0.16);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(10, 18, 17, 0.96), rgba(4, 7, 7, 0.94)),
    radial-gradient(circle at 20% 0%, rgba(118, 185, 173, 0.14), transparent 58%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(215, 238, 232, 0.08);
}

.top-controls .settings-panel[hidden],
.top-controls .dropdown-panel[hidden] {
  display: none;
}

.top-controls .settings-button {
  width: 36px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
}

.top-controls .row-label {
  min-width: 0;
}

.top-controls .status {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: rgba(164, 178, 172, 0.74);
  font-size: 0.64rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liturgy-start-row {
  width: min(760px, 100%);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
}

.liturgy-button {
  min-height: 58px;
  padding: 8px 14px;
}

.liturgy-button.is-on .liturgy-button-title::after,
body.liturgy-paused .liturgy-button.is-on .liturgy-button-title::after {
  content: "";
}

.liturgy-button.is-paused {
  animation: none;
  border-color: rgba(118, 185, 173, 0.72);
  background: linear-gradient(180deg, #162421 0%, #070b0b 100%);
}

.liturgy-button .liturgy-progress {
  width: 100%;
  min-height: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.liturgy-button .liturgy-progress-time {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.liturgy-button .liturgy-progress-track {
  height: 6px;
  background: rgba(183, 207, 200, 0.13);
}

.stop-button {
  width: 48px;
  min-height: 58px;
  border-color: rgba(213, 194, 118, 0.34);
}

/* ============================ Desktop polish ============================ */

@media (min-width: 980px) {
  .app-shell { grid-template-rows: minmax(0, 1fr) auto; }
  .stage { min-height: 0; }
  .choir { width: min(1080px, 97%); height: min(500px, 62svh); }
  .monk.front { height: clamp(150px, 17vw, 240px); }
  .monk.middle { height: clamp(128px, 14.6vw, 206px); }
  .monk.back { height: clamp(108px, 12.4vw, 174px); }
  .monk.center.front { height: clamp(164px, 18.4vw, 258px); }
  .monk.center.middle { height: clamp(138px, 15.8vw, 222px); }
  .monk.center.back { height: clamp(116px, 13.4vw, 188px); }
}

/* ============================== Mobile ================================== */

@media (max-width: 720px) {
  .app-shell {
    min-height: 100svh;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .stage {
    min-height: 0;
    padding: 12px 8px 0;
  }

  .brand h1 {
    max-width: min(320px, 92vw);
    margin-right: auto;
    margin-left: auto;
    font-size: clamp(1.6rem, 7.6vw, 2.2rem);
  }

  .brand p {
    font-size: 0.6rem;
    letter-spacing: 0.13em;
  }

  .top-controls {
    top: calc(env(safe-area-inset-top, 0px) + 7px);
    left: calc(env(safe-area-inset-left, 0px) + 7px);
    width: calc(100vw - 14px);
    gap: 4px;
  }

  .top-menu-row {
    gap: 5px;
  }

  .menu-button {
    width: 34px;
    min-height: 32px;
    padding: 0;
    font-size: 0.6rem;
  }

  .menu-button strong {
    font-size: 0.62rem;
  }

  .top-controls .settings-panel,
  .top-controls .dropdown-panel {
    width: calc(100vw - 14px);
    max-height: 56svh;
    padding: 8px;
  }

  .song-panel .liturgy-picker,
  .song-panel .level-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-controls .row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 6px;
  }

  .mode-line {
    gap: 5px;
  }

  .top-controls .status {
    max-width: min(240px, 66vw);
    font-size: 0.58rem;
  }

  .rose-window { top: -36px; width: clamp(180px, 56vw, 240px); }

  .hint {
    top: clamp(86px, 26vw, 130px);
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    line-height: 1.35;
    letter-spacing: 0.035em;
  }

  .choir {
    left: 50vw;
    bottom: clamp(10px, 2.2svh, 22px);
    width: 96vw;
    max-width: 96vw;
    height: min(350px, 52svh);
    grid-template-rows: minmax(0, 0.8fr) minmax(0, 1.05fr);
    align-content: end;
    padding: 0 1px;
  }

  .choir-row { column-gap: 0; }
  .row-back {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 86%;
  }
  .row-middle { display: none; }
  .row-front {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 70%;
  }

  .row-back .monk:first-child,
  .row-back .monk:nth-child(n+9),
  .row-front .monk:first-child,
  .row-front .monk:last-child {
    display: none;
  }

  .monk.front { height: clamp(128px, 35vw, 178px); }
  .monk.middle { --row-drop: 6px; height: clamp(76px, 21.2vw, 108px); }
  .monk.back { --row-drop: 5px; height: clamp(96px, 26vw, 136px); }
  .monk.center.front { height: clamp(138px, 37vw, 190px); }
  .monk.center.middle { height: clamp(82px, 23vw, 116px); }
  .monk.center.back { height: clamp(102px, 28vw, 146px); }

  .choir-row .monk:first-child,
  .choir-row .monk:last-child { --edge-drop: 9px; }

  .choir-row .monk:nth-child(2),
  .choir-row .monk:nth-last-child(2) { --edge-drop: 4px; }

  .row-front .monk:nth-child(2),
  .row-front .monk:nth-child(6),
  .row-back .monk:nth-child(2),
  .row-back .monk:nth-child(8) { --edge-drop: 8px; }

  .monk .robe { width: clamp(38px, 12vw, 56px); }
  .monk .hood { width: clamp(36px, 11.2vw, 52px); }
  .monk .face {
    width: clamp(20px, 6.2vw, 30px);
    height: clamp(25px, 7.7vw, 37px);
  }
  .monk .tag { bottom: 9px; }
  .monk .tag-key { display: none; }
  .monk .cord { bottom: 35%; width: clamp(24px, 7.6vw, 36px); }

  .candles .candle:nth-child(3) { display: none; }

  .console {
    gap: 7px;
    padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  }

  .row-liturgy {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    overflow: hidden;
  }

  .liturgy-picker,
  .level-picker,
  .liturgy-start-row {
    width: 100%;
    max-width: 100%;
  }

  .console-strip {
    gap: 8px;
  }

  .settings-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.68rem;
  }

  .top-controls .settings-button {
    width: 34px;
    padding: 0;
  }

  .settings-icon {
    width: 11px;
    height: 11px;
    border-width: 1.5px;
  }

  .settings-icon::before,
  .settings-icon::after {
    top: -4px;
    height: 17px;
  }

  .settings-panel {
    gap: 6px;
    padding: 7px;
    border-radius: 9px;
  }

  .row {
    gap: 8px;
  }

  .row-voices { align-items: center; }
  .row-label { min-width: 56px; }
  .row-label span { font-size: 0.58rem; }
  .row-label strong { font-size: 0.7rem; }

  .chip {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.68rem;
  }

  .row-touch {
    align-items: start;
  }

  .touch-control {
    min-width: 0;
    gap: 3px;
  }

  .touch-slider {
    height: 15px;
  }

  .touch-slider::-webkit-slider-thumb {
    width: 15px;
    height: 15px;
  }

  .touch-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
  }

  .touch-scale {
    font-size: 0.48rem;
  }

  .actions {
    display: grid;
    grid-template-columns: 1.3fr 0.8fr 1fr 1fr;
    gap: 7px;
  }

  .secondary-button,
  .vigil-button {
    min-height: 40px;
    padding: 0 6px;
    justify-content: center;
    font-size: 0.68rem;
  }

  .status {
    min-height: 1rem;
    overflow: hidden;
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .liturgy-hud {
    top: clamp(50px, 15vw, 76px);
  }

  .liturgy-hud-score { font-size: 0.84rem; }
  .liturgy-hud-multiplier { font-size: 0.72rem; }
  .liturgy-hud-combo { font-size: 0.62rem; }
  .liturgy-hud-misses { font-size: 0.58rem; }
  .liturgy-hud-perfect {
    padding: 2px 6px;
    font-size: 0.5rem;
    letter-spacing: 0.07em;
  }

  .liturgy-result {
    top: clamp(64px, 16svh, 108px);
    width: min(330px, 88vw);
    padding: 12px 10px;
    border-radius: 9px;
  }

  .liturgy-result-kicker {
    font-size: 0.56rem;
  }

  .liturgy-result strong {
    font-size: 1.32rem;
  }

  .liturgy-result.is-perfect strong {
    font-size: clamp(2.1rem, 15vw, 3.8rem);
  }

  .multiplier-celebration {
    top: clamp(66px, 18svh, 112px);
    font-size: clamp(2.25rem, 16vw, 4.25rem);
  }

  .liturgy-countdown {
    top: clamp(58px, 15svh, 96px);
  }

  .liturgy-countdown span {
    font-size: 0.58rem;
  }

  .liturgy-countdown strong {
    font-size: 3.7rem;
  }

  .liturgy-countdown.is-go strong {
    font-size: 2.6rem;
  }

  .liturgy-result small,
  .liturgy-result em {
    font-size: 0.62rem;
  }

  .liturgy-button {
    min-height: 40px;
    padding: 6px 10px;
  }

  .liturgy-start-row {
    width: min(100%, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    margin: 0 auto;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 5px;
  }

  .liturgy-button {
    grid-column: auto;
  }

  .playback-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .playback-button {
    min-width: 0;
    min-height: 52px;
    font-size: 0.72rem;
  }

  .stop-button {
    width: 38px;
    min-height: 50px;
  }

  .liturgy-button .liturgy-progress {
    min-height: 10px;
    padding: 0;
  }

  .liturgy-progress-track { height: 5px; }

  .liturgy-button-title { font-size: 0.74rem; }
  .liturgy-button-sub { font-size: 0.56rem; }

  .sigil { width: clamp(20px, 6vw, 32px); height: clamp(20px, 6vw, 32px); }
  .sigil-beam { width: clamp(22px, 7vw, 40px); }
  .sigil-bar { width: clamp(6px, 2.4vw, 12px); }
}

@media (max-width: 380px) {
  .actions { grid-template-columns: 1fr 1fr; }
}

/* ------------------------- Reduced motion ------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .motes { display: none; }
}
