/* Shared Guess-the-Sound stage player */

.lh-sound {
  --lh-bg: #000;
  --lh-ink: #f4e9d2;
  --lh-muted: #c4b49a;
  --lh-accent: #ff8c00;
  --lh-glow: #ff6600;
  --lh-fill: #1a0e04;
  --lh-accent-rgb: 255, 140, 0;
  --lh-glow-rgb: 255, 102, 0;
  --lh-accent-hover: var(--lh-accent-hover);
  --lh-on-accent: #111;
  --lh-btn-bg: #0b0b0b;
  --lh-card-bg: #111;
  --lh-reveal-anim: lh-sound-flicker 360ms linear;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  color: var(--lh-ink);
  font-family: "Open Sans", sans-serif;
}

:where(.lh-sound *, .lh-sound *::before, .lh-sound *::after) {
  box-sizing: border-box;
}

:where(.lh-sound button) {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}

:where(.lh-sound button:hover),
:where(.lh-sound button:disabled) {
  background: transparent;
  color: inherit;
  box-shadow: none;
  transform: none;
}

:where(.lh-sound button:focus) {
  outline: none;
}

:where(.lh-sound button:focus-visible) {
  box-shadow: 0 0 0 3px rgba(var(--lh-accent-rgb), 0.55);
}

:where(.lh-sound img) {
  max-width: 100%;
}

body.lh-sound-on {
  background: var(--lh-bg, #000);
}

body.lh-sound-on .grid {
  min-height: 0;
}

body.lh-sound-on .mainCenter {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0 16px;
  border: 0;
  overflow: visible;
  background: transparent;
}

.lh-sound-stage,
.lh-sound-end,
.lh-sound-full,
.lh-sound-keys {
  display: none;
}

.lh-sound.is-on .lh-sound-stage {
  display: flex;
}

.lh-sound.is-on .lh-sound-full:not([hidden]) {
  display: inline-flex;
}

.lh-sound.is-on .lh-sound-keys {
  display: block;
}

.lh-sound.is-on.is-end .lh-sound-stage,
.lh-sound.is-on.is-end .lh-sound-full,
.lh-sound.is-on.is-end .lh-sound-keys {
  display: none;
}

.lh-sound.is-on.is-end .lh-sound-end {
  display: block;
}

.lh-sound.is-on .lh-sound-source {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.lh-sound-head {
  flex: 0 0 auto;
  width: 100%;
  padding: 8px 0 0;
  text-align: center;
  background: none;
}

.lh-sound-head h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--lh-accent);
  font-size: 3em;
  line-height: 1.1;
}

.lh-sound-head h1 img {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.lh-sound-intro {
  margin: 8px 0 12px;
  color: var(--lh-ink);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lh-sound-stage {
  position: relative;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 18px;
  background: var(--lh-fill);
  box-shadow: 0 0 0 1px rgba(var(--lh-accent-rgb), 0.28), 0 0 28px rgba(var(--lh-glow-rgb), 0.12);
}

.lh-sound-exitfull {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: var(--lh-accent);
  font-size: 0.9rem;
  box-shadow: 0 0 0 1.5px var(--lh-accent);
}

.lh-sound-count {
  margin: 0;
  color: var(--lh-accent);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lh-sound-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
}

.lh-sound-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 1.5px rgba(var(--lh-accent-rgb), 0.45);
}

.lh-sound-dot.is-done {
  background: rgba(var(--lh-accent-rgb), 0.55);
  box-shadow: none;
}

.lh-sound-dot.is-current {
  background: var(--lh-accent);
  box-shadow: 0 0 0 3px rgba(var(--lh-glow-rgb), 0.35);
}

.lh-sound-hero-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  grid-template-areas:
    "prev hero next"
    ". phrase ."
    ". reveal .";
  align-items: center;
  justify-items: center;
  column-gap: 8px;
  row-gap: 12px;
  width: 100%;
}

.lh-sound-skip-prev { grid-area: prev; }
.lh-sound-hero { grid-area: hero; }
.lh-sound-skip-next { grid-area: next; }
.lh-sound-reveal-btn { grid-area: reveal; }
.lh-sound-phrase { grid-area: phrase; }

.lh-sound-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
}

.lh-sound-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 56px;
  height: 56px;
  margin: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lh-accent);
  box-shadow: 0 0 0 2px var(--lh-accent);
}

.lh-sound-skip svg {
  display: block;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lh-sound-skip:hover {
  background: rgba(var(--lh-accent-rgb), 0.12);
  color: var(--lh-accent);
}

.lh-sound-skip:disabled,
.lh-sound-skip[aria-disabled="true"] {
  opacity: 0.25;
  color: var(--lh-accent);
  background: transparent;
  box-shadow: 0 0 0 2px var(--lh-accent);
  cursor: default;
  pointer-events: none;
}

.lh-sound-stage.is-revealed .lh-sound-skip-next:not(:disabled) {
  animation: lh-skip-glow 1.4s ease-in-out infinite;
}

.lh-sound-imgwrap {
  display: none;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: transparent;
}

.lh-sound-stage.is-revealed .lh-sound-imgwrap {
  display: block;
}

.lh-sound-imgwrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lh-sound-imgwrap.is-flicker img {
  animation: var(--lh-reveal-anim);
}

.lh-sound-play,
.lh-sound-reveal-btn,
.lh-sound-full,
.lh-sound-again,
.lh-sound-exitfull,
.lh-sound-replay {
  margin: 0;
}

.lh-sound-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--lh-btn-bg);
  color: var(--lh-accent);
  box-shadow: 0 0 0 3px var(--lh-accent), 0 0 22px rgba(var(--lh-glow-rgb), 0.55);
}

.lh-sound-play svg {
  display: block;
  width: 48px;
  height: 48px;
  fill: currentColor;
}

.lh-sound-play .lh-sound-icon-play {
  margin-left: 6px;
}

.lh-sound-play .lh-sound-icon-pause {
  display: none;
  width: 36px;
  height: 36px;
  margin: 0;
}

.lh-sound-play.is-playing .lh-sound-icon-play {
  display: none;
}

.lh-sound-play.is-playing .lh-sound-icon-pause {
  display: block;
}

.lh-sound-play:hover {
  color: var(--lh-accent);
  box-shadow: 0 0 0 3px var(--lh-accent), 0 0 32px rgba(var(--lh-glow-rgb), 0.8);
}

.lh-sound-play.is-playing {
  animation: lh-sound-pulse 1.15s ease-in-out infinite;
}

.lh-sound-stage.is-revealed .lh-sound-play {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  width: 48px;
  height: 48px;
}

.lh-sound-stage.is-revealed .lh-sound-play svg {
  width: 24px;
  height: 24px;
}

.lh-sound-stage.is-revealed .lh-sound-play .lh-sound-icon-play {
  margin-left: 3px;
}

.lh-sound-stage.is-revealed .lh-sound-play .lh-sound-icon-pause {
  width: 20px;
  height: 20px;
  height: 16px;
}

.lh-sound-phrase {
  display: none;
  margin: 0;
  color: var(--lh-ink);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.lh-sound-stage.is-revealed .lh-sound-phrase {
  display: block;
}

.lh-sound-reveal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  min-height: 48px;
  min-width: 160px;
  padding: 0 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--lh-accent);
  font-size: 1rem;
  box-shadow: 0 0 0 2px var(--lh-accent);
}

.lh-sound-reveal-btn:hover {
  background: rgba(var(--lh-accent-rgb), 0.12);
  color: var(--lh-accent);
}

.lh-sound-stage.is-revealed .lh-sound-reveal-btn {
  display: none;
}

.lh-sound-again {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--lh-accent);
  color: var(--lh-on-accent);
  font-size: 1rem;
}

.lh-sound-again:hover {
  background: var(--lh-accent-hover);
  color: var(--lh-on-accent);
}

.lh-sound-full {
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 8px;
  height: 48px;
  min-height: 48px;
  margin: 16px auto 0;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--lh-accent);
  color: var(--lh-on-accent);
  font-size: 1.05rem;
  font-weight: 800;
}

.lh-sound-full:hover {
  background: var(--lh-accent-hover);
  color: var(--lh-on-accent);
}

.lh-sound-full svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lh-sound-keys {
  margin: 10px 0 16px;
  color: var(--lh-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

.lh-sound-end {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 0 36px;
}

.lh-sound-end h2 {
  margin: 8px 0 6px;
  color: var(--lh-accent);
  font-size: 1.6rem;
  text-align: center;
}

.lh-sound-pattern {
  margin: 0 0 16px;
  color: var(--lh-muted);
  font-size: 0.95rem;
  text-align: center;
}

.lh-sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.lh-sound-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border-radius: 12px;
  background: var(--lh-fill);
  box-shadow: 0 0 0 1px rgba(var(--lh-accent-rgb), 0.28);
}

.lh-sound-card img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--lh-card-bg);
}

.lh-sound-card-body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 10px;
}

.lh-sound-card p {
  flex: 1 1 auto;
  margin: 0;
  color: var(--lh-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}

.lh-sound-card p strong {
  color: var(--lh-accent);
  font-weight: 800;
}

.lh-sound-replay {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--lh-accent);
  box-shadow: 0 0 0 1.5px var(--lh-accent);
}

.lh-sound-replay svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
  fill: currentColor;
}

.lh-sound-replay.is-playing {
  animation: lh-sound-pulse 1.15s ease-in-out infinite;
}

.lh-sound-end-actions {
  display: flex;
  justify-content: center;
  margin: 22px 0 8px;
}

.lh-sound-more {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(var(--lh-accent-rgb), 0.25);
  text-align: center;
}

.lh-sound-more h2 {
  font-size: 1.2rem;
}

.lh-sound-more p {
  margin: 8px 0;
  color: var(--lh-ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.lh-sound-more a {
  color: var(--lh-accent);
}

.lh-sound-ad {
  width: 100%;
  margin: 20px 0 8px;
}

.lh-sound-stage:fullscreen,
.lh-sound-stage:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 32px 40px;
  border-radius: 0;
  background: var(--lh-bg);
}

.lh-sound-stage:fullscreen .lh-sound-exitfull,
.lh-sound-stage:-webkit-full-screen .lh-sound-exitfull {
  display: inline-flex;
}

.lh-sound-stage:fullscreen .lh-sound-play,
.lh-sound-stage:-webkit-full-screen .lh-sound-play {
  width: 180px;
  height: 180px;
}

.lh-sound-stage:fullscreen .lh-sound-play svg,
.lh-sound-stage:-webkit-full-screen .lh-sound-play svg {
  width: 72px;
  height: 72px;
}

.lh-sound-stage:fullscreen.is-revealed .lh-sound-play,
.lh-sound-stage:-webkit-full-screen.is-revealed .lh-sound-play {
  width: 64px;
  height: 64px;
}

.lh-sound-stage:fullscreen.is-revealed .lh-sound-play svg,
.lh-sound-stage:-webkit-full-screen.is-revealed .lh-sound-play svg {
  width: 28px;
  height: 28px;
}

.lh-sound-stage:fullscreen .lh-sound-hero,
.lh-sound-stage:-webkit-full-screen .lh-sound-hero,
.lh-sound-stage:fullscreen .lh-sound-imgwrap,
.lh-sound-stage:-webkit-full-screen .lh-sound-imgwrap {
  width: min(80vw, calc(60vh * 16 / 9), 100%);
  max-width: min(80vw, calc(60vh * 16 / 9), 100%);
}

.lh-sound-stage:fullscreen .lh-sound-phrase,
.lh-sound-stage:-webkit-full-screen .lh-sound-phrase {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

.lh-sound-stage:fullscreen .lh-sound-count,
.lh-sound-stage:-webkit-full-screen .lh-sound-count {
  font-size: 1.25rem;
}

.lh-sound-stage:fullscreen .lh-sound-dot,
.lh-sound-stage:-webkit-full-screen .lh-sound-dot {
  width: 16px;
  height: 16px;
}

.lh-sound-stage:fullscreen .lh-sound-dots,
.lh-sound-stage:-webkit-full-screen .lh-sound-dots {
  gap: 10px;
}

.lh-sound-stage:fullscreen .lh-sound-hero-row,
.lh-sound-stage:-webkit-full-screen .lh-sound-hero-row {
  grid-template-columns: 72px minmax(0, 1fr) 72px;
}

.lh-sound-stage:fullscreen .lh-sound-skip,
.lh-sound-stage:-webkit-full-screen .lh-sound-skip {
  width: 72px;
  height: 72px;
}

.lh-sound-stage:fullscreen .lh-sound-skip svg,
.lh-sound-stage:-webkit-full-screen .lh-sound-skip svg {
  width: 36px;
  height: 36px;
}

@keyframes lh-skip-glow {
  0%,
  100% {
    box-shadow: 0 0 0 2px var(--lh-accent), 0 0 8px rgba(var(--lh-glow-rgb), 0.25);
  }
  50% {
    box-shadow: 0 0 0 3px var(--lh-accent), 0 0 18px rgba(var(--lh-glow-rgb), 0.75);
  }
}

@keyframes lh-sound-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--lh-accent), 0 0 18px rgba(var(--lh-glow-rgb), 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px var(--lh-accent), 0 0 40px rgba(var(--lh-glow-rgb), 0.95);
  }
}

@keyframes lh-sound-flicker {
  0% { opacity: 0; }
  18% { opacity: 1; }
  32% { opacity: 0.12; }
  48% { opacity: 1; }
  62% { opacity: 0.18; }
  78% { opacity: 1; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .lh-sound-play.is-playing,
  .lh-sound-replay.is-playing {
    animation: none;
    box-shadow: 0 0 0 4px var(--lh-accent), 0 0 24px rgba(var(--lh-glow-rgb), 0.7);
  }

  .lh-sound-stage.is-revealed .lh-sound-skip-next:not(:disabled) {
    animation: none;
    box-shadow: 0 0 0 3px var(--lh-accent), 0 0 14px rgba(var(--lh-glow-rgb), 0.5);
  }

  .lh-sound-imgwrap.is-flicker img {
    animation: none;
    opacity: 1;
  }
}

@media (hover: none), (pointer: coarse) {
  .lh-sound-keys {
    display: none !important;
  }
}

@media (max-width: 599px) {
  .lh-sound-hero-row {
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    grid-template-areas:
      "hero hero hero"
      "phrase phrase phrase"
      "prev reveal next";
    column-gap: 8px;
  }

  .lh-sound-reveal-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  body.lh-sound-on .mainCenter {
    padding: 0 16px;
  }

  .lh-sound-head h1 {
    font-size: 1.7em;
    gap: 8px;
  }

  .lh-sound-head h1 img {
    width: 28px;
    height: 28px;
  }

  .lh-sound-stage {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .lh-sound-play {
    width: 100px;
    height: 100px;
  }

  .lh-sound-full {
    width: 100%;
    max-width: 640px;
  }

  .lh-sound-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Keep the play button on-theme in every state (no browser/site default blue) */
.lh-sound .lh-sound-play,
.lh-sound .lh-sound-play:hover,
.lh-sound .lh-sound-play:focus,
.lh-sound .lh-sound-play:active,
.lh-sound .lh-sound-play.is-playing {
  background: var(--lh-btn-bg);
  background-color: var(--lh-btn-bg);
  color: var(--lh-accent);
}

@keyframes lh-sound-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Beat the site-wide button border (the :where() reset above has zero specificity) */
.lh-sound button {
  border: 0;
}

/* Replay buttons on the answers grid: beat the site-wide button background */
.lh-sound .lh-sound-replay {
  background: transparent;
}

.lh-sound .lh-sound-replay:hover,
.lh-sound .lh-sound-replay:focus-visible {
  background: rgba(var(--lh-accent-rgb), 0.15);
}
