/* Design tokens */
:root {
  --plum: #351c3b;
  --deep: #241329;
  --gold: #d6b35f;
  --gold-light: #ecd49a;
  --green: #286344;
  --cream: #f7e8d8;
  --muted: #c5b49d;
}

/* Base */
* {
  box-sizing: border-box;
}

html,body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--deep);
  color: var(--cream);
}

body {
  font-family: "Playfair Display",Georgia,serif;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 38%,#49264b 0%,var(--plum) 48%,var(--deep) 100%);
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

/* Header */
header {
  position: fixed;
  z-index: 2;
  top: clamp(18px,4vh,42px);
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw,760px);
  text-align: center;
  pointer-events: none;
}

.brand-mark {
  width: clamp(34px,5vw,52px);
  height: auto;
  margin-bottom: 5px;
  filter: drop-shadow(0 0 12px #d6b35f55);
}

h1 {
  font-family: Cinzel,Georgia,serif;
  font-weight: 600;
  font-size: clamp(1.25rem,4vw,2.25rem);
  letter-spacing: clamp(2px,.55vw,6px);
  line-height: 1.2;
  color: var(--gold);
  margin: 0;
  text-shadow: 0 3px 18px #d6b35f33;
}

header p {
  font-size: clamp(.76rem,1.7vw,.98rem);
  font-style: italic;
  color: var(--gold-light);
  margin: .55rem 0 0;
  opacity: .9;
}

.ornament {
  color: var(--gold);
  letter-spacing: 9px;
  margin-top: 9px;
  font-size: .9rem;
  opacity: .8;
}

/* Hint text */
.hint {
  position: fixed;
  z-index: 2;
  bottom: clamp(82px,12vh,112px);
  left: 0;
  right: 0;
  text-align: center;
  color: var(--muted);
  font: .68rem Cinzel,serif;
  letter-spacing: 2px;
  pointer-events: none;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: .45;
  }
}

/* Control bar */
.controls {
  position: fixed;
  z-index: 3;
  bottom: clamp(17px,3vh,28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: #241329d9;
  border: 1px solid #d6b35f77;
  border-radius: 40px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px #0005;
  max-width: calc(100vw - 24px);
}

button {
  font: 600 .7rem Cinzel,Georgia,serif;
  letter-spacing: .5px;
  color: var(--gold-light);
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 25px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s,color .2s,transform .2s;
}

button:hover:not(:disabled),button:focus-visible {
  background: var(--gold);
  color: var(--deep);
  outline: none;
}

button:active {
  transform: scale(.97);
}

/* Verse modal */
#modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: clamp(14px,4vw,28px);
  background: #190c1dd9;
  backdrop-filter: blur(13px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s,visibility .25s;
}

#modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: min(100%,620px);
  max-height: 86vh;
  overflow: auto;
  text-align: center;
  padding: clamp(26px,6vw,48px) clamp(20px,5vw,42px);
  border: 1.5px solid var(--gold);
  border-radius: 18px;
  background: linear-gradient(145deg,#452649,#28162f);
  box-shadow: 0 25px 70px #0009;
  transform: translateY(16px);
  transition: transform .3s;
}

#modal.active .modal-card {
  transform: translateY(0);
}

.modal-ornament {
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 18px;
}

.modal-quote {
  font-size: clamp(1.2rem,4vw,1.8rem);
  font-style: italic;
  line-height: 1.55;
  margin: 0 0 26px;
}

.modal-meta {
  border-top: 1px solid #d6b35f55;
  padding-top: 18px;
  font-family: Cinzel,Georgia,serif;
  color: var(--gold);
}

.modal-character {
  display: block;
  color: var(--gold-light);
  font-weight: 700;
  margin-bottom: 7px;
}

.modal-play {
  font-size: .78rem;
  color: var(--muted);
}

.close-hint {
  margin-top: 24px;
  color: var(--muted);
  font: .65rem Cinzel,serif;
  letter-spacing: 1.4px;
}

/* Responsive and accessibility */
@media (max-width:600px) {
  header {
    top: 16px;
  }
  .ornament {
    margin-top: 5px;
  }
  .controls {
    gap: 7px;
    padding: 8px 10px;
  }
  .controls button {
    padding: 8px 11px;
    font-size: .62rem;
  }
  .hint {
    bottom: 76px;
  }
  .modal-card {
    border-radius: 14px;
  }
}

@media (max-height:560px) {
  header {
    top: 8px;
  }
  .brand-mark {
    width: 27px;
  }
  header p {
    margin-top: 3px;
  }
  .ornament {
    display: none;
  }
  .hint {
    bottom: 65px;
  }
  .controls {
    bottom: 8px;
  }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation: none!important;
    transition: none!important;
  }
}

/* Verse modal: allow copying the quote, and show focus gently */
.modal-card {
  user-select: text;
}
.modal-card:focus {
  outline: none;
}

/* Control bar: Pause, Size - +, Speed - + */
.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 12px;
  border-left: 1px solid #d6b35f44;
}
.control-label {
  color: var(--muted);
  font: 600 .62rem Cinzel, Georgia, serif;
  letter-spacing: 1px;
}
.label-short {
  display: none;
}
.controls .step-btn {
  min-width: 34px;
  padding: 9px 0;
  font-size: .9rem;
  line-height: 1;
}
button:disabled {
  opacity: .35;
  cursor: default;
}

@media (max-width: 600px) {
  .control-group {
    gap: 5px;
    padding-left: 7px;
  }
  .label-full {
    display: none;
  }
  .label-short {
    display: inline;
  }
  .controls .step-btn {
    min-width: 30px;
    padding: 8px 0;
  }
}
