:root {
  --mahogany-deep: #16100c;
  --leather-umbrage: #241912;
  --leather-edge: #3a291d;
  --brass-tack: #c89b54;
  --brass-bright: #dfb46f;
  --parchment-warm: #efe5d4;
  --parchment-muted: #b9aa95;
  --erva-frost: #6ba353;
  --erva-surface: rgba(107, 163, 83, 0.14);
  --dust-rust: #c45c43;
  --dust-surface: rgba(196, 92, 67, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--mahogany-deep);
  color: var(--parchment-warm);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 22% 18%, rgba(200, 155, 84, 0.09), transparent 52%),
    radial-gradient(circle at 82% 80%, rgba(74, 48, 30, 0.35), transparent 58%);
}

.page-shell {
  min-height: 100dvh;
  max-width: 1020px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.stage {
  margin: auto 0;
  display: grid;
  grid-template-columns: minmax(270px, 400px) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}

.portrait-frame {
  position: relative;
  margin: 0;
  padding: 0.85rem 0.85rem 0.95rem;
  background: var(--leather-umbrage);
  border: 1px solid var(--leather-edge);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(200, 155, 84, 0.22);
  transition: border-color 260ms ease, box-shadow 260ms ease;
}

.page-shell[data-state="sim"] .portrait-frame {
  border-color: var(--erva-frost);
  box-shadow:
    0 24px 52px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(107, 163, 83, 0.35);
}

.page-shell[data-state="nao"] .portrait-frame {
  border-color: var(--dust-rust);
  box-shadow:
    0 24px 52px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(196, 92, 67, 0.35);
}

.tack {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brass-bright), #7c5925);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.tack-tl { top: 8px; left: 8px; }
.tack-tr { top: 8px; right: 8px; }
.tack-bl { bottom: 8px; left: 8px; }
.tack-br { bottom: 8px; right: 8px; }

.portrait-viewport {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #100b08;
}

.portrait-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), filter 320ms ease;
}

.page-shell[data-state="drawing"] .portrait-img {
  filter: blur(5px) brightness(0.55);
  transform: scale(1.03);
}

.page-shell[data-state="nao"] .portrait-img {
  filter: saturate(0.78) contrast(1.04);
}

.shuffle-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: rgba(22, 16, 12, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.page-shell[data-state="drawing"] .shuffle-veil {
  opacity: 1;
}

.shuffle-word {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 1.45rem;
  color: var(--brass-bright);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.portrait-caption {
  margin-top: 0.75rem;
  font-size: 0.94rem;
  line-height: 1.4;
  color: var(--parchment-muted);
  text-align: center;
}

.editorial {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.question-title {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  font-size: clamp(2.05rem, 4vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--parchment-warm);
  max-width: 16ch;
}

.verdict-box {
  max-width: 50ch;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.verdict-stamp {
  margin: 0;
  align-self: flex-start;
  padding: 0.35rem 0.85rem;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.2;
  border-left: 3px solid var(--brass-tack);
}

.page-shell[data-state="sim"] .verdict-stamp {
  color: #b7e2a4;
  background: var(--erva-surface);
  border-left-color: var(--erva-frost);
}

.page-shell[data-state="nao"] .verdict-stamp {
  color: #f2a999;
  background: var(--dust-surface);
  border-left-color: var(--dust-rust);
}

.verdict-copy {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.55;
  color: var(--parchment-muted);
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
}

.draw-button {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--brass-bright);
  background: linear-gradient(180deg, var(--brass-bright) 0%, var(--brass-tack) 100%);
  color: #19110b;
  font-family: "Source Sans 3", sans-serif;
  font-weight: 700;
  font-size: 1.12rem;
  padding: 0.9rem 1.75rem;
  border-radius: 4px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  transition: transform 120ms ease, filter 150ms ease;
}

.draw-button:hover:not(:disabled) {
  filter: brightness(1.06);
}

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

.draw-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.tally {
  margin: 0;
  font-size: 0.95rem;
  color: var(--parchment-muted);
}

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.jukebox {
  position: relative;
  border-top: 1px solid var(--leather-edge);
  padding-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.jukebox-now {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 280px;
}

.vinyl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--parchment-muted);
  opacity: 0.5;
}

.vinyl-dot.is-playing {
  background: var(--erva-frost);
  opacity: 1;
  box-shadow: 0 0 10px rgba(107, 163, 83, 0.75);
}

.jukebox-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  min-width: 0;
}

.jukebox-title {
  font-size: 0.95rem;
  color: var(--parchment-muted);
}

.track-select {
  max-width: 100%;
  background: var(--leather-umbrage);
  color: var(--parchment-warm);
  border: 1px solid var(--leather-edge);
  border-radius: 4px;
  padding: 0.38rem 0.65rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.jukebox-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.jukebox-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  background: var(--leather-umbrage);
  color: var(--parchment-warm);
  border: 1px solid var(--leather-edge);
  border-radius: 4px;
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.jukebox-btn:hover {
  border-color: var(--brass-tack);
}

.jukebox-btn-subtle {
  color: var(--parchment-muted);
}

.colophon {
  border-top: 1px solid rgba(58, 41, 29, 0.65);
  padding-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.5rem;
  font-size: 0.9rem;
  color: var(--parchment-muted);
}

.rop-socials {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.rop-socials-label {
  color: var(--parchment-muted);
}

.rop-socials a,
.author-credit a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--parchment-warm);
  text-decoration: none;
  transition: color 150ms ease;
}

.rop-socials a:hover,
.author-credit a:hover {
  color: var(--brass-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.author-credit {
  margin: 0;
}

/* Keep the iframe rendered with non-zero dimensions so mobile browsers do not throttle audio playback. */
.player-drawer {
  position: fixed;
  right: 1rem;
  bottom: 6.75rem;
  width: 280px;
  height: 158px;
  border: 1px solid var(--leather-edge);
  background: #000;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.player-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.player-drawer iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 780px) {
  .page-shell {
    padding: 1.25rem 1.1rem 1.25rem;
    gap: 1.5rem;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 440px;
    margin: 0 auto;
  }

  .portrait-frame {
    max-width: 340px;
    width: 100%;
    margin: 0 auto;
  }

  .draw-button {
    width: 100%;
    text-align: center;
  }

  .player-drawer {
    right: 1rem;
    left: 1rem;
    width: auto;
    height: 190px;
  }
}

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