:root {
  --void: #12100d;
  --carbon: #201c17;
  --paper: #f2ead8;
  --paper-deep: #c8b176;
  --ink: #17120d;
  --ink-soft: #5f4d36;
  --red: #d63821;
  --red-dark: #8d2217;
  --gold: #f0b83c;
  --teal: #009782;
  --steel: #d7dad1;
  --line: rgba(23, 18, 13, 0.22);
  --shadow: 0 32px 90px rgba(0, 0, 0, 0.34);
  --display: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --body: "Alegreya Sans", "Gill Sans", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--void);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  font-family: var(--body);
  background:
    linear-gradient(115deg, rgba(214, 56, 33, 0.22), transparent 31%),
    radial-gradient(circle at 14% 12%, rgba(240, 184, 60, 0.16), transparent 20rem),
    radial-gradient(circle at 86% 18%, rgba(0, 151, 130, 0.18), transparent 26rem),
    linear-gradient(90deg, transparent 0 49%, rgba(242, 234, 216, 0.08) 49% 51%, transparent 51%),
    var(--void);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.26;
  background-image:
    linear-gradient(90deg, rgba(242, 234, 216, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(242, 234, 216, 0.05) 1px, transparent 1px);
  background-size: 19px 19px;
  mix-blend-mode: screen;
}

.cursor-glow {
  position: fixed;
  width: 18rem;
  height: 18rem;
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(200, 47, 29, 0.12), transparent 65%);
  transform: translate3d(-50%, -50%, 0);
  transition: opacity 180ms ease;
}

.broadcast {
  position: relative;
  z-index: 2;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 46px;
}

.masthead,
.library-head,
.panel-title,
.primary-actions,
.library-tools,
.toggle-grid,
.slider-row {
  display: flex;
  align-items: center;
}

.masthead {
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 22px;
  border-bottom: 2px solid rgba(242, 234, 216, 0.78);
  animation: revealDown 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 850;
  letter-spacing: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(3.2rem, 9vw, 8.6rem);
  line-height: 0.82;
}

.signal {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border: 2px solid var(--paper);
  background: rgba(18, 16, 13, 0.72);
  box-shadow: 7px 7px 0 var(--red);
  font-weight: 800;
  text-transform: uppercase;
}

.signal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(200, 47, 29, 0.52);
  animation: pulse 1.9s ease-out infinite;
}

.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  min-height: 620px;
  padding: 24px 0;
}

.verse-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 620px;
  padding: clamp(22px, 4vw, 54px);
  overflow: hidden;
  border: 2px solid var(--ink);
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(214, 56, 33, 0.12) 46% 54%, transparent 54%),
    radial-gradient(circle at 78% 18%, rgba(240, 184, 60, 0.35), transparent 18rem),
    linear-gradient(90deg, rgba(32, 28, 23, 0.08) 0 1px, transparent 1px) 0 0 / 34px 100%,
    rgba(255, 249, 236, 0.72);
  box-shadow: var(--shadow);
  color: var(--ink);
  animation: revealUp 700ms 110ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.verse-stage::before,
.verse-stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.verse-stage::before {
  inset: 22px;
  border: 1px solid rgba(23, 18, 13, 0.34);
}

.verse-stage::after {
  right: -8rem;
  bottom: -9rem;
  width: 25rem;
  height: 25rem;
  border: 2px solid rgba(23, 18, 13, 0.2);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 22px rgba(14, 108, 101, 0.08),
    inset 0 0 0 62px rgba(200, 47, 29, 0.06);
}

.dial {
  position: relative;
  z-index: 1;
  display: grid;
  width: 108px;
  height: 108px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
  color: var(--paper);
  box-shadow: 9px 9px 0 var(--ink);
  animation: slowTurn 18s linear infinite;
}

.dial span {
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 900;
}

.dial small {
  position: absolute;
  right: 15px;
  bottom: 14px;
  font-weight: 800;
}

.verse-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 970px;
}

.verse-text {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.5rem, 5.8vw, 7.1rem);
  font-weight: 760;
  line-height: 0.95;
  text-wrap: balance;
  transition:
    opacity 260ms ease,
    transform 260ms ease,
    filter 260ms ease;
}

.verse-ref {
  width: max-content;
  max-width: 100%;
  margin: 24px 0 0;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: var(--gold);
  font-size: clamp(1rem, 1.4vw, 1.35rem);
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 6px 6px 0 var(--ink);
}

.verse-stage.switching .verse-text {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(18px) skewY(-1deg);
}

.primary-actions {
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  gap: 12px;
}

.command,
.quiet,
.segmented button {
  min-height: 44px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.command {
  padding: 11px 16px;
  box-shadow: 5px 5px 0 var(--ink);
}

.command:hover,
.quiet:hover,
.segmented button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.command:active,
.quiet:active,
.segmented button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.command.strong {
  background: var(--red);
  color: var(--paper);
}

.command.dark {
  background: var(--ink);
  color: var(--paper);
}

.command.full {
  width: 100%;
}

.icon-command {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.icon-command[aria-pressed="true"] {
  background: var(--teal);
  color: #fffaf0;
}

.control-stack {
  display: grid;
  align-content: start;
  gap: 18px;
}

.control-stack .panel {
  animation: revealUp 660ms 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.control-stack .panel:nth-child(2) {
  animation-delay: 260ms;
}

.panel {
  border: 2px solid var(--ink);
  background: rgba(255, 249, 236, 0.86);
  box-shadow: 9px 9px 0 rgba(23, 18, 13, 0.95);
}

.playback-panel {
  padding: 18px;
}

.reflection-panel {
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(14, 108, 101, 0.09) 0 50%, transparent 50%),
    rgba(255, 249, 236, 0.86);
  background-size: 18px 18px;
}

.panel-title {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-title h2,
.library-head h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 0.92;
}

.panel-title span {
  color: var(--teal);
  font-weight: 800;
  text-transform: uppercase;
}

.quiet {
  min-height: 36px;
  padding: 7px 10px;
  box-shadow: 4px 4px 0 var(--ink);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span {
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fffaf0;
  color: var(--ink);
  outline: none;
}

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

input,
select {
  min-height: 44px;
  padding: 8px 10px;
}

textarea {
  min-height: 126px;
  padding: 10px;
  resize: vertical;
}

input[type="range"] {
  min-height: 28px;
  padding: 0;
  accent-color: var(--red);
  background: transparent;
}

output {
  color: var(--red-dark);
  font-weight: 800;
}

.slider-row {
  gap: 12px;
}

.compact {
  flex: 1;
}

.toggle-grid {
  align-items: stretch;
  gap: 12px;
  margin-top: 16px;
}

.toggle {
  display: flex;
  flex: 1;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px;
  border: 2px solid var(--ink);
  background: rgba(220, 202, 165, 0.42);
  font-weight: 800;
}

.toggle input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--teal);
}

.library-band {
  padding: clamp(20px, 4vw, 40px);
  border: 2px solid var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 18, 13, 0.09) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(180deg, rgba(255, 249, 236, 0.94), rgba(215, 218, 209, 0.9));
  box-shadow: var(--shadow);
  color: var(--ink);
  animation: revealUp 740ms 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.library-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.library-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.segmented {
  display: inline-flex;
  border: 2px solid var(--ink);
  background: var(--ink);
}

.segmented button {
  min-width: 76px;
  border: 0;
  border-right: 2px solid var(--ink);
  box-shadow: none;
  padding: 9px 12px;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--red);
  color: var(--paper);
}

.verse-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.verse-card {
  display: grid;
  gap: 14px;
  min-height: 210px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: #fffaf0;
  box-shadow: 6px 6px 0 rgba(23, 18, 13, 0.9);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.verse-card:hover {
  transform: rotate(-0.6deg) translate(-2px, -2px);
  box-shadow: 10px 10px 0 rgba(23, 18, 13, 0.94);
}

.verse-card.active {
  background: rgba(212, 154, 43, 0.28);
}

.verse-card p {
  margin: 0;
  font-family: var(--display);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.05;
}

.verse-card footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.verse-card small {
  color: var(--red-dark);
  font-weight: 900;
  text-transform: uppercase;
}

.mini-actions {
  display: flex;
  gap: 8px;
}

.mini-actions button {
  min-width: 36px;
  min-height: 34px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-weight: 900;
  box-shadow: 3px 3px 0 var(--ink);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 2px dashed var(--ink);
  background: rgba(255, 249, 236, 0.72);
  font-family: var(--display);
  font-size: 1.5rem;
}

dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(23, 18, 13, 0.54);
  backdrop-filter: blur(3px);
}

.dialog-card {
  padding: 20px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 11px 11px 0 var(--ink);
}

@keyframes pulse {
  100% {
    box-shadow: 0 0 0 18px rgba(200, 47, 29, 0);
  }
}

@keyframes slowTurn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

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

  .control-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .verse-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .broadcast {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

  .masthead,
  .library-head {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

  .stage-grid,
  .verse-stage {
    min-height: auto;
  }

  .verse-stage {
    padding: 20px;
  }

  .verse-stage::before {
    inset: 12px;
  }

  .dial {
    width: 82px;
    height: 82px;
  }

  .dial span {
    font-size: 2rem;
  }

  .verse-copy {
    min-height: 350px;
    padding: 34px 0;
  }

  .verse-text {
    font-size: clamp(2.25rem, 13vw, 4rem);
  }

  .control-stack,
  .verse-list {
    grid-template-columns: 1fr;
  }

  .slider-row,
  .toggle-grid {
    flex-direction: column;
  }

  .primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .command {
    width: 100%;
  }
}
